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

module GI.Gio.Objects.DesktopAppInfo
    ( 

-- * Exported types
    DesktopAppInfo(..)                      ,
    DesktopAppInfoK                         ,
    toDesktopAppInfo                        ,
    noDesktopAppInfo                        ,


 -- * Methods
-- ** desktopAppInfoGetActionName
    desktopAppInfoGetActionName             ,


-- ** desktopAppInfoGetBoolean
    desktopAppInfoGetBoolean                ,


-- ** desktopAppInfoGetCategories
    desktopAppInfoGetCategories             ,


-- ** desktopAppInfoGetFilename
    desktopAppInfoGetFilename               ,


-- ** desktopAppInfoGetGenericName
    desktopAppInfoGetGenericName            ,


-- ** desktopAppInfoGetImplementations
    desktopAppInfoGetImplementations        ,


-- ** desktopAppInfoGetIsHidden
    desktopAppInfoGetIsHidden               ,


-- ** desktopAppInfoGetKeywords
    desktopAppInfoGetKeywords               ,


-- ** desktopAppInfoGetNodisplay
    desktopAppInfoGetNodisplay              ,


-- ** desktopAppInfoGetShowIn
    desktopAppInfoGetShowIn                 ,


-- ** desktopAppInfoGetStartupWmClass
    desktopAppInfoGetStartupWmClass         ,


-- ** desktopAppInfoGetString
    desktopAppInfoGetString                 ,


-- ** desktopAppInfoHasKey
    desktopAppInfoHasKey                    ,


-- ** desktopAppInfoLaunchAction
    desktopAppInfoLaunchAction              ,


-- ** desktopAppInfoListActions
    desktopAppInfoListActions               ,


-- ** desktopAppInfoNew
    desktopAppInfoNew                       ,


-- ** desktopAppInfoNewFromFilename
    desktopAppInfoNewFromFilename           ,


-- ** desktopAppInfoNewFromKeyfile
    desktopAppInfoNewFromKeyfile            ,


-- ** desktopAppInfoSearch
    desktopAppInfoSearch                    ,


-- ** desktopAppInfoSetDesktopEnv
    desktopAppInfoSetDesktopEnv             ,




 -- * Properties
-- ** Filename
    DesktopAppInfoFilenamePropertyInfo      ,
    constructDesktopAppInfoFilename         ,
    getDesktopAppInfoFilename               ,




    ) 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.GLib as GLib
import qualified GI.GObject as GObject

newtype DesktopAppInfo = DesktopAppInfo (ForeignPtr DesktopAppInfo)
foreign import ccall "g_desktop_app_info_get_type"
    c_g_desktop_app_info_get_type :: IO GType

type instance ParentTypes DesktopAppInfo = DesktopAppInfoParentTypes
type DesktopAppInfoParentTypes = '[GObject.Object, AppInfo]

instance GObject DesktopAppInfo where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_desktop_app_info_get_type
    

class GObject o => DesktopAppInfoK o
instance (GObject o, IsDescendantOf DesktopAppInfo o) => DesktopAppInfoK o

toDesktopAppInfo :: DesktopAppInfoK o => o -> IO DesktopAppInfo
toDesktopAppInfo = unsafeCastTo DesktopAppInfo

noDesktopAppInfo :: Maybe DesktopAppInfo
noDesktopAppInfo = Nothing

-- VVV Prop "filename"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]

getDesktopAppInfoFilename :: (MonadIO m, DesktopAppInfoK o) => o -> m T.Text
getDesktopAppInfoFilename obj = liftIO $ getObjectPropertyString obj "filename"

constructDesktopAppInfoFilename :: T.Text -> IO ([Char], GValue)
constructDesktopAppInfoFilename val = constructObjectPropertyString "filename" val

data DesktopAppInfoFilenamePropertyInfo
instance AttrInfo DesktopAppInfoFilenamePropertyInfo where
    type AttrAllowedOps DesktopAppInfoFilenamePropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint DesktopAppInfoFilenamePropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint DesktopAppInfoFilenamePropertyInfo = DesktopAppInfoK
    type AttrGetType DesktopAppInfoFilenamePropertyInfo = T.Text
    type AttrLabel DesktopAppInfoFilenamePropertyInfo = "DesktopAppInfo::filename"
    attrGet _ = getDesktopAppInfoFilename
    attrSet _ = undefined
    attrConstruct _ = constructDesktopAppInfoFilename

type instance AttributeList DesktopAppInfo = DesktopAppInfoAttributeList
type DesktopAppInfoAttributeList = ('[ '("filename", DesktopAppInfoFilenamePropertyInfo)] :: [(Symbol, *)])

type instance SignalList DesktopAppInfo = DesktopAppInfoSignalList
type DesktopAppInfoSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method DesktopAppInfo::new
-- method type : Constructor
-- Args : [Arg {argName = "desktop_id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "desktop_id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "DesktopAppInfo"
-- throws : False
-- Skip return : False

foreign import ccall "g_desktop_app_info_new" g_desktop_app_info_new :: 
    CString ->                              -- desktop_id : TBasicType TUTF8
    IO (Ptr DesktopAppInfo)


desktopAppInfoNew ::
    (MonadIO m) =>
    T.Text ->                               -- desktop_id
    m DesktopAppInfo
desktopAppInfoNew desktop_id = liftIO $ do
    desktop_id' <- textToCString desktop_id
    result <- g_desktop_app_info_new desktop_id'
    checkUnexpectedReturnNULL "g_desktop_app_info_new" result
    result' <- (wrapObject DesktopAppInfo) result
    freeMem desktop_id'
    return result'

-- method DesktopAppInfo::new_from_filename
-- method type : Constructor
-- Args : [Arg {argName = "filename", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "filename", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "DesktopAppInfo"
-- throws : False
-- Skip return : False

foreign import ccall "g_desktop_app_info_new_from_filename" g_desktop_app_info_new_from_filename :: 
    CString ->                              -- filename : TBasicType TUTF8
    IO (Ptr DesktopAppInfo)


desktopAppInfoNewFromFilename ::
    (MonadIO m) =>
    T.Text ->                               -- filename
    m DesktopAppInfo
desktopAppInfoNewFromFilename filename = liftIO $ do
    filename' <- textToCString filename
    result <- g_desktop_app_info_new_from_filename filename'
    checkUnexpectedReturnNULL "g_desktop_app_info_new_from_filename" result
    result' <- (wrapObject DesktopAppInfo) result
    freeMem filename'
    return result'

-- method DesktopAppInfo::new_from_keyfile
-- method type : Constructor
-- Args : [Arg {argName = "key_file", argType = TInterface "GLib" "KeyFile", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "key_file", argType = TInterface "GLib" "KeyFile", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "DesktopAppInfo"
-- throws : False
-- Skip return : False

foreign import ccall "g_desktop_app_info_new_from_keyfile" g_desktop_app_info_new_from_keyfile :: 
    Ptr GLib.KeyFile ->                     -- key_file : TInterface "GLib" "KeyFile"
    IO (Ptr DesktopAppInfo)


desktopAppInfoNewFromKeyfile ::
    (MonadIO m) =>
    GLib.KeyFile ->                         -- key_file
    m DesktopAppInfo
desktopAppInfoNewFromKeyfile key_file = liftIO $ do
    let key_file' = unsafeManagedPtrGetPtr key_file
    result <- g_desktop_app_info_new_from_keyfile key_file'
    checkUnexpectedReturnNULL "g_desktop_app_info_new_from_keyfile" result
    result' <- (wrapObject DesktopAppInfo) result
    touchManagedPtr key_file
    return result'

-- method DesktopAppInfo::get_action_name
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "g_desktop_app_info_get_action_name" g_desktop_app_info_get_action_name :: 
    Ptr DesktopAppInfo ->                   -- _obj : TInterface "Gio" "DesktopAppInfo"
    CString ->                              -- action_name : TBasicType TUTF8
    IO CString


desktopAppInfoGetActionName ::
    (MonadIO m, DesktopAppInfoK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- action_name
    m T.Text
desktopAppInfoGetActionName _obj action_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    action_name' <- textToCString action_name
    result <- g_desktop_app_info_get_action_name _obj' action_name'
    checkUnexpectedReturnNULL "g_desktop_app_info_get_action_name" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    freeMem action_name'
    return result'

-- method DesktopAppInfo::get_boolean
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_desktop_app_info_get_boolean" g_desktop_app_info_get_boolean :: 
    Ptr DesktopAppInfo ->                   -- _obj : TInterface "Gio" "DesktopAppInfo"
    CString ->                              -- key : TBasicType TUTF8
    IO CInt


desktopAppInfoGetBoolean ::
    (MonadIO m, DesktopAppInfoK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- key
    m Bool
desktopAppInfoGetBoolean _obj key = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    key' <- textToCString key
    result <- g_desktop_app_info_get_boolean _obj' key'
    let result' = (/= 0) result
    touchManagedPtr _obj
    freeMem key'
    return result'

-- method DesktopAppInfo::get_categories
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "g_desktop_app_info_get_categories" g_desktop_app_info_get_categories :: 
    Ptr DesktopAppInfo ->                   -- _obj : TInterface "Gio" "DesktopAppInfo"
    IO CString


desktopAppInfoGetCategories ::
    (MonadIO m, DesktopAppInfoK a) =>
    a ->                                    -- _obj
    m T.Text
desktopAppInfoGetCategories _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_desktop_app_info_get_categories _obj'
    checkUnexpectedReturnNULL "g_desktop_app_info_get_categories" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

-- method DesktopAppInfo::get_filename
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "g_desktop_app_info_get_filename" g_desktop_app_info_get_filename :: 
    Ptr DesktopAppInfo ->                   -- _obj : TInterface "Gio" "DesktopAppInfo"
    IO CString


desktopAppInfoGetFilename ::
    (MonadIO m, DesktopAppInfoK a) =>
    a ->                                    -- _obj
    m T.Text
desktopAppInfoGetFilename _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_desktop_app_info_get_filename _obj'
    checkUnexpectedReturnNULL "g_desktop_app_info_get_filename" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

-- method DesktopAppInfo::get_generic_name
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "g_desktop_app_info_get_generic_name" g_desktop_app_info_get_generic_name :: 
    Ptr DesktopAppInfo ->                   -- _obj : TInterface "Gio" "DesktopAppInfo"
    IO CString


desktopAppInfoGetGenericName ::
    (MonadIO m, DesktopAppInfoK a) =>
    a ->                                    -- _obj
    m T.Text
desktopAppInfoGetGenericName _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_desktop_app_info_get_generic_name _obj'
    checkUnexpectedReturnNULL "g_desktop_app_info_get_generic_name" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

-- method DesktopAppInfo::get_is_hidden
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_desktop_app_info_get_is_hidden" g_desktop_app_info_get_is_hidden :: 
    Ptr DesktopAppInfo ->                   -- _obj : TInterface "Gio" "DesktopAppInfo"
    IO CInt


desktopAppInfoGetIsHidden ::
    (MonadIO m, DesktopAppInfoK a) =>
    a ->                                    -- _obj
    m Bool
desktopAppInfoGetIsHidden _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_desktop_app_info_get_is_hidden _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method DesktopAppInfo::get_keywords
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TCArray True (-1) (-1) (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_desktop_app_info_get_keywords" g_desktop_app_info_get_keywords :: 
    Ptr DesktopAppInfo ->                   -- _obj : TInterface "Gio" "DesktopAppInfo"
    IO (Ptr CString)


desktopAppInfoGetKeywords ::
    (MonadIO m, DesktopAppInfoK a) =>
    a ->                                    -- _obj
    m [T.Text]
desktopAppInfoGetKeywords _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_desktop_app_info_get_keywords _obj'
    checkUnexpectedReturnNULL "g_desktop_app_info_get_keywords" result
    result' <- unpackZeroTerminatedUTF8CArray result
    touchManagedPtr _obj
    return result'

-- method DesktopAppInfo::get_nodisplay
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_desktop_app_info_get_nodisplay" g_desktop_app_info_get_nodisplay :: 
    Ptr DesktopAppInfo ->                   -- _obj : TInterface "Gio" "DesktopAppInfo"
    IO CInt


desktopAppInfoGetNodisplay ::
    (MonadIO m, DesktopAppInfoK a) =>
    a ->                                    -- _obj
    m Bool
desktopAppInfoGetNodisplay _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_desktop_app_info_get_nodisplay _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method DesktopAppInfo::get_show_in
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "desktop_env", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "desktop_env", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_desktop_app_info_get_show_in" g_desktop_app_info_get_show_in :: 
    Ptr DesktopAppInfo ->                   -- _obj : TInterface "Gio" "DesktopAppInfo"
    CString ->                              -- desktop_env : TBasicType TUTF8
    IO CInt


desktopAppInfoGetShowIn ::
    (MonadIO m, DesktopAppInfoK a) =>
    a ->                                    -- _obj
    Maybe (T.Text) ->                       -- desktop_env
    m Bool
desktopAppInfoGetShowIn _obj desktop_env = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeDesktop_env <- case desktop_env of
        Nothing -> return nullPtr
        Just jDesktop_env -> do
            jDesktop_env' <- textToCString jDesktop_env
            return jDesktop_env'
    result <- g_desktop_app_info_get_show_in _obj' maybeDesktop_env
    let result' = (/= 0) result
    touchManagedPtr _obj
    freeMem maybeDesktop_env
    return result'

-- method DesktopAppInfo::get_startup_wm_class
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "g_desktop_app_info_get_startup_wm_class" g_desktop_app_info_get_startup_wm_class :: 
    Ptr DesktopAppInfo ->                   -- _obj : TInterface "Gio" "DesktopAppInfo"
    IO CString


desktopAppInfoGetStartupWmClass ::
    (MonadIO m, DesktopAppInfoK a) =>
    a ->                                    -- _obj
    m T.Text
desktopAppInfoGetStartupWmClass _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_desktop_app_info_get_startup_wm_class _obj'
    checkUnexpectedReturnNULL "g_desktop_app_info_get_startup_wm_class" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

-- method DesktopAppInfo::get_string
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "g_desktop_app_info_get_string" g_desktop_app_info_get_string :: 
    Ptr DesktopAppInfo ->                   -- _obj : TInterface "Gio" "DesktopAppInfo"
    CString ->                              -- key : TBasicType TUTF8
    IO CString


desktopAppInfoGetString ::
    (MonadIO m, DesktopAppInfoK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- key
    m T.Text
desktopAppInfoGetString _obj key = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    key' <- textToCString key
    result <- g_desktop_app_info_get_string _obj' key'
    checkUnexpectedReturnNULL "g_desktop_app_info_get_string" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    freeMem key'
    return result'

-- method DesktopAppInfo::has_key
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_desktop_app_info_has_key" g_desktop_app_info_has_key :: 
    Ptr DesktopAppInfo ->                   -- _obj : TInterface "Gio" "DesktopAppInfo"
    CString ->                              -- key : TBasicType TUTF8
    IO CInt


desktopAppInfoHasKey ::
    (MonadIO m, DesktopAppInfoK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- key
    m Bool
desktopAppInfoHasKey _obj key = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    key' <- textToCString key
    result <- g_desktop_app_info_has_key _obj' key'
    let result' = (/= 0) result
    touchManagedPtr _obj
    freeMem key'
    return result'

-- method DesktopAppInfo::launch_action
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "launch_context", argType = TInterface "Gio" "AppLaunchContext", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "launch_context", argType = TInterface "Gio" "AppLaunchContext", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_desktop_app_info_launch_action" g_desktop_app_info_launch_action :: 
    Ptr DesktopAppInfo ->                   -- _obj : TInterface "Gio" "DesktopAppInfo"
    CString ->                              -- action_name : TBasicType TUTF8
    Ptr AppLaunchContext ->                 -- launch_context : TInterface "Gio" "AppLaunchContext"
    IO ()


desktopAppInfoLaunchAction ::
    (MonadIO m, DesktopAppInfoK a, AppLaunchContextK b) =>
    a ->                                    -- _obj
    T.Text ->                               -- action_name
    Maybe (b) ->                            -- launch_context
    m ()
desktopAppInfoLaunchAction _obj action_name launch_context = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    action_name' <- textToCString action_name
    maybeLaunch_context <- case launch_context of
        Nothing -> return nullPtr
        Just jLaunch_context -> do
            let jLaunch_context' = unsafeManagedPtrCastPtr jLaunch_context
            return jLaunch_context'
    g_desktop_app_info_launch_action _obj' action_name' maybeLaunch_context
    touchManagedPtr _obj
    whenJust launch_context touchManagedPtr
    freeMem action_name'
    return ()

-- XXX Could not generate method DesktopAppInfo::launch_uris_as_manager
-- Error was : Bad introspection data: "Closure not found! Callable\n  { returnType = TBasicType TBoolean\n  , returnMayBeNull = False\n  , returnTransfer = TransferNothing\n  , args =\n      [ Arg\n          { argName = \"_obj\"\n          , argType = TInterface \"Gio\" \"DesktopAppInfo\"\n          , direction = DirectionIn\n          , mayBeNull = False\n          , argScope = ScopeTypeInvalid\n          , argClosure = -1\n          , argDestroy = -1\n          , transfer = TransferNothing\n          }\n      , Arg\n          { argName = \"uris\"\n          , argType = TGList (TBasicType TUTF8)\n          , direction = DirectionIn\n          , mayBeNull = False\n          , argScope = ScopeTypeInvalid\n          , argClosure = -1\n          , argDestroy = -1\n          , transfer = TransferNothing\n          }\n      , Arg\n          { argName = \"launch_context\"\n          , argType = TInterface \"Gio\" \"AppLaunchContext\"\n          , direction = DirectionIn\n          , mayBeNull = True\n          , argScope = ScopeTypeInvalid\n          , argClosure = -1\n          , argDestroy = -1\n          , transfer = TransferNothing\n          }\n      , Arg\n          { argName = \"spawn_flags\"\n          , argType = TInterface \"GLib\" \"SpawnFlags\"\n          , direction = DirectionIn\n          , mayBeNull = False\n          , argScope = ScopeTypeInvalid\n          , argClosure = -1\n          , argDestroy = -1\n          , transfer = TransferNothing\n          }\n      , Arg\n          { argName = \"user_setup\"\n          , argType = TInterface \"GLib\" \"SpawnChildSetupFunc\"\n          , direction = DirectionIn\n          , mayBeNull = True\n          , argScope = ScopeTypeCall\n          , argClosure = 5\n          , argDestroy = -1\n          , transfer = TransferNothing\n          }\n      , Arg\n          { argName = \"user_setup_data\"\n          , argType = TBasicType TVoid\n          , direction = DirectionIn\n          , mayBeNull = True\n          , argScope = ScopeTypeInvalid\n          , argClosure = 4\n          , argDestroy = -1\n          , transfer = TransferNothing\n          }\n      , Arg\n          { argName = \"pid_callback\"\n          , argType = TInterface \"Gio\" \"DesktopAppLaunchCallback\"\n          , direction = DirectionIn\n          , mayBeNull = True\n          , argScope = ScopeTypeCall\n          , argClosure = 7\n          , argDestroy = -1\n          , transfer = TransferNothing\n          }\n      , Arg\n          { argName = \"pid_callback_data\"\n          , argType = TBasicType TVoid\n          , direction = DirectionIn\n          , mayBeNull = True\n          , argScope = ScopeTypeInvalid\n          , argClosure = 6\n          , argDestroy = -1\n          , transfer = TransferNothing\n          }\n      ]\n  , skipReturn = False\n  , callableDeprecated = Nothing\n  }\nfromList\n  [ ( 5\n    , Arg\n        { argName = \"user_setup\"\n        , argType = TInterface \"GLib\" \"SpawnChildSetupFunc\"\n        , direction = DirectionIn\n        , mayBeNull = True\n        , argScope = ScopeTypeCall\n        , argClosure = 5\n        , argDestroy = -1\n        , transfer = TransferNothing\n        }\n    )\n  , ( 7\n    , Arg\n        { argName = \"pid_callback\"\n        , argType = TInterface \"Gio\" \"DesktopAppLaunchCallback\"\n        , direction = DirectionIn\n        , mayBeNull = True\n        , argScope = ScopeTypeCall\n        , argClosure = 7\n        , argDestroy = -1\n        , transfer = TransferNothing\n        }\n    )\n  ]\n4"
-- method DesktopAppInfo::list_actions
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DesktopAppInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TCArray True (-1) (-1) (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_desktop_app_info_list_actions" g_desktop_app_info_list_actions :: 
    Ptr DesktopAppInfo ->                   -- _obj : TInterface "Gio" "DesktopAppInfo"
    IO (Ptr CString)


desktopAppInfoListActions ::
    (MonadIO m, DesktopAppInfoK a) =>
    a ->                                    -- _obj
    m [T.Text]
desktopAppInfoListActions _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_desktop_app_info_list_actions _obj'
    checkUnexpectedReturnNULL "g_desktop_app_info_list_actions" result
    result' <- unpackZeroTerminatedUTF8CArray result
    touchManagedPtr _obj
    return result'

-- method DesktopAppInfo::get_implementations
-- method type : MemberFunction
-- Args : [Arg {argName = "interface", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "interface", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGList (TInterface "Gio" "DesktopAppInfo")
-- throws : False
-- Skip return : False

foreign import ccall "g_desktop_app_info_get_implementations" g_desktop_app_info_get_implementations :: 
    CString ->                              -- interface : TBasicType TUTF8
    IO (Ptr (GList (Ptr DesktopAppInfo)))


desktopAppInfoGetImplementations ::
    (MonadIO m) =>
    T.Text ->                               -- interface
    m [DesktopAppInfo]
desktopAppInfoGetImplementations interface = liftIO $ do
    interface' <- textToCString interface
    result <- g_desktop_app_info_get_implementations interface'
    checkUnexpectedReturnNULL "g_desktop_app_info_get_implementations" result
    result' <- unpackGList result
    result'' <- mapM (wrapObject DesktopAppInfo) result'
    g_list_free result
    freeMem interface'
    return result''

-- method DesktopAppInfo::search
-- method type : MemberFunction
-- Args : [Arg {argName = "search_string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "search_string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TCArray True (-1) (-1) (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "g_desktop_app_info_search" g_desktop_app_info_search :: 
    CString ->                              -- search_string : TBasicType TUTF8
    IO (Ptr (Ptr CString))


desktopAppInfoSearch ::
    (MonadIO m) =>
    T.Text ->                               -- search_string
    m [[T.Text]]
desktopAppInfoSearch search_string = liftIO $ do
    search_string' <- textToCString search_string
    result <- g_desktop_app_info_search search_string'
    checkUnexpectedReturnNULL "g_desktop_app_info_search" result
    result' <- unpackZeroTerminatedPtrArray result
    result'' <- mapM unpackZeroTerminatedUTF8CArray result'
    let freeElemOfResult e = mapZeroTerminatedCArray freeMem e >> freeMem e
    mapZeroTerminatedCArray freeElemOfResult result
    freeMem result
    freeMem search_string'
    return result''

-- method DesktopAppInfo::set_desktop_env
-- method type : MemberFunction
-- Args : [Arg {argName = "desktop_env", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "desktop_env", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_desktop_app_info_set_desktop_env" g_desktop_app_info_set_desktop_env :: 
    CString ->                              -- desktop_env : TBasicType TUTF8
    IO ()

{-# DEPRECATED desktopAppInfoSetDesktopEnv ["(Since version 2.42)","do not use this API.  Since 2.42 the value of the","`XDG_CURRENT_DESKTOP` environment variable will be used."]#-}
desktopAppInfoSetDesktopEnv ::
    (MonadIO m) =>
    T.Text ->                               -- desktop_env
    m ()
desktopAppInfoSetDesktopEnv desktop_env = liftIO $ do
    desktop_env' <- textToCString desktop_env
    g_desktop_app_info_set_desktop_env desktop_env'
    freeMem desktop_env'
    return ()