Commits

Byron Clark committed 56ccc78

Only allow a single filter file.

With this change we also stop using the global xdg config directory.

Comments (0)

Files changed (1)

 import gobject
 import gio
 import pynotify
-import xdg.BaseDirectory
+
+from xdg.BaseDirectory import xdg_config_home
 
 import udiskie.device
 import udiskie.match
 class AutoMounter:
     CONFIG_PATH = 'udiskie/filters.conf'
 
-    def __init__(self, bus=None, filter_files=None):
+    def __init__(self, bus=None, filter_file=None):
         self.log = logging.getLogger('udiskie.mount.AutoMounter')
         self.last_device_state = {}
 
         else:
             self.bus = bus
 
-        if not filter_files:
-            base_paths = xdg.BaseDirectory.xdg_config_dirs
-            filter_files = [os.path.join(D, self.CONFIG_PATH) for D in base_paths]
-        self.filters = udiskie.match.FilterMatcher(filter_files)
+        if not filter_file:
+            filter_file = os.path.join(xdg_config_home, self.CONFIG_PATH)
+        self.filters = udiskie.match.FilterMatcher((filter_file,))
 
 
         self.bus.add_signal_receiver(self.device_added,
 
     pynotify.init('udiskie.mount')
 
-    mounter = AutoMounter(bus=None, filter_files=options.filters)
+    mounter = AutoMounter(bus=None, filter_file=options.filters)
     mounter.mount_present_devices()
     return gobject.MainLoop().run()