[gnome-boxes] display-toolbar: props button -> box menu button



commit 67194a05821bee554c5c8116fb9dcd853d07d107
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Nov 14 19:51:35 2014 +0000

    display-toolbar: props button -> box menu button
    
    Replace properties button by a menu button that presents the box actions
    using the new ActionsPopover.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=735329

 data/ui/display-toolbar.ui |    6 ++----
 src/display-toolbar.vala   |   14 +++++++-------
 2 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/data/ui/display-toolbar.ui b/data/ui/display-toolbar.ui
index 6416e94..d85821c 100644
--- a/data/ui/display-toolbar.ui
+++ b/data/ui/display-toolbar.ui
@@ -64,11 +64,9 @@
         </child>
 
         <child>
-          <object class="GtkButton" id="props">
+          <object class="GtkMenuButton" id="menu_button">
             <property name="visible">True</property>
             <property name="valign">center</property>
-            <property name="use-underline">True</property>
-            <signal name="clicked" handler="on_props_clicked"/>
             <style>
               <class name="image-button"/>
             </style>
@@ -76,7 +74,7 @@
             <child>
               <object class="GtkImage" id="props_image">
                 <property name="visible">True</property>
-                <property name="icon-name">preferences-system-symbolic</property>
+                <property name="icon-name">open-menu-symbolic</property>
                 <property name="icon-size">1</property>
               </object>
             </child>
diff --git a/src/display-toolbar.vala b/src/display-toolbar.vala
index 67bdd1c..fbbdeba 100644
--- a/src/display-toolbar.vala
+++ b/src/display-toolbar.vala
@@ -13,7 +13,7 @@ private class Boxes.DisplayToolbar: Gtk.HeaderBar {
     [GtkChild]
     private Gtk.Button fullscreen;
     [GtkChild]
-    private Gtk.Button props;
+    private Gtk.MenuButton menu_button;
 
     private AppWindow window;
 
@@ -37,7 +37,7 @@ private class Boxes.DisplayToolbar: Gtk.HeaderBar {
         if (!overlay) {
             back.get_style_context ().add_class ("raised");
             fullscreen.get_style_context ().add_class ("raised");
-            props.get_style_context ().add_class ("raised");
+            menu_button.get_style_context ().add_class ("raised");
         }
 
         App.app.notify["fullscreened"].connect_after ( () => {
@@ -51,9 +51,14 @@ private class Boxes.DisplayToolbar: Gtk.HeaderBar {
     public void setup_ui (AppWindow window) {
         this.window = window;
 
+        menu_button.popover = new ActionsPopover (window);
         App.app.notify["main-window"].connect (() => {
             back.visible = (window == App.app.main_window);
         });
+        window.notify["ui-state"].connect (() => {
+            if (window.ui_state == UIState.DISPLAY)
+                (menu_button.popover as ActionsPopover).update_for_item (window.current_item);
+        });
     }
 
     private bool button_down;
@@ -126,9 +131,4 @@ private class Boxes.DisplayToolbar: Gtk.HeaderBar {
     private void on_fullscreen_clicked () {
         window.fullscreened = !window.fullscreened;
     }
-
-    [GtkCallback]
-    private void on_props_clicked () {
-        window.set_state (UIState.PROPERTIES);
-    }
 }


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