From 8f4cecc8e5079fbf17db2090b2ad8d0155cec6b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 23 Mar 2015 23:55:43 +0100 Subject: [PATCH] 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 file changed, 17 insertions(+), 14 deletions(-) diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js index 232ebcc6..b6c5ae0c 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) {