[gnome-disk-utility] Add "Attach Disk Image..." item to application menu



commit 4520bd69c84b35cfbf6520d17da0073fd6f82984
Author: David Zeuthen <davidz redhat com>
Date:   Mon Jan 23 14:06:59 2012 -0500

    Add "Attach Disk Image..." item to application menu
    
    http://people.freedesktop.org/~david/palimpsest-app-menu.png
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 data/ui/app-menu.ui             |    5 +++--
 src/palimpsest/gduapplication.c |   18 ++++++++++++++----
 src/palimpsest/gduwindow.c      |   14 ++++++++++----
 src/palimpsest/gduwindow.h      |    2 ++
 4 files changed, 29 insertions(+), 10 deletions(-)
---
diff --git a/data/ui/app-menu.ui b/data/ui/app-menu.ui
index b923410..9d5c78d 100644
--- a/data/ui/app-menu.ui
+++ b/data/ui/app-menu.ui
@@ -2,10 +2,11 @@
 <interface>
   <menu id='app-menu'>
     <section>
-      <item action='app.about' label="_About"/>
+      <item action='app.attach_disk_image' label='Attach Disk _Image...'/>
     </section>
     <section>
-      <item action='app.quit' accel='&lt;Primary&gt;q' label="_Quit"/>
+      <item action='app.about' label='_About Disks'/>
+      <item action='app.quit' accel='&lt;Primary&gt;q' label='_Quit'/>
     </section>
   </menu>
 </interface>
diff --git a/src/palimpsest/gduapplication.c b/src/palimpsest/gduapplication.c
index e7011ea..1d1172a 100644
--- a/src/palimpsest/gduapplication.c
+++ b/src/palimpsest/gduapplication.c
@@ -106,12 +106,12 @@ gdu_application_activate (GApplication *_app)
 /* ---------------------------------------------------------------------------------------------------- */
 
 static void
-quit_activated (GSimpleAction *action,
-                GVariant      *parameter,
-                gpointer       user_data)
+attach_disk_image_activated (GSimpleAction *action,
+                             GVariant      *parameter,
+                             gpointer       user_data)
 {
   GduApplication *app = GDU_APPLICATION (user_data);
-  gtk_widget_destroy (GTK_WIDGET (app->window));
+  gdu_window_show_attach_disk_image (app->window);
 }
 
 static void
@@ -137,8 +137,18 @@ about_activated (GSimpleAction *action,
   g_object_unref (dialog);
 }
 
+static void
+quit_activated (GSimpleAction *action,
+                GVariant      *parameter,
+                gpointer       user_data)
+{
+  GduApplication *app = GDU_APPLICATION (user_data);
+  gtk_widget_destroy (GTK_WIDGET (app->window));
+}
+
 static GActionEntry app_entries[] =
 {
+  { "attach_disk_image", attach_disk_image_activated, NULL, NULL, NULL },
   { "about", about_activated, NULL, NULL, NULL },
   { "quit", quit_activated, NULL, NULL, NULL }
 };
diff --git a/src/palimpsest/gduwindow.c b/src/palimpsest/gduwindow.c
index 6fee9ed..1cadeb6 100644
--- a/src/palimpsest/gduwindow.c
+++ b/src/palimpsest/gduwindow.c
@@ -626,11 +626,9 @@ loop_setup_cb (UDisksManager  *manager,
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static void
-on_device_tree_attach_disk_image_button_clicked (GtkToolButton *button,
-                                                 gpointer       user_data)
+void
+gdu_window_show_attach_disk_image (GduWindow *window)
 {
-  GduWindow *window = GDU_WINDOW (user_data);
   GtkWidget *dialog;
   gchar *filename;
   gint fd;
@@ -697,6 +695,14 @@ on_device_tree_attach_disk_image_button_clicked (GtkToolButton *button,
   g_free (filename);
 }
 
+static void
+on_device_tree_attach_disk_image_button_clicked (GtkToolButton *button,
+                                                 gpointer       user_data)
+{
+  GduWindow *window = GDU_WINDOW (user_data);
+  gdu_window_show_attach_disk_image (window);
+}
+
 /* ---------------------------------------------------------------------------------------------------- */
 
 gboolean
diff --git a/src/palimpsest/gduwindow.h b/src/palimpsest/gduwindow.h
index 778d213..29e1b52 100644
--- a/src/palimpsest/gduwindow.h
+++ b/src/palimpsest/gduwindow.h
@@ -51,6 +51,8 @@ gboolean        gdu_window_select_object     (GduWindow    *window,
                                               UDisksObject *object);
 
 
+void            gdu_window_show_attach_disk_image (GduWindow *window);
+
 G_END_DECLS
 
 #endif /* __GDU_WINDOW_H__ */



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