[gnome-shell] overview: Split a public init() function out of the constructor
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] overview: Split a public init() function out of the constructor
- Date: Wed, 16 Feb 2011 18:59:20 +0000 (UTC)
commit f39e6933242248f661b9ec57854438e4641a8390
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Feb 11 23:53:27 2011 +0100
overview: Split a public init() function out of the constructor
The Overview does not only hold the different elements visible in
the overview, but is also a central point to manage drag signals.
As objects which are constructed in the overview constructor cannot
access Main.overview (as its constructor has not finished yet), we
use misnamed show/hide methods to work around this limitation, which
are called when entering/leaving the overview.
A better way to handle this problem is to remove the limitation
altogether by splitting the overview constructor between internals,
which remain in the constructor, and more complex objects which
need to access Main.overview, and whose initialization is moved
to a public init() function which is called by main.js after the
overview has been constructed.
https://bugzilla.gnome.org/show_bug.cgi?id=642196
js/ui/main.js | 1 +
js/ui/overview.js | 45 ++++++++++++++++++++++++++-------------------
2 files changed, 27 insertions(+), 19 deletions(-)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index 1410d28..265dbf9 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -145,6 +145,7 @@ function start() {
windowAttentionHandler = new WindowAttentionHandler.WindowAttentionHandler();
telepathyClient = new TelepathyClient.Client();
+ overview.init();
statusIconDispatcher.start(messageTray.actor);
ctrlAltTabManager = new CtrlAltTab.CtrlAltTabManager();
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 5195df4..71c9bf6 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -129,8 +129,6 @@ Overview.prototype = {
this._capturedEventId = 0;
this._buttonPressId = 0;
- this.shellInfo = new ShellInfo();
-
this._workspacesDisplay = null;
this.visible = false; // animating to overview, in overview, animating out
@@ -152,6 +150,32 @@ Overview.prototype = {
this._group.hide();
global.overlay_group.add_actor(this._group);
+ this._coverPane.hide();
+
+ // XDND
+ this._dragMonitor = {
+ dragMotion: Lang.bind(this, this._onDragMotion)
+ };
+
+ Main.xdndHandler.connect('drag-begin', Lang.bind(this, this._onDragBegin));
+ Main.xdndHandler.connect('drag-end', Lang.bind(this, this._onDragEnd));
+
+ this._windowSwitchTimeoutId = 0;
+ this._windowSwitchTimestamp = 0;
+ this._lastActiveWorkspaceIndex = -1;
+ this._lastHoveredWindow = null;
+ this._needsFakePointerEvent = false;
+
+ this.workspaces = null;
+ },
+
+ // The members we construct that are implemented in JS might
+ // want to access the overview as Main.overview to connect
+ // signal handlers and so forth. So we create them after
+ // construction in this init() method.
+ init: function() {
+ this.shellInfo = new ShellInfo();
+
this.viewSelector = new ViewSelector.ViewSelector();
this._group.add_actor(this.viewSelector.actor);
@@ -173,23 +197,6 @@ Overview.prototype = {
this.dash.actor.add_constraint(this.viewSelector.constrainY);
this.dash.actor.add_constraint(this.viewSelector.constrainHeight);
- this._coverPane.hide();
-
- // XDND
- this._dragMonitor = {
- dragMotion: Lang.bind(this, this._onDragMotion)
- };
-
- Main.xdndHandler.connect('drag-begin', Lang.bind(this, this._onDragBegin));
- Main.xdndHandler.connect('drag-end', Lang.bind(this, this._onDragEnd));
-
- this._windowSwitchTimeoutId = 0;
- this._windowSwitchTimestamp = 0;
- this._lastActiveWorkspaceIndex = -1;
- this._lastHoveredWindow = null;
- this._needsFakePointerEvent = false;
-
- this.workspaces = null;
},
_onDragBegin: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]