From 9c483dd9a6efb4c8022b597ca3e9bc0999dcb43d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 20 Apr 2016 20:26:49 +0200 Subject: [PATCH] system: Only show rotation lock when a builtin output is present We currently show the orientation lock button when an accelerometer is present, however gnome-settings-daemon's xrandr plugin only applies rotation when a builtin monitor is present. Update the button's visibility to match gnome-settings-daemon. https://bugzilla.gnome.org/show_bug.cgi?id=765267 --- js/ui/status/system.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/ui/status/system.js b/js/ui/status/system.js index fb0b04037..4981d948b 100644 --- a/js/ui/status/system.js +++ b/js/ui/status/system.js @@ -6,6 +6,7 @@ const Gdm = imports.gi.Gdm; const Gio = imports.gi.Gio; const GLib = imports.gi.GLib; const Lang = imports.lang; +const Meta = imports.gi.Meta; const Shell = imports.gi.Shell; const St = imports.gi.St; @@ -110,6 +111,7 @@ const Indicator = new Lang.Class({ this._session = new GnomeSession.SessionManager(); this._loginManager = LoginManager.getLoginManager(); + this._monitorManager = Meta.MonitorManager.get(); this._haveShutdown = true; this._haveSuspend = true; @@ -155,6 +157,8 @@ const Indicator = new Lang.Class({ this._orientationSettings.connect('changed::orientation-lock', Lang.bind(this, this._updateOrientationLock)); + Main.layoutManager.connect('monitors-changed', + Lang.bind(this, this._updateOrientationLock)); Gio.DBus.system.watch_name(SENSOR_BUS_NAME, Gio.BusNameWatcherFlags.NONE, Lang.bind(this, this._sensorProxyAppeared), @@ -264,7 +268,8 @@ const Indicator = new Lang.Class({ _updateOrientationLock: function() { if (this._sensorProxy) - this._orientationLockAction.visible = this._sensorProxy.HasAccelerometer; + this._orientationLockAction.visible = this._sensorProxy.HasAccelerometer && + this._monitorManager.get_is_builtin_display_on(); else this._orientationLockAction.visible = false;