{-# LANGUAGE TemplateHaskell #-}
module StatusNotifier.Watcher.Signals where

import DBus.Generation
import Language.Haskell.TH

import StatusNotifier.Watcher.Constants

-- The bus name is set to nothing here because sender comes through as the
-- unique name of the watcher, not the special bus name that it requests.
generateSignals watcherClientGenerationParams { genBusName = Nothing }
                defaultWatcherInterfaceName watcherSignals

printWatcherSignals :: IO ()
printWatcherSignals =
  Q [Dec] -> IO [Dec]
forall (m :: * -> *) a. Quasi m => Q a -> m a
runQ (GenerationParams -> InterfaceName -> [Signal] -> Q [Dec]
generateSignals GenerationParams
watcherClientGenerationParams { genBusName :: Maybe BusName
genBusName = Maybe BusName
forall a. Maybe a
Nothing }
                InterfaceName
defaultWatcherInterfaceName [Signal]
watcherSignals) IO [Dec] -> ([Dec] -> IO ()) -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
       String -> IO ()
putStrLn (String -> IO ()) -> ([Dec] -> String) -> [Dec] -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Dec] -> String
forall a. Ppr a => a -> String
pprint