status/system: Swap power- and user-related items in session menu

Quoting Allan:
"It's been niggling me that log out is closest to hand,
as opposed to suspend"

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2202
This commit is contained in:
Florian Müllner 2020-07-01 17:18:16 +02:00 committed by Florian Müllner
parent c723a1b72a
commit e6153bb578

View File

@ -113,31 +113,7 @@ class Indicator extends PanelMenu.SystemIndicator {
_('Power Off / Log Out'), true);
this._sessionSubMenu.icon.icon_name = 'system-shutdown-symbolic';
item = new PopupMenu.PopupMenuItem(_("Log Out"));
item.connect('activate', () => {
this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);
this._systemActions.activateLogout();
});
this._sessionSubMenu.menu.addMenuItem(item);
this._logoutItem = item;
this._systemActions.bind_property('can-logout',
this._logoutItem, 'visible',
bindFlags);
item = new PopupMenu.PopupMenuItem(_("Switch User…"));
item.connect('activate', () => {
this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);
this._systemActions.activateSwitchUser();
});
this._sessionSubMenu.menu.addMenuItem(item);
this._loginScreenItem = item;
this._systemActions.bind_property('can-switch-user',
this._loginScreenItem, 'visible',
bindFlags);
this._sessionSubMenu.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
item = new PopupMenu.PopupMenuItem(_("Suspend"));
item = new PopupMenu.PopupMenuItem(_('Suspend'));
item.connect('activate', () => {
this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);
this._systemActions.activateSuspend();
@ -148,7 +124,7 @@ class Indicator extends PanelMenu.SystemIndicator {
this._suspendItem, 'visible',
bindFlags);
item = new PopupMenu.PopupMenuItem(_("Power Off…"));
item = new PopupMenu.PopupMenuItem(_('Power Off…'));
item.connect('activate', () => {
this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);
this._systemActions.activatePowerOff();
@ -159,6 +135,30 @@ class Indicator extends PanelMenu.SystemIndicator {
this._powerOffItem, 'visible',
bindFlags);
this._sessionSubMenu.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
item = new PopupMenu.PopupMenuItem(_('Log Out'));
item.connect('activate', () => {
this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);
this._systemActions.activateLogout();
});
this._sessionSubMenu.menu.addMenuItem(item);
this._logoutItem = item;
this._systemActions.bind_property('can-logout',
this._logoutItem, 'visible',
bindFlags);
item = new PopupMenu.PopupMenuItem(_('Switch User…'));
item.connect('activate', () => {
this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);
this._systemActions.activateSwitchUser();
});
this._sessionSubMenu.menu.addMenuItem(item);
this._loginScreenItem = item;
this._systemActions.bind_property('can-switch-user',
this._loginScreenItem, 'visible',
bindFlags);
this.menu.addMenuItem(this._sessionSubMenu);
}
});