[gnome-shell] view-selector: Remove show/hide functions



commit 6b429b7f50ae8218b227ad7b6e7d0fc949434445
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Feb 12 23:03:56 2011 +0100

    view-selector: Remove show/hide functions
    
    As Main.overview is now usable from the view selector's constructor,
    move the setup of signal connections there and remove the show/hide
    methods which were used as workaround.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=642196

 js/ui/overview.js     |    2 --
 js/ui/viewSelector.js |   42 ++++++++----------------------------------
 2 files changed, 8 insertions(+), 36 deletions(-)
---
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 2f6c6ab..843d8f2 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -535,7 +535,6 @@ Overview.prototype = {
         this._group.show();
         this._background.show();
 
-        this.viewSelector.show();
         this._workspacesDisplay.show();
 
         this.workspaces = this._workspacesDisplay.workspacesView;
@@ -749,7 +748,6 @@ Overview.prototype = {
         this.workspaces = null;
 
         this._workspacesDisplay.hide();
-        this.viewSelector.hide();
 
         this._desktopFade.hide();
         this._background.hide();
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 636994c..3e1f210 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -350,6 +350,8 @@ ViewSelector.prototype = {
     _init : function() {
         this.actor = new St.BoxLayout({ name: 'viewSelector',
                                         vertical: true });
+        this.actor.connect('key-press-event',
+                           Lang.bind(this, this._onKeyPress));
 
         // The tab bar is located at the top of the view selector and
         // holds both "normal" tab labels and the search entry. The former
@@ -392,9 +394,12 @@ ViewSelector.prototype = {
                 this._switchTab(this._activeTab);
             }));
 
-        this._keyPressId = 0;
-        this._itemDragBeginId = 0;
-        this._overviewHidingId = 0;
+        Main.overview.connect('item-drag-begin',
+                              Lang.bind(this, this._switchDefaultTab));
+        Main.overview.connect('showing',
+                              Lang.bind(this, this._switchDefaultTab));
+        Main.overview.connect('hiding',
+                              Lang.bind(this, this._switchDefaultTab));
 
         // Public constraints which may be used to tie actors' height or
         // vertical position to the current tab's content; as the content's
@@ -571,37 +576,6 @@ ViewSelector.prototype = {
 
     addSearchProvider: function(provider) {
         this._searchTab.addSearchProvider(provider);
-    },
-
-    show: function() {
-        if (this._itemDragBeginId == 0)
-            this._itemDragBeginId = Main.overview.connect('item-drag-begin',
-                                                          Lang.bind(this, this._switchDefaultTab));
-        if (this._overviewHidingId == 0)
-            this._overviewHidingId = Main.overview.connect('hiding',
-                                                           Lang.bind(this, this._switchDefaultTab));
-        if (this._keyPressId == 0)
-            this._keyPressId = this.actor.connect('key-press-event',
-                                                  Lang.bind(this, this._onKeyPress));
-
-        this._switchDefaultTab();
-    },
-
-    hide: function() {
-        if (this._keyPressId > 0) {
-            this.actor.disconnect(this._keyPressId);
-            this._keyPressId = 0;
-        }
-
-        if (this._itemDragBeginId > 0) {
-            Main.overview.disconnect(this._itemDragBeginId);
-            this._itemDragBeginId = 0;
-        }
-
-        if (this._overviewHidingId > 0) {
-            Main.overview.disconnect(this._overviewHidingId);
-            this._overviewHidingId = 0;
-        }
     }
 };
 Signals.addSignalMethods(ViewSelector.prototype);



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