#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Notify.Functions
(
getAppName ,
getServerCaps ,
getServerInfo ,
init ,
isInitted ,
setAppName ,
uninit ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
foreign import ccall "notify_uninit" notify_uninit ::
IO ()
uninit ::
(B.CallStack.HasCallStack, MonadIO m) =>
m ()
uninit :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ()
uninit = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
IO ()
notify_uninit
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
foreign import ccall "notify_set_app_name" notify_set_app_name ::
CString ->
IO ()
setAppName ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m ()
setAppName :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m ()
setAppName Text
appName = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
CString
appName' <- Text -> IO CString
textToCString Text
appName
CString -> IO ()
notify_set_app_name CString
appName'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
appName'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
foreign import ccall "notify_is_initted" notify_is_initted ::
IO CInt
isInitted ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Bool
isInitted :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Bool
isInitted = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
CInt
result <- IO CInt
notify_is_initted
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
foreign import ccall "notify_init" notify_init ::
CString ->
IO CInt
init ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m Bool
init :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool
init Text
appName = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
CString
appName' <- Text -> IO CString
textToCString Text
appName
CInt
result <- CString -> IO CInt
notify_init CString
appName'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
appName'
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
foreign import ccall "notify_get_server_info" notify_get_server_info ::
Ptr CString ->
Ptr CString ->
Ptr CString ->
Ptr CString ->
IO CInt
getServerInfo ::
(B.CallStack.HasCallStack, MonadIO m) =>
m ((Bool, T.Text, T.Text, T.Text, T.Text))
getServerInfo :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
m (Bool, Text, Text, Text, Text)
getServerInfo = IO (Bool, Text, Text, Text, Text)
-> m (Bool, Text, Text, Text, Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Text, Text, Text, Text)
-> m (Bool, Text, Text, Text, Text))
-> IO (Bool, Text, Text, Text, Text)
-> m (Bool, Text, Text, Text, Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr CString
retName <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
Ptr CString
retVendor <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
Ptr CString
retVersion <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
Ptr CString
retSpecVersion <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
CInt
result <- Ptr CString -> Ptr CString -> Ptr CString -> Ptr CString -> IO CInt
notify_get_server_info Ptr CString
retName Ptr CString
retVendor Ptr CString
retVersion Ptr CString
retSpecVersion
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
CString
retName' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
retName
Text
retName'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
retName'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
retName'
CString
retVendor' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
retVendor
Text
retVendor'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
retVendor'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
retVendor'
CString
retVersion' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
retVersion
Text
retVersion'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
retVersion'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
retVersion'
CString
retSpecVersion' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
retSpecVersion
Text
retSpecVersion'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
retSpecVersion'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
retSpecVersion'
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
retName
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
retVendor
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
retVersion
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
retSpecVersion
(Bool, Text, Text, Text, Text) -> IO (Bool, Text, Text, Text, Text)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Text
retName'', Text
retVendor'', Text
retVersion'', Text
retSpecVersion'')
foreign import ccall "notify_get_server_caps" notify_get_server_caps ::
IO (Ptr (GList CString))
getServerCaps ::
(B.CallStack.HasCallStack, MonadIO m) =>
m [T.Text]
getServerCaps :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m [Text]
getServerCaps = IO [Text] -> m [Text]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Text] -> m [Text]) -> IO [Text] -> m [Text]
forall a b. (a -> b) -> a -> b
$ do
Ptr (GList CString)
result <- IO (Ptr (GList CString))
notify_get_server_caps
[CString]
result' <- Ptr (GList CString) -> IO [CString]
forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList CString)
result
[Text]
result'' <- (CString -> IO Text) -> [CString] -> IO [Text]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText [CString]
result'
(CString -> IO ()) -> Ptr (GList CString) -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (GList (Ptr a)) -> IO ()
mapGList CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (GList CString)
result
Ptr (GList CString) -> IO ()
forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList CString)
result
[Text] -> IO [Text]
forall (m :: * -> *) a. Monad m => a -> m a
return [Text]
result''
foreign import ccall "notify_get_app_name" notify_get_app_name ::
IO CString
getAppName ::
(B.CallStack.HasCallStack, MonadIO m) =>
m T.Text
getAppName :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Text
getAppName = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
CString
result <- IO CString
notify_get_app_name
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"getAppName" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'