[eog/wip/gaction-migration: 7/7] Populate EogScrollView popup menu using GtkBuilder



commit 49fe9e214c064e7f7a5beb89232982f5f5d96700
Author: Felix Riemann <friemann gnome org>
Date:   Wed Dec 17 21:34:28 2014 +0100

    Populate EogScrollView popup menu using GtkBuilder
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741050

 data/eog-ui.xml        |   19 -----------------
 data/eog-view-popup.ui |   53 ++++++++++++++++++++++++++++++++++++++++++++++++
 po/POTFILES.in         |    1 +
 src/eog-window.c       |   10 ++++++++-
 src/eog.gresource.xml  |    1 +
 5 files changed, 64 insertions(+), 20 deletions(-)
---
diff --git a/data/eog-ui.xml b/data/eog-ui.xml
index 374a171..ac13e83 100644
--- a/data/eog-ui.xml
+++ b/data/eog-ui.xml
@@ -36,23 +36,4 @@
     <menuitem action="ImageSetAsWallpaper"/>
     <menuitem action="ImageOpenContainingFolder"/>
   </popup>
-
-  <popup name="ViewPopup">
-    <menu action='ImageOpenWith'>
-       <placeholder name="Applications Placeholder"/>
-    </menu>
-    <separator/>
-    <menuitem action="ImageSave"/>
-    <menuitem action="ImageSaveAs"/>
-    <separator/>
-    <menuitem action="ImagePrint"/>
-    <separator/>
-    <menuitem action="EditCopyImage"/>
-    <separator/>
-    <menuitem action="EditMoveToTrash"/>
-    <separator/>
-    <menuitem action="ImageProperties"/>
-    <menuitem action="ImageSetAsWallpaper"/>
-    <menuitem action="ImageOpenContainingFolder"/>
-  </popup>
 </ui>
diff --git a/data/eog-view-popup.ui b/data/eog-view-popup.ui
new file mode 100644
index 0000000..5670a0f
--- /dev/null
+++ b/data/eog-view-popup.ui
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<interface>
+  <menu id="view-popup-menu">
+    <section>
+      <submenu>
+        <attribute name="label" translatable="yes">Open _with</attribute>
+        <section id="open-with-placeholder"/>
+      </submenu>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Save</attribute>
+        <attribute name="action">win.ImageSave</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Save _As…</attribute>
+        <attribute name="action">win.ImageSaveAs</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Print…</attribute>
+        <attribute name="action">win.ImagePrint</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Copy</attribute>
+        <attribute name="action">win.EditCopyImage</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Move to _Trash</attribute>
+        <attribute name="action">win.EditMoveToTrash</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Prope_rties</attribute>
+        <attribute name="action">win.ImageProperties</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Set as Wa_llpaper</attribute>
+        <attribute name="action">win.ImageSetAsWallpaper</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Show Containing _Folder</attribute>
+        <attribute name="action">win.ImageOpenContainingFolder</attribute>
+      </item>
+    </section>
+  </menu>
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 62f73ac..673c612 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -7,6 +7,7 @@ data/eog.desktop.in.in
 [type: gettext/glade]data/eog-image-properties-dialog.ui
 [type: gettext/glade]data/eog-multiple-save-as-dialog.ui
 [type: gettext/glade]data/eog-preferences-dialog.ui
+[type: gettext/glade]data/eog-view-popup.ui
 [type: gettext/gsettings]data/org.gnome.eog.gschema.xml.in
 plugins/fullscreen/eog-fullscreen-plugin.c
 plugins/fullscreen/fullscreen.plugin.desktop.in
diff --git a/src/eog-window.c b/src/eog-window.c
index 0d3d4e1..caa16ff 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -2851,6 +2851,7 @@ eog_window_retrieve_save_as_file (EogWindow *window, EogImage *image)
                g_object_unref (image_file);
        }
 
+       gtk_window_set_transient_for (GTK_WINDOW(dialog), GTK_WINDOW(window));
        response = gtk_dialog_run (GTK_DIALOG (dialog));
        gtk_widget_hide (dialog);
 
@@ -4400,6 +4401,8 @@ eog_window_construct_ui (EogWindow *window)
        GtkWidget *view_popup;
        GtkWidget *hpaned;
        GAction *action = NULL;
+       GtkBuilder *builder;
+       GObject *builder_object;
 
 
        g_return_if_fail (EOG_IS_WINDOW (window));
@@ -4520,10 +4523,15 @@ eog_window_construct_ui (EogWindow *window)
        g_settings_bind (priv->view_settings, EOG_CONF_VIEW_ZOOM_MULTIPLIER,
                         priv->view, "zoom-multiplier", G_SETTINGS_BIND_GET);
 
-       view_popup = gtk_ui_manager_get_widget (priv->ui_mgr, "/ViewPopup");
+       builder = gtk_builder_new_from_resource ("/org/gnome/eog/ui/eog-view-popup.ui");
+       builder_object = gtk_builder_get_object (builder, "view-popup-menu");
+       view_popup = gtk_menu_new_from_model (G_MENU_MODEL(builder_object));
+
        eog_scroll_view_set_popup (EOG_SCROLL_VIEW (priv->view),
                                   GTK_MENU (view_popup));
 
+       g_clear_object (&builder);
+
        gtk_paned_pack1 (GTK_PANED (hpaned),
                         priv->sidebar,
                         FALSE,
diff --git a/src/eog.gresource.xml b/src/eog.gresource.xml
index 8dd0acf..bee47b3 100644
--- a/src/eog.gresource.xml
+++ b/src/eog.gresource.xml
@@ -6,6 +6,7 @@
     <file compressed="true" preprocess="xml-stripblanks">eog-image-properties-dialog.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">eog-multiple-save-as-dialog.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">eog-preferences-dialog.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks">eog-view-popup.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">eog-ui.xml</file>
   </gresource>
 </gresources>


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