[gnome-shell] system: Add an orientation lock action button
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] system: Add an orientation lock action button
- Date: Tue, 13 Aug 2013 10:51:15 +0000 (UTC)
commit e76bcce3bb6d74e59a0ef9c14e8ef34ec70f7334
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Jul 17 02:33:09 2013 -0400
system: Add an orientation lock action button
https://bugzilla.gnome.org/show_bug.cgi?id=705845
js/ui/status/system.js | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/status/system.js b/js/ui/status/system.js
index d1ec3e7..a4674c7 100644
--- a/js/ui/status/system.js
+++ b/js/ui/status/system.js
@@ -50,6 +50,7 @@ const Indicator = new Lang.Class({
this._screenSaverSettings = new Gio.Settings({ schema: SCREENSAVER_SCHEMA });
this._lockdownSettings = new Gio.Settings({ schema: LOCKDOWN_SCHEMA });
this._privacySettings = new Gio.Settings({ schema: PRIVACY_SCHEMA });
+ this._orientationSettings = new Gio.Settings({ schema:
'org.gnome.settings-daemon.peripherals.touchscreen' });
this._session = new GnomeSession.SessionManager();
this._haveShutdown = true;
@@ -93,6 +94,21 @@ const Indicator = new Lang.Class({
this._lockdownSettings.connect('changed::' + DISABLE_LOG_OUT_KEY,
Lang.bind(this, this._updateHaveShutdown));
+ this._orientationSettings.connect('changed::orientation-lock',
+ Lang.bind(this, this._updateOrientationLock));
+ this._orientationExists = false;
+ Gio.DBus.session.watch_name('org.gnome.SettingsDaemon.Orientation',
+ Gio.BusNameWatcherFlags.NONE,
+ Lang.bind(this, function() {
+ this._orentationExists = true;
+ this._updateOrientationLock();
+ }),
+ Lang.bind(this, function() {
+ this._orentationExists = false;
+ this._updateOrientationLock();
+ }));
+ this._updateOrientationLock();
+
Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
this._sessionUpdated();
},
@@ -150,6 +166,14 @@ const Indicator = new Lang.Class({
}
},
+ _updateOrientationLock: function() {
+ this._orientationLockAction.visible = this._orientationExists;
+
+ let locked = this._orientationSettings.get_boolean('orientation-lock');
+ let icon = this._orientationLockAction.child;
+ icon.icon_name = locked ? 'rotation-locked-symbolic' : 'rotation-allowed-symbolic';
+ },
+
_updateLockScreen: function() {
let showLock = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
let allowLockScreen = !this._lockdownSettings.get_boolean(DISABLE_LOCK_SCREEN_KEY);
@@ -209,6 +233,10 @@ const Indicator = new Lang.Class({
this._settingsAction.connect('clicked', Lang.bind(this, this._onSettingsClicked));
hbox.add(this._settingsAction, { expand: true, x_fill: false });
+ this._orientationLockAction = this._createActionButton('', _("Orientation Lock"));
+ this._orientationLockAction.connect('clicked', Lang.bind(this, this._onOrientationLockClicked));
+ item.actor.add(this._orientationLockAction, { expand: true, x_fill: false });
+
this._lockScreenAction = this._createActionButton('changes-prevent-symbolic', _("Lock"));
this._lockScreenAction.connect('clicked', Lang.bind(this, this._onLockScreenClicked));
hbox.add(this._lockScreenAction, { expand: true, x_fill: false });
@@ -231,6 +259,13 @@ const Indicator = new Lang.Class({
app.activate();
},
+ _onOrientationLockClicked: function() {
+ this.menu.itemActivated();
+ let locked = this._orientationSettings.get_boolean('orientation-lock');
+ this._orientationSettings.set_boolean('orientation-lock', !locked);
+ this._updateOrientationLock();
+ },
+
_onLockScreenClicked: function() {
this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);
Main.overview.hide();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]