[baobab] Make F10 open the gear menu



commit 88b9f93acd560f28e2210999e37ba7acdcd40dce
Author: Paolo Borelli <pborelli gnome org>
Date:   Fri Mar 8 09:05:42 2013 +0100

    Make F10 open the gear menu

 src/baobab-application.vala |    2 ++
 src/baobab-main-window.ui   |    1 +
 src/baobab-window.vala      |    6 ++++++
 3 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/baobab-application.vala b/src/baobab-application.vala
index c5a493f..1a488e0 100644
--- a/src/baobab-application.vala
+++ b/src/baobab-application.vala
@@ -98,6 +98,8 @@ namespace Baobab {
                 var menubar = builder.get_object ("menubar") as MenuModel;
                 set_menubar (menubar);
             }
+
+            add_accelerator ("F10", "win.gear-menu", null);
         }
 
         protected override bool local_command_line ([CCode (array_length = false, array_null_terminated = 
true)] ref unowned string[] arguments, out int exit_status) {
diff --git a/src/baobab-main-window.ui b/src/baobab-main-window.ui
index b593fba..15d9b42 100644
--- a/src/baobab-main-window.ui
+++ b/src/baobab-main-window.ui
@@ -31,6 +31,7 @@
             <property name="can_focus">False</property>
             <property name="symbolic-icon-name">emblem-system-symbolic</property>
             <property name="menu-model">winmenu</property>
+            <property name="action_name">win.gear-menu</property>
           </object>
           <packing>
             <property name="pack_type">end</property>
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index ce2e5e5..7a9cf32 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -49,6 +49,7 @@ namespace Baobab {
         }
 
         private const GLib.ActionEntry[] action_entries = {
+            { "gear-menu", on_show_gear_menu_activate , null, "false", null},
             { "show-home-page", on_show_home_page_activate },
             { "active-chart", radio_activate, "s", "'rings'", on_chart_type_changed },
             { "scan-home", on_scan_home_activate },
@@ -175,6 +176,11 @@ namespace Baobab {
             show ();
         }
 
+        void on_show_gear_menu_activate (SimpleAction action) {
+            var state = action.get_state ().get_boolean ();
+            action.set_state (new Variant.boolean (!state));
+        }
+
         void on_show_home_page_activate () {
             if (active_location != null && active_location.scanner != null) {
                 active_location.scanner.cancel ();


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