diff options
author | Joey Hess <joey@kitenet.net> | 2012-08-23 18:58:54 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-08-23 18:58:54 -0400 |
commit | f3721d89bc56bbee764977d6dee8f9bf342554c0 (patch) | |
tree | 1a4effc4dcab60db0191543d4299ae6895e2f8a2 /Assistant | |
parent | 4a4f8064aee71d71d7ad2035f5e0156c41d3340f (diff) |
also notice dbus unmount events
Diffstat (limited to 'Assistant')
-rw-r--r-- | Assistant/Threads/MountWatcher.hs | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/Assistant/Threads/MountWatcher.hs b/Assistant/Threads/MountWatcher.hs index 56b2b7c70..2d9b5a82b 100644 --- a/Assistant/Threads/MountWatcher.hs +++ b/Assistant/Threads/MountWatcher.hs @@ -58,7 +58,7 @@ dbusThread st dstatus scanremotes = E.catch (go =<< connectSession) onerr - work out the mount point from the dbus - message, but this is easier. -} mvar <- newMVar =<< currentMountPoints - forM_ mountAdded $ \matcher -> + forM_ mountChanged $ \matcher -> listen client matcher $ \_event -> do nowmounted <- currentMountPoints wasmounted <- swapMVar mvar nowmounted @@ -110,18 +110,28 @@ startOneService client (x:xs) = do , startOneService client xs ) -{- Filter matching events recieved when drives are mounted. -} -mountAdded :: [MatchRule] -mountAdded = [gvfs, kde] +{- Filter matching events recieved when drives are mounted and unmounted. -} +mountChanged :: [MatchRule] +mountChanged = [gvfs True, gvfs False, kde, kdefallback] where - gvfs = matchAny + {- gvfs reliably generates this event whenever a drive is mounted/unmounted, + - whether automatically, or manually -} + gvfs mount = matchAny { matchInterface = Just "org.gtk.Private.RemoteVolumeMonitor" - , matchMember = Just "MountAdded" + , matchMember = Just $ if mount then "MountAdded" else "MountRemoved" } + {- This event fires when KDE prompts the user what to do with a drive, + - but maybe not at other times. And it's not received -} kde = matchAny { matchInterface = Just "org.kde.Solid.Device" , matchMember = Just "setupDone" } + {- This event may not be closely related to mounting a drive, but it's + - observed reliably when a drive gets mounted or unmounted. -} + kdefallback = matchAny + { matchInterface = Just "org.kde.KDirNotify" + , matchMember = Just "enteredDirectory" + } #endif |