[gnome-shell] sessionMode: Introduce the concept of "primary" modes



commit 8109dd684ed5ad92cabeeab58952b87a6b8a1362
Author: Florian MÃllner <fmuellner gnome org>
Date:   Thu Sep 6 13:21:12 2012 +0200

    sessionMode: Introduce the concept of "primary" modes
    
    With the recent session mode changes, there is now a mix of modes
    that are meant to apply to the entire session (specified as parameter
    to the --mode command line switch) and temporary modes like the lock
    screen; introduce a property to make the difference explicit, and only
    allow "primary" modes to be specified on the command line.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=683488

 js/ui/sessionMode.js |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js
index 51fb6d6..27c81a8 100644
--- a/js/ui/sessionMode.js
+++ b/js/ui/sessionMode.js
@@ -20,6 +20,7 @@ const _modes = {
         hasWindows: false,
         isLocked: false,
         isGreeter: false,
+        isPrimary: false,
         unlockDialog: null,
         components: [],
         panel: {
@@ -32,6 +33,7 @@ const _modes = {
     'gdm': {
         allowKeybindingsWhenModal: true,
         isGreeter: true,
+        isPrimary: true,
         unlockDialog: imports.gdm.loginDialog.LoginDialog,
         components: ['polkitAgent'],
         panel: {
@@ -55,6 +57,7 @@ const _modes = {
     },
 
     'initial-setup': {
+        isPrimary: true,
         components: ['keyring'],
         panel: {
             left: [],
@@ -73,6 +76,7 @@ const _modes = {
         hasWindows: true,
         unlockDialog: imports.ui.unlockDialog.UnlockDialog,
         isLocked: false,
+        isPrimary: true,
         components: ['networkAgent', 'polkitAgent', 'telepathyClient',
                      'keyring', 'recorder', 'autorunManager', 'automountManager'],
         panel: {
@@ -87,7 +91,8 @@ const _modes = {
 function listModes() {
     let modes = Object.getOwnPropertyNames(_modes);
     for (let i = 0; i < modes.length; i++)
-        print(modes[i]);
+        if (_modes[modes[i]].isPrimary)
+            print(modes[i]);
 }
 
 const SessionMode = new Lang.Class({
@@ -95,7 +100,9 @@ const SessionMode = new Lang.Class({
 
     _init: function() {
         global.connect('notify::session-mode', Lang.bind(this, this._sync));
-        this._modeStack = [global.session_mode];
+        let mode = _modes[global.session_mode].isPrimary ? global.session_mode
+                                                         : 'user';
+        this._modeStack = [mode];
         this._sync();
     },
 



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