[simple-scan] Add a gear menu, removing some elements from the app menu (as per new design)



commit 377b8474dffdd6637fbafaff1667078bdebb04c0
Author: Robert Ancell <robert ancell canonical com>
Date:   Wed May 17 22:09:06 2017 +1200

    Add a gear menu, removing some elements from the app menu (as per new design)

 src/app-window.ui   |   27 +++++++++++++++++++++++++--
 src/app-window.vala |   19 ++++++++++---------
 2 files changed, 35 insertions(+), 11 deletions(-)
---
diff --git a/src/app-window.ui b/src/app-window.ui
index f65a0c0..debb7e5 100644
--- a/src/app-window.ui
+++ b/src/app-window.ui
@@ -771,6 +771,29 @@
           </packing>
         </child>
         <child>
+          <object class="GtkMenuButton" id="menu_button">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="receives_default">False</property>
+            <property name="use_underline">True</property>
+            <child>
+              <object class="GtkImage">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="icon_name">open-menu-symbolic</property>
+                <property name="icon_size">1</property>
+              </object>
+            </child>
+            <style>
+              <class name="image-button"/>
+            </style>
+          </object>
+          <packing>
+            <property name="pack_type">end</property>
+            <property name="position">3</property>
+          </packing>
+        </child>
+        <child>
           <object class="GtkBox" id="rotate_box">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
@@ -835,7 +858,7 @@
           </object>
           <packing>
             <property name="pack_type">end</property>
-            <property name="position">3</property>
+            <property name="position">4</property>
           </packing>
         </child>
         <child>
@@ -860,7 +883,7 @@
           </object>
           <packing>
             <property name="pack_type">end</property>
-            <property name="position">4</property>
+            <property name="position">5</property>
           </packing>
         </child>
         <style>
diff --git a/src/app-window.vala b/src/app-window.vala
index 031c2fd..1ba1ea1 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -109,6 +109,9 @@ public class AppWindow : Gtk.ApplicationWindow
     [GtkChild]
     private Gtk.RadioMenuItem photo_menuitem;
 
+    [GtkChild]
+    private Gtk.MenuButton menu_button;
+
     private string? missing_driver = null;
 
     private Gtk.FileChooserDialog? save_dialog;
@@ -1650,15 +1653,6 @@ public class AppWindow : Gtk.ApplicationWindow
 
             section = new Menu ();
             appmenu.append_section (null, section);
-            var menu = new Menu ();
-            section.append_submenu (_("Document"), menu);
-            menu.append (_("Reorder Pages"), "app.reorder");
-            menu.append (_("Save"), "app.save");
-            menu.append (_("Email…"), "app.email");
-            menu.append (_("Print…"), "app.print");
-
-            section = new Menu ();
-            appmenu.append_section (null, section);
             section.append (_("Preferences"), "app.preferences");
 
             section = new Menu ();
@@ -1675,6 +1669,13 @@ public class AppWindow : Gtk.ApplicationWindow
             app.add_accelerator ("<Ctrl>P", "app.print", null);
             app.add_accelerator ("F1", "app.help", null);
             app.add_accelerator ("<Ctrl>Q", "app.quit", null);
+
+            var gear_menu = new Menu ();
+            section = new Menu ();
+            gear_menu.append_section (null, section);
+            section.append (_("Reorder Pages"), "app.reorder");
+            section.append (_("Preferences"), "app.preferences");
+            menu_button.set_menu_model (gear_menu);
         }
         app.add_window (this);
 


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