[gnome-shell-extensions] XrandrIndicator: update for API change in GnomeRR



commit b730d7f97e9bc1f8d62af2f04ad80d1452d40517
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sat Feb 19 18:49:46 2011 +0100

    XrandrIndicator: update for API change in GnomeRR
    
    The API in GnomeRR was changed when it was merged, and noone ever
    noticed in this extension.

 extensions/xrandr-indicator/extension.js |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/extensions/xrandr-indicator/extension.js b/extensions/xrandr-indicator/extension.js
index da95767..4f47936 100644
--- a/extensions/xrandr-indicator/extension.js
+++ b/extensions/xrandr-indicator/extension.js
@@ -58,7 +58,7 @@ Indicator.prototype = {
         }
 
         this._createMenu();
-        this._screen.connect('screen-changed', Lang.bind(this, this._randrEvent));
+        this._screen.connect('changed', Lang.bind(this, this._randrEvent));
     },
 
     _randrEvent: function() {
@@ -70,7 +70,7 @@ Indicator.prototype = {
         let config = GnomeDesktop.RRConfig.new_current(this._screen);
         let outputs = config.get_outputs();
         for (let i = 0; i < outputs.length; i++) {
-            if (outputs[i].get_connected())
+            if (outputs[i].is_connected())
                 this._addOutputItem(config, outputs[i]);
         }
         this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
@@ -87,10 +87,14 @@ Indicator.prototype = {
         this.menu.addMenuItem(item);
 
         let allowedRotations = this._getAllowedRotations(config, output);
+        let currentRotation = output.get_rotation();
         for (let i = 0; i < rotations.length; i++) {
             let [bitmask, name] = rotations[i];
             if (bitmask & allowedRotations) {
-                this.menu.addAction(name, Lang.bind(this, function(event) {
+                let item = new PopupMenu.PopupMenuItem(name);
+                if (bitmask & currentRotation)
+                    item.setShowDot(true);
+                item.connect('activate', Lang.bind(this, function(item, event) {
                     /* ensure config is saved so we get a backup if anything goes wrong */
                     config.save();
 
@@ -99,9 +103,10 @@ Indicator.prototype = {
                         config.save();
                         this._proxy.ApplyConfigurationRemote(global.stage_xwindow, event.get_time());
                     } catch (e) {
-                        logError ('Could not save monitor configuration: ' + e);
+                        log ('Could not save monitor configuration: ' + e);
                     }
                 }));
+                this.menu.addMenuItem(item);
             }
         }
     },



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