summaryrefslogtreecommitdiff
path: root/Assistant/Threads
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-04-26 20:18:33 -0300
committerGravatar Joey Hess <joey@kitenet.net>2014-04-26 19:24:56 -0400
commita885d67e97c63d8fff657f6eb8d503fd91b0b42c (patch)
treebdbf15870fde400e0b4a97103d8d06ede55d78e0 /Assistant/Threads
parent956627eced12ca7494d2cafc4a9d3b4ed86556f5 (diff)
avoid build warning from new dbus
Diffstat (limited to 'Assistant/Threads')
-rw-r--r--Assistant/Threads/NetWatcher.hs20
1 files changed, 15 insertions, 5 deletions
diff --git a/Assistant/Threads/NetWatcher.hs b/Assistant/Threads/NetWatcher.hs
index 9dd617822..f8c456aac 100644
--- a/Assistant/Threads/NetWatcher.hs
+++ b/Assistant/Threads/NetWatcher.hs
@@ -112,8 +112,13 @@ checkNetMonitor client = do
-}
listenNMConnections :: Client -> (Bool -> IO ()) -> IO ()
listenNMConnections client setconnected =
- listen client matcher $ \event -> mapM_ handle
- (map dictionaryItems $ mapMaybe fromVariant $ signalBody event)
+#if MIN_VERSION_dbus(0,10,7)
+ void $ addMatch client matcher
+#else
+ listen client matcher
+#endif
+ $ \event -> mapM_ handle
+ (map dictionaryItems $ mapMaybe fromVariant $ signalBody event)
where
matcher = matchAny
{ matchInterface = Just "org.freedesktop.NetworkManager"
@@ -142,10 +147,10 @@ listenNMConnections client setconnected =
-}
listenWicdConnections :: Client -> (Bool -> IO ()) -> IO ()
listenWicdConnections client setconnected = do
- listen client connmatcher $ \event ->
+ match connmatcher $ \event ->
when (any (== wicd_success) (signalBody event)) $
setconnected True
- listen client statusmatcher $ \event -> handle (signalBody event)
+ match statusmatcher $ \event -> handle (signalBody event)
where
connmatcher = matchAny
{ matchInterface = Just "org.wicd.daemon"
@@ -160,7 +165,12 @@ listenWicdConnections client setconnected = do
handle status
| any (== wicd_disconnected) status = setconnected False
| otherwise = noop
-
+ match matcher a =
+#if MIN_VERSION_dbus(0,10,7)
+ void $ addMatch client matcher a
+#else
+ listen client matcher a
+#endif
#endif
handleConnection :: Assistant ()