[gnome-boxes/drop-app-menu: 18/21] collection-toolbar: Introduce the hamburger menu



commit aa7ec017354f81e7f750da314d6a4560e4568a88
Author: Felipe Borges <felipeborges gnome org>
Date:   Tue Oct 9 17:27:48 2018 +0200

    collection-toolbar: Introduce the hamburger menu
    
    This is part of the GNOME Initiative of removing app-menus.
    See https://gitlab.gnome.org/GNOME/Initiatives/wikis/App-Menu-Retirement
    
    Fixes #223

 data/ui/collection-toolbar.ui | 27 +++++++++++++++++++++++++++
 src/collection-toolbar.vala   |  6 ++++++
 2 files changed, 33 insertions(+)
---
diff --git a/data/ui/collection-toolbar.ui b/data/ui/collection-toolbar.ui
index e6862ff1..bd57cfc0 100644
--- a/data/ui/collection-toolbar.ui
+++ b/data/ui/collection-toolbar.ui
@@ -51,6 +51,33 @@
       </object>
     </child>
 
+    <child>
+      <object class="GtkMenuButton" id="hamburger_btn">
+        <property name="visible">True</property>
+        <property name="valign">center</property>
+        <property name="use-underline">True</property>
+        <style>
+          <class name="image-button"/>
+        </style>
+        <child internal-child="accessible">
+          <object class="AtkObject">
+            <property name="accessible-name" translatable="yes">Application Menu</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkImage">
+            <property name="visible">True</property>
+            <property name="icon-name">open-menu-symbolic</property>
+            <property name="icon-size">1</property>
+          </object>
+        </child>
+      </object>
+
+      <packing>
+        <property name="pack-type">end</property>
+      </packing>
+    </child>
+
     <child>
       <object class="GtkButton" id="select_btn">
         <property name="visible">True</property>
diff --git a/src/collection-toolbar.vala b/src/collection-toolbar.vala
index cc476be5..76bcac4c 100644
--- a/src/collection-toolbar.vala
+++ b/src/collection-toolbar.vala
@@ -16,6 +16,8 @@
     [GtkChild]
     private Button new_btn;
     [GtkChild]
+    private MenuButton hamburger_btn;
+    [GtkChild]
     private CollectionFilterSwitcher filter_switcher;
 
     private AppWindow window;
@@ -40,6 +42,10 @@ public void setup_ui (AppWindow window) {
         App.app.notify["main-window"].connect (ui_state_changed);
 
         filter_switcher.setup_ui (window);
+
+        var builder = new Builder.from_resource ("/org/gnome/Boxes/gtk/menus.ui");
+        MenuModel menu = (MenuModel) builder.get_object ("app-menu");
+        hamburger_btn.popover = new Popover.from_model (hamburger_btn, menu);
     }
 
     public void click_back_button () {


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