[gnome-shell] system: Only show rotation lock when a builtin output is present



commit 9c483dd9a6efb4c8022b597ca3e9bc0999dcb43d
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Apr 20 20:26:49 2016 +0200

    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 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/status/system.js b/js/ui/status/system.js
index fb0b040..4981d94 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;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]