[gnome-shell] Use St.Group where appropriate



commit 03a0809e393e1d2cee87cbcc6147759beda29b48
Author: Florian Müllner <fmuellner src gnome org>
Date:   Mon Mar 22 01:39:49 2010 +0100

    Use St.Group where appropriate
    
    There are some places in the code where we use both fixed positioning
    and CSS. Currently we use either a combination of ClutterGroup and StBin,
    or we uses StBoxLayout with fixed positioning. Replace those with the new
    StGroup container.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=613907

 js/ui/messageTray.js    |   12 ++++++------
 js/ui/overview.js       |    3 ++-
 js/ui/workspacesView.js |   26 ++++++++++++--------------
 3 files changed, 20 insertions(+), 21 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index e96add1..c71ce88 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -403,19 +403,19 @@ function MessageTray() {
 
 MessageTray.prototype = {
     _init: function() {
-        this.actor = new St.BoxLayout({ name: 'message-tray',
-                                        reactive: true,
-                                        track_hover: true });
+        this.actor = new St.Group({ name: 'message-tray',
+                                    reactive: true,
+                                    track_hover: true });
         this.actor.connect('notify::hover', Lang.bind(this, this._onTrayHoverChanged));
 
         this._notificationBin = new St.Bin();
-        this.actor.add(this._notificationBin);
+        this.actor.add_actor(this._notificationBin);
         this._notificationBin.hide();
         this._notificationQueue = [];
         this._notification = null;
 
         this._summaryBin = new St.Bin({ anchor_gravity: Clutter.Gravity.NORTH_EAST });
-        this.actor.add(this._summaryBin);
+        this.actor.add_actor(this._summaryBin);
         this._summary = new St.BoxLayout({ name: 'summary-mode',
                                            reactive: true,
                                            track_hover: true });
@@ -427,7 +427,7 @@ MessageTray.prototype = {
                                                     anchor_gravity: Clutter.Gravity.NORTH_EAST,
                                                     reactive: true,
                                                     track_hover: true });
-        this.actor.add(this._summaryNotificationBin);
+        this.actor.add_actor(this._summaryNotificationBin);
         this._summaryNotificationBin.lower_bottom();
         this._summaryNotificationBin.hide();
         this._summaryNotificationBin.connect('notify::hover', Lang.bind(this, this._onSummaryNotificationHoverChanged));
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 17a61eb..b2a241d 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -174,7 +174,7 @@ function Overview() {
 
 Overview.prototype = {
     _init : function() {
-        this._group = new St.BoxLayout({ style_class: 'overview' });
+        this._group = new St.Group({ style_class: 'overview' });
         this._group._delegate = this;
 
         this.infoBar = new InfoBar();
@@ -268,6 +268,7 @@ Overview.prototype = {
         this._recalculateGridSizes();
 
         this._group.set_position(primary.x, primary.y);
+        this._group.set_size(primary.width, primary.height);
 
         let contentY = Panel.PANEL_HEIGHT;
         let contentHeight = primary.height - contentY;
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index bb58566..f947da3 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -43,12 +43,10 @@ function GenericWorkspacesView(width, height, x, y, workspaces) {
 
 GenericWorkspacesView.prototype = {
     _init: function(width, height, x, y, workspaces) {
-        this.actor = new St.Bin({ style_class: 'workspaces' });
-        this._actor = new Clutter.Group();
+        this.actor = new St.Group({ style_class: 'workspaces' });
 
         this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
 
-        this.actor.add_actor(this._actor);
         this.actor.connect('style-changed', Lang.bind(this,
             function() {
                 let node = this.actor.get_theme_node();
@@ -74,7 +72,7 @@ GenericWorkspacesView.prototype = {
 
         // Add workspace actors
         for (let w = 0; w < global.screen.n_workspaces; w++)
-            this._workspaces[w].actor.reparent(this._actor);
+            this._workspaces[w].actor.reparent(this.actor);
         this._workspaces[activeWorkspaceIndex].actor.raise_top();
 
         // Position/scale the desktop windows and their children after the
@@ -297,10 +295,10 @@ MosaicView.prototype = {
         GenericWorkspacesView.prototype._init.call(this, width, height, x, y, workspaces);
 
         this.actor.add_style_class_name('mosaic');
-        this._actor.set_clip(x - Workspace.FRAME_SIZE,
-                             y - Workspace.FRAME_SIZE,
-                             width + 2 * Workspace.FRAME_SIZE,
-                             height + 2 * Workspace.FRAME_SIZE);
+        this.actor.set_clip(x - Workspace.FRAME_SIZE,
+                            y - Workspace.FRAME_SIZE,
+                            width + 2 * Workspace.FRAME_SIZE,
+                            height + 2 * Workspace.FRAME_SIZE);
         this._workspaces[global.screen.get_active_workspace_index()].setSelected(true);
     },
 
@@ -411,7 +409,7 @@ MosaicView.prototype = {
         // Add actors
         if (newNumWorkspaces > oldNumWorkspaces)
             for (let w = oldNumWorkspaces; w < newNumWorkspaces; w++)
-                this._actor.add_actor(this._workspaces[w].actor);
+                this.actor.add_actor(this._workspaces[w].actor);
 
         // Figure out the new layout
         this._computeWorkspacePositions();
@@ -648,12 +646,12 @@ SingleView.prototype = {
                                                                                Lang.bind(this, this._onWindowDragEnd));
         }
 
-        this._actor.add_actor(this._newWorkspaceArea.actor);
-        this._actor.add_actor(this._leftShadow);
-        this._actor.add_actor(this._rightShadow);
+        this.actor.add_actor(this._newWorkspaceArea.actor);
+        this.actor.add_actor(this._leftShadow);
+        this.actor.add_actor(this._rightShadow);
 
         this.actor.add_style_class_name('single');
-        this._actor.set_clip(x, y, width, height);
+        this.actor.set_clip(x, y, width, height);
         this._activeWorkspaceX = 0; // x offset of active ws while dragging
         this._activeWorkspaceY = 0; // y offset of active ws while dragging
         this._scroll = null;
@@ -1085,7 +1083,7 @@ SingleView.prototype = {
 
         if (newNumWorkspaces > oldNumWorkspaces) {
             for (let w = oldNumWorkspaces; w < newNumWorkspaces; w++) {
-                this._actor.add_actor(this._workspaces[w].actor);
+                this.actor.add_actor(this._workspaces[w].actor);
                 this._workspaces[w]._windowDragBeginId = this._workspaces[w].connect('window-drag-begin',
                                                                                      Lang.bind(this, this._onWindowDragBegin));
                 this._workspaces[w]._windowDragEndId = this._workspaces[w].connect('window-drag-end',



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