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
This commit is contained in:
Florian Müllner
2015-03-23 23:55:43 +01:00
parent 487c089e86
commit 8f4cecc8e5

View File

@@ -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) {