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

The 'GI.Wnck.Objects.Application.Application' struct contains only private fields and should not be
directly accessed.
-}

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

module GI.Wnck.Objects.Application
    (

-- * Exported types
    Application(..)                         ,
    IsApplication                           ,
    toApplication                           ,
    noApplication                           ,


 -- * Methods
-- ** get #method:get#

    applicationGet                          ,


-- ** getIcon #method:getIcon#

#if ENABLE_OVERLOADING
    ApplicationGetIconMethodInfo            ,
#endif
    applicationGetIcon                      ,


-- ** getIconIsFallback #method:getIconIsFallback#

#if ENABLE_OVERLOADING
    ApplicationGetIconIsFallbackMethodInfo  ,
#endif
    applicationGetIconIsFallback            ,


-- ** getIconName #method:getIconName#

#if ENABLE_OVERLOADING
    ApplicationGetIconNameMethodInfo        ,
#endif
    applicationGetIconName                  ,


-- ** getMiniIcon #method:getMiniIcon#

#if ENABLE_OVERLOADING
    ApplicationGetMiniIconMethodInfo        ,
#endif
    applicationGetMiniIcon                  ,


-- ** getNWindows #method:getNWindows#

#if ENABLE_OVERLOADING
    ApplicationGetNWindowsMethodInfo        ,
#endif
    applicationGetNWindows                  ,


-- ** getName #method:getName#

#if ENABLE_OVERLOADING
    ApplicationGetNameMethodInfo            ,
#endif
    applicationGetName                      ,


-- ** getPid #method:getPid#

#if ENABLE_OVERLOADING
    ApplicationGetPidMethodInfo             ,
#endif
    applicationGetPid                       ,


-- ** getStartupId #method:getStartupId#

#if ENABLE_OVERLOADING
    ApplicationGetStartupIdMethodInfo       ,
#endif
    applicationGetStartupId                 ,


-- ** getWindows #method:getWindows#

#if ENABLE_OVERLOADING
    ApplicationGetWindowsMethodInfo         ,
#endif
    applicationGetWindows                   ,


-- ** getXid #method:getXid#

#if ENABLE_OVERLOADING
    ApplicationGetXidMethodInfo             ,
#endif
    applicationGetXid                       ,




 -- * Signals
-- ** iconChanged #signal:iconChanged#

    ApplicationIconChangedCallback          ,
#if ENABLE_OVERLOADING
    ApplicationIconChangedSignalInfo        ,
#endif
    C_ApplicationIconChangedCallback        ,
    afterApplicationIconChanged             ,
    genClosure_ApplicationIconChanged       ,
    mk_ApplicationIconChangedCallback       ,
    noApplicationIconChangedCallback        ,
    onApplicationIconChanged                ,
    wrap_ApplicationIconChangedCallback     ,


-- ** nameChanged #signal:nameChanged#

    ApplicationNameChangedCallback          ,
#if ENABLE_OVERLOADING
    ApplicationNameChangedSignalInfo        ,
#endif
    C_ApplicationNameChangedCallback        ,
    afterApplicationNameChanged             ,
    genClosure_ApplicationNameChanged       ,
    mk_ApplicationNameChangedCallback       ,
    noApplicationNameChangedCallback        ,
    onApplicationNameChanged                ,
    wrap_ApplicationNameChangedCallback     ,




    ) 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 qualified GI.GdkPixbuf.Objects.Pixbuf as GdkPixbuf.Pixbuf
import {-# SOURCE #-} qualified GI.Wnck.Objects.Window as Wnck.Window

-- | Memory-managed wrapper type.
newtype Application = Application (ManagedPtr Application)
foreign import ccall "wnck_application_get_type"
    c_wnck_application_get_type :: IO GType

instance GObject Application where
    gobjectType = c_wnck_application_get_type


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

instance O.HasParentTypes Application
type instance O.ParentTypes Application = '[GObject.Object.Object]

-- | Cast to `Application`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toApplication :: (MonadIO m, IsApplication o) => o -> m Application
toApplication = liftIO . unsafeCastTo Application

-- | A convenience alias for `Nothing` :: `Maybe` `Application`.
noApplication :: Maybe Application
noApplication = Nothing

#if ENABLE_OVERLOADING
type family ResolveApplicationMethod (t :: Symbol) (o :: *) :: * where
    ResolveApplicationMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveApplicationMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveApplicationMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveApplicationMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveApplicationMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveApplicationMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveApplicationMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveApplicationMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveApplicationMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveApplicationMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveApplicationMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveApplicationMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveApplicationMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveApplicationMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveApplicationMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveApplicationMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveApplicationMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveApplicationMethod "getIcon" o = ApplicationGetIconMethodInfo
    ResolveApplicationMethod "getIconIsFallback" o = ApplicationGetIconIsFallbackMethodInfo
    ResolveApplicationMethod "getIconName" o = ApplicationGetIconNameMethodInfo
    ResolveApplicationMethod "getMiniIcon" o = ApplicationGetMiniIconMethodInfo
    ResolveApplicationMethod "getNWindows" o = ApplicationGetNWindowsMethodInfo
    ResolveApplicationMethod "getName" o = ApplicationGetNameMethodInfo
    ResolveApplicationMethod "getPid" o = ApplicationGetPidMethodInfo
    ResolveApplicationMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveApplicationMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveApplicationMethod "getStartupId" o = ApplicationGetStartupIdMethodInfo
    ResolveApplicationMethod "getWindows" o = ApplicationGetWindowsMethodInfo
    ResolveApplicationMethod "getXid" o = ApplicationGetXidMethodInfo
    ResolveApplicationMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveApplicationMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveApplicationMethod l o = O.MethodResolutionFailed l o

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

-- signal Application::icon-changed
{- |
Emitted when the icon of /@app@/ changes.
-}
type ApplicationIconChangedCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ApplicationIconChangedCallback`@.
noApplicationIconChangedCallback :: Maybe ApplicationIconChangedCallback
noApplicationIconChangedCallback = Nothing

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

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

-- | Wrap the callback into a `GClosure`.
genClosure_ApplicationIconChanged :: MonadIO m => ApplicationIconChangedCallback -> m (GClosure C_ApplicationIconChangedCallback)
genClosure_ApplicationIconChanged cb = liftIO $ do
    let cb' = wrap_ApplicationIconChangedCallback cb
    mk_ApplicationIconChangedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `ApplicationIconChangedCallback` into a `C_ApplicationIconChangedCallback`.
wrap_ApplicationIconChangedCallback ::
    ApplicationIconChangedCallback ->
    C_ApplicationIconChangedCallback
wrap_ApplicationIconChangedCallback _cb _ _ = do
    _cb


{- |
Connect a signal handler for the “@icon-changed@” 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' application #iconChanged callback
@
-}
onApplicationIconChanged :: (IsApplication a, MonadIO m) => a -> ApplicationIconChangedCallback -> m SignalHandlerId
onApplicationIconChanged obj cb = liftIO $ do
    let cb' = wrap_ApplicationIconChangedCallback cb
    cb'' <- mk_ApplicationIconChangedCallback cb'
    connectSignalFunPtr obj "icon-changed" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@icon-changed@” 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' application #iconChanged callback
@
-}
afterApplicationIconChanged :: (IsApplication a, MonadIO m) => a -> ApplicationIconChangedCallback -> m SignalHandlerId
afterApplicationIconChanged obj cb = liftIO $ do
    let cb' = wrap_ApplicationIconChangedCallback cb
    cb'' <- mk_ApplicationIconChangedCallback cb'
    connectSignalFunPtr obj "icon-changed" cb'' SignalConnectAfter


-- signal Application::name-changed
{- |
Emitted when the name of /@app@/ changes.
-}
type ApplicationNameChangedCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ApplicationNameChangedCallback`@.
noApplicationNameChangedCallback :: Maybe ApplicationNameChangedCallback
noApplicationNameChangedCallback = Nothing

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

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

-- | Wrap the callback into a `GClosure`.
genClosure_ApplicationNameChanged :: MonadIO m => ApplicationNameChangedCallback -> m (GClosure C_ApplicationNameChangedCallback)
genClosure_ApplicationNameChanged cb = liftIO $ do
    let cb' = wrap_ApplicationNameChangedCallback cb
    mk_ApplicationNameChangedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `ApplicationNameChangedCallback` into a `C_ApplicationNameChangedCallback`.
wrap_ApplicationNameChangedCallback ::
    ApplicationNameChangedCallback ->
    C_ApplicationNameChangedCallback
wrap_ApplicationNameChangedCallback _cb _ _ = do
    _cb


{- |
Connect a signal handler for the “@name-changed@” 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' application #nameChanged callback
@
-}
onApplicationNameChanged :: (IsApplication a, MonadIO m) => a -> ApplicationNameChangedCallback -> m SignalHandlerId
onApplicationNameChanged obj cb = liftIO $ do
    let cb' = wrap_ApplicationNameChangedCallback cb
    cb'' <- mk_ApplicationNameChangedCallback cb'
    connectSignalFunPtr obj "name-changed" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@name-changed@” 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' application #nameChanged callback
@
-}
afterApplicationNameChanged :: (IsApplication a, MonadIO m) => a -> ApplicationNameChangedCallback -> m SignalHandlerId
afterApplicationNameChanged obj cb = liftIO $ do
    let cb' = wrap_ApplicationNameChangedCallback cb
    cb'' <- mk_ApplicationNameChangedCallback cb'
    connectSignalFunPtr obj "name-changed" cb'' SignalConnectAfter


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

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
data ApplicationIconChangedSignalInfo
instance SignalInfo ApplicationIconChangedSignalInfo where
    type HaskellCallbackType ApplicationIconChangedSignalInfo = ApplicationIconChangedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_ApplicationIconChangedCallback cb
        cb'' <- mk_ApplicationIconChangedCallback cb'
        connectSignalFunPtr obj "icon-changed" cb'' connectMode

data ApplicationNameChangedSignalInfo
instance SignalInfo ApplicationNameChangedSignalInfo where
    type HaskellCallbackType ApplicationNameChangedSignalInfo = ApplicationNameChangedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_ApplicationNameChangedCallback cb
        cb'' <- mk_ApplicationNameChangedCallback cb'
        connectSignalFunPtr obj "name-changed" cb'' connectMode

type instance O.SignalList Application = ApplicationSignalList
type ApplicationSignalList = ('[ '("iconChanged", ApplicationIconChangedSignalInfo), '("nameChanged", ApplicationNameChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method Application::get_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "app", argType = TInterface (Name {namespace = "Wnck", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckApplication.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GdkPixbuf", name = "Pixbuf"}))
-- throws : False
-- Skip return : False

foreign import ccall "wnck_application_get_icon" wnck_application_get_icon ::
    Ptr Application ->                      -- app : TInterface (Name {namespace = "Wnck", name = "Application"})
    IO (Ptr GdkPixbuf.Pixbuf.Pixbuf)

{- |
Gets the icon to be used for /@app@/. If no icon is set for /@app@/, a
suboptimal heuristic is used to find an appropriate icon. If no icon was
found, a fallback icon is used.
-}
applicationGetIcon ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@app@/: a 'GI.Wnck.Objects.Application.Application'. -}
    -> m GdkPixbuf.Pixbuf.Pixbuf
    {- ^ __Returns:__ the icon for /@app@/. The caller should
reference the returned \<classname>GdkPixbuf\<\/classname> if it needs to keep
the icon around. -}
applicationGetIcon app = liftIO $ do
    app' <- unsafeManagedPtrCastPtr app
    result <- wnck_application_get_icon app'
    checkUnexpectedReturnNULL "applicationGetIcon" result
    result' <- (newObject GdkPixbuf.Pixbuf.Pixbuf) result
    touchManagedPtr app
    return result'

#if ENABLE_OVERLOADING
data ApplicationGetIconMethodInfo
instance (signature ~ (m GdkPixbuf.Pixbuf.Pixbuf), MonadIO m, IsApplication a) => O.MethodInfo ApplicationGetIconMethodInfo a signature where
    overloadedMethod _ = applicationGetIcon

#endif

-- method Application::get_icon_is_fallback
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "app", argType = TInterface (Name {namespace = "Wnck", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckApplication", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "wnck_application_get_icon_is_fallback" wnck_application_get_icon_is_fallback ::
    Ptr Application ->                      -- app : TInterface (Name {namespace = "Wnck", name = "Application"})
    IO CInt

{- |
Gets whether a default fallback icon is used for /@app@/ (because none
was set on /@app@/).
-}
applicationGetIconIsFallback ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@app@/: a 'GI.Wnck.Objects.Application.Application' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the icon for /@app@/ is a fallback, 'False' otherwise. -}
applicationGetIconIsFallback app = liftIO $ do
    app' <- unsafeManagedPtrCastPtr app
    result <- wnck_application_get_icon_is_fallback app'
    let result' = (/= 0) result
    touchManagedPtr app
    return result'

#if ENABLE_OVERLOADING
data ApplicationGetIconIsFallbackMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsApplication a) => O.MethodInfo ApplicationGetIconIsFallbackMethodInfo a signature where
    overloadedMethod _ = applicationGetIconIsFallback

#endif

-- method Application::get_icon_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "app", argType = TInterface (Name {namespace = "Wnck", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckApplication", 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 "wnck_application_get_icon_name" wnck_application_get_icon_name ::
    Ptr Application ->                      -- app : TInterface (Name {namespace = "Wnck", name = "Application"})
    IO CString

{- |
Gets the icon name of /@app@/ (to be used when /@app@/ is minimized). Since
there is no way to properly find this name, various suboptimal heuristics
are used to find it.
-}
applicationGetIconName ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@app@/: a 'GI.Wnck.Objects.Application.Application' -}
    -> m T.Text
    {- ^ __Returns:__ the icon name of /@app@/, or a fallback icon name if no icon name
is available. -}
applicationGetIconName app = liftIO $ do
    app' <- unsafeManagedPtrCastPtr app
    result <- wnck_application_get_icon_name app'
    checkUnexpectedReturnNULL "applicationGetIconName" result
    result' <- cstringToText result
    touchManagedPtr app
    return result'

#if ENABLE_OVERLOADING
data ApplicationGetIconNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsApplication a) => O.MethodInfo ApplicationGetIconNameMethodInfo a signature where
    overloadedMethod _ = applicationGetIconName

#endif

-- method Application::get_mini_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "app", argType = TInterface (Name {namespace = "Wnck", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckApplication.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GdkPixbuf", name = "Pixbuf"}))
-- throws : False
-- Skip return : False

foreign import ccall "wnck_application_get_mini_icon" wnck_application_get_mini_icon ::
    Ptr Application ->                      -- app : TInterface (Name {namespace = "Wnck", name = "Application"})
    IO (Ptr GdkPixbuf.Pixbuf.Pixbuf)

{- |
Gets the mini-icon to be used for /@app@/. If no mini-icon is set for /@app@/,
a suboptimal heuristic is used to find an appropriate icon. If no mini-icon
was found, a fallback mini-icon is used.
-}
applicationGetMiniIcon ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@app@/: a 'GI.Wnck.Objects.Application.Application'. -}
    -> m GdkPixbuf.Pixbuf.Pixbuf
    {- ^ __Returns:__ the mini-icon for /@app@/. The caller should
reference the returned \<classname>GdkPixbuf\<\/classname> if it needs to keep
the mini-icon around. -}
applicationGetMiniIcon app = liftIO $ do
    app' <- unsafeManagedPtrCastPtr app
    result <- wnck_application_get_mini_icon app'
    checkUnexpectedReturnNULL "applicationGetMiniIcon" result
    result' <- (newObject GdkPixbuf.Pixbuf.Pixbuf) result
    touchManagedPtr app
    return result'

#if ENABLE_OVERLOADING
data ApplicationGetMiniIconMethodInfo
instance (signature ~ (m GdkPixbuf.Pixbuf.Pixbuf), MonadIO m, IsApplication a) => O.MethodInfo ApplicationGetMiniIconMethodInfo a signature where
    overloadedMethod _ = applicationGetMiniIcon

#endif

-- method Application::get_n_windows
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "app", argType = TInterface (Name {namespace = "Wnck", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckApplication.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "wnck_application_get_n_windows" wnck_application_get_n_windows ::
    Ptr Application ->                      -- app : TInterface (Name {namespace = "Wnck", name = "Application"})
    IO Int32

{- |
Gets the number of 'GI.Wnck.Objects.Window.Window' belonging to /@app@/.
-}
applicationGetNWindows ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@app@/: a 'GI.Wnck.Objects.Application.Application'. -}
    -> m Int32
    {- ^ __Returns:__ the number of 'GI.Wnck.Objects.Window.Window' belonging to /@app@/. -}
applicationGetNWindows app = liftIO $ do
    app' <- unsafeManagedPtrCastPtr app
    result <- wnck_application_get_n_windows app'
    touchManagedPtr app
    return result

#if ENABLE_OVERLOADING
data ApplicationGetNWindowsMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsApplication a) => O.MethodInfo ApplicationGetNWindowsMethodInfo a signature where
    overloadedMethod _ = applicationGetNWindows

#endif

-- method Application::get_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "app", argType = TInterface (Name {namespace = "Wnck", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckApplication.", 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 "wnck_application_get_name" wnck_application_get_name ::
    Ptr Application ->                      -- app : TInterface (Name {namespace = "Wnck", name = "Application"})
    IO CString

{- |
Gets the name of /@app@/. Since there is no way to properly find this name,
various suboptimal heuristics are used to find it. GTK+ should probably have
a function to allow applications to set the _NET_WM_NAME property on the
group leader as the application name, and the \<ulink
url=\"http:\/\/standards.freedesktop.org\/wm-spec\/wm-spec-latest.html\">EWMH\<\/ulink>
should say that this is where the application name goes.
-}
applicationGetName ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@app@/: a 'GI.Wnck.Objects.Application.Application'. -}
    -> m T.Text
    {- ^ __Returns:__ the name of /@app@/, or a fallback name if no name is available. -}
applicationGetName app = liftIO $ do
    app' <- unsafeManagedPtrCastPtr app
    result <- wnck_application_get_name app'
    checkUnexpectedReturnNULL "applicationGetName" result
    result' <- cstringToText result
    touchManagedPtr app
    return result'

#if ENABLE_OVERLOADING
data ApplicationGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsApplication a) => O.MethodInfo ApplicationGetNameMethodInfo a signature where
    overloadedMethod _ = applicationGetName

#endif

-- method Application::get_pid
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "app", argType = TInterface (Name {namespace = "Wnck", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckApplication.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "wnck_application_get_pid" wnck_application_get_pid ::
    Ptr Application ->                      -- app : TInterface (Name {namespace = "Wnck", name = "Application"})
    IO Int32

{- |
Gets the process ID of /@app@/.
-}
applicationGetPid ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@app@/: a 'GI.Wnck.Objects.Application.Application'. -}
    -> m Int32
    {- ^ __Returns:__ the process ID of /@app@/, or 0 if none is available. -}
applicationGetPid app = liftIO $ do
    app' <- unsafeManagedPtrCastPtr app
    result <- wnck_application_get_pid app'
    touchManagedPtr app
    return result

#if ENABLE_OVERLOADING
data ApplicationGetPidMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsApplication a) => O.MethodInfo ApplicationGetPidMethodInfo a signature where
    overloadedMethod _ = applicationGetPid

#endif

-- method Application::get_startup_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "app", argType = TInterface (Name {namespace = "Wnck", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckApplication.", 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 "wnck_application_get_startup_id" wnck_application_get_startup_id ::
    Ptr Application ->                      -- app : TInterface (Name {namespace = "Wnck", name = "Application"})
    IO CString

{- |
Gets the startup sequence ID used for startup notification of /@app@/.

/Since: 2.2/
-}
applicationGetStartupId ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@app@/: a 'GI.Wnck.Objects.Application.Application'. -}
    -> m T.Text
    {- ^ __Returns:__ the startup sequence ID used for startup notification of /@app@/,
or 'Nothing' if none is available. -}
applicationGetStartupId app = liftIO $ do
    app' <- unsafeManagedPtrCastPtr app
    result <- wnck_application_get_startup_id app'
    checkUnexpectedReturnNULL "applicationGetStartupId" result
    result' <- cstringToText result
    touchManagedPtr app
    return result'

#if ENABLE_OVERLOADING
data ApplicationGetStartupIdMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsApplication a) => O.MethodInfo ApplicationGetStartupIdMethodInfo a signature where
    overloadedMethod _ = applicationGetStartupId

#endif

-- method Application::get_windows
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "app", argType = TInterface (Name {namespace = "Wnck", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckApplication.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TInterface (Name {namespace = "Wnck", name = "Window"})))
-- throws : False
-- Skip return : False

foreign import ccall "wnck_application_get_windows" wnck_application_get_windows ::
    Ptr Application ->                      -- app : TInterface (Name {namespace = "Wnck", name = "Application"})
    IO (Ptr (GList (Ptr Wnck.Window.Window)))

{- |
Gets the list of 'GI.Wnck.Objects.Window.Window' belonging to /@app@/.
-}
applicationGetWindows ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@app@/: a 'GI.Wnck.Objects.Application.Application'. -}
    -> m [Wnck.Window.Window]
    {- ^ __Returns:__ the list of
'GI.Wnck.Objects.Window.Window' belonging to /@app@/, or 'Nothing' if the application contains no
window. The list should not be modified nor freed, as it is owned by /@app@/. -}
applicationGetWindows app = liftIO $ do
    app' <- unsafeManagedPtrCastPtr app
    result <- wnck_application_get_windows app'
    result' <- unpackGList result
    result'' <- mapM (newObject Wnck.Window.Window) result'
    touchManagedPtr app
    return result''

#if ENABLE_OVERLOADING
data ApplicationGetWindowsMethodInfo
instance (signature ~ (m [Wnck.Window.Window]), MonadIO m, IsApplication a) => O.MethodInfo ApplicationGetWindowsMethodInfo a signature where
    overloadedMethod _ = applicationGetWindows

#endif

-- method Application::get_xid
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "app", argType = TInterface (Name {namespace = "Wnck", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckApplication.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TULong)
-- throws : False
-- Skip return : False

foreign import ccall "wnck_application_get_xid" wnck_application_get_xid ::
    Ptr Application ->                      -- app : TInterface (Name {namespace = "Wnck", name = "Application"})
    IO CULong

{- |
Gets the X window ID of the group leader window for /@app@/.
-}
applicationGetXid ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@app@/: a 'GI.Wnck.Objects.Application.Application'. -}
    -> m CULong
    {- ^ __Returns:__ the X window ID of the group leader window for /@app@/. -}
applicationGetXid app = liftIO $ do
    app' <- unsafeManagedPtrCastPtr app
    result <- wnck_application_get_xid app'
    touchManagedPtr app
    return result

#if ENABLE_OVERLOADING
data ApplicationGetXidMethodInfo
instance (signature ~ (m CULong), MonadIO m, IsApplication a) => O.MethodInfo ApplicationGetXidMethodInfo a signature where
    overloadedMethod _ = applicationGetXid

#endif

-- method Application::get
-- method type : MemberFunction
-- Args : [Arg {argCName = "xwindow", argType = TBasicType TULong, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the X window ID of a group leader.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Wnck", name = "Application"}))
-- throws : False
-- Skip return : False

foreign import ccall "wnck_application_get" wnck_application_get ::
    CULong ->                               -- xwindow : TBasicType TULong
    IO (Ptr Application)

{- |
Gets the 'GI.Wnck.Objects.Application.Application' corresponding to the group leader with /@xwindow@/
as X window ID.
-}
applicationGet ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CULong
    {- ^ /@xwindow@/: the X window ID of a group leader. -}
    -> m Application
    {- ^ __Returns:__ the 'GI.Wnck.Objects.Application.Application' corresponding to
/@xwindow@/, or 'Nothing' if there no such 'GI.Wnck.Objects.Application.Application' could be found. The
returned 'GI.Wnck.Objects.Application.Application' is owned by libwnck and must not be referenced or
unreferenced. -}
applicationGet xwindow = liftIO $ do
    result <- wnck_application_get xwindow
    checkUnexpectedReturnNULL "applicationGet" result
    result' <- (newObject Application) result
    return result'

#if ENABLE_OVERLOADING
#endif