[gnome-shell/wip/re-search-v2: 24/28] overview: hide side controls when searching



commit e1bafef3cfea6ee3cbe684488f2748f762c4c4a9
Author: Tanner Doshier <doshitan gmail com>
Date:   Fri Aug 10 13:38:33 2012 -0500

    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(+), 0 deletions(-)
---
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 1a6f9f8..3e3d892 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 02e5347..978031f 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]