[geary/wip/3.32-ux: 309/314] Add main menu to sidebar



commit af615c2c7ec1d496e514020a105bb2dded0a7e97
Author: p3732 <p3732 users noreply github com>
Date:   Thu Oct 25 04:32:30 2018 +0200

    Add main menu to sidebar
    
    Add main menu to the folder header, as described on 
https://gitlab.gnome.org/GNOME/Initiatives/wikis/App-Menu-Retirement#3-applications-that-use-a-sidebar-for-navigation
    The "About" string changed to "About Geary" and needs to be retranslated.

 src/client/components/main-toolbar.vala |  4 ++++
 ui/gtk/menus.ui                         |  6 ------
 ui/main-toolbar-menus.ui                | 31 +++++++++++++++++++++++++++++++
 ui/main-toolbar.ui                      | 27 ++++++++++++++++++++++++---
 4 files changed, 59 insertions(+), 9 deletions(-)
---
diff --git a/src/client/components/main-toolbar.vala b/src/client/components/main-toolbar.vala
index 247a255b..605f9a9e 100644
--- a/src/client/components/main-toolbar.vala
+++ b/src/client/components/main-toolbar.vala
@@ -39,6 +39,8 @@ public class MainToolbar : Gtk.Box {
     private Gtk.MenuButton empty_menu_button;
     [GtkChild]
     private Gtk.ToggleButton search_conversations_button;
+    [GtkChild]
+    private Gtk.MenuButton main_menu_button;
     private Binding guest_header_binding;
 
     // Conversation header elements
@@ -92,10 +94,12 @@ public class MainToolbar : Gtk.Box {
         // Assemble the empty/mark menus
         Gtk.Builder builder = new Gtk.Builder.from_resource("/org/gnome/Geary/main-toolbar-menus.ui");
         MenuModel empty_menu = (MenuModel) builder.get_object("empty_menu");
+        MenuModel main_menu = (MenuModel) builder.get_object("main_menu");
         MenuModel mark_menu = (MenuModel) builder.get_object("mark_message_menu");
 
         // Setup folder header elements
         this.empty_menu_button.popover = new Gtk.Popover.from_model(null, empty_menu);
+        this.main_menu_button.popover = new Gtk.Popover.from_model(null, main_menu);
         this.bind_property("search-open", this.search_conversations_button, "active",
             BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
 
diff --git a/ui/gtk/menus.ui b/ui/gtk/menus.ui
index 50aa4e81..2a573eff 100644
--- a/ui/gtk/menus.ui
+++ b/ui/gtk/menus.ui
@@ -2,12 +2,6 @@
 
 <interface>
   <menu id="app-menu">
-    <section>
-      <item>
-        <attribute name="label" translatable="yes">Compose Message</attribute>
-        <attribute name="action">app.compose</attribute>
-      </item>
-    </section>
     <section>
       <item>
         <attribute name="label" translatable="yes">A_ccounts</attribute>
diff --git a/ui/main-toolbar-menus.ui b/ui/main-toolbar-menus.ui
index dea30ccb..19cc9971 100644
--- a/ui/main-toolbar-menus.ui
+++ b/ui/main-toolbar-menus.ui
@@ -37,4 +37,35 @@
       <attribute name="action">win.mark-message-not-spam</attribute>
     </item>
   </menu>
+  <menu id="main_menu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Accounts</attribute>
+        <attribute name="action">app.accounts</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Preferences</attribute>
+        <attribute name="action">app.preferences</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
+        <attribute name="action">win.show-help-overlay</attribute>
+        <attribute name="accel">&lt;Primary&gt;F1</attribute>
+        <attribute name="hidden-when">action-missing</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Help</attribute>
+        <attribute name="action">app.help</attribute>
+        <attribute name="accel">F1</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_About Geary</attribute>
+        <attribute name="action">app.about</attribute>
+      </item>
+    </section>
+
+  </menu>
 </interface>
+
diff --git a/ui/main-toolbar.ui b/ui/main-toolbar.ui
index 8c128136..3b8964b4 100644
--- a/ui/main-toolbar.ui
+++ b/ui/main-toolbar.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.2 -->
+<!-- Generated with glade 3.22.1 -->
 <interface>
   <requires lib="gtk+" version="3.20"/>
   <object class="GtkImage" id="archive_image">
@@ -61,7 +61,7 @@
           </object>
           <packing>
             <property name="pack_type">end</property>
-            <property name="position">2</property>
+            <property name="position">3</property>
           </packing>
         </child>
         <child>
@@ -82,7 +82,27 @@
           </object>
           <packing>
             <property name="pack_type">end</property>
-            <property name="position">3</property>
+            <property name="position">4</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkMenuButton" id="main_menu_button">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="focus_on_click">False</property>
+            <property name="receives_default">False</property>
+            <property name="always_show_image">True</property>
+            <child>
+              <object class="GtkImage" id="main_menu_image">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="icon_name">open-menu-symbolic</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack_type">end</property>
+            <property name="position">2</property>
           </packing>
         </child>
         <style>
@@ -365,3 +385,4 @@
     </child>
   </template>
 </interface>
+


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