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.
This commit is contained in:
p3732 2018-10-25 04:32:30 +02:00 committed by Michael James Gratton
parent 325070b5f0
commit af615c2c7e
4 changed files with 59 additions and 9 deletions

View file

@ -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);

View file

@ -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>

View file

@ -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>

View file

@ -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>