[gnome-shell-extensions] apps-menu: Move panel-main-menu handling into AppsMenuButton



commit 8f4cecc8e5079fbf17db2090b2ad8d0155cec6b2
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Mar 23 23:55:43 2015 +0100

    apps-menu: Move panel-main-menu handling into AppsMenuButton
    
    This is really where it belongs, and will make an upcoming fix slightly
    less ugly ...
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746639

 extensions/apps-menu/extension.js |   31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)
---
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index 232ebcc..b6c5ae0 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -295,6 +295,7 @@ const ApplicationsButton = new Lang.Class({
         this._hidingId = Main.overview.connect('hiding', Lang.bind(this, function() {
             this.actor.remove_accessible_state (Atk.StateType.CHECKED);
         }));
+        this._setKeybinding();
 
         this.reloadFlag = false;
         this._createLayout();
@@ -332,6 +333,13 @@ const ApplicationsButton = new Lang.Class({
         Main.overview.disconnect(this._hidingId);
         Main.layoutManager.disconnect(this._panelBoxChangedId);
         appSys.disconnect(this._installedChangedId);
+
+        Main.wm.setCustomKeybindingHandler('panel-main-menu',
+                                           Shell.ActionMode.NORMAL |
+                                           Shell.ActionMode.OVERVIEW,
+                                           Main.sessionMode.hasOverview ?
+                                           Lang.bind(Main.overview, Main.overview.toggle) :
+                                           null);
     },
 
     _onCapturedEvent: function(actor, event) {
@@ -379,6 +387,15 @@ const ApplicationsButton = new Lang.Class({
        this.parent(menu, open);
     },
 
+    _setKeybinding: function() {
+        Main.wm.setCustomKeybindingHandler('panel-main-menu',
+                                           Shell.ActionMode.NORMAL |
+                                           Shell.ActionMode.OVERVIEW,
+                                           Lang.bind(this, function() {
+                                               this.menu.toggle();
+                                           }));
+    },
+
     _redisplay: function() {
         this.applicationsBox.destroy_all_children();
         this.categoriesBox.destroy_all_children();
@@ -587,26 +604,12 @@ function enable() {
     activitiesButton.container.hide();
     appsMenuButton = new ApplicationsButton();
     Main.panel.addToStatusArea('apps-menu', appsMenuButton, 1, 'left');
-
-    Main.wm.setCustomKeybindingHandler('panel-main-menu',
-                                       Shell.ActionMode.NORMAL |
-                                       Shell.ActionMode.OVERVIEW,
-                                       function() {
-                                           appsMenuButton.menu.toggle();
-                                       });
 }
 
 function disable() {
     Main.panel.menuManager.removeMenu(appsMenuButton.menu);
     appsMenuButton.destroy();
     activitiesButton.container.show();
-
-    Main.wm.setCustomKeybindingHandler('panel-main-menu',
-                                       Shell.ActionMode.NORMAL |
-                                       Shell.ActionMode.OVERVIEW,
-                                       Main.sessionMode.hasOverview ?
-                                       Lang.bind(Main.overview, Main.overview.toggle) :
-                                       null);
 }
 
 function init(metadata) {


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