Delegate mode information to a dedicated object

Rather than accessing global.session_type / global.session_mode
all over the place, delegate mode information to a dedicated
sessionMode object. While not very useful for now, we will replace
checks for a particular mode with checks for particular properties
that sessionMode defines based on global.session_mode.

https://bugzilla.gnome.org/show_bug.cgi?id=676156
This commit is contained in:
Florian Müllner
2012-05-17 00:26:44 +02:00
parent 940ddb104c
commit 3d26224180
6 changed files with 41 additions and 12 deletions

View File

@ -962,7 +962,7 @@ const Panel = new Lang.Class({
this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
/* Button on the left side of the panel. */
if (global.session_type == Shell.SessionType.USER) {
if (Main.sessionMode.sessionType == Shell.SessionType.USER) {
this._activitiesButton = new ActivitiesButton();
this._activities = this._activitiesButton.actor;
this._leftBox.add(this._activities);
@ -976,7 +976,7 @@ const Panel = new Lang.Class({
}
/* center */
if (global.session_type == Shell.SessionType.USER)
if (Main.sessionMode.sessionType == Shell.SessionType.USER)
this._dateMenu = new DateMenu.DateMenuButton({ showEvents: true });
else
this._dateMenu = new DateMenu.DateMenuButton({ showEvents: false });
@ -984,7 +984,7 @@ const Panel = new Lang.Class({
this._menus.addMenu(this._dateMenu.menu);
/* right */
if (global.session_type == Shell.SessionType.GDM) {
if (Main.sessionMode.sessionType == Shell.SessionType.GDM) {
this._status_area_order = GDM_STATUS_AREA_ORDER;
this._status_area_shell_implementation = GDM_STATUS_AREA_SHELL_IMPLEMENTATION;
} else {