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
This commit is contained in:
parent
e3e8d32924
commit
5a68acb521
4 changed files with 190 additions and 17 deletions
28
Utility/DBus.hs
Normal file
28
Utility/DBus.hs
Normal file
|
@ -0,0 +1,28 @@
|
|||
{- DBus utilities
|
||||
-
|
||||
- Copyright 2012 Joey Hess <joey@kitenet.net>
|
||||
-
|
||||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Utility.DBus where
|
||||
|
||||
import DBus.Client
|
||||
import DBus
|
||||
import Data.Maybe
|
||||
|
||||
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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue