summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-01-22 16:50:08 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-01-22 16:50:08 -0400
commitbb64ea64d5e832cc5d044ad283d65ae3ef956d47 (patch)
treed47dfdc64439ef985d88e688875339811fdea44b
parent2a756eabe28658eb5f35fe7bbac078c27c79be8b (diff)
assistant: Use udisks2 dbus events to detect when disks are mounted, instead of relying on gnome/kde stuff that is not stable.
-rw-r--r--Assistant/Threads/MountWatcher.hs43
-rw-r--r--debian/changelog3
-rw-r--r--doc/bugs/Volume_monitor_in_GNOME_3.18.mdwn2
-rw-r--r--doc/bugs/Volume_monitor_in_GNOME_3.18/comment_3_ba8748cb3113fb73dcb74bf92d7a3df5._comment10
4 files changed, 27 insertions, 31 deletions
diff --git a/Assistant/Threads/MountWatcher.hs b/Assistant/Threads/MountWatcher.hs
index 0367c7b1a..dd45598f8 100644
--- a/Assistant/Threads/MountWatcher.hs
+++ b/Assistant/Threads/MountWatcher.hs
@@ -48,7 +48,7 @@ mountWatcherThread urlrenderer = namedThread "MountWatcher" $
dbusThread :: UrlRenderer -> Assistant ()
dbusThread urlrenderer = do
runclient <- asIO1 go
- r <- liftIO $ E.try $ runClient getSessionAddress runclient
+ r <- liftIO $ E.try $ runClient getSystemAddress runclient
either onerr (const noop) r
where
go client = ifM (checkMountMonitor client)
@@ -71,11 +71,6 @@ dbusThread urlrenderer = do
)
onerr :: E.SomeException -> Assistant ()
onerr e = do
- {- If the session dbus fails, the user probably
- - logged out of their desktop. Even if they log
- - back in, we won't have access to the dbus
- - session key, so polling is the best that can be
- - done in this situation. -}
liftAnnex $
warning $ "dbus failed; falling back to mtab polling (" ++ show e ++ ")"
pollingThread urlrenderer
@@ -95,12 +90,9 @@ checkMountMonitor client = do
]
return True
where
- startableservices = [gvfsnew, gvfs, gvfsgdu]
- usableservices = startableservices ++ [kde]
- gvfs = "org.gtk.Private.UDisks2VolumeMonitor"
- gvfsnew = "org.gtk.vfs.UDisks2VolumeMonitor"
- gvfsgdu = "org.gtk.Private.GduVolumeMonitor"
- kde = "org.kde.DeviceNotifications"
+ startableservices = [udisks2]
+ usableservices = startableservices
+ udisks2 = "org.freedesktop.UDisks2"
startOneService :: Client -> [ServiceName] -> Assistant Bool
startOneService _ [] = return False
@@ -119,27 +111,18 @@ startOneService client (x:xs) = do
{- Filter matching events recieved when drives are mounted and unmounted. -}
mountChanged :: [MatchRule]
-mountChanged = [gvfs True, gvfs False, kde, kdefallback]
+mountChanged = [udisks2mount, udisks2umount]
where
- {- 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 $ if mount then "MountAdded" else "MountRemoved"
+ udisks2mount = matchAny
+ { matchPath = Just "/org/freedesktop/UDisks2"
+ , matchInterface = Just "org.freedesktop.DBus.ObjectManager"
+ , matchMember = Just "InterfacesAdded"
}
- {- 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"
+ udisks2umount = matchAny
+ { matchPath = Just "/org/freedesktop/UDisks2"
+ , matchInterface = Just "org.freedesktop.DBus.ObjectManager"
+ , matchMember = Just "InterfacesRemoved"
}
- {- 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
pollingThread :: UrlRenderer -> Assistant ()
diff --git a/debian/changelog b/debian/changelog
index 29472515e..0dfabba64 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,7 +13,8 @@ git-annex (6.20160115) UNRELEASED; urgency=medium
* registerurl: Check if a remote claims the url, same as addurl does.
* Bug fix: Git config settings passed to git-annex -c did not always take
effect.
- * assistant: Added new name used for udisks2 dbus service in gnome 3.18.
+ * assistant: Use udisks2 dbus events to detect when disks are mounted,
+ instead of relying on gnome/kde stuff that is not stable.
-- Joey Hess <id@joeyh.name> Fri, 15 Jan 2016 14:05:01 -0400
diff --git a/doc/bugs/Volume_monitor_in_GNOME_3.18.mdwn b/doc/bugs/Volume_monitor_in_GNOME_3.18.mdwn
index 685cb96b5..4013f1b40 100644
--- a/doc/bugs/Volume_monitor_in_GNOME_3.18.mdwn
+++ b/doc/bugs/Volume_monitor_in_GNOME_3.18.mdwn
@@ -178,3 +178,5 @@ node /org/gtk/Private/RemoteVolumeMonitor {
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
Works fine in general.
+
+> [[fixed|done]] --[[Joey]]
diff --git a/doc/bugs/Volume_monitor_in_GNOME_3.18/comment_3_ba8748cb3113fb73dcb74bf92d7a3df5._comment b/doc/bugs/Volume_monitor_in_GNOME_3.18/comment_3_ba8748cb3113fb73dcb74bf92d7a3df5._comment
new file mode 100644
index 000000000..2ac4d3e60
--- /dev/null
+++ b/doc/bugs/Volume_monitor_in_GNOME_3.18/comment_3_ba8748cb3113fb73dcb74bf92d7a3df5._comment
@@ -0,0 +1,10 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 3"""
+ date="2016-01-22T20:10:01Z"
+ content="""
+Thanks for the info.
+
+I think I was having difficulty matching on the udisks2 signals before, due
+to how they're structured, but I found a way now.
+"""]]