summaryrefslogtreecommitdiff
path: root/Assistant/Threads/MountWatcher.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-08-21 19:58:53 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-08-21 19:58:53 -0400
commit5a68acb521bae0277b2c8a8ca023dc57a5ff4b33 (patch)
tree75dd571ae83a88f9e29da125faee474c0dc42293 /Assistant/Threads/MountWatcher.hs
parente3e8d3292478d8cca0206db8b99dcd4d2f9ac5aa (diff)
add NetWatcher thread
This deals with interruptions in network connectevity, by listening for a new network interface coming up (using dbus to see when network-manager or wicd do it), and forcing a rescan of
Diffstat (limited to 'Assistant/Threads/MountWatcher.hs')
-rw-r--r--Assistant/Threads/MountWatcher.hs17
1 files changed, 2 insertions, 15 deletions
diff --git a/Assistant/Threads/MountWatcher.hs b/Assistant/Threads/MountWatcher.hs
index 83f582a91..82de186cc 100644
--- a/Assistant/Threads/MountWatcher.hs
+++ b/Assistant/Threads/MountWatcher.hs
@@ -31,6 +31,7 @@ import qualified Data.Set as S
import Data.Time.Clock
#if WITH_DBUS
+import Utility.DBus
import DBus.Client
import DBus
import Data.Word (Word32)
@@ -78,20 +79,6 @@ dbusThread st dstatus scanremotes = E.catch (go =<< connectSession) onerr
pollinstead
pollinstead = pollingThread st dstatus scanremotes
-type ServiceName = String
-
-listServiceNames :: Client -> IO [ServiceName]
-listServiceNames client = do
- reply <- callDBus client "ListNames" []
- return $ fromMaybe [] $ fromVariant (methodReturnBody reply !! 0)
-
-callDBus :: Client -> MemberName -> [Variant] -> IO MethodReturn
-callDBus client name params = call_ client $
- (methodCall "/org/freedesktop/DBus" "org.freedesktop.DBus" name)
- { methodCallDestination = Just "org.freedesktop.DBus"
- , methodCallBody = params
- }
-
{- Examine the list of services connected to dbus, to see if there
- are any we can use to monitor mounts. If not, will attempt to start one. -}
checkMountMonitor :: Client -> IO Bool
@@ -164,7 +151,7 @@ handleMount st dstatus scanremotes dir = do
let nonspecial = filter (Git.repoIsLocal . Remote.repo) rs
unless (null nonspecial) $ do
void $ alertWhile dstatus (syncAlert nonspecial) $ do
- debug thisThread ["syncing with", show rs]
+ debug thisThread ["syncing with", show nonspecial]
sync nonspecial =<< runThreadState st (inRepo Git.Branch.current)
addScanRemotes scanremotes nonspecial
where