{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

Integrating the launch with the launching application. This is used to
handle for instance startup notification and launching the new application
on the same screen as the launching window.
-}

#define ENABLE_OVERLOADING \
       (!defined(__HADDOCK_VERSION__))

module GI.Gio.Objects.AppLaunchContext
    ( 

-- * Exported types
    AppLaunchContext(..)                    ,
    IsAppLaunchContext                      ,
    toAppLaunchContext                      ,
    noAppLaunchContext                      ,


 -- * Methods
-- ** getDisplay #method:getDisplay#

#if ENABLE_OVERLOADING
    AppLaunchContextGetDisplayMethodInfo    ,
#endif
    appLaunchContextGetDisplay              ,


-- ** getEnvironment #method:getEnvironment#

#if ENABLE_OVERLOADING
    AppLaunchContextGetEnvironmentMethodInfo,
#endif
    appLaunchContextGetEnvironment          ,


-- ** getStartupNotifyId #method:getStartupNotifyId#

#if ENABLE_OVERLOADING
    AppLaunchContextGetStartupNotifyIdMethodInfo,
#endif
    appLaunchContextGetStartupNotifyId      ,


-- ** launchFailed #method:launchFailed#

#if ENABLE_OVERLOADING
    AppLaunchContextLaunchFailedMethodInfo  ,
#endif
    appLaunchContextLaunchFailed            ,


-- ** new #method:new#

    appLaunchContextNew                     ,


-- ** setenv #method:setenv#

#if ENABLE_OVERLOADING
    AppLaunchContextSetenvMethodInfo        ,
#endif
    appLaunchContextSetenv                  ,


-- ** unsetenv #method:unsetenv#

#if ENABLE_OVERLOADING
    AppLaunchContextUnsetenvMethodInfo      ,
#endif
    appLaunchContextUnsetenv                ,




 -- * Signals
-- ** launchFailed #signal:launchFailed#

    AppLaunchContextLaunchFailedCallback    ,
#if ENABLE_OVERLOADING
    AppLaunchContextLaunchFailedSignalInfo  ,
#endif
    C_AppLaunchContextLaunchFailedCallback  ,
    afterAppLaunchContextLaunchFailed       ,
    genClosure_AppLaunchContextLaunchFailed ,
    mk_AppLaunchContextLaunchFailedCallback ,
    noAppLaunchContextLaunchFailedCallback  ,
    onAppLaunchContextLaunchFailed          ,
    wrap_AppLaunchContextLaunchFailedCallback,


-- ** launched #signal:launched#

    AppLaunchContextLaunchedCallback        ,
#if ENABLE_OVERLOADING
    AppLaunchContextLaunchedSignalInfo      ,
#endif
    C_AppLaunchContextLaunchedCallback      ,
    afterAppLaunchContextLaunched           ,
    genClosure_AppLaunchContextLaunched     ,
    mk_AppLaunchContextLaunchedCallback     ,
    noAppLaunchContextLaunchedCallback      ,
    onAppLaunchContextLaunched              ,
    wrap_AppLaunchContextLaunchedCallback   ,




    ) 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.ManagedPtr as B.ManagedPtr
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.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AppInfo as Gio.AppInfo
import {-# SOURCE #-} qualified GI.Gio.Interfaces.File as Gio.File

-- | Memory-managed wrapper type.
newtype AppLaunchContext = AppLaunchContext (ManagedPtr AppLaunchContext)
foreign import ccall "g_app_launch_context_get_type"
    c_g_app_launch_context_get_type :: IO GType

instance GObject AppLaunchContext where
    gobjectType :: AppLaunchContext -> IO GType
gobjectType _ = IO GType
c_g_app_launch_context_get_type
    

-- | Type class for types which can be safely cast to `AppLaunchContext`, for instance with `toAppLaunchContext`.
class GObject o => IsAppLaunchContext o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError AppLaunchContext a) =>
    IsAppLaunchContext a
#endif
instance IsAppLaunchContext AppLaunchContext
instance GObject.Object.IsObject AppLaunchContext

-- | Cast to `AppLaunchContext`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toAppLaunchContext :: (MonadIO m, IsAppLaunchContext o) => o -> m AppLaunchContext
toAppLaunchContext :: o -> m AppLaunchContext
toAppLaunchContext = IO AppLaunchContext -> m AppLaunchContext
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO AppLaunchContext -> m AppLaunchContext)
-> (o -> IO AppLaunchContext) -> o -> m AppLaunchContext
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr AppLaunchContext -> AppLaunchContext)
-> o -> IO AppLaunchContext
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr AppLaunchContext -> AppLaunchContext
AppLaunchContext

-- | A convenience alias for `Nothing` :: `Maybe` `AppLaunchContext`.
noAppLaunchContext :: Maybe AppLaunchContext
noAppLaunchContext :: Maybe AppLaunchContext
noAppLaunchContext = Maybe AppLaunchContext
forall a. Maybe a
Nothing

#if ENABLE_OVERLOADING
type family ResolveAppLaunchContextMethod (t :: Symbol) (o :: *) :: * where
    ResolveAppLaunchContextMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveAppLaunchContextMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveAppLaunchContextMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveAppLaunchContextMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveAppLaunchContextMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveAppLaunchContextMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveAppLaunchContextMethod "launchFailed" o = AppLaunchContextLaunchFailedMethodInfo
    ResolveAppLaunchContextMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveAppLaunchContextMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveAppLaunchContextMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveAppLaunchContextMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveAppLaunchContextMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveAppLaunchContextMethod "setenv" o = AppLaunchContextSetenvMethodInfo
    ResolveAppLaunchContextMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveAppLaunchContextMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveAppLaunchContextMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveAppLaunchContextMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveAppLaunchContextMethod "unsetenv" o = AppLaunchContextUnsetenvMethodInfo
    ResolveAppLaunchContextMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveAppLaunchContextMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveAppLaunchContextMethod "getDisplay" o = AppLaunchContextGetDisplayMethodInfo
    ResolveAppLaunchContextMethod "getEnvironment" o = AppLaunchContextGetEnvironmentMethodInfo
    ResolveAppLaunchContextMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveAppLaunchContextMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveAppLaunchContextMethod "getStartupNotifyId" o = AppLaunchContextGetStartupNotifyIdMethodInfo
    ResolveAppLaunchContextMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveAppLaunchContextMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveAppLaunchContextMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveAppLaunchContextMethod t AppLaunchContext, O.MethodInfo info AppLaunchContext p) => O.IsLabelProxy t (AppLaunchContext -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveAppLaunchContextMethod t AppLaunchContext, O.MethodInfo info AppLaunchContext p) => O.IsLabel t (AppLaunchContext -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif

#endif

-- signal AppLaunchContext::launch-failed
{- |
The ::launch-failed signal is emitted when a 'GI.Gio.Interfaces.AppInfo.AppInfo' launch
fails. The startup notification id is provided, so that the launcher
can cancel the startup notification.

/Since: 2.36/
-}
type AppLaunchContextLaunchFailedCallback =
    T.Text
    {- ^ /@startupNotifyId@/: the startup notification id for the failed launch -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `AppLaunchContextLaunchFailedCallback`@.
noAppLaunchContextLaunchFailedCallback :: Maybe AppLaunchContextLaunchFailedCallback
noAppLaunchContextLaunchFailedCallback :: Maybe AppLaunchContextLaunchFailedCallback
noAppLaunchContextLaunchFailedCallback = Maybe AppLaunchContextLaunchFailedCallback
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_AppLaunchContextLaunchFailedCallback =
    Ptr () ->                               -- object
    CString ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_AppLaunchContextLaunchFailedCallback`.
foreign import ccall "wrapper"
    mk_AppLaunchContextLaunchFailedCallback :: C_AppLaunchContextLaunchFailedCallback -> IO (FunPtr C_AppLaunchContextLaunchFailedCallback)

-- | Wrap the callback into a `Closure`.
genClosure_AppLaunchContextLaunchFailed :: AppLaunchContextLaunchFailedCallback -> IO Closure
genClosure_AppLaunchContextLaunchFailed :: AppLaunchContextLaunchFailedCallback -> IO Closure
genClosure_AppLaunchContextLaunchFailed cb :: AppLaunchContextLaunchFailedCallback
cb = do
    let cb' :: C_AppLaunchContextLaunchFailedCallback
cb' = AppLaunchContextLaunchFailedCallback
-> C_AppLaunchContextLaunchFailedCallback
wrap_AppLaunchContextLaunchFailedCallback AppLaunchContextLaunchFailedCallback
cb
    C_AppLaunchContextLaunchFailedCallback
-> IO (FunPtr C_AppLaunchContextLaunchFailedCallback)
mk_AppLaunchContextLaunchFailedCallback C_AppLaunchContextLaunchFailedCallback
cb' IO (FunPtr C_AppLaunchContextLaunchFailedCallback)
-> (FunPtr C_AppLaunchContextLaunchFailedCallback -> IO Closure)
-> IO Closure
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_AppLaunchContextLaunchFailedCallback -> IO Closure
forall a. FunPtr a -> IO Closure
newCClosure


-- | Wrap a `AppLaunchContextLaunchFailedCallback` into a `C_AppLaunchContextLaunchFailedCallback`.
wrap_AppLaunchContextLaunchFailedCallback ::
    AppLaunchContextLaunchFailedCallback ->
    C_AppLaunchContextLaunchFailedCallback
wrap_AppLaunchContextLaunchFailedCallback :: AppLaunchContextLaunchFailedCallback
-> C_AppLaunchContextLaunchFailedCallback
wrap_AppLaunchContextLaunchFailedCallback _cb :: AppLaunchContextLaunchFailedCallback
_cb _ startupNotifyId :: CString
startupNotifyId _ = do
    Text
startupNotifyId' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
startupNotifyId
    AppLaunchContextLaunchFailedCallback
_cb  Text
startupNotifyId'


{- |
Connect a signal handler for the “@launch-failed@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' appLaunchContext #launchFailed callback
@
-}
onAppLaunchContextLaunchFailed :: (IsAppLaunchContext a, MonadIO m) => a -> AppLaunchContextLaunchFailedCallback -> m SignalHandlerId
onAppLaunchContextLaunchFailed :: a -> AppLaunchContextLaunchFailedCallback -> m SignalHandlerId
onAppLaunchContextLaunchFailed obj :: a
obj cb :: AppLaunchContextLaunchFailedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_AppLaunchContextLaunchFailedCallback
cb' = AppLaunchContextLaunchFailedCallback
-> C_AppLaunchContextLaunchFailedCallback
wrap_AppLaunchContextLaunchFailedCallback AppLaunchContextLaunchFailedCallback
cb
    FunPtr C_AppLaunchContextLaunchFailedCallback
cb'' <- C_AppLaunchContextLaunchFailedCallback
-> IO (FunPtr C_AppLaunchContextLaunchFailedCallback)
mk_AppLaunchContextLaunchFailedCallback C_AppLaunchContextLaunchFailedCallback
cb'
    a
-> String
-> FunPtr C_AppLaunchContextLaunchFailedCallback
-> SignalConnectMode
-> IO SignalHandlerId
forall o a.
GObject o =>
o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId
connectSignalFunPtr a
obj "launch-failed" FunPtr C_AppLaunchContextLaunchFailedCallback
cb'' SignalConnectMode
SignalConnectBefore

{- |
Connect a signal handler for the “@launch-failed@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' appLaunchContext #launchFailed callback
@
-}
afterAppLaunchContextLaunchFailed :: (IsAppLaunchContext a, MonadIO m) => a -> AppLaunchContextLaunchFailedCallback -> m SignalHandlerId
afterAppLaunchContextLaunchFailed :: a -> AppLaunchContextLaunchFailedCallback -> m SignalHandlerId
afterAppLaunchContextLaunchFailed obj :: a
obj cb :: AppLaunchContextLaunchFailedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_AppLaunchContextLaunchFailedCallback
cb' = AppLaunchContextLaunchFailedCallback
-> C_AppLaunchContextLaunchFailedCallback
wrap_AppLaunchContextLaunchFailedCallback AppLaunchContextLaunchFailedCallback
cb
    FunPtr C_AppLaunchContextLaunchFailedCallback
cb'' <- C_AppLaunchContextLaunchFailedCallback
-> IO (FunPtr C_AppLaunchContextLaunchFailedCallback)
mk_AppLaunchContextLaunchFailedCallback C_AppLaunchContextLaunchFailedCallback
cb'
    a
-> String
-> FunPtr C_AppLaunchContextLaunchFailedCallback
-> SignalConnectMode
-> IO SignalHandlerId
forall o a.
GObject o =>
o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId
connectSignalFunPtr a
obj "launch-failed" FunPtr C_AppLaunchContextLaunchFailedCallback
cb'' SignalConnectMode
SignalConnectAfter


-- signal AppLaunchContext::launched
{- |
The ::launched signal is emitted when a 'GI.Gio.Interfaces.AppInfo.AppInfo' is successfully
launched. The /@platformData@/ is an GVariant dictionary mapping
strings to variants (ie a{sv}), which contains additional,
platform-specific data about this launch. On UNIX, at least the
\"pid\" and \"startup-notification-id\" keys will be present.

/Since: 2.36/
-}
type AppLaunchContextLaunchedCallback =
    Gio.AppInfo.AppInfo
    {- ^ /@info@/: the 'GI.Gio.Interfaces.AppInfo.AppInfo' that was just launched -}
    -> GVariant
    {- ^ /@platformData@/: additional platform-specific data for this launch -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `AppLaunchContextLaunchedCallback`@.
noAppLaunchContextLaunchedCallback :: Maybe AppLaunchContextLaunchedCallback
noAppLaunchContextLaunchedCallback :: Maybe AppLaunchContextLaunchedCallback
noAppLaunchContextLaunchedCallback = Maybe AppLaunchContextLaunchedCallback
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_AppLaunchContextLaunchedCallback =
    Ptr () ->                               -- object
    Ptr Gio.AppInfo.AppInfo ->
    Ptr GVariant ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_AppLaunchContextLaunchedCallback`.
foreign import ccall "wrapper"
    mk_AppLaunchContextLaunchedCallback :: C_AppLaunchContextLaunchedCallback -> IO (FunPtr C_AppLaunchContextLaunchedCallback)

-- | Wrap the callback into a `Closure`.
genClosure_AppLaunchContextLaunched :: AppLaunchContextLaunchedCallback -> IO Closure
genClosure_AppLaunchContextLaunched :: AppLaunchContextLaunchedCallback -> IO Closure
genClosure_AppLaunchContextLaunched cb :: AppLaunchContextLaunchedCallback
cb = do
    let cb' :: C_AppLaunchContextLaunchedCallback
cb' = AppLaunchContextLaunchedCallback
-> C_AppLaunchContextLaunchedCallback
wrap_AppLaunchContextLaunchedCallback AppLaunchContextLaunchedCallback
cb
    C_AppLaunchContextLaunchedCallback
-> IO (FunPtr C_AppLaunchContextLaunchedCallback)
mk_AppLaunchContextLaunchedCallback C_AppLaunchContextLaunchedCallback
cb' IO (FunPtr C_AppLaunchContextLaunchedCallback)
-> (FunPtr C_AppLaunchContextLaunchedCallback -> IO Closure)
-> IO Closure
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_AppLaunchContextLaunchedCallback -> IO Closure
forall a. FunPtr a -> IO Closure
newCClosure


-- | Wrap a `AppLaunchContextLaunchedCallback` into a `C_AppLaunchContextLaunchedCallback`.
wrap_AppLaunchContextLaunchedCallback ::
    AppLaunchContextLaunchedCallback ->
    C_AppLaunchContextLaunchedCallback
wrap_AppLaunchContextLaunchedCallback :: AppLaunchContextLaunchedCallback
-> C_AppLaunchContextLaunchedCallback
wrap_AppLaunchContextLaunchedCallback _cb :: AppLaunchContextLaunchedCallback
_cb _ info :: Ptr AppInfo
info platformData :: Ptr GVariant
platformData _ = do
    AppInfo
info' <- ((ManagedPtr AppInfo -> AppInfo) -> Ptr AppInfo -> IO AppInfo
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr AppInfo -> AppInfo
Gio.AppInfo.AppInfo) Ptr AppInfo
info
    GVariant
platformData' <- Ptr GVariant -> IO GVariant
B.GVariant.newGVariantFromPtr Ptr GVariant
platformData
    AppLaunchContextLaunchedCallback
_cb  AppInfo
info' GVariant
platformData'


{- |
Connect a signal handler for the “@launched@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' appLaunchContext #launched callback
@
-}
onAppLaunchContextLaunched :: (IsAppLaunchContext a, MonadIO m) => a -> AppLaunchContextLaunchedCallback -> m SignalHandlerId
onAppLaunchContextLaunched :: a -> AppLaunchContextLaunchedCallback -> m SignalHandlerId
onAppLaunchContextLaunched obj :: a
obj cb :: AppLaunchContextLaunchedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_AppLaunchContextLaunchedCallback
cb' = AppLaunchContextLaunchedCallback
-> C_AppLaunchContextLaunchedCallback
wrap_AppLaunchContextLaunchedCallback AppLaunchContextLaunchedCallback
cb
    FunPtr C_AppLaunchContextLaunchedCallback
cb'' <- C_AppLaunchContextLaunchedCallback
-> IO (FunPtr C_AppLaunchContextLaunchedCallback)
mk_AppLaunchContextLaunchedCallback C_AppLaunchContextLaunchedCallback
cb'
    a
-> String
-> FunPtr C_AppLaunchContextLaunchedCallback
-> SignalConnectMode
-> IO SignalHandlerId
forall o a.
GObject o =>
o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId
connectSignalFunPtr a
obj "launched" FunPtr C_AppLaunchContextLaunchedCallback
cb'' SignalConnectMode
SignalConnectBefore

{- |
Connect a signal handler for the “@launched@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' appLaunchContext #launched callback
@
-}
afterAppLaunchContextLaunched :: (IsAppLaunchContext a, MonadIO m) => a -> AppLaunchContextLaunchedCallback -> m SignalHandlerId
afterAppLaunchContextLaunched :: a -> AppLaunchContextLaunchedCallback -> m SignalHandlerId
afterAppLaunchContextLaunched obj :: a
obj cb :: AppLaunchContextLaunchedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_AppLaunchContextLaunchedCallback
cb' = AppLaunchContextLaunchedCallback
-> C_AppLaunchContextLaunchedCallback
wrap_AppLaunchContextLaunchedCallback AppLaunchContextLaunchedCallback
cb
    FunPtr C_AppLaunchContextLaunchedCallback
cb'' <- C_AppLaunchContextLaunchedCallback
-> IO (FunPtr C_AppLaunchContextLaunchedCallback)
mk_AppLaunchContextLaunchedCallback C_AppLaunchContextLaunchedCallback
cb'
    a
-> String
-> FunPtr C_AppLaunchContextLaunchedCallback
-> SignalConnectMode
-> IO SignalHandlerId
forall o a.
GObject o =>
o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId
connectSignalFunPtr a
obj "launched" FunPtr C_AppLaunchContextLaunchedCallback
cb'' SignalConnectMode
SignalConnectAfter


#if ENABLE_OVERLOADING
instance O.HasAttributeList AppLaunchContext
type instance O.AttributeList AppLaunchContext = AppLaunchContextAttributeList
type AppLaunchContextAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
data AppLaunchContextLaunchFailedSignalInfo
instance SignalInfo AppLaunchContextLaunchFailedSignalInfo where
    type HaskellCallbackType AppLaunchContextLaunchFailedSignalInfo = AppLaunchContextLaunchFailedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_AppLaunchContextLaunchFailedCallback cb
        cb'' <- mk_AppLaunchContextLaunchFailedCallback cb'
        connectSignalFunPtr obj "launch-failed" cb'' connectMode

data AppLaunchContextLaunchedSignalInfo
instance SignalInfo AppLaunchContextLaunchedSignalInfo where
    type HaskellCallbackType AppLaunchContextLaunchedSignalInfo = AppLaunchContextLaunchedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_AppLaunchContextLaunchedCallback cb
        cb'' <- mk_AppLaunchContextLaunchedCallback cb'
        connectSignalFunPtr obj "launched" cb'' connectMode

type instance O.SignalList AppLaunchContext = AppLaunchContextSignalList
type AppLaunchContextSignalList = ('[ '("launchFailed", AppLaunchContextLaunchFailedSignalInfo), '("launched", AppLaunchContextLaunchedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method AppLaunchContext::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "AppLaunchContext"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_app_launch_context_new" g_app_launch_context_new :: 
    IO (Ptr AppLaunchContext)

{- |
Creates a new application launch context. This is not normally used,
instead you instantiate a subclass of this, such as @/GdkAppLaunchContext/@.
-}
appLaunchContextNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m AppLaunchContext
    {- ^ __Returns:__ a 'GI.Gio.Objects.AppLaunchContext.AppLaunchContext'. -}
appLaunchContextNew :: m AppLaunchContext
appLaunchContextNew  = IO AppLaunchContext -> m AppLaunchContext
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO AppLaunchContext -> m AppLaunchContext)
-> IO AppLaunchContext -> m AppLaunchContext
forall a b. (a -> b) -> a -> b
$ do
    Ptr AppLaunchContext
result <- IO (Ptr AppLaunchContext)
g_app_launch_context_new
    Text -> Ptr AppLaunchContext -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "appLaunchContextNew" Ptr AppLaunchContext
result
    AppLaunchContext
result' <- ((ManagedPtr AppLaunchContext -> AppLaunchContext)
-> Ptr AppLaunchContext -> IO AppLaunchContext
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr AppLaunchContext -> AppLaunchContext
AppLaunchContext) Ptr AppLaunchContext
result
    AppLaunchContext -> IO AppLaunchContext
forall (m :: * -> *) a. Monad m => a -> m a
return AppLaunchContext
result'

#if ENABLE_OVERLOADING
#endif

-- method AppLaunchContext::get_display
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gio", name = "AppLaunchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAppLaunchContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "info", argType = TInterface (Name {namespace = "Gio", name = "AppInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAppInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "files", argType = TGList (TInterface (Name {namespace = "Gio", name = "File"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GList of #GFile objects", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_app_launch_context_get_display" g_app_launch_context_get_display :: 
    Ptr AppLaunchContext ->                 -- context : TInterface (Name {namespace = "Gio", name = "AppLaunchContext"})
    Ptr Gio.AppInfo.AppInfo ->              -- info : TInterface (Name {namespace = "Gio", name = "AppInfo"})
    Ptr (GList (Ptr Gio.File.File)) ->      -- files : TGList (TInterface (Name {namespace = "Gio", name = "File"}))
    IO CString

{- |
Gets the display string for the /@context@/. This is used to ensure new
applications are started on the same display as the launching
application, by setting the @DISPLAY@ environment variable.
-}
appLaunchContextGetDisplay ::
    (B.CallStack.HasCallStack, MonadIO m, IsAppLaunchContext a, Gio.AppInfo.IsAppInfo b, Gio.File.IsFile c) =>
    a
    {- ^ /@context@/: a 'GI.Gio.Objects.AppLaunchContext.AppLaunchContext' -}
    -> b
    {- ^ /@info@/: a 'GI.Gio.Interfaces.AppInfo.AppInfo' -}
    -> [c]
    {- ^ /@files@/: a 'GI.GLib.Structs.List.List' of 'GI.Gio.Interfaces.File.File' objects -}
    -> m T.Text
    {- ^ __Returns:__ a display string for the display. -}
appLaunchContextGetDisplay :: a -> b -> [c] -> m Text
appLaunchContextGetDisplay context :: a
context info :: b
info files :: [c]
files = 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 AppLaunchContext
context' <- a -> IO (Ptr AppLaunchContext)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
context
    Ptr AppInfo
info' <- b -> IO (Ptr AppInfo)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
info
    [Ptr File]
files' <- (c -> IO (Ptr File)) -> [c] -> IO [Ptr File]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM c -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr [c]
files
    Ptr (GList (Ptr File))
files'' <- [Ptr File] -> IO (Ptr (GList (Ptr File)))
forall a. [Ptr a] -> IO (Ptr (GList (Ptr a)))
packGList [Ptr File]
files'
    CString
result <- Ptr AppLaunchContext
-> Ptr AppInfo -> Ptr (GList (Ptr File)) -> IO CString
g_app_launch_context_get_display Ptr AppLaunchContext
context' Ptr AppInfo
info' Ptr (GList (Ptr File))
files''
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "appLaunchContextGetDisplay" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
context
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
info
    (c -> IO ()) -> [c] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [c]
files
    Ptr (GList (Ptr File)) -> IO ()
forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr File))
files''
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if ENABLE_OVERLOADING
data AppLaunchContextGetDisplayMethodInfo
instance (signature ~ (b -> [c] -> m T.Text), MonadIO m, IsAppLaunchContext a, Gio.AppInfo.IsAppInfo b, Gio.File.IsFile c) => O.MethodInfo AppLaunchContextGetDisplayMethodInfo a signature where
    overloadedMethod _ = appLaunchContextGetDisplay

#endif

-- method AppLaunchContext::get_environment
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gio", name = "AppLaunchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAppLaunchContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TFileName))
-- throws : False
-- Skip return : False

foreign import ccall "g_app_launch_context_get_environment" g_app_launch_context_get_environment :: 
    Ptr AppLaunchContext ->                 -- context : TInterface (Name {namespace = "Gio", name = "AppLaunchContext"})
    IO (Ptr CString)

{- |
Gets the complete environment variable list to be passed to
the child process when /@context@/ is used to launch an application.
This is a 'Nothing'-terminated array of strings, where each string has
the form @KEY=VALUE@.

/Since: 2.32/
-}
appLaunchContextGetEnvironment ::
    (B.CallStack.HasCallStack, MonadIO m, IsAppLaunchContext a) =>
    a
    {- ^ /@context@/: a 'GI.Gio.Objects.AppLaunchContext.AppLaunchContext' -}
    -> m [[Char]]
    {- ^ __Returns:__ 
    the child\'s environment -}
appLaunchContextGetEnvironment :: a -> m [String]
appLaunchContextGetEnvironment context :: a
context = IO [String] -> m [String]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [String] -> m [String]) -> IO [String] -> m [String]
forall a b. (a -> b) -> a -> b
$ do
    Ptr AppLaunchContext
context' <- a -> IO (Ptr AppLaunchContext)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
context
    Ptr CString
result <- Ptr AppLaunchContext -> IO (Ptr CString)
g_app_launch_context_get_environment Ptr AppLaunchContext
context'
    Text -> Ptr CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "appLaunchContextGetEnvironment" Ptr CString
result
    [String]
result' <- HasCallStack => Ptr CString -> IO [String]
Ptr CString -> IO [String]
unpackZeroTerminatedFileNameArray Ptr CString
result
    (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
context
    [String] -> IO [String]
forall (m :: * -> *) a. Monad m => a -> m a
return [String]
result'

#if ENABLE_OVERLOADING
data AppLaunchContextGetEnvironmentMethodInfo
instance (signature ~ (m [[Char]]), MonadIO m, IsAppLaunchContext a) => O.MethodInfo AppLaunchContextGetEnvironmentMethodInfo a signature where
    overloadedMethod _ = appLaunchContextGetEnvironment

#endif

-- method AppLaunchContext::get_startup_notify_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gio", name = "AppLaunchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAppLaunchContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "info", argType = TInterface (Name {namespace = "Gio", name = "AppInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAppInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "files", argType = TGList (TInterface (Name {namespace = "Gio", name = "File"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GList of of #GFile objects", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_app_launch_context_get_startup_notify_id" g_app_launch_context_get_startup_notify_id :: 
    Ptr AppLaunchContext ->                 -- context : TInterface (Name {namespace = "Gio", name = "AppLaunchContext"})
    Ptr Gio.AppInfo.AppInfo ->              -- info : TInterface (Name {namespace = "Gio", name = "AppInfo"})
    Ptr (GList (Ptr Gio.File.File)) ->      -- files : TGList (TInterface (Name {namespace = "Gio", name = "File"}))
    IO CString

{- |
Initiates startup notification for the application and returns the
@DESKTOP_STARTUP_ID@ for the launched operation, if supported.

Startup notification IDs are defined in the
<http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt FreeDesktop.Org Startup Notifications standard>.
-}
appLaunchContextGetStartupNotifyId ::
    (B.CallStack.HasCallStack, MonadIO m, IsAppLaunchContext a, Gio.AppInfo.IsAppInfo b, Gio.File.IsFile c) =>
    a
    {- ^ /@context@/: a 'GI.Gio.Objects.AppLaunchContext.AppLaunchContext' -}
    -> b
    {- ^ /@info@/: a 'GI.Gio.Interfaces.AppInfo.AppInfo' -}
    -> [c]
    {- ^ /@files@/: a 'GI.GLib.Structs.List.List' of of 'GI.Gio.Interfaces.File.File' objects -}
    -> m T.Text
    {- ^ __Returns:__ a startup notification ID for the application, or 'Nothing' if
    not supported. -}
appLaunchContextGetStartupNotifyId :: a -> b -> [c] -> m Text
appLaunchContextGetStartupNotifyId context :: a
context info :: b
info files :: [c]
files = 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 AppLaunchContext
context' <- a -> IO (Ptr AppLaunchContext)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
context
    Ptr AppInfo
info' <- b -> IO (Ptr AppInfo)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
info
    [Ptr File]
files' <- (c -> IO (Ptr File)) -> [c] -> IO [Ptr File]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM c -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr [c]
files
    Ptr (GList (Ptr File))
files'' <- [Ptr File] -> IO (Ptr (GList (Ptr File)))
forall a. [Ptr a] -> IO (Ptr (GList (Ptr a)))
packGList [Ptr File]
files'
    CString
result <- Ptr AppLaunchContext
-> Ptr AppInfo -> Ptr (GList (Ptr File)) -> IO CString
g_app_launch_context_get_startup_notify_id Ptr AppLaunchContext
context' Ptr AppInfo
info' Ptr (GList (Ptr File))
files''
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "appLaunchContextGetStartupNotifyId" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
context
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
info
    (c -> IO ()) -> [c] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [c]
files
    Ptr (GList (Ptr File)) -> IO ()
forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr File))
files''
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if ENABLE_OVERLOADING
data AppLaunchContextGetStartupNotifyIdMethodInfo
instance (signature ~ (b -> [c] -> m T.Text), MonadIO m, IsAppLaunchContext a, Gio.AppInfo.IsAppInfo b, Gio.File.IsFile c) => O.MethodInfo AppLaunchContextGetStartupNotifyIdMethodInfo a signature where
    overloadedMethod _ = appLaunchContextGetStartupNotifyId

#endif

-- method AppLaunchContext::launch_failed
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gio", name = "AppLaunchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAppLaunchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "startup_notify_id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the startup notification id that was returned by g_app_launch_context_get_startup_notify_id().", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_app_launch_context_launch_failed" g_app_launch_context_launch_failed :: 
    Ptr AppLaunchContext ->                 -- context : TInterface (Name {namespace = "Gio", name = "AppLaunchContext"})
    CString ->                              -- startup_notify_id : TBasicType TUTF8
    IO ()

{- |
Called when an application has failed to launch, so that it can cancel
the application startup notification started in 'GI.Gio.Objects.AppLaunchContext.appLaunchContextGetStartupNotifyId'.
-}
appLaunchContextLaunchFailed ::
    (B.CallStack.HasCallStack, MonadIO m, IsAppLaunchContext a) =>
    a
    {- ^ /@context@/: a 'GI.Gio.Objects.AppLaunchContext.AppLaunchContext'. -}
    -> T.Text
    {- ^ /@startupNotifyId@/: the startup notification id that was returned by 'GI.Gio.Objects.AppLaunchContext.appLaunchContextGetStartupNotifyId'. -}
    -> m ()
appLaunchContextLaunchFailed :: a -> Text -> m ()
appLaunchContextLaunchFailed context :: a
context startupNotifyId :: Text
startupNotifyId = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr AppLaunchContext
context' <- a -> IO (Ptr AppLaunchContext)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
context
    CString
startupNotifyId' <- Text -> IO CString
textToCString Text
startupNotifyId
    Ptr AppLaunchContext -> CString -> IO ()
g_app_launch_context_launch_failed Ptr AppLaunchContext
context' CString
startupNotifyId'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
context
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
startupNotifyId'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data AppLaunchContextLaunchFailedMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsAppLaunchContext a) => O.MethodInfo AppLaunchContextLaunchFailedMethodInfo a signature where
    overloadedMethod _ = appLaunchContextLaunchFailed

#endif

-- method AppLaunchContext::setenv
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gio", name = "AppLaunchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAppLaunchContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "variable", argType = TBasicType TFileName, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the environment variable to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TFileName, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the value for to set the variable to.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_app_launch_context_setenv" g_app_launch_context_setenv :: 
    Ptr AppLaunchContext ->                 -- context : TInterface (Name {namespace = "Gio", name = "AppLaunchContext"})
    CString ->                              -- variable : TBasicType TFileName
    CString ->                              -- value : TBasicType TFileName
    IO ()

{- |
Arranges for /@variable@/ to be set to /@value@/ in the child\'s
environment when /@context@/ is used to launch an application.

/Since: 2.32/
-}
appLaunchContextSetenv ::
    (B.CallStack.HasCallStack, MonadIO m, IsAppLaunchContext a) =>
    a
    {- ^ /@context@/: a 'GI.Gio.Objects.AppLaunchContext.AppLaunchContext' -}
    -> [Char]
    {- ^ /@variable@/: the environment variable to set -}
    -> [Char]
    {- ^ /@value@/: the value for to set the variable to. -}
    -> m ()
appLaunchContextSetenv :: a -> String -> String -> m ()
appLaunchContextSetenv context :: a
context variable :: String
variable value :: String
value = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr AppLaunchContext
context' <- a -> IO (Ptr AppLaunchContext)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
context
    CString
variable' <- String -> IO CString
stringToCString String
variable
    CString
value' <- String -> IO CString
stringToCString String
value
    Ptr AppLaunchContext -> CString -> CString -> IO ()
g_app_launch_context_setenv Ptr AppLaunchContext
context' CString
variable' CString
value'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
context
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
variable'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
value'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data AppLaunchContextSetenvMethodInfo
instance (signature ~ ([Char] -> [Char] -> m ()), MonadIO m, IsAppLaunchContext a) => O.MethodInfo AppLaunchContextSetenvMethodInfo a signature where
    overloadedMethod _ = appLaunchContextSetenv

#endif

-- method AppLaunchContext::unsetenv
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gio", name = "AppLaunchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAppLaunchContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "variable", argType = TBasicType TFileName, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the environment variable to remove", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_app_launch_context_unsetenv" g_app_launch_context_unsetenv :: 
    Ptr AppLaunchContext ->                 -- context : TInterface (Name {namespace = "Gio", name = "AppLaunchContext"})
    CString ->                              -- variable : TBasicType TFileName
    IO ()

{- |
Arranges for /@variable@/ to be unset in the child\'s environment
when /@context@/ is used to launch an application.

/Since: 2.32/
-}
appLaunchContextUnsetenv ::
    (B.CallStack.HasCallStack, MonadIO m, IsAppLaunchContext a) =>
    a
    {- ^ /@context@/: a 'GI.Gio.Objects.AppLaunchContext.AppLaunchContext' -}
    -> [Char]
    {- ^ /@variable@/: the environment variable to remove -}
    -> m ()
appLaunchContextUnsetenv :: a -> String -> m ()
appLaunchContextUnsetenv context :: a
context variable :: String
variable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr AppLaunchContext
context' <- a -> IO (Ptr AppLaunchContext)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
context
    CString
variable' <- String -> IO CString
stringToCString String
variable
    Ptr AppLaunchContext -> CString -> IO ()
g_app_launch_context_unsetenv Ptr AppLaunchContext
context' CString
variable'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
context
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
variable'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data AppLaunchContextUnsetenvMethodInfo
instance (signature ~ ([Char] -> m ()), MonadIO m, IsAppLaunchContext a) => O.MethodInfo AppLaunchContextUnsetenvMethodInfo a signature where
    overloadedMethod _ = appLaunchContextUnsetenv

#endif