[gnome-shell] PowerStatus: make the primary device activatable



commit 991a0c642bf3b628cb3cb2c00e5c85f40d745a82
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Fri Nov 26 22:23:22 2010 +0100

    PowerStatus: make the primary device activatable
    
    If the primary device is not virtual, make it open
    gnome-power-statistics on activate.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=635880

 js/ui/status/power.js |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/status/power.js b/js/ui/status/power.js
index 794a090..e8d94be 100644
--- a/js/ui/status/power.js
+++ b/js/ui/status/power.js
@@ -121,6 +121,18 @@ Indicator.prototype = {
             }
 
             this._primaryDeviceId = device_id;
+            if (this._primaryDeviceId) {
+                this._batteryItem.actor.reactive = true;
+                this._batteryItem.actor.can_focus = true;
+                this._batteryItem.connect('activate', function(item) {
+                    let p = new Shell.Process({ args: ['gnome-power-statistics', '--device', device_id] });
+                    p.run();
+                });
+            } else {
+                // virtual device
+                this._batteryItem.actor.reactive = false;
+                this._batteryItem.actor.can_focus = false;
+            }
         }));
     },
 



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