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

GdkAppLaunchContext is an implementation of 'GI.Gio.Objects.AppLaunchContext.AppLaunchContext' that
handles launching an application in a graphical context. It provides
startup notification and allows to launch applications on a specific
screen or workspace.

== Launching an application


=== /C code/
>
>GdkAppLaunchContext *context;
>
>context = gdk_display_get_app_launch_context (display);
>
>gdk_app_launch_context_set_screen (screen);
>gdk_app_launch_context_set_timestamp (event->time);
>
>if (!g_app_info_launch_default_for_uri ("http://www.gtk.org", context, &error))
>  g_warning ("Launching failed: %s\n", error->message);
>
>g_object_unref (context);

-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.Gdk.Objects.AppLaunchContext
    (

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


 -- * Methods
-- ** new #method:new#

    appLaunchContextNew                     ,


-- ** setDesktop #method:setDesktop#

#if ENABLE_OVERLOADING
    AppLaunchContextSetDesktopMethodInfo    ,
#endif
    appLaunchContextSetDesktop              ,


-- ** setDisplay #method:setDisplay#

#if ENABLE_OVERLOADING
    AppLaunchContextSetDisplayMethodInfo    ,
#endif
    appLaunchContextSetDisplay              ,


-- ** setIcon #method:setIcon#

#if ENABLE_OVERLOADING
    AppLaunchContextSetIconMethodInfo       ,
#endif
    appLaunchContextSetIcon                 ,


-- ** setIconName #method:setIconName#

#if ENABLE_OVERLOADING
    AppLaunchContextSetIconNameMethodInfo   ,
#endif
    appLaunchContextSetIconName             ,


-- ** setScreen #method:setScreen#

#if ENABLE_OVERLOADING
    AppLaunchContextSetScreenMethodInfo     ,
#endif
    appLaunchContextSetScreen               ,


-- ** setTimestamp #method:setTimestamp#

#if ENABLE_OVERLOADING
    AppLaunchContextSetTimestampMethodInfo  ,
#endif
    appLaunchContextSetTimestamp            ,




 -- * Properties
-- ** display #attr:display#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    AppLaunchContextDisplayPropertyInfo     ,
#endif
#if ENABLE_OVERLOADING
    appLaunchContextDisplay                 ,
#endif
    constructAppLaunchContextDisplay        ,
    getAppLaunchContextDisplay              ,




    ) 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.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.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 GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gdk.Objects.Display as Gdk.Display
import {-# SOURCE #-} qualified GI.Gdk.Objects.Screen as Gdk.Screen
import qualified GI.Gio.Interfaces.Icon as Gio.Icon
import qualified GI.Gio.Objects.AppLaunchContext as Gio.AppLaunchContext

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

instance GObject AppLaunchContext where
    gobjectType = c_gdk_app_launch_context_get_type


-- | Type class for types which can be safely cast to `AppLaunchContext`, for instance with `toAppLaunchContext`.
class (GObject o, O.IsDescendantOf AppLaunchContext o) => IsAppLaunchContext o
instance (GObject o, O.IsDescendantOf AppLaunchContext o) => IsAppLaunchContext o

instance O.HasParentTypes AppLaunchContext
type instance O.ParentTypes AppLaunchContext = '[Gio.AppLaunchContext.AppLaunchContext, GObject.Object.Object]

-- | 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 = liftIO . unsafeCastTo AppLaunchContext

-- | A convenience alias for `Nothing` :: `Maybe` `AppLaunchContext`.
noAppLaunchContext :: Maybe AppLaunchContext
noAppLaunchContext = 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 = Gio.AppLaunchContext.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 = Gio.AppLaunchContext.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 = Gio.AppLaunchContext.AppLaunchContextUnsetenvMethodInfo
    ResolveAppLaunchContextMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveAppLaunchContextMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveAppLaunchContextMethod "getDisplay" o = Gio.AppLaunchContext.AppLaunchContextGetDisplayMethodInfo
    ResolveAppLaunchContextMethod "getEnvironment" o = Gio.AppLaunchContext.AppLaunchContextGetEnvironmentMethodInfo
    ResolveAppLaunchContextMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveAppLaunchContextMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveAppLaunchContextMethod "getStartupNotifyId" o = Gio.AppLaunchContext.AppLaunchContextGetStartupNotifyIdMethodInfo
    ResolveAppLaunchContextMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveAppLaunchContextMethod "setDesktop" o = AppLaunchContextSetDesktopMethodInfo
    ResolveAppLaunchContextMethod "setDisplay" o = AppLaunchContextSetDisplayMethodInfo
    ResolveAppLaunchContextMethod "setIcon" o = AppLaunchContextSetIconMethodInfo
    ResolveAppLaunchContextMethod "setIconName" o = AppLaunchContextSetIconNameMethodInfo
    ResolveAppLaunchContextMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveAppLaunchContextMethod "setScreen" o = AppLaunchContextSetScreenMethodInfo
    ResolveAppLaunchContextMethod "setTimestamp" o = AppLaunchContextSetTimestampMethodInfo
    ResolveAppLaunchContextMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveAppLaunchContextMethod t AppLaunchContext, O.MethodInfo info AppLaunchContext p) => OL.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

-- VVV Prop "display"
   -- Type: TInterface (Name {namespace = "Gdk", name = "Display"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Just False)

{- |
Get the value of the “@display@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' appLaunchContext #display
@
-}
getAppLaunchContextDisplay :: (MonadIO m, IsAppLaunchContext o) => o -> m (Maybe Gdk.Display.Display)
getAppLaunchContextDisplay obj = liftIO $ B.Properties.getObjectPropertyObject obj "display" Gdk.Display.Display

{- |
Construct a `GValueConstruct` with valid value for the “@display@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructAppLaunchContextDisplay :: (IsAppLaunchContext o, Gdk.Display.IsDisplay a) => a -> IO (GValueConstruct o)
constructAppLaunchContextDisplay val = B.Properties.constructObjectPropertyObject "display" (Just val)

#if ENABLE_OVERLOADING
data AppLaunchContextDisplayPropertyInfo
instance AttrInfo AppLaunchContextDisplayPropertyInfo where
    type AttrAllowedOps AppLaunchContextDisplayPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint AppLaunchContextDisplayPropertyInfo = Gdk.Display.IsDisplay
    type AttrBaseTypeConstraint AppLaunchContextDisplayPropertyInfo = IsAppLaunchContext
    type AttrGetType AppLaunchContextDisplayPropertyInfo = (Maybe Gdk.Display.Display)
    type AttrLabel AppLaunchContextDisplayPropertyInfo = "display"
    type AttrOrigin AppLaunchContextDisplayPropertyInfo = AppLaunchContext
    attrGet _ = getAppLaunchContextDisplay
    attrSet _ = undefined
    attrConstruct _ = constructAppLaunchContextDisplay
    attrClear _ = undefined
#endif

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

#if ENABLE_OVERLOADING
appLaunchContextDisplay :: AttrLabelProxy "display"
appLaunchContextDisplay = AttrLabelProxy

#endif

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

#endif

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

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

{-# DEPRECATED appLaunchContextNew ["(Since version 3.0)","Use 'GI.Gdk.Objects.Display.displayGetAppLaunchContext' instead"] #-}
{- |
Creates a new 'GI.Gdk.Objects.AppLaunchContext.AppLaunchContext'.

/Since: 2.14/
-}
appLaunchContextNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m AppLaunchContext
    {- ^ __Returns:__ a new 'GI.Gdk.Objects.AppLaunchContext.AppLaunchContext' -}
appLaunchContextNew  = liftIO $ do
    result <- gdk_app_launch_context_new
    checkUnexpectedReturnNULL "appLaunchContextNew" result
    result' <- (wrapObject AppLaunchContext) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method AppLaunchContext::set_desktop
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gdk", name = "AppLaunchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkAppLaunchContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "desktop", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of a workspace, or -1", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gdk_app_launch_context_set_desktop" gdk_app_launch_context_set_desktop ::
    Ptr AppLaunchContext ->                 -- context : TInterface (Name {namespace = "Gdk", name = "AppLaunchContext"})
    Int32 ->                                -- desktop : TBasicType TInt
    IO ()

{- |
Sets the workspace on which applications will be launched when
using this context when running under a window manager that
supports multiple workspaces, as described in the
<http://www.freedesktop.org/Standards/wm-spec Extended Window Manager Hints>.

When the workspace is not specified or /@desktop@/ is set to -1,
it is up to the window manager to pick one, typically it will
be the current workspace.

/Since: 2.14/
-}
appLaunchContextSetDesktop ::
    (B.CallStack.HasCallStack, MonadIO m, IsAppLaunchContext a) =>
    a
    {- ^ /@context@/: a 'GI.Gdk.Objects.AppLaunchContext.AppLaunchContext' -}
    -> Int32
    {- ^ /@desktop@/: the number of a workspace, or -1 -}
    -> m ()
appLaunchContextSetDesktop context desktop = liftIO $ do
    context' <- unsafeManagedPtrCastPtr context
    gdk_app_launch_context_set_desktop context' desktop
    touchManagedPtr context
    return ()

#if ENABLE_OVERLOADING
data AppLaunchContextSetDesktopMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m, IsAppLaunchContext a) => O.MethodInfo AppLaunchContextSetDesktopMethodInfo a signature where
    overloadedMethod _ = appLaunchContextSetDesktop

#endif

-- method AppLaunchContext::set_display
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gdk", name = "AppLaunchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkAppLaunchContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "display", argType = TInterface (Name {namespace = "Gdk", name = "Display"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkDisplay", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gdk_app_launch_context_set_display" gdk_app_launch_context_set_display ::
    Ptr AppLaunchContext ->                 -- context : TInterface (Name {namespace = "Gdk", name = "AppLaunchContext"})
    Ptr Gdk.Display.Display ->              -- display : TInterface (Name {namespace = "Gdk", name = "Display"})
    IO ()

{-# DEPRECATED appLaunchContextSetDisplay ["(Since version 3.0)","Use 'GI.Gdk.Objects.Display.displayGetAppLaunchContext' instead"] #-}
{- |
Sets the display on which applications will be launched when
using this context. See also 'GI.Gdk.Objects.AppLaunchContext.appLaunchContextSetScreen'.

/Since: 2.14/
-}
appLaunchContextSetDisplay ::
    (B.CallStack.HasCallStack, MonadIO m, IsAppLaunchContext a, Gdk.Display.IsDisplay b) =>
    a
    {- ^ /@context@/: a 'GI.Gdk.Objects.AppLaunchContext.AppLaunchContext' -}
    -> b
    {- ^ /@display@/: a 'GI.Gdk.Objects.Display.Display' -}
    -> m ()
appLaunchContextSetDisplay context display = liftIO $ do
    context' <- unsafeManagedPtrCastPtr context
    display' <- unsafeManagedPtrCastPtr display
    gdk_app_launch_context_set_display context' display'
    touchManagedPtr context
    touchManagedPtr display
    return ()

#if ENABLE_OVERLOADING
data AppLaunchContextSetDisplayMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsAppLaunchContext a, Gdk.Display.IsDisplay b) => O.MethodInfo AppLaunchContextSetDisplayMethodInfo a signature where
    overloadedMethod _ = appLaunchContextSetDisplay

#endif

-- method AppLaunchContext::set_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gdk", name = "AppLaunchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkAppLaunchContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "icon", argType = TInterface (Name {namespace = "Gio", name = "Icon"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GIcon, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gdk_app_launch_context_set_icon" gdk_app_launch_context_set_icon ::
    Ptr AppLaunchContext ->                 -- context : TInterface (Name {namespace = "Gdk", name = "AppLaunchContext"})
    Ptr Gio.Icon.Icon ->                    -- icon : TInterface (Name {namespace = "Gio", name = "Icon"})
    IO ()

{- |
Sets the icon for applications that are launched with this
context.

Window Managers can use this information when displaying startup
notification.

See also 'GI.Gdk.Objects.AppLaunchContext.appLaunchContextSetIconName'.

/Since: 2.14/
-}
appLaunchContextSetIcon ::
    (B.CallStack.HasCallStack, MonadIO m, IsAppLaunchContext a, Gio.Icon.IsIcon b) =>
    a
    {- ^ /@context@/: a 'GI.Gdk.Objects.AppLaunchContext.AppLaunchContext' -}
    -> Maybe (b)
    {- ^ /@icon@/: a 'GI.Gio.Interfaces.Icon.Icon', or 'Nothing' -}
    -> m ()
appLaunchContextSetIcon context icon = liftIO $ do
    context' <- unsafeManagedPtrCastPtr context
    maybeIcon <- case icon of
        Nothing -> return nullPtr
        Just jIcon -> do
            jIcon' <- unsafeManagedPtrCastPtr jIcon
            return jIcon'
    gdk_app_launch_context_set_icon context' maybeIcon
    touchManagedPtr context
    whenJust icon touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data AppLaunchContextSetIconMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsAppLaunchContext a, Gio.Icon.IsIcon b) => O.MethodInfo AppLaunchContextSetIconMethodInfo a signature where
    overloadedMethod _ = appLaunchContextSetIcon

#endif

-- method AppLaunchContext::set_icon_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gdk", name = "AppLaunchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkAppLaunchContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "icon_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "an icon name, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

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

{- |
Sets the icon for applications that are launched with this context.
The /@iconName@/ will be interpreted in the same way as the Icon field
in desktop files. See also 'GI.Gdk.Objects.AppLaunchContext.appLaunchContextSetIcon'.

If both /@icon@/ and /@iconName@/ are set, the /@iconName@/ takes priority.
If neither /@icon@/ or /@iconName@/ is set, the icon is taken from either
the file that is passed to launched application or from the 'GI.Gio.Interfaces.AppInfo.AppInfo'
for the launched application itself.

/Since: 2.14/
-}
appLaunchContextSetIconName ::
    (B.CallStack.HasCallStack, MonadIO m, IsAppLaunchContext a) =>
    a
    {- ^ /@context@/: a 'GI.Gdk.Objects.AppLaunchContext.AppLaunchContext' -}
    -> Maybe (T.Text)
    {- ^ /@iconName@/: an icon name, or 'Nothing' -}
    -> m ()
appLaunchContextSetIconName context iconName = liftIO $ do
    context' <- unsafeManagedPtrCastPtr context
    maybeIconName <- case iconName of
        Nothing -> return nullPtr
        Just jIconName -> do
            jIconName' <- textToCString jIconName
            return jIconName'
    gdk_app_launch_context_set_icon_name context' maybeIconName
    touchManagedPtr context
    freeMem maybeIconName
    return ()

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

#endif

-- method AppLaunchContext::set_screen
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gdk", name = "AppLaunchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkAppLaunchContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "screen", argType = TInterface (Name {namespace = "Gdk", name = "Screen"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkScreen", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gdk_app_launch_context_set_screen" gdk_app_launch_context_set_screen ::
    Ptr AppLaunchContext ->                 -- context : TInterface (Name {namespace = "Gdk", name = "AppLaunchContext"})
    Ptr Gdk.Screen.Screen ->                -- screen : TInterface (Name {namespace = "Gdk", name = "Screen"})
    IO ()

{- |
Sets the screen on which applications will be launched when
using this context. See also 'GI.Gdk.Objects.AppLaunchContext.appLaunchContextSetDisplay'.

If both /@screen@/ and /@display@/ are set, the /@screen@/ takes priority.
If neither /@screen@/ or /@display@/ are set, the default screen and
display are used.

/Since: 2.14/
-}
appLaunchContextSetScreen ::
    (B.CallStack.HasCallStack, MonadIO m, IsAppLaunchContext a, Gdk.Screen.IsScreen b) =>
    a
    {- ^ /@context@/: a 'GI.Gdk.Objects.AppLaunchContext.AppLaunchContext' -}
    -> b
    {- ^ /@screen@/: a 'GI.Gdk.Objects.Screen.Screen' -}
    -> m ()
appLaunchContextSetScreen context screen = liftIO $ do
    context' <- unsafeManagedPtrCastPtr context
    screen' <- unsafeManagedPtrCastPtr screen
    gdk_app_launch_context_set_screen context' screen'
    touchManagedPtr context
    touchManagedPtr screen
    return ()

#if ENABLE_OVERLOADING
data AppLaunchContextSetScreenMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsAppLaunchContext a, Gdk.Screen.IsScreen b) => O.MethodInfo AppLaunchContextSetScreenMethodInfo a signature where
    overloadedMethod _ = appLaunchContextSetScreen

#endif

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

foreign import ccall "gdk_app_launch_context_set_timestamp" gdk_app_launch_context_set_timestamp ::
    Ptr AppLaunchContext ->                 -- context : TInterface (Name {namespace = "Gdk", name = "AppLaunchContext"})
    Word32 ->                               -- timestamp : TBasicType TUInt32
    IO ()

{- |
Sets the timestamp of /@context@/. The timestamp should ideally
be taken from the event that triggered the launch.

Window managers can use this information to avoid moving the
focus to the newly launched application when the user is busy
typing in another window. This is also known as \'focus stealing
prevention\'.

/Since: 2.14/
-}
appLaunchContextSetTimestamp ::
    (B.CallStack.HasCallStack, MonadIO m, IsAppLaunchContext a) =>
    a
    {- ^ /@context@/: a 'GI.Gdk.Objects.AppLaunchContext.AppLaunchContext' -}
    -> Word32
    {- ^ /@timestamp@/: a timestamp -}
    -> m ()
appLaunchContextSetTimestamp context timestamp = liftIO $ do
    context' <- unsafeManagedPtrCastPtr context
    gdk_app_launch_context_set_timestamp context' timestamp
    touchManagedPtr context
    return ()

#if ENABLE_OVERLOADING
data AppLaunchContextSetTimestampMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m, IsAppLaunchContext a) => O.MethodInfo AppLaunchContextSetTimestampMethodInfo a signature where
    overloadedMethod _ = appLaunchContextSetTimestamp

#endif