status/system: Update text of orientation lock menu entry
Since the orientation lock menu entry is a proper menu entry instead of a icon-only button now, we also show a description-text for that entry, so update this text depending on whether orientation is locked or not to better reflect what clicking the menu entry will do. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/964
This commit is contained in:
parent
526c601512
commit
3f21c21532
@ -125,11 +125,10 @@ const SystemActions = GObject.registerClass({
|
|||||||
available: false,
|
available: false,
|
||||||
});
|
});
|
||||||
this._actions.set(LOCK_ORIENTATION_ACTION_ID, {
|
this._actions.set(LOCK_ORIENTATION_ACTION_ID, {
|
||||||
// Translators: The name of the lock orientation action in search
|
name: '',
|
||||||
name: C_("search-result", "Lock Orientation"),
|
|
||||||
iconName: '',
|
iconName: '',
|
||||||
// Translators: A list of keywords that match the lock orientation action, separated by semicolons
|
// Translators: A list of keywords that match the lock orientation action, separated by semicolons
|
||||||
keywords: _("lock orientation;screen;rotation").split(/[; ]/),
|
keywords: _("lock orientation;unlock orientation;screen;rotation").split(/[; ]/),
|
||||||
available: false,
|
available: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -167,10 +166,9 @@ const SystemActions = GObject.registerClass({
|
|||||||
|
|
||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
|
|
||||||
this._orientationSettings.connect('changed::orientation-lock',
|
this._orientationSettings.connect('changed::orientation-lock', () => {
|
||||||
() => {
|
|
||||||
this._updateOrientationLock();
|
this._updateOrientationLock();
|
||||||
this._updateOrientationLockIcon();
|
this._updateOrientationLockStatus();
|
||||||
});
|
});
|
||||||
Main.layoutManager.connect('monitors-changed',
|
Main.layoutManager.connect('monitors-changed',
|
||||||
() => this._updateOrientationLock());
|
() => this._updateOrientationLock());
|
||||||
@ -190,7 +188,7 @@ const SystemActions = GObject.registerClass({
|
|||||||
this._updateOrientationLock();
|
this._updateOrientationLock();
|
||||||
});
|
});
|
||||||
this._updateOrientationLock();
|
this._updateOrientationLock();
|
||||||
this._updateOrientationLockIcon();
|
this._updateOrientationLockStatus();
|
||||||
|
|
||||||
Main.sessionMode.connect('updated', () => this._sessionUpdated());
|
Main.sessionMode.connect('updated', () => this._sessionUpdated());
|
||||||
this._sessionUpdated();
|
this._sessionUpdated();
|
||||||
@ -243,12 +241,21 @@ const SystemActions = GObject.registerClass({
|
|||||||
this.notify('can-lock-orientation');
|
this.notify('can-lock-orientation');
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateOrientationLockIcon() {
|
_updateOrientationLockStatus() {
|
||||||
let locked = this._orientationSettings.get_boolean('orientation-lock');
|
let locked = this._orientationSettings.get_boolean('orientation-lock');
|
||||||
|
let action = this._actions.get(LOCK_ORIENTATION_ACTION_ID);
|
||||||
|
|
||||||
|
// Translators: The name of the lock orientation action in search
|
||||||
|
// and in the system status menu
|
||||||
|
let name = locked
|
||||||
|
? C_('search-result', 'Unlock Screen Rotation')
|
||||||
|
: C_('search-result', 'Lock Screen Rotation');
|
||||||
let iconName = locked
|
let iconName = locked
|
||||||
? 'rotation-locked-symbolic'
|
? 'rotation-locked-symbolic'
|
||||||
: 'rotation-allowed-symbolic';
|
: 'rotation-allowed-symbolic';
|
||||||
this._actions.get(LOCK_ORIENTATION_ACTION_ID).iconName = iconName;
|
|
||||||
|
action.name = name;
|
||||||
|
action.iconName = iconName;
|
||||||
|
|
||||||
this.notify('orientation-lock-icon');
|
this.notify('orientation-lock-icon');
|
||||||
}
|
}
|
||||||
|
@ -54,8 +54,10 @@ class Indicator extends PanelMenu.SystemIndicator {
|
|||||||
let bindFlags = GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE;
|
let bindFlags = GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE;
|
||||||
let item;
|
let item;
|
||||||
|
|
||||||
item = new PopupMenu.PopupImageMenuItem(_('Lock Screen Rotation'),
|
item = new PopupMenu.PopupImageMenuItem(
|
||||||
|
this._systemActions.getName('lock-orientation'),
|
||||||
this._systemActions.orientation_lock_icon);
|
this._systemActions.orientation_lock_icon);
|
||||||
|
|
||||||
item.connect('activate', () => {
|
item.connect('activate', () => {
|
||||||
this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);
|
this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);
|
||||||
this._systemActions.activateLockOrientation();
|
this._systemActions.activateLockOrientation();
|
||||||
@ -68,7 +70,10 @@ class Indicator extends PanelMenu.SystemIndicator {
|
|||||||
bindFlags);
|
bindFlags);
|
||||||
this._systemActions.connect('notify::orientation-lock-icon', () => {
|
this._systemActions.connect('notify::orientation-lock-icon', () => {
|
||||||
let iconName = this._systemActions.orientation_lock_icon;
|
let iconName = this._systemActions.orientation_lock_icon;
|
||||||
|
let labelText = this._systemActions.getName("lock-orientation");
|
||||||
|
|
||||||
this._orientationLockItem.setIcon(iconName);
|
this._orientationLockItem.setIcon(iconName);
|
||||||
|
this._orientationLockItem.label.text = labelText;
|
||||||
});
|
});
|
||||||
|
|
||||||
let app = this._settingsApp = Shell.AppSystem.get_default().lookup_app(
|
let app = this._settingsApp = Shell.AppSystem.get_default().lookup_app(
|
||||||
|
Loading…
Reference in New Issue
Block a user