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
This commit is contained in:
Florian Müllner 2016-04-20 20:26:49 +02:00
parent 8fd6e93fbe
commit 9c483dd9a6

View File

@ -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;