[gnome-shell/gnome-3-8] panel: Change openAppMenu() to a toggle action



commit 8b7803224810549af28710434f4745e4855c50da
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Apr 26 16:14:55 2013 +0200

    panel: Change openAppMenu() to a toggle action
    
    It makes sense to allow closing the app menu with the same shortcut
    that is used to open it, so make it a toggle action and allow it
    TOPBAR_POPUP mode.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686756

 js/ui/panel.js         |    9 +++++----
 js/ui/windowManager.js |    9 +++++----
 2 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 8c3c484..283a031 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -1077,17 +1077,18 @@ const Panel = new Lang.Class({
         return true;
     },
 
-    openAppMenu: function() {
+    toggleAppMenu: function() {
         let indicator = this.statusArea.appMenu;
         if (!indicator) // appMenu not supported by current session mode
             return;
 
         let menu = indicator.menu;
-        if (!indicator.actor.reactive || menu.isOpen)
+        if (!indicator.actor.reactive)
             return;
 
-        menu.open();
-        menu.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
+        menu.toggle();
+        if (menu.isOpen)
+            menu.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
     },
 
     set boxOpacity(value) {
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index c642d2c..3617d56 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -172,8 +172,9 @@ const WindowManager = new Lang.Class({
         this.addKeybinding('open-application-menu',
                            new Gio.Settings({ schema: SHELL_KEYBINDINGS_SCHEMA }),
                            Meta.KeyBindingFlags.NONE,
-                           Shell.KeyBindingMode.NORMAL,
-                           Lang.bind(this, this._openAppMenu));
+                           Shell.KeyBindingMode.NORMAL |
+                           Shell.KeyBindingMode.TOPBAR_POPUP,
+                           Lang.bind(this, this._toggleAppMenu));
 
         Main.overview.connect('showing', Lang.bind(this, function() {
             for (let i = 0; i < this._dimmedWindows.length; i++)
@@ -679,8 +680,8 @@ const WindowManager = new Lang.Class({
         Main.ctrlAltTabManager.popup(backwards, binding.get_name(), binding.get_mask());
     },
 
-    _openAppMenu : function(display, screen, window, event, binding) {
-        Main.panel.openAppMenu();
+    _toggleAppMenu : function(display, screen, window, event, binding) {
+        Main.panel.toggleAppMenu();
     },
 
     _showWorkspaceSwitcher : function(display, screen, window, binding) {


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