diff --git a/js/ui/dash.js b/js/ui/dash.js index e421e584c..f4c033bad 100644 --- a/js/ui/dash.js +++ b/js/ui/dash.js @@ -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, diff --git a/js/ui/overview.js b/js/ui/overview.js index b0a6f3be2..a7d29109a 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -195,12 +195,13 @@ const Overview = new Lang.Class({ can_focus: true }); this._group.add_actor(this._searchEntry); - this._viewSelector = new ViewSelector.ViewSelector(this._searchEntry); + this._dash = new Dash.Dash(); + this._viewSelector = new ViewSelector.ViewSelector(this._searchEntry, + this._dash.showAppsButton); this._group.add_actor(this._viewSelector.actor); + this._group.add_actor(this._dash.actor); // TODO - recalculate everything when desktop size changes - this._dash = new Dash.Dash(); - this._group.add_actor(this._dash.actor); this._dash.actor.add_constraint(this._viewSelector.constrainY); this._dash.actor.add_constraint(this._viewSelector.constrainHeight); this.dashIconSize = this._dash.iconSize; diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js index dd5ac20e1..4e43d439e 100644 --- a/js/ui/viewSelector.js +++ b/js/ui/viewSelector.js @@ -345,10 +345,19 @@ const SearchTab = new Lang.Class({ const ViewSelector = new Lang.Class({ Name: 'ViewSelector', - _init : function(searchEntry) { + _init : function(searchEntry, showAppsButton) { this.actor = new St.BoxLayout({ name: 'viewSelector', vertical: true }); + this._showAppsButton = showAppsButton; + this._showAppsButton.connect('notify::checked', Lang.bind(this, + function() { + if (this._showAppsButton.checked) + this._switchTab(this._appsTab); + else + this._switchTab(this._windowsTab); + })); + // The tab bar is located at the top of the view selector and // holds both "normal" tab labels and the search entry. The former // is left aligned, the latter right aligned - unless the text @@ -409,18 +418,18 @@ const ViewSelector = new Lang.Class({ RemoteSearch.loadRemoteSearchProviders(Lang.bind(this, this.addSearchProvider)); Main.overview.connect('item-drag-begin', - Lang.bind(this, this._switchDefaultTab)); + Lang.bind(this, this._resetShowAppsButton)); this._stageKeyPressId = 0; Main.overview.connect('showing', Lang.bind(this, function () { - this._switchDefaultTab(); + this._resetShowAppsButton(); this._stageKeyPressId = global.stage.connect('key-press-event', Lang.bind(this, this._onStageKeyPress)); })); Main.overview.connect('hiding', Lang.bind(this, function () { - this._switchDefaultTab(); + this._resetShowAppsButton(); if (this._stageKeyPressId != 0) { global.stage.disconnect(this._stageKeyPressId); this._stageKeyPressId = 0; @@ -505,9 +514,8 @@ const ViewSelector = new Lang.Class({ } }, - _switchDefaultTab: function() { - if (this._tabs.length > 0) - this._switchTab(this._tabs[0]); + _resetShowAppsButton: function() { + this._showAppsButton.checked = false; }, _nextTab: function() {