From 09e7ab5611dc79b46afda18dd8bfe40b15c33974 Mon Sep 17 00:00:00 2001 From: Tanner Doshier Date: Fri, 10 Aug 2012 13:38:33 -0500 Subject: [PATCH] overview: hide side controls when searching Hide the elements when the search is active. Show them if the search is cancelled. https://bugzilla.gnome.org/show_bug.cgi?id=682050 --- js/ui/overview.js | 34 ++++++++++++++++++++++++++++++++++ js/ui/viewSelector.js | 5 +++++ 2 files changed, 39 insertions(+) diff --git a/js/ui/overview.js b/js/ui/overview.js index 01df6e9ba..19bb1c826 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -268,10 +268,44 @@ const Overview = new Lang.Class({ y_fill: true }); this._overview.add_actor(this._messageTrayGhost); + this._viewSelector.connect('page-changed', Lang.bind(this, + function() { + this._setSideControlsVisibility(); + })); + Main.layoutManager.connect('monitors-changed', Lang.bind(this, this._relayout)); this._relayout(); }, + _setSideControlsVisibility: function() { + // Ignore the case when we're leaving the overview, since + // actors will be made visible again when entering the overview + // next time, and animating them while doing so is just + // unnecesary noise + if (!this.visible || this.animationInProgress) + return; + + let searchActive = this._viewSelector.getSearchActive(); + let dashVisible = !searchActive; + let thumbnailsVisible = !searchActive; + let trayVisible = !searchActive; + + if (dashVisible) + this._dash.show(); + else + this._dash.hide(); + + if (thumbnailsVisible) + this._thumbnailsBox.show(); + else + this._thumbnailsBox.hide(); + + if (trayVisible) + Main.messageTray.show(); + else + Main.messageTray.hide(); + }, + addSearchProvider: function(provider) { this._viewSelector.addSearchProvider(provider); }, diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js index 3bc4bbe55..2b45f3707 100644 --- a/js/ui/viewSelector.js +++ b/js/ui/viewSelector.js @@ -207,6 +207,7 @@ const ViewSelector = new Lang.Class({ function() { this._activePage.hide(); this._activePage = page; + this.emit('page-changed'); }) }); } @@ -468,6 +469,10 @@ const ViewSelector = new Lang.Class({ removeSearchProvider: function(provider) { this._searchSystem.unregisterProvider(provider); this._searchResults.destroyProviderMeta(provider); + }, + + getSearchActive: function() { + return this._searchActive; } }); Signals.addSignalMethods(ViewSelector.prototype);