[gnome-shell] status/system: Update text of orientation lock menu entry
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] status/system: Update text of orientation lock menu entry
- Date: Tue, 28 Jan 2020 15:54:24 +0000 (UTC)
commit 3f21c21532db75d374c1d3b42c66ba8592f83813
Author: Jonas Dreßler <verdre v0yd nl>
Date: Mon Dec 9 19:16:41 2019 +0100
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
js/misc/systemActions.js | 29 ++++++++++++++++++-----------
js/ui/status/system.js | 7 ++++++-
2 files changed, 24 insertions(+), 12 deletions(-)
---
diff --git a/js/misc/systemActions.js b/js/misc/systemActions.js
index 07e1880b3c..4442a5b715 100644
--- a/js/misc/systemActions.js
+++ b/js/misc/systemActions.js
@@ -125,11 +125,10 @@ const SystemActions = GObject.registerClass({
available: false,
});
this._actions.set(LOCK_ORIENTATION_ACTION_ID, {
- // Translators: The name of the lock orientation action in search
- name: C_("search-result", "Lock Orientation"),
+ name: '',
iconName: '',
// 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,
});
@@ -167,11 +166,10 @@ const SystemActions = GObject.registerClass({
this.forceUpdate();
- this._orientationSettings.connect('changed::orientation-lock',
- () => {
- this._updateOrientationLock();
- this._updateOrientationLockIcon();
- });
+ this._orientationSettings.connect('changed::orientation-lock', () => {
+ this._updateOrientationLock();
+ this._updateOrientationLockStatus();
+ });
Main.layoutManager.connect('monitors-changed',
() => this._updateOrientationLock());
this._sensorProxy = new SensorProxy(Gio.DBus.system,
@@ -190,7 +188,7 @@ const SystemActions = GObject.registerClass({
this._updateOrientationLock();
});
this._updateOrientationLock();
- this._updateOrientationLockIcon();
+ this._updateOrientationLockStatus();
Main.sessionMode.connect('updated', () => this._sessionUpdated());
this._sessionUpdated();
@@ -243,12 +241,21 @@ const SystemActions = GObject.registerClass({
this.notify('can-lock-orientation');
}
- _updateOrientationLockIcon() {
+ _updateOrientationLockStatus() {
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
? 'rotation-locked-symbolic'
: 'rotation-allowed-symbolic';
- this._actions.get(LOCK_ORIENTATION_ACTION_ID).iconName = iconName;
+
+ action.name = name;
+ action.iconName = iconName;
this.notify('orientation-lock-icon');
}
diff --git a/js/ui/status/system.js b/js/ui/status/system.js
index 1353422dd3..195e9a1c8a 100644
--- a/js/ui/status/system.js
+++ b/js/ui/status/system.js
@@ -54,8 +54,10 @@ class Indicator extends PanelMenu.SystemIndicator {
let bindFlags = GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE;
let item;
- item = new PopupMenu.PopupImageMenuItem(_('Lock Screen Rotation'),
+ item = new PopupMenu.PopupImageMenuItem(
+ this._systemActions.getName('lock-orientation'),
this._systemActions.orientation_lock_icon);
+
item.connect('activate', () => {
this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);
this._systemActions.activateLockOrientation();
@@ -68,7 +70,10 @@ class Indicator extends PanelMenu.SystemIndicator {
bindFlags);
this._systemActions.connect('notify::orientation-lock-icon', () => {
let iconName = this._systemActions.orientation_lock_icon;
+ let labelText = this._systemActions.getName("lock-orientation");
+
this._orientationLockItem.setIcon(iconName);
+ this._orientationLockItem.label.text = labelText;
});
let app = this._settingsApp = Shell.AppSystem.get_default().lookup_app(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]