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
This commit is contained in:
Florian Müllner 2011-02-12 23:03:56 +01:00
parent 0ae44f4015
commit 6b429b7f50
2 changed files with 8 additions and 36 deletions

View File

@ -535,7 +535,6 @@ Overview.prototype = {
this._group.show(); this._group.show();
this._background.show(); this._background.show();
this.viewSelector.show();
this._workspacesDisplay.show(); this._workspacesDisplay.show();
this.workspaces = this._workspacesDisplay.workspacesView; this.workspaces = this._workspacesDisplay.workspacesView;
@ -749,7 +748,6 @@ Overview.prototype = {
this.workspaces = null; this.workspaces = null;
this._workspacesDisplay.hide(); this._workspacesDisplay.hide();
this.viewSelector.hide();
this._desktopFade.hide(); this._desktopFade.hide();
this._background.hide(); this._background.hide();

View File

@ -350,6 +350,8 @@ ViewSelector.prototype = {
_init : function() { _init : function() {
this.actor = new St.BoxLayout({ name: 'viewSelector', this.actor = new St.BoxLayout({ name: 'viewSelector',
vertical: true }); 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 // The tab bar is located at the top of the view selector and
// holds both "normal" tab labels and the search entry. The former // holds both "normal" tab labels and the search entry. The former
@ -392,9 +394,12 @@ ViewSelector.prototype = {
this._switchTab(this._activeTab); this._switchTab(this._activeTab);
})); }));
this._keyPressId = 0; Main.overview.connect('item-drag-begin',
this._itemDragBeginId = 0; Lang.bind(this, this._switchDefaultTab));
this._overviewHidingId = 0; 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 // Public constraints which may be used to tie actors' height or
// vertical position to the current tab's content; as the content's // vertical position to the current tab's content; as the content's
@ -571,37 +576,6 @@ ViewSelector.prototype = {
addSearchProvider: function(provider) { addSearchProvider: function(provider) {
this._searchTab.addSearchProvider(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); Signals.addSignalMethods(ViewSelector.prototype);