[nautilus: 1/2] nautilus-properties-window: Add a button to open gnome-disks



commit 09c7390cae513fa10c877f7ad679064fbbab42b1
Author: Rahul Verma <rv404674 gmail com>
Date:   Mon Feb 26 14:25:25 2018 +0530

    nautilus-properties-window: Add a button to open gnome-disks
    
    The volume label is visible in properties, so to edit it we need to open
    gnome-disks.
    
    Closes #20

 src/nautilus-properties-window.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 8bd335a07..66828e9ba 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -3095,6 +3095,30 @@ create_volume_usage_widget (NautilusPropertiesWindow *window)
     return piewidget;
 }
 
+static void
+open_in_disks (GtkButton                *button,
+               NautilusPropertiesWindow *self)
+{
+    g_autofree char *message = NULL;
+    g_autoptr (GError) error = NULL;
+    g_autoptr (GAppInfo) app_info = NULL;
+
+    app_info = g_app_info_create_from_commandline ("gnome-disks",
+                                                    NULL,
+                                                    G_APP_INFO_CREATE_NONE,
+                                                    NULL);
+
+    g_app_info_launch (app_info, NULL, NULL, &error);
+
+    if (error != NULL)
+    {
+        message = g_strdup_printf (_("Details: %s"), error->message);
+        eel_show_error_dialog (_("There was an error launching the application."),
+                               message,
+                               GTK_WINDOW (self));
+    }
+}
+
 static void
 create_basic_page (NautilusPropertiesWindow *window)
 {
@@ -3102,6 +3126,7 @@ create_basic_page (NautilusPropertiesWindow *window)
     GtkWidget *icon_pixmap_widget;
     GtkWidget *volume_usage;
     GtkWidget *hbox, *vbox;
+    GtkWidget *button;
 
     hbox = create_page_with_box (window->details->notebook,
                                  GTK_ORIENTATION_HORIZONTAL,
@@ -3243,6 +3268,15 @@ create_basic_page (NautilusPropertiesWindow *window)
                                                "width", 3,
                                                NULL);
         }
+
+       /*Translators: Here Disks mean the name of application GNOME Disks.*/
+       button = gtk_button_new_with_label (_("Open in Disks"));
+       g_signal_connect (button, "clicked", G_CALLBACK (open_in_disks), NULL);
+       gtk_container_add_with_properties (GTK_CONTAINER (grid),
+                                          button,
+                                          "width", 3,
+                                          NULL);
+       gtk_widget_show_all (GTK_WIDGET (grid));
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]