[cheese] Move thumbview popup menu to GtkBuilder file



commit f05e7d47127648366e97ed11fe77a501c2d34f6b
Author: David King <amigadave amigadave com>
Date:   Thu Aug 7 16:32:22 2014 +0100

    Move thumbview popup menu to GtkBuilder file

 data/menus.ui          |   24 ++++++++++++++++++++++++
 src/cheese-window.vala |   16 +---------------
 2 files changed, 25 insertions(+), 15 deletions(-)
---
diff --git a/data/menus.ui b/data/menus.ui
index 8d32f11..1ff54c0 100644
--- a/data/menus.ui
+++ b/data/menus.ui
@@ -28,4 +28,28 @@
             </item>
         </section>
     </menu>
+    <menu id="thumbview-menu">
+        <section>
+            <item>
+                <attribute name="accel">&lt;Primary&gt;o</attribute>
+                <attribute name="label" translatable="yes">Open</attribute>
+                <attribute name="action">win.file-open</attribute>
+            </item>
+            <item>
+                <attribute name="accel">&lt;Primary&gt;s</attribute>
+                <attribute name="label" translatable="yes">Save _As…</attribute>
+                <attribute name="action">win.file-saveas</attribute>
+            </item>
+            <item>
+                <attribute name="accel">Delete</attribute>
+                <attribute name="label" translatable="yes">Move to _Trash</attribute>
+                <attribute name="action">win.file-trash</attribute>
+            </item>
+            <item>
+                <attribute name="accel">&lt;Shift&gt;Delete</attribute>
+                <attribute name="label" translatable="yes">Delete</attribute>
+                <attribute name="action">win.file-delete</attribute>
+            </item>
+        </section>
+    </menu>
 </interface>
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index 9e0b733..9d8aac5 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -1235,21 +1235,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
     flash           = new Flash (this);
     settings        = new GLib.Settings ("org.gnome.Cheese");
 
-        var menu = new GLib.Menu ();
-        var section = new GLib.Menu ();
-        menu.append_section (null, section);
-        var item = new GLib.MenuItem (_("Open"), "win.file-open");
-        item.set_attribute ("accel", "s", "<Primary>o");
-        section.append_item (item);
-        item = new GLib.MenuItem (_("Save _As…"), "win.file-saveas");
-        item.set_attribute ("accel", "s", "<Primary>S");
-        section.append_item (item);
-        item = new GLib.MenuItem (_("Move to _Trash"), "win.file-trash");
-        item.set_attribute ("accel", "s", "Delete");
-        section.append_item (item);
-        item = new GLib.MenuItem (_("Delete"), "win.file-delete");
-        item.set_attribute ("accel", "s", "<Shift>Delete");
-        section.append_item (item);
+        var menu = application.get_menu_by_id ("thumbview-menu");
         thumbnail_popup = new Gtk.Menu.from_model (menu);
 
         this.add_action_entries (actions, this);


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