viewSelector: Hook up the dash's showApps button

We pass the dash’s showApps button to the viewSelector, and we connect it
to the showing and hiding of the appsView. This is necessary because there
are different mechanisms for switching the views, and it has to stay in
sync with the button’s state.

https://bugzilla.gnome.org/show_bug.cgi?id=682109
This commit is contained in:
Joost Verdoorn
2012-07-22 14:45:53 +02:00
committed by Florian Müllner
parent 27fbe4cd83
commit 816a29d582
3 changed files with 29 additions and 18 deletions

View File

@ -233,19 +233,19 @@ const ShowAppsIcon = new Lang.Class({
_init: function() {
this.parent();
this._button = new St.Button({ style_class: 'show-apps',
track_hover: true,
can_focus: true,
toggle_mode: true });
this.toggleButton = new St.Button({ style_class: 'show-apps',
track_hover: true,
can_focus: true,
toggle_mode: true });
this._iconActor = null;
this.icon = new IconGrid.BaseIcon(_("Show Applications"),
{ setSizeManually: true,
showLabel: false,
createIcon: Lang.bind(this, this._createIcon) });
this._button.add_actor(this.icon.actor);
this._button._delegate = this;
this.toggleButton.add_actor(this.icon.actor);
this.toggleButton._delegate = this;
this.setChild(this._button);
this.setChild(this.toggleButton);
},
_createIcon: function(size) {
@ -258,7 +258,7 @@ const ShowAppsIcon = new Lang.Class({
},
setHover: function(hovered) {
this._button.set_hover(hovered);
this.toggleButton.set_hover(hovered);
if (this._iconActor)
this._iconActor.set_hover(hovered);
},
@ -327,6 +327,8 @@ const Dash = new Lang.Class({
this._showAppsIcon = new ShowAppsIcon();
this._showAppsIcon.icon.setIconSize(this.iconSize);
this.showAppsButton = this._showAppsIcon.toggleButton;
this._container.add(this._showAppsIcon.actor);
this.actor = new St.Bin({ child: this._container,