Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/view/devices/battery.py
diff options
context:
space:
mode:
Diffstat (limited to 'shell/view/devices/battery.py')
-rw-r--r--shell/view/devices/battery.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/shell/view/devices/battery.py b/shell/view/devices/battery.py
index 520f94c..6a667a8 100644
--- a/shell/view/devices/battery.py
+++ b/shell/view/devices/battery.py
@@ -7,5 +7,14 @@ class DeviceView(canvasicon.CanvasIcon):
canvasicon.CanvasIcon.__init__(self)
self._model = model
- icon_name = canvasicon.get_icon_state(_ICON_NAME, 60)
- self.props.icon_name = icon_name
+ model.connect('notify::strength', self._level_changed_cb)
+
+ self._update_level()
+
+ def _update_level(self):
+ self.props.icon_name = canvasicon.get_icon_state(
+ _ICON_NAME, self._model.props.level)
+
+ def _level_changed_cb(self, pspec):
+ self._update_level()
+