[gnome-shell] sessionMode: Add panelStyle property



commit 2511f60d39fbeb25f213fa00e785b368e4e72957
Author: Florian MÃllner <fmuellner gnome org>
Date:   Fri Sep 21 22:19:27 2012 +0200

    sessionMode: Add panelStyle property
    
    The panel should change appearance according to the sessionMode,
    so add a new panelStyle sessionMode property which allows to
    specify a mode specific style class for the panel actors.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=684573

 js/ui/panel.js       |   21 +++++++++++++++++++++
 js/ui/sessionMode.js |    6 +++++-
 2 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/panel.js b/js/ui/panel.js
index e7f2c3b..0388acf 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -964,6 +964,8 @@ const Panel = new Lang.Class({
                                                   reactive: true });
         this.actor._delegate = this;
 
+        this._sessionStyle = null;
+
         this.statusArea = {};
 
         this.menuManager = new PopupMenu.PopupMenuManager(this);
@@ -1151,6 +1153,13 @@ const Panel = new Lang.Class({
         this._updateBox(panel.left, this._leftBox);
         this._updateBox(panel.center, this._centerBox);
         this._updateBox(panel.right, this._rightBox);
+
+        if (this._sessionStyle)
+            this._removeStyleClassName(this._sessionStyle);
+
+        this._sessionStyle = Main.sessionMode.panelStyle;
+        if (this._sessionStyle)
+            this._addStyleClassName(this._sessionStyle);
     },
 
     _initBox: function(elements, box) {
@@ -1239,5 +1248,17 @@ const Panel = new Lang.Class({
         this.statusArea[role] = indicator;
         this._addToPanelBox(role, indicator, position, boxContainer);
         return indicator;
+    },
+
+    _addStyleClassName: function(className) {
+        this.actor.add_style_class_name(className);
+        this._rightCorner.actor.add_style_class_name(className);
+        this._leftCorner.actor.add_style_class_name(className);
+    },
+
+    _removeStyleClassName: function(className) {
+        this.actor.remove_style_class_name(className);
+        this._rightCorner.actor.remove_style_class_name(className);
+        this._leftCorner.actor.remove_style_class_name(className);
     }
 });
diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js
index 47b1bbf..73f0fcb 100644
--- a/js/ui/sessionMode.js
+++ b/js/ui/sessionMode.js
@@ -28,6 +28,7 @@ const _modes = {
             center: [],
             right: []
         },
+        panelStyle: null
     },
 
     'gdm': {
@@ -41,7 +42,8 @@ const _modes = {
             center: ['dateMenu'],
             right: ['a11y', 'display', 'keyboard',
                     'volume', 'battery', 'powerMenu']
-        }
+        },
+        panelStyle: 'login-screen'
     },
 
     'lock-screen': {
@@ -54,6 +56,7 @@ const _modes = {
             center: [],
             right: ['lockScreen']
         },
+        panelStyle: 'lock-screen'
     },
 
     'unlock-dialog': {
@@ -65,6 +68,7 @@ const _modes = {
             center: [],
             right: ['a11y', 'keyboard', 'lockScreen']
         },
+        panelStyle: 'unlock-screen'
     },
 
     'initial-setup': {



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