diff options
author | Sascha Silbe <silbe@activitycentral.com> | 2011-03-12 17:09:51 (GMT) |
---|---|---|
committer | Sascha Silbe <silbe@activitycentral.com> | 2011-03-12 17:09:51 (GMT) |
commit | 3d7cae64f6eacdb77d84cd34c2965086221ff509 (patch) | |
tree | 62370ed13a666649db6047dfd5a7631952365da2 /extensions/deviceicon/volume.py | |
parent | 12ed51c8c945ce02d93fbec048b6d44a18f639d9 (diff) | |
parent | ff47b24c5aa032f830c6f3dc3ae32dfed3c72229 (diff) |
Merge commit 'refs/top-bases/t/upower' into t/upowert/upower
* commit 'refs/top-bases/t/upower': (87 commits)
Fix up style issues introduced by commit 3f8a1e1
Don't set default timezone
Restore setting a language with the command line OLPC #10681
battery frame device: replace HAL with UPower
use ConsoleKit instead of HAL for shutdown/reboot
fix recognition of JEBs outside of data store
Adjust the year in the licence visible in the control panel
Handle activities that cycle through windows dlo#10695
Speaker frame device: pop up palette on left-click instead of toggling mute
recognise translations using pgettext
Remove last few pieces of buddy-icon.jpg handling
fix whitespace error introduced by 4b6a534 (revert of 4a3416b)
Commit from Sugar Labs: Translation System by user RafaelOrtiz.: 374 of 374 messages translated (0 fuzzy).
Intro: Fall back to user name if GECOS real name field is empty
Sugar Ad-hoc icons show in search results when connect/disconnect to AP OLPC #10412
Show busy cursor during session shutdown
Show free space for the Journal in the Journal volumes toolbar (SL#2318)
Fix incorrect logging level for warning about missing GSM configuration
simplify extension loading exception error
Revert "Add cpu and memory resource indicator to frame" as agreed on with erikos. Scheduling for inclusion in 0.94 after potential artwork changes based on feedback from the Design Team.
...
Conflicts:
extensions/deviceicon/battery.py
Diffstat (limited to 'extensions/deviceicon/volume.py')
-rw-r--r-- | extensions/deviceicon/volume.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/extensions/deviceicon/volume.py b/extensions/deviceicon/volume.py index e7f62a2..ea2377d 100644 --- a/extensions/deviceicon/volume.py +++ b/extensions/deviceicon/volume.py @@ -28,8 +28,10 @@ from jarabe.journal import journalactivity from jarabe.view.palettes import VolumePalette from jarabe.frame.frameinvoker import FrameWidgetInvoker + _icons = {} + class DeviceView(TrayIcon): FRAME_POSITION_RELATIVE = 500 @@ -70,9 +72,11 @@ class DeviceView(TrayIcon): journal.reveal() return True + def setup(tray): gobject.idle_add(_setup_volumes, tray) + def _setup_volumes(tray): volume_monitor = gio.volume_monitor_get() @@ -86,9 +90,11 @@ def _setup_volumes(tray): volume_monitor.connect('mount-added', _mount_added_cb, tray) volume_monitor.connect('mount-removed', _mount_removed_cb, tray) + def _volume_added_cb(volume_monitor, volume, tray): _mount(volume, tray) + def _mount(volume, tray): # Follow Nautilus behaviour here # since it has the same issue with removable device @@ -102,20 +108,23 @@ def _mount(volume, tray): #TODO: pass None as mount_operation, or better, SugarMountOperation volume.mount(gtk.MountOperation(tray.get_toplevel()), _mount_cb) + def _mount_cb(volume, result): logging.debug('_mount_cb %r %r', volume, result) volume.mount_finish(result) + def _mount_added_cb(volume_monitor, mount, tray): _add_device(mount, tray) + def _mount_removed_cb(volume_monitor, mount, tray): icon = _icons[mount] tray.remove_device(icon) del _icons[mount] + def _add_device(mount, tray): icon = DeviceView(mount) _icons[mount] = icon tray.add_device(icon) - |