summaryrefslogtreecommitdiff
path: root/tests/Monitor.hs
blob: d07cea079eb3c6d1318c39294a0936324337b621 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{-# LANGUAGE ForeignFunctionInterface #-}
module Main where

import Bustle.Monitor

import System.Glib.GError
import System.Glib.MainLoop

foreign import ccall "g_type_init" g_type_init :: IO ()

main = do
    g_type_init
    emonitor <- monitorNew BusTypeSession "/tmp/test.bustle" DebugOutput
    case emonitor of
        Left (GError _ _ message) -> error message
        Right monitor -> do
            loop <- mainLoopNew Nothing False
            timeoutAdd (mainLoopQuit loop >> return False) 5000
            mainLoopRun loop
            monitorStop monitor