module GI.Gio.Objects.AppLaunchContext
(
AppLaunchContext(..) ,
AppLaunchContextK ,
toAppLaunchContext ,
noAppLaunchContext ,
appLaunchContextGetDisplay ,
appLaunchContextGetEnvironment ,
appLaunchContextGetStartupNotifyId ,
appLaunchContextLaunchFailed ,
appLaunchContextNew ,
appLaunchContextSetenv ,
appLaunchContextUnsetenv ,
AppLaunchContextLaunchFailedCallback ,
AppLaunchContextLaunchFailedCallbackC ,
AppLaunchContextLaunchFailedSignalInfo ,
afterAppLaunchContextLaunchFailed ,
appLaunchContextLaunchFailedCallbackWrapper,
appLaunchContextLaunchFailedClosure ,
mkAppLaunchContextLaunchFailedCallback ,
noAppLaunchContextLaunchFailedCallback ,
onAppLaunchContextLaunchFailed ,
AppLaunchContextLaunchedCallback ,
AppLaunchContextLaunchedCallbackC ,
AppLaunchContextLaunchedSignalInfo ,
afterAppLaunchContextLaunched ,
appLaunchContextLaunchedCallbackWrapper ,
appLaunchContextLaunchedClosure ,
mkAppLaunchContextLaunchedCallback ,
noAppLaunchContextLaunchedCallback ,
onAppLaunchContextLaunched ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.Gio.Types
import GI.Gio.Callbacks
import qualified GI.GObject as GObject
newtype AppLaunchContext = AppLaunchContext (ForeignPtr AppLaunchContext)
foreign import ccall "g_app_launch_context_get_type"
c_g_app_launch_context_get_type :: IO GType
type instance ParentTypes AppLaunchContext = AppLaunchContextParentTypes
type AppLaunchContextParentTypes = '[GObject.Object]
instance GObject AppLaunchContext where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_g_app_launch_context_get_type
class GObject o => AppLaunchContextK o
instance (GObject o, IsDescendantOf AppLaunchContext o) => AppLaunchContextK o
toAppLaunchContext :: AppLaunchContextK o => o -> IO AppLaunchContext
toAppLaunchContext = unsafeCastTo AppLaunchContext
noAppLaunchContext :: Maybe AppLaunchContext
noAppLaunchContext = Nothing
type AppLaunchContextLaunchFailedCallback =
T.Text ->
IO ()
noAppLaunchContextLaunchFailedCallback :: Maybe AppLaunchContextLaunchFailedCallback
noAppLaunchContextLaunchFailedCallback = Nothing
type AppLaunchContextLaunchFailedCallbackC =
Ptr () ->
CString ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mkAppLaunchContextLaunchFailedCallback :: AppLaunchContextLaunchFailedCallbackC -> IO (FunPtr AppLaunchContextLaunchFailedCallbackC)
appLaunchContextLaunchFailedClosure :: AppLaunchContextLaunchFailedCallback -> IO Closure
appLaunchContextLaunchFailedClosure cb = newCClosure =<< mkAppLaunchContextLaunchFailedCallback wrapped
where wrapped = appLaunchContextLaunchFailedCallbackWrapper cb
appLaunchContextLaunchFailedCallbackWrapper ::
AppLaunchContextLaunchFailedCallback ->
Ptr () ->
CString ->
Ptr () ->
IO ()
appLaunchContextLaunchFailedCallbackWrapper _cb _ startup_notify_id _ = do
startup_notify_id' <- cstringToText startup_notify_id
_cb startup_notify_id'
onAppLaunchContextLaunchFailed :: (GObject a, MonadIO m) => a -> AppLaunchContextLaunchFailedCallback -> m SignalHandlerId
onAppLaunchContextLaunchFailed obj cb = liftIO $ connectAppLaunchContextLaunchFailed obj cb SignalConnectBefore
afterAppLaunchContextLaunchFailed :: (GObject a, MonadIO m) => a -> AppLaunchContextLaunchFailedCallback -> m SignalHandlerId
afterAppLaunchContextLaunchFailed obj cb = connectAppLaunchContextLaunchFailed obj cb SignalConnectAfter
connectAppLaunchContextLaunchFailed :: (GObject a, MonadIO m) =>
a -> AppLaunchContextLaunchFailedCallback -> SignalConnectMode -> m SignalHandlerId
connectAppLaunchContextLaunchFailed obj cb after = liftIO $ do
cb' <- mkAppLaunchContextLaunchFailedCallback (appLaunchContextLaunchFailedCallbackWrapper cb)
connectSignalFunPtr obj "launch-failed" cb' after
type AppLaunchContextLaunchedCallback =
AppInfo ->
GVariant ->
IO ()
noAppLaunchContextLaunchedCallback :: Maybe AppLaunchContextLaunchedCallback
noAppLaunchContextLaunchedCallback = Nothing
type AppLaunchContextLaunchedCallbackC =
Ptr () ->
Ptr AppInfo ->
Ptr GVariant ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mkAppLaunchContextLaunchedCallback :: AppLaunchContextLaunchedCallbackC -> IO (FunPtr AppLaunchContextLaunchedCallbackC)
appLaunchContextLaunchedClosure :: AppLaunchContextLaunchedCallback -> IO Closure
appLaunchContextLaunchedClosure cb = newCClosure =<< mkAppLaunchContextLaunchedCallback wrapped
where wrapped = appLaunchContextLaunchedCallbackWrapper cb
appLaunchContextLaunchedCallbackWrapper ::
AppLaunchContextLaunchedCallback ->
Ptr () ->
Ptr AppInfo ->
Ptr GVariant ->
Ptr () ->
IO ()
appLaunchContextLaunchedCallbackWrapper _cb _ info platform_data _ = do
info' <- (newObject AppInfo) info
platform_data' <- newGVariantFromPtr platform_data
_cb info' platform_data'
onAppLaunchContextLaunched :: (GObject a, MonadIO m) => a -> AppLaunchContextLaunchedCallback -> m SignalHandlerId
onAppLaunchContextLaunched obj cb = liftIO $ connectAppLaunchContextLaunched obj cb SignalConnectBefore
afterAppLaunchContextLaunched :: (GObject a, MonadIO m) => a -> AppLaunchContextLaunchedCallback -> m SignalHandlerId
afterAppLaunchContextLaunched obj cb = connectAppLaunchContextLaunched obj cb SignalConnectAfter
connectAppLaunchContextLaunched :: (GObject a, MonadIO m) =>
a -> AppLaunchContextLaunchedCallback -> SignalConnectMode -> m SignalHandlerId
connectAppLaunchContextLaunched obj cb after = liftIO $ do
cb' <- mkAppLaunchContextLaunchedCallback (appLaunchContextLaunchedCallbackWrapper cb)
connectSignalFunPtr obj "launched" cb' after
type instance AttributeList AppLaunchContext = AppLaunchContextAttributeList
type AppLaunchContextAttributeList = ('[ ] :: [(Symbol, *)])
data AppLaunchContextLaunchFailedSignalInfo
instance SignalInfo AppLaunchContextLaunchFailedSignalInfo where
type HaskellCallbackType AppLaunchContextLaunchFailedSignalInfo = AppLaunchContextLaunchFailedCallback
connectSignal _ = connectAppLaunchContextLaunchFailed
data AppLaunchContextLaunchedSignalInfo
instance SignalInfo AppLaunchContextLaunchedSignalInfo where
type HaskellCallbackType AppLaunchContextLaunchedSignalInfo = AppLaunchContextLaunchedCallback
connectSignal _ = connectAppLaunchContextLaunched
type instance SignalList AppLaunchContext = AppLaunchContextSignalList
type AppLaunchContextSignalList = ('[ '("launch-failed", AppLaunchContextLaunchFailedSignalInfo), '("launched", AppLaunchContextLaunchedSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
foreign import ccall "g_app_launch_context_new" g_app_launch_context_new ::
IO (Ptr AppLaunchContext)
appLaunchContextNew ::
(MonadIO m) =>
m AppLaunchContext
appLaunchContextNew = liftIO $ do
result <- g_app_launch_context_new
checkUnexpectedReturnNULL "g_app_launch_context_new" result
result' <- (wrapObject AppLaunchContext) result
return result'
foreign import ccall "g_app_launch_context_get_display" g_app_launch_context_get_display ::
Ptr AppLaunchContext ->
Ptr AppInfo ->
Ptr (GList (Ptr File)) ->
IO CString
appLaunchContextGetDisplay ::
(MonadIO m, AppLaunchContextK a, AppInfoK b, FileK c) =>
a ->
b ->
[c] ->
m T.Text
appLaunchContextGetDisplay _obj info files = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let info' = unsafeManagedPtrCastPtr info
let files' = map unsafeManagedPtrCastPtr files
files'' <- packGList files'
result <- g_app_launch_context_get_display _obj' info' files''
checkUnexpectedReturnNULL "g_app_launch_context_get_display" result
result' <- cstringToText result
freeMem result
touchManagedPtr _obj
touchManagedPtr info
mapM_ touchManagedPtr files
g_list_free files''
return result'
foreign import ccall "g_app_launch_context_get_environment" g_app_launch_context_get_environment ::
Ptr AppLaunchContext ->
IO (Ptr CString)
appLaunchContextGetEnvironment ::
(MonadIO m, AppLaunchContextK a) =>
a ->
m [T.Text]
appLaunchContextGetEnvironment _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_app_launch_context_get_environment _obj'
checkUnexpectedReturnNULL "g_app_launch_context_get_environment" result
result' <- unpackZeroTerminatedUTF8CArray result
mapZeroTerminatedCArray freeMem result
freeMem result
touchManagedPtr _obj
return result'
foreign import ccall "g_app_launch_context_get_startup_notify_id" g_app_launch_context_get_startup_notify_id ::
Ptr AppLaunchContext ->
Ptr AppInfo ->
Ptr (GList (Ptr File)) ->
IO CString
appLaunchContextGetStartupNotifyId ::
(MonadIO m, AppLaunchContextK a, AppInfoK b, FileK c) =>
a ->
b ->
[c] ->
m T.Text
appLaunchContextGetStartupNotifyId _obj info files = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let info' = unsafeManagedPtrCastPtr info
let files' = map unsafeManagedPtrCastPtr files
files'' <- packGList files'
result <- g_app_launch_context_get_startup_notify_id _obj' info' files''
checkUnexpectedReturnNULL "g_app_launch_context_get_startup_notify_id" result
result' <- cstringToText result
freeMem result
touchManagedPtr _obj
touchManagedPtr info
mapM_ touchManagedPtr files
g_list_free files''
return result'
foreign import ccall "g_app_launch_context_launch_failed" g_app_launch_context_launch_failed ::
Ptr AppLaunchContext ->
CString ->
IO ()
appLaunchContextLaunchFailed ::
(MonadIO m, AppLaunchContextK a) =>
a ->
T.Text ->
m ()
appLaunchContextLaunchFailed _obj startup_notify_id = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
startup_notify_id' <- textToCString startup_notify_id
g_app_launch_context_launch_failed _obj' startup_notify_id'
touchManagedPtr _obj
freeMem startup_notify_id'
return ()
foreign import ccall "g_app_launch_context_setenv" g_app_launch_context_setenv ::
Ptr AppLaunchContext ->
CString ->
CString ->
IO ()
appLaunchContextSetenv ::
(MonadIO m, AppLaunchContextK a) =>
a ->
T.Text ->
T.Text ->
m ()
appLaunchContextSetenv _obj variable value = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
variable' <- textToCString variable
value' <- textToCString value
g_app_launch_context_setenv _obj' variable' value'
touchManagedPtr _obj
freeMem variable'
freeMem value'
return ()
foreign import ccall "g_app_launch_context_unsetenv" g_app_launch_context_unsetenv ::
Ptr AppLaunchContext ->
CString ->
IO ()
appLaunchContextUnsetenv ::
(MonadIO m, AppLaunchContextK a) =>
a ->
T.Text ->
m ()
appLaunchContextUnsetenv _obj variable = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
variable' <- textToCString variable
g_app_launch_context_unsetenv _obj' variable'
touchManagedPtr _obj
freeMem variable'
return ()