- return [(_("Show files from %s") % r.description, boundFunction(menuEntry, r.description, r.mountpoint), "hotplug", None) for r in harddiskmanager.getMountedPartitions(onlyhotplug = True)]
+ return [(("%s (files)") % r.description, boundFunction(menuEntry, r.description, r.mountpoint), "hotplug_%s" % r.mountpoint, None) for r in harddiskmanager.getMountedPartitions(onlyhotplug = True)]
+
+global_session = None
+
+def partitionListChanged(action, device):
+ if InfoBar.instance:
+ if InfoBar.instance.execing:
+ if action == 'add' and device.is_hotplug:
+ print "mountpoint", device.mountpoint
+ print "description", device.description
+ print "force_mounted", device.force_mounted
+ mountpoint_choosen((device.description, device.mountpoint, global_session))
+ else:
+ print "main infobar is not execing... so we ignore hotplug event!"
+ else:
+ print "hotplug event.. but no infobar"
+
+def sessionstart(reason, session):
+ global global_session
+ global_session = session
+
+def autostart(reason, **kwargs):
+ global global_session
+ if reason == 0:
+ harddiskmanager.on_partition_list_change.append(partitionListChanged)
+ elif reason == 1:
+ harddiskmanager.on_partition_list_change.remove(partitionListChanged)
+ global_session = None