[conduit/iphone: 1/4] Remove VolumeMonitor from HalFactory as it is a singleton in gio



commit 24c7f42f30e501c9764abf4d667edc8a6b195492
Author: John Stowers <john stowers gmail com>
Date:   Wed Sep 22 22:50:37 2010 +1200

    Remove VolumeMonitor from HalFactory as it is a singleton in gio

 conduit/dataproviders/HalFactory.py      |    2 --
 conduit/modules/iPodModule/iPodModule.py |    5 +++--
 2 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/conduit/dataproviders/HalFactory.py b/conduit/dataproviders/HalFactory.py
index 8fe7db2..af34d46 100644
--- a/conduit/dataproviders/HalFactory.py
+++ b/conduit/dataproviders/HalFactory.py
@@ -1,6 +1,5 @@
 import gobject
 import gudev
-import gio
 
 import logging
 log = logging.getLogger("dataproviders.HalFactory")
@@ -22,7 +21,6 @@ class HalFactory(SimpleFactory.SimpleFactory):
 
         self.gudev = UDev.UDevSingleton(self.SUBSYSTEMS)
         self.gudev.connect("uevent", self._on_uevent)
-        self.vm = gio.volume_monitor_get()
 
     def _print_device(self, device):
         return
diff --git a/conduit/modules/iPodModule/iPodModule.py b/conduit/modules/iPodModule/iPodModule.py
index cfa1f50..8ad1cf6 100644
--- a/conduit/modules/iPodModule/iPodModule.py
+++ b/conduit/modules/iPodModule/iPodModule.py
@@ -20,6 +20,7 @@ import locale
 import weakref
 import threading
 import gobject
+import gio
 log = logging.getLogger("modules.iPod")
 
 import conduit
@@ -98,7 +99,7 @@ class iPhoneFactory(HalFactory.HalFactory):
             self._print_device(self.get_udev_device_for_sysfs_path(sysfs_path))
             if props.get("ID_SERIAL_SHORT"):
                 uuid = "afc://%s/" % props["ID_SERIAL_SHORT"]
-                for m in self.vm.get_mounts():
+                for m in gio.volume_monitor_get().get_mounts():
                     root = m.get_root()
                     uri = root.get_uri()
                     if uuid == uri:
@@ -146,7 +147,7 @@ class iPodFactory(MediaPlayerFactory.MediaPlayerFactory):
         access_protocols = self.get_mpi_access_protocol(props)
         if "ipod" in access_protocols.split(";"):
             uuid = props.get("ID_FS_UUID")
-            for vol in self.vm.get_volumes():
+            for vol in gio.volume_monitor_get().get_volumes():
                 #is this the disk corresponding to the ipod
                 #FIXME: we should be able to do gio.VolumeMonitor.get_volume_for_uuid()
                 #but that doesnt work



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