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

A 'GI.Gio.Objects.Application.Application' is the foundation of an application.  It wraps some
low-level platform-specific services and is intended to act as the
foundation for higher-level application classes such as
@/GtkApplication/@ or @/MxApplication/@.  In general, you should not use
this class outside of a higher level framework.

GApplication provides convenient life cycle management by maintaining
a \"use count\" for the primary application instance. The use count can
be changed using 'GI.Gio.Objects.Application.applicationHold' and 'GI.Gio.Objects.Application.applicationRelease'. If
it drops to zero, the application exits. Higher-level classes such as
@/GtkApplication/@ employ the use count to ensure that the application
stays alive as long as it has any opened windows.

Another feature that GApplication (optionally) provides is process
uniqueness. Applications can make use of this functionality by
providing a unique application ID. If given, only one application
with this ID can be running at a time per session. The session
concept is platform-dependent, but corresponds roughly to a graphical
desktop login. When your application is launched again, its
arguments are passed through platform communication to the already
running program. The already running instance of the program is
called the \"primary instance\"; for non-unique applications this is
the always the current instance. On Linux, the D-Bus session bus
is used for communication.

The use of 'GI.Gio.Objects.Application.Application' differs from some other commonly-used
uniqueness libraries (such as libunique) in important ways. The
application is not expected to manually register itself and check
if it is the primary instance. Instead, the @/main()/@ function of a
'GI.Gio.Objects.Application.Application' should do very little more than instantiating the
application instance, possibly connecting signal handlers, then
calling 'GI.Gio.Objects.Application.applicationRun'. All checks for uniqueness are done
internally. If the application is the primary instance then the
startup signal is emitted and the mainloop runs. If the application
is not the primary instance then a signal is sent to the primary
instance and 'GI.Gio.Objects.Application.applicationRun' promptly returns. See the code
examples below.

If used, the expected form of an application identifier is very close
to that of of a
<http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-interface DBus bus name>.
Examples include: \"com.example.MyApp\", \"org.example.internal-apps.Calculator\".
For details on valid application identifiers, see 'GI.Gio.Objects.Application.applicationIdIsValid'.

On Linux, the application identifier is claimed as a well-known bus name
on the user\'s session bus.  This means that the uniqueness of your
application is scoped to the current session.  It also means that your
application may provide additional services (through registration of other
object paths) at that bus name.  The registration of these object paths
should be done with the shared GDBus session bus.  Note that due to the
internal architecture of GDBus, method calls can be dispatched at any time
(even if a main loop is not running).  For this reason, you must ensure that
any object paths that you wish to register are registered before 'GI.Gio.Objects.Application.Application'
attempts to acquire the bus name of your application (which happens in
'GI.Gio.Objects.Application.applicationRegister').  Unfortunately, this means that you cannot use
'GI.Gio.Objects.Application.applicationGetIsRemote' to decide if you want to register object paths.

GApplication also implements the 'GI.Gio.Interfaces.ActionGroup.ActionGroup' and 'GI.Gio.Interfaces.ActionMap.ActionMap'
interfaces and lets you easily export actions by adding them with
'GI.Gio.Interfaces.ActionMap.actionMapAddAction'. When invoking an action by calling
'GI.Gio.Interfaces.ActionGroup.actionGroupActivateAction' on the application, it is always
invoked in the primary instance. The actions are also exported on
the session bus, and GIO provides the 'GI.Gio.Objects.DBusActionGroup.DBusActionGroup' wrapper to
conveniently access them remotely. GIO provides a 'GI.Gio.Objects.DBusMenuModel.DBusMenuModel' wrapper
for remote access to exported @/GMenuModels/@.

There is a number of different entry points into a GApplication:

* via \'Activate\' (i.e. just starting the application)
* via \'Open\' (i.e. opening some files)
* by handling a command-line
* via activating an action


The 'GI.Gio.Objects.Application.Application'::@/startup/@ signal lets you handle the application
initialization for all of these in a single place.

Regardless of which of these entry points is used to start the
application, GApplication passes some \"platform data from the
launching instance to the primary instance, in the form of a
'GVariant' dictionary mapping strings to variants. To use platform
data, override the /@beforeEmit@/ or /@afterEmit@/ virtual functions
in your 'GI.Gio.Objects.Application.Application' subclass. When dealing with
'GI.Gio.Objects.ApplicationCommandLine.ApplicationCommandLine' objects, the platform data is
directly available via 'GI.Gio.Objects.ApplicationCommandLine.applicationCommandLineGetCwd',
'GI.Gio.Objects.ApplicationCommandLine.applicationCommandLineGetEnviron' and
'GI.Gio.Objects.ApplicationCommandLine.applicationCommandLineGetPlatformData'.

As the name indicates, the platform data may vary depending on the
operating system, but it always includes the current directory (key
\"cwd\"), and optionally the environment (ie the set of environment
variables and their values) of the calling process (key \"environ\").
The environment is only added to the platform data if the
'GI.Gio.Flags.ApplicationFlagsSendEnvironment' flag is set. 'GI.Gio.Objects.Application.Application' subclasses
can add their own platform data by overriding the /@addPlatformData@/
virtual function. For instance, @/GtkApplication/@ adds startup notification
data in this way.

To parse commandline arguments you may handle the
'GI.Gio.Objects.Application.Application'::@/command-line/@ signal or override the @/local_command_line()/@
vfunc, to parse them in either the primary instance or the local instance,
respectively.

For an example of opening files with a GApplication, see
<https://git.gnome.org/browse/glib/tree/gio/tests/gapplication-example-open.c gapplication-example-open.c>.

For an example of using actions with GApplication, see
<https://git.gnome.org/browse/glib/tree/gio/tests/gapplication-example-actions.c gapplication-example-actions.c>.

For an example of using extra D-Bus hooks with GApplication, see
<https://git.gnome.org/browse/glib/tree/gio/tests/gapplication-example-dbushooks.c gapplication-example-dbushooks.c>.
-}

module GI.Gio.Objects.Application
    ( 

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


 -- * Methods
-- ** activate #method:activate#
    ApplicationActivateMethodInfo           ,
    applicationActivate                     ,


-- ** addMainOption #method:addMainOption#
    ApplicationAddMainOptionMethodInfo      ,
    applicationAddMainOption                ,


-- ** addMainOptionEntries #method:addMainOptionEntries#
    ApplicationAddMainOptionEntriesMethodInfo,
    applicationAddMainOptionEntries         ,


-- ** addOptionGroup #method:addOptionGroup#
    ApplicationAddOptionGroupMethodInfo     ,
    applicationAddOptionGroup               ,


-- ** bindBusyProperty #method:bindBusyProperty#
    ApplicationBindBusyPropertyMethodInfo   ,
    applicationBindBusyProperty             ,


-- ** getApplicationId #method:getApplicationId#
    ApplicationGetApplicationIdMethodInfo   ,
    applicationGetApplicationId             ,


-- ** getDbusConnection #method:getDbusConnection#
    ApplicationGetDbusConnectionMethodInfo  ,
    applicationGetDbusConnection            ,


-- ** getDbusObjectPath #method:getDbusObjectPath#
    ApplicationGetDbusObjectPathMethodInfo  ,
    applicationGetDbusObjectPath            ,


-- ** getDefault #method:getDefault#
    applicationGetDefault                   ,


-- ** getFlags #method:getFlags#
    ApplicationGetFlagsMethodInfo           ,
    applicationGetFlags                     ,


-- ** getInactivityTimeout #method:getInactivityTimeout#
    ApplicationGetInactivityTimeoutMethodInfo,
    applicationGetInactivityTimeout         ,


-- ** getIsBusy #method:getIsBusy#
    ApplicationGetIsBusyMethodInfo          ,
    applicationGetIsBusy                    ,


-- ** getIsRegistered #method:getIsRegistered#
    ApplicationGetIsRegisteredMethodInfo    ,
    applicationGetIsRegistered              ,


-- ** getIsRemote #method:getIsRemote#
    ApplicationGetIsRemoteMethodInfo        ,
    applicationGetIsRemote                  ,


-- ** getResourceBasePath #method:getResourceBasePath#
    ApplicationGetResourceBasePathMethodInfo,
    applicationGetResourceBasePath          ,


-- ** hold #method:hold#
    ApplicationHoldMethodInfo               ,
    applicationHold                         ,


-- ** idIsValid #method:idIsValid#
    applicationIdIsValid                    ,


-- ** markBusy #method:markBusy#
    ApplicationMarkBusyMethodInfo           ,
    applicationMarkBusy                     ,


-- ** new #method:new#
    applicationNew                          ,


-- ** open #method:open#
    ApplicationOpenMethodInfo               ,
    applicationOpen                         ,


-- ** quit #method:quit#
    ApplicationQuitMethodInfo               ,
    applicationQuit                         ,


-- ** register #method:register#
    ApplicationRegisterMethodInfo           ,
    applicationRegister                     ,


-- ** release #method:release#
    ApplicationReleaseMethodInfo            ,
    applicationRelease                      ,


-- ** run #method:run#
    ApplicationRunMethodInfo                ,
    applicationRun                          ,


-- ** sendNotification #method:sendNotification#
    ApplicationSendNotificationMethodInfo   ,
    applicationSendNotification             ,


-- ** setActionGroup #method:setActionGroup#
    ApplicationSetActionGroupMethodInfo     ,
    applicationSetActionGroup               ,


-- ** setApplicationId #method:setApplicationId#
    ApplicationSetApplicationIdMethodInfo   ,
    applicationSetApplicationId             ,


-- ** setDefault #method:setDefault#
    ApplicationSetDefaultMethodInfo         ,
    applicationSetDefault                   ,


-- ** setFlags #method:setFlags#
    ApplicationSetFlagsMethodInfo           ,
    applicationSetFlags                     ,


-- ** setInactivityTimeout #method:setInactivityTimeout#
    ApplicationSetInactivityTimeoutMethodInfo,
    applicationSetInactivityTimeout         ,


-- ** setResourceBasePath #method:setResourceBasePath#
    ApplicationSetResourceBasePathMethodInfo,
    applicationSetResourceBasePath          ,


-- ** unbindBusyProperty #method:unbindBusyProperty#
    ApplicationUnbindBusyPropertyMethodInfo ,
    applicationUnbindBusyProperty           ,


-- ** unmarkBusy #method:unmarkBusy#
    ApplicationUnmarkBusyMethodInfo         ,
    applicationUnmarkBusy                   ,


-- ** withdrawNotification #method:withdrawNotification#
    ApplicationWithdrawNotificationMethodInfo,
    applicationWithdrawNotification         ,




 -- * Properties
-- ** actionGroup #attr:actionGroup#
    ApplicationActionGroupPropertyInfo      ,
    applicationActionGroup                  ,
    clearApplicationActionGroup             ,
    constructApplicationActionGroup         ,
    setApplicationActionGroup               ,


-- ** applicationId #attr:applicationId#
    ApplicationApplicationIdPropertyInfo    ,
    applicationApplicationId                ,
    clearApplicationApplicationId           ,
    constructApplicationApplicationId       ,
    getApplicationApplicationId             ,
    setApplicationApplicationId             ,


-- ** flags #attr:flags#
    ApplicationFlagsPropertyInfo            ,
    applicationFlags                        ,
    constructApplicationFlags               ,
    getApplicationFlags                     ,
    setApplicationFlags                     ,


-- ** inactivityTimeout #attr:inactivityTimeout#
    ApplicationInactivityTimeoutPropertyInfo,
    applicationInactivityTimeout            ,
    constructApplicationInactivityTimeout   ,
    getApplicationInactivityTimeout         ,
    setApplicationInactivityTimeout         ,


-- ** isBusy #attr:isBusy#
    ApplicationIsBusyPropertyInfo           ,
    applicationIsBusy                       ,
    getApplicationIsBusy                    ,


-- ** isRegistered #attr:isRegistered#
    ApplicationIsRegisteredPropertyInfo     ,
    applicationIsRegistered                 ,
    getApplicationIsRegistered              ,


-- ** isRemote #attr:isRemote#
    ApplicationIsRemotePropertyInfo         ,
    applicationIsRemote                     ,
    getApplicationIsRemote                  ,


-- ** resourceBasePath #attr:resourceBasePath#
    ApplicationResourceBasePathPropertyInfo ,
    applicationResourceBasePath             ,
    clearApplicationResourceBasePath        ,
    constructApplicationResourceBasePath    ,
    getApplicationResourceBasePath          ,
    setApplicationResourceBasePath          ,




 -- * Signals
-- ** activate #signal:activate#
    ApplicationActivateCallback             ,
    ApplicationActivateSignalInfo           ,
    C_ApplicationActivateCallback           ,
    afterApplicationActivate                ,
    genClosure_ApplicationActivate          ,
    mk_ApplicationActivateCallback          ,
    noApplicationActivateCallback           ,
    onApplicationActivate                   ,
    wrap_ApplicationActivateCallback        ,


-- ** commandLine #signal:commandLine#
    ApplicationCommandLineCallback          ,
    ApplicationCommandLineSignalInfo        ,
    C_ApplicationCommandLineCallback        ,
    afterApplicationCommandLine             ,
    genClosure_ApplicationCommandLine       ,
    mk_ApplicationCommandLineCallback       ,
    noApplicationCommandLineCallback        ,
    onApplicationCommandLine                ,
    wrap_ApplicationCommandLineCallback     ,


-- ** handleLocalOptions #signal:handleLocalOptions#
    ApplicationHandleLocalOptionsCallback   ,
    ApplicationHandleLocalOptionsSignalInfo ,
    C_ApplicationHandleLocalOptionsCallback ,
    afterApplicationHandleLocalOptions      ,
    genClosure_ApplicationHandleLocalOptions,
    mk_ApplicationHandleLocalOptionsCallback,
    noApplicationHandleLocalOptionsCallback ,
    onApplicationHandleLocalOptions         ,
    wrap_ApplicationHandleLocalOptionsCallback,


-- ** open #signal:open#
    ApplicationOpenCallback                 ,
    ApplicationOpenSignalInfo               ,
    C_ApplicationOpenCallback               ,
    afterApplicationOpen                    ,
    genClosure_ApplicationOpen              ,
    mk_ApplicationOpenCallback              ,
    noApplicationOpenCallback               ,
    onApplicationOpen                       ,
    wrap_ApplicationOpenCallback            ,


-- ** shutdown #signal:shutdown#
    ApplicationShutdownCallback             ,
    ApplicationShutdownSignalInfo           ,
    C_ApplicationShutdownCallback           ,
    afterApplicationShutdown                ,
    genClosure_ApplicationShutdown          ,
    mk_ApplicationShutdownCallback          ,
    noApplicationShutdownCallback           ,
    onApplicationShutdown                   ,
    wrap_ApplicationShutdownCallback        ,


-- ** startup #signal:startup#
    ApplicationStartupCallback              ,
    ApplicationStartupSignalInfo            ,
    C_ApplicationStartupCallback            ,
    afterApplicationStartup                 ,
    genClosure_ApplicationStartup           ,
    mk_ApplicationStartupCallback           ,
    noApplicationStartupCallback            ,
    onApplicationStartup                    ,
    wrap_ApplicationStartupCallback         ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GLib.Enums as GLib.Enums
import qualified GI.GLib.Flags as GLib.Flags
import qualified GI.GLib.Structs.OptionEntry as GLib.OptionEntry
import qualified GI.GLib.Structs.OptionGroup as GLib.OptionGroup
import qualified GI.GLib.Structs.VariantDict as GLib.VariantDict
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Flags as Gio.Flags
import {-# SOURCE #-} qualified GI.Gio.Interfaces.ActionGroup as Gio.ActionGroup
import {-# SOURCE #-} qualified GI.Gio.Interfaces.ActionMap as Gio.ActionMap
import {-# SOURCE #-} qualified GI.Gio.Interfaces.File as Gio.File
import {-# SOURCE #-} qualified GI.Gio.Objects.ApplicationCommandLine as Gio.ApplicationCommandLine
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.DBusConnection as Gio.DBusConnection
import {-# SOURCE #-} qualified GI.Gio.Objects.Notification as Gio.Notification

newtype Application = Application (ManagedPtr Application)
foreign import ccall "g_application_get_type"
    c_g_application_get_type :: IO GType

instance GObject Application where
    gobjectType _ = c_g_application_get_type
    

class GObject o => IsApplication o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError Application a) =>
    IsApplication a
#endif
instance IsApplication Application
instance GObject.Object.IsObject Application
instance Gio.ActionGroup.IsActionGroup Application
instance Gio.ActionMap.IsActionMap Application

toApplication :: IsApplication o => o -> IO Application
toApplication = unsafeCastTo Application

noApplication :: Maybe Application
noApplication = Nothing

type family ResolveApplicationMethod (t :: Symbol) (o :: *) :: * where
    ResolveApplicationMethod "actionAdded" o = Gio.ActionGroup.ActionGroupActionAddedMethodInfo
    ResolveApplicationMethod "actionEnabledChanged" o = Gio.ActionGroup.ActionGroupActionEnabledChangedMethodInfo
    ResolveApplicationMethod "actionRemoved" o = Gio.ActionGroup.ActionGroupActionRemovedMethodInfo
    ResolveApplicationMethod "actionStateChanged" o = Gio.ActionGroup.ActionGroupActionStateChangedMethodInfo
    ResolveApplicationMethod "activate" o = ApplicationActivateMethodInfo
    ResolveApplicationMethod "activateAction" o = Gio.ActionGroup.ActionGroupActivateActionMethodInfo
    ResolveApplicationMethod "addAction" o = Gio.ActionMap.ActionMapAddActionMethodInfo
    ResolveApplicationMethod "addActionEntries" o = Gio.ActionMap.ActionMapAddActionEntriesMethodInfo
    ResolveApplicationMethod "addMainOption" o = ApplicationAddMainOptionMethodInfo
    ResolveApplicationMethod "addMainOptionEntries" o = ApplicationAddMainOptionEntriesMethodInfo
    ResolveApplicationMethod "addOptionGroup" o = ApplicationAddOptionGroupMethodInfo
    ResolveApplicationMethod "bindBusyProperty" o = ApplicationBindBusyPropertyMethodInfo
    ResolveApplicationMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveApplicationMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveApplicationMethod "changeActionState" o = Gio.ActionGroup.ActionGroupChangeActionStateMethodInfo
    ResolveApplicationMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveApplicationMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveApplicationMethod "hasAction" o = Gio.ActionGroup.ActionGroupHasActionMethodInfo
    ResolveApplicationMethod "hold" o = ApplicationHoldMethodInfo
    ResolveApplicationMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveApplicationMethod "listActions" o = Gio.ActionGroup.ActionGroupListActionsMethodInfo
    ResolveApplicationMethod "lookupAction" o = Gio.ActionMap.ActionMapLookupActionMethodInfo
    ResolveApplicationMethod "markBusy" o = ApplicationMarkBusyMethodInfo
    ResolveApplicationMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveApplicationMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveApplicationMethod "open" o = ApplicationOpenMethodInfo
    ResolveApplicationMethod "queryAction" o = Gio.ActionGroup.ActionGroupQueryActionMethodInfo
    ResolveApplicationMethod "quit" o = ApplicationQuitMethodInfo
    ResolveApplicationMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveApplicationMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveApplicationMethod "register" o = ApplicationRegisterMethodInfo
    ResolveApplicationMethod "release" o = ApplicationReleaseMethodInfo
    ResolveApplicationMethod "removeAction" o = Gio.ActionMap.ActionMapRemoveActionMethodInfo
    ResolveApplicationMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveApplicationMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveApplicationMethod "run" o = ApplicationRunMethodInfo
    ResolveApplicationMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveApplicationMethod "sendNotification" o = ApplicationSendNotificationMethodInfo
    ResolveApplicationMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveApplicationMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveApplicationMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveApplicationMethod "unbindBusyProperty" o = ApplicationUnbindBusyPropertyMethodInfo
    ResolveApplicationMethod "unmarkBusy" o = ApplicationUnmarkBusyMethodInfo
    ResolveApplicationMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveApplicationMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveApplicationMethod "withdrawNotification" o = ApplicationWithdrawNotificationMethodInfo
    ResolveApplicationMethod "getActionEnabled" o = Gio.ActionGroup.ActionGroupGetActionEnabledMethodInfo
    ResolveApplicationMethod "getActionParameterType" o = Gio.ActionGroup.ActionGroupGetActionParameterTypeMethodInfo
    ResolveApplicationMethod "getActionState" o = Gio.ActionGroup.ActionGroupGetActionStateMethodInfo
    ResolveApplicationMethod "getActionStateHint" o = Gio.ActionGroup.ActionGroupGetActionStateHintMethodInfo
    ResolveApplicationMethod "getActionStateType" o = Gio.ActionGroup.ActionGroupGetActionStateTypeMethodInfo
    ResolveApplicationMethod "getApplicationId" o = ApplicationGetApplicationIdMethodInfo
    ResolveApplicationMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveApplicationMethod "getDbusConnection" o = ApplicationGetDbusConnectionMethodInfo
    ResolveApplicationMethod "getDbusObjectPath" o = ApplicationGetDbusObjectPathMethodInfo
    ResolveApplicationMethod "getFlags" o = ApplicationGetFlagsMethodInfo
    ResolveApplicationMethod "getInactivityTimeout" o = ApplicationGetInactivityTimeoutMethodInfo
    ResolveApplicationMethod "getIsBusy" o = ApplicationGetIsBusyMethodInfo
    ResolveApplicationMethod "getIsRegistered" o = ApplicationGetIsRegisteredMethodInfo
    ResolveApplicationMethod "getIsRemote" o = ApplicationGetIsRemoteMethodInfo
    ResolveApplicationMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveApplicationMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveApplicationMethod "getResourceBasePath" o = ApplicationGetResourceBasePathMethodInfo
    ResolveApplicationMethod "setActionGroup" o = ApplicationSetActionGroupMethodInfo
    ResolveApplicationMethod "setApplicationId" o = ApplicationSetApplicationIdMethodInfo
    ResolveApplicationMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveApplicationMethod "setDefault" o = ApplicationSetDefaultMethodInfo
    ResolveApplicationMethod "setFlags" o = ApplicationSetFlagsMethodInfo
    ResolveApplicationMethod "setInactivityTimeout" o = ApplicationSetInactivityTimeoutMethodInfo
    ResolveApplicationMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveApplicationMethod "setResourceBasePath" o = ApplicationSetResourceBasePathMethodInfo
    ResolveApplicationMethod l o = O.MethodResolutionFailed l o

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

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

-- signal Application::activate
type ApplicationActivateCallback =
    IO ()

noApplicationActivateCallback :: Maybe ApplicationActivateCallback
noApplicationActivateCallback = Nothing

type C_ApplicationActivateCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_ApplicationActivateCallback :: C_ApplicationActivateCallback -> IO (FunPtr C_ApplicationActivateCallback)

genClosure_ApplicationActivate :: ApplicationActivateCallback -> IO Closure
genClosure_ApplicationActivate cb = do
    let cb' = wrap_ApplicationActivateCallback cb
    mk_ApplicationActivateCallback cb' >>= newCClosure


wrap_ApplicationActivateCallback ::
    ApplicationActivateCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_ApplicationActivateCallback _cb _ _ = do
    _cb 


onApplicationActivate :: (GObject a, MonadIO m) => a -> ApplicationActivateCallback -> m SignalHandlerId
onApplicationActivate obj cb = liftIO $ connectApplicationActivate obj cb SignalConnectBefore
afterApplicationActivate :: (GObject a, MonadIO m) => a -> ApplicationActivateCallback -> m SignalHandlerId
afterApplicationActivate obj cb = connectApplicationActivate obj cb SignalConnectAfter

connectApplicationActivate :: (GObject a, MonadIO m) =>
                              a -> ApplicationActivateCallback -> SignalConnectMode -> m SignalHandlerId
connectApplicationActivate obj cb after = liftIO $ do
    let cb' = wrap_ApplicationActivateCallback cb
    cb'' <- mk_ApplicationActivateCallback cb'
    connectSignalFunPtr obj "activate" cb'' after

-- signal Application::command-line
type ApplicationCommandLineCallback =
    Gio.ApplicationCommandLine.ApplicationCommandLine ->
    IO Int32

noApplicationCommandLineCallback :: Maybe ApplicationCommandLineCallback
noApplicationCommandLineCallback = Nothing

type C_ApplicationCommandLineCallback =
    Ptr () ->                               -- object
    Ptr Gio.ApplicationCommandLine.ApplicationCommandLine ->
    Ptr () ->                               -- user_data
    IO Int32

foreign import ccall "wrapper"
    mk_ApplicationCommandLineCallback :: C_ApplicationCommandLineCallback -> IO (FunPtr C_ApplicationCommandLineCallback)

genClosure_ApplicationCommandLine :: ApplicationCommandLineCallback -> IO Closure
genClosure_ApplicationCommandLine cb = do
    let cb' = wrap_ApplicationCommandLineCallback cb
    mk_ApplicationCommandLineCallback cb' >>= newCClosure


wrap_ApplicationCommandLineCallback ::
    ApplicationCommandLineCallback ->
    Ptr () ->
    Ptr Gio.ApplicationCommandLine.ApplicationCommandLine ->
    Ptr () ->
    IO Int32
wrap_ApplicationCommandLineCallback _cb _ commandLine _ = do
    commandLine' <- (newObject Gio.ApplicationCommandLine.ApplicationCommandLine) commandLine
    result <- _cb  commandLine'
    return result


onApplicationCommandLine :: (GObject a, MonadIO m) => a -> ApplicationCommandLineCallback -> m SignalHandlerId
onApplicationCommandLine obj cb = liftIO $ connectApplicationCommandLine obj cb SignalConnectBefore
afterApplicationCommandLine :: (GObject a, MonadIO m) => a -> ApplicationCommandLineCallback -> m SignalHandlerId
afterApplicationCommandLine obj cb = connectApplicationCommandLine obj cb SignalConnectAfter

connectApplicationCommandLine :: (GObject a, MonadIO m) =>
                                 a -> ApplicationCommandLineCallback -> SignalConnectMode -> m SignalHandlerId
connectApplicationCommandLine obj cb after = liftIO $ do
    let cb' = wrap_ApplicationCommandLineCallback cb
    cb'' <- mk_ApplicationCommandLineCallback cb'
    connectSignalFunPtr obj "command-line" cb'' after

-- signal Application::handle-local-options
type ApplicationHandleLocalOptionsCallback =
    GLib.VariantDict.VariantDict ->
    IO Int32

noApplicationHandleLocalOptionsCallback :: Maybe ApplicationHandleLocalOptionsCallback
noApplicationHandleLocalOptionsCallback = Nothing

type C_ApplicationHandleLocalOptionsCallback =
    Ptr () ->                               -- object
    Ptr GLib.VariantDict.VariantDict ->
    Ptr () ->                               -- user_data
    IO Int32

foreign import ccall "wrapper"
    mk_ApplicationHandleLocalOptionsCallback :: C_ApplicationHandleLocalOptionsCallback -> IO (FunPtr C_ApplicationHandleLocalOptionsCallback)

genClosure_ApplicationHandleLocalOptions :: ApplicationHandleLocalOptionsCallback -> IO Closure
genClosure_ApplicationHandleLocalOptions cb = do
    let cb' = wrap_ApplicationHandleLocalOptionsCallback cb
    mk_ApplicationHandleLocalOptionsCallback cb' >>= newCClosure


wrap_ApplicationHandleLocalOptionsCallback ::
    ApplicationHandleLocalOptionsCallback ->
    Ptr () ->
    Ptr GLib.VariantDict.VariantDict ->
    Ptr () ->
    IO Int32
wrap_ApplicationHandleLocalOptionsCallback _cb _ options _ = do
    options' <- (newBoxed GLib.VariantDict.VariantDict) options
    result <- _cb  options'
    return result


onApplicationHandleLocalOptions :: (GObject a, MonadIO m) => a -> ApplicationHandleLocalOptionsCallback -> m SignalHandlerId
onApplicationHandleLocalOptions obj cb = liftIO $ connectApplicationHandleLocalOptions obj cb SignalConnectBefore
afterApplicationHandleLocalOptions :: (GObject a, MonadIO m) => a -> ApplicationHandleLocalOptionsCallback -> m SignalHandlerId
afterApplicationHandleLocalOptions obj cb = connectApplicationHandleLocalOptions obj cb SignalConnectAfter

connectApplicationHandleLocalOptions :: (GObject a, MonadIO m) =>
                                        a -> ApplicationHandleLocalOptionsCallback -> SignalConnectMode -> m SignalHandlerId
connectApplicationHandleLocalOptions obj cb after = liftIO $ do
    let cb' = wrap_ApplicationHandleLocalOptionsCallback cb
    cb'' <- mk_ApplicationHandleLocalOptionsCallback cb'
    connectSignalFunPtr obj "handle-local-options" cb'' after

-- signal Application::open
type ApplicationOpenCallback =
    [Gio.File.File] ->
    T.Text ->
    IO ()

noApplicationOpenCallback :: Maybe ApplicationOpenCallback
noApplicationOpenCallback = Nothing

type C_ApplicationOpenCallback =
    Ptr () ->                               -- object
    Ptr (Ptr Gio.File.File) ->
    Int32 ->
    CString ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_ApplicationOpenCallback :: C_ApplicationOpenCallback -> IO (FunPtr C_ApplicationOpenCallback)

genClosure_ApplicationOpen :: ApplicationOpenCallback -> IO Closure
genClosure_ApplicationOpen cb = do
    let cb' = wrap_ApplicationOpenCallback cb
    mk_ApplicationOpenCallback cb' >>= newCClosure


wrap_ApplicationOpenCallback ::
    ApplicationOpenCallback ->
    Ptr () ->
    Ptr (Ptr Gio.File.File) ->
    Int32 ->
    CString ->
    Ptr () ->
    IO ()
wrap_ApplicationOpenCallback _cb _ files nFiles hint _ = do
    files' <- (unpackPtrArrayWithLength nFiles) files
    files'' <- mapM (newObject Gio.File.File) files'
    hint' <- cstringToText hint
    _cb  files'' hint'


onApplicationOpen :: (GObject a, MonadIO m) => a -> ApplicationOpenCallback -> m SignalHandlerId
onApplicationOpen obj cb = liftIO $ connectApplicationOpen obj cb SignalConnectBefore
afterApplicationOpen :: (GObject a, MonadIO m) => a -> ApplicationOpenCallback -> m SignalHandlerId
afterApplicationOpen obj cb = connectApplicationOpen obj cb SignalConnectAfter

connectApplicationOpen :: (GObject a, MonadIO m) =>
                          a -> ApplicationOpenCallback -> SignalConnectMode -> m SignalHandlerId
connectApplicationOpen obj cb after = liftIO $ do
    let cb' = wrap_ApplicationOpenCallback cb
    cb'' <- mk_ApplicationOpenCallback cb'
    connectSignalFunPtr obj "open" cb'' after

-- signal Application::shutdown
type ApplicationShutdownCallback =
    IO ()

noApplicationShutdownCallback :: Maybe ApplicationShutdownCallback
noApplicationShutdownCallback = Nothing

type C_ApplicationShutdownCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_ApplicationShutdownCallback :: C_ApplicationShutdownCallback -> IO (FunPtr C_ApplicationShutdownCallback)

genClosure_ApplicationShutdown :: ApplicationShutdownCallback -> IO Closure
genClosure_ApplicationShutdown cb = do
    let cb' = wrap_ApplicationShutdownCallback cb
    mk_ApplicationShutdownCallback cb' >>= newCClosure


wrap_ApplicationShutdownCallback ::
    ApplicationShutdownCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_ApplicationShutdownCallback _cb _ _ = do
    _cb 


onApplicationShutdown :: (GObject a, MonadIO m) => a -> ApplicationShutdownCallback -> m SignalHandlerId
onApplicationShutdown obj cb = liftIO $ connectApplicationShutdown obj cb SignalConnectBefore
afterApplicationShutdown :: (GObject a, MonadIO m) => a -> ApplicationShutdownCallback -> m SignalHandlerId
afterApplicationShutdown obj cb = connectApplicationShutdown obj cb SignalConnectAfter

connectApplicationShutdown :: (GObject a, MonadIO m) =>
                              a -> ApplicationShutdownCallback -> SignalConnectMode -> m SignalHandlerId
connectApplicationShutdown obj cb after = liftIO $ do
    let cb' = wrap_ApplicationShutdownCallback cb
    cb'' <- mk_ApplicationShutdownCallback cb'
    connectSignalFunPtr obj "shutdown" cb'' after

-- signal Application::startup
type ApplicationStartupCallback =
    IO ()

noApplicationStartupCallback :: Maybe ApplicationStartupCallback
noApplicationStartupCallback = Nothing

type C_ApplicationStartupCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_ApplicationStartupCallback :: C_ApplicationStartupCallback -> IO (FunPtr C_ApplicationStartupCallback)

genClosure_ApplicationStartup :: ApplicationStartupCallback -> IO Closure
genClosure_ApplicationStartup cb = do
    let cb' = wrap_ApplicationStartupCallback cb
    mk_ApplicationStartupCallback cb' >>= newCClosure


wrap_ApplicationStartupCallback ::
    ApplicationStartupCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_ApplicationStartupCallback _cb _ _ = do
    _cb 


onApplicationStartup :: (GObject a, MonadIO m) => a -> ApplicationStartupCallback -> m SignalHandlerId
onApplicationStartup obj cb = liftIO $ connectApplicationStartup obj cb SignalConnectBefore
afterApplicationStartup :: (GObject a, MonadIO m) => a -> ApplicationStartupCallback -> m SignalHandlerId
afterApplicationStartup obj cb = connectApplicationStartup obj cb SignalConnectAfter

connectApplicationStartup :: (GObject a, MonadIO m) =>
                             a -> ApplicationStartupCallback -> SignalConnectMode -> m SignalHandlerId
connectApplicationStartup obj cb after = liftIO $ do
    let cb' = wrap_ApplicationStartupCallback cb
    cb'' <- mk_ApplicationStartupCallback cb'
    connectSignalFunPtr obj "startup" cb'' after

-- VVV Prop "action-group"
   -- Type: TInterface (Name {namespace = "Gio", name = "ActionGroup"})
   -- Flags: [PropertyWritable]
   -- Nullable: (Nothing,Just True)

setApplicationActionGroup :: (MonadIO m, IsApplication o, Gio.ActionGroup.IsActionGroup a) => o -> a -> m ()
setApplicationActionGroup obj val = liftIO $ setObjectPropertyObject obj "action-group" (Just val)

constructApplicationActionGroup :: (IsApplication o, Gio.ActionGroup.IsActionGroup a) => a -> IO (GValueConstruct o)
constructApplicationActionGroup val = constructObjectPropertyObject "action-group" (Just val)

clearApplicationActionGroup :: (MonadIO m, IsApplication o) => o -> m ()
clearApplicationActionGroup obj = liftIO $ setObjectPropertyObject obj "action-group" (Nothing :: Maybe Gio.ActionGroup.ActionGroup)

data ApplicationActionGroupPropertyInfo
instance AttrInfo ApplicationActionGroupPropertyInfo where
    type AttrAllowedOps ApplicationActionGroupPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrClear]
    type AttrSetTypeConstraint ApplicationActionGroupPropertyInfo = Gio.ActionGroup.IsActionGroup
    type AttrBaseTypeConstraint ApplicationActionGroupPropertyInfo = IsApplication
    type AttrGetType ApplicationActionGroupPropertyInfo = ()
    type AttrLabel ApplicationActionGroupPropertyInfo = "action-group"
    type AttrOrigin ApplicationActionGroupPropertyInfo = Application
    attrGet _ = undefined
    attrSet _ = setApplicationActionGroup
    attrConstruct _ = constructApplicationActionGroup
    attrClear _ = clearApplicationActionGroup

-- VVV Prop "application-id"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Just False,Just True)

getApplicationApplicationId :: (MonadIO m, IsApplication o) => o -> m T.Text
getApplicationApplicationId obj = liftIO $ checkUnexpectedNothing "getApplicationApplicationId" $ getObjectPropertyString obj "application-id"

setApplicationApplicationId :: (MonadIO m, IsApplication o) => o -> T.Text -> m ()
setApplicationApplicationId obj val = liftIO $ setObjectPropertyString obj "application-id" (Just val)

constructApplicationApplicationId :: (IsApplication o) => T.Text -> IO (GValueConstruct o)
constructApplicationApplicationId val = constructObjectPropertyString "application-id" (Just val)

clearApplicationApplicationId :: (MonadIO m, IsApplication o) => o -> m ()
clearApplicationApplicationId obj = liftIO $ setObjectPropertyString obj "application-id" (Nothing :: Maybe T.Text)

data ApplicationApplicationIdPropertyInfo
instance AttrInfo ApplicationApplicationIdPropertyInfo where
    type AttrAllowedOps ApplicationApplicationIdPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint ApplicationApplicationIdPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint ApplicationApplicationIdPropertyInfo = IsApplication
    type AttrGetType ApplicationApplicationIdPropertyInfo = T.Text
    type AttrLabel ApplicationApplicationIdPropertyInfo = "application-id"
    type AttrOrigin ApplicationApplicationIdPropertyInfo = Application
    attrGet _ = getApplicationApplicationId
    attrSet _ = setApplicationApplicationId
    attrConstruct _ = constructApplicationApplicationId
    attrClear _ = clearApplicationApplicationId

-- VVV Prop "flags"
   -- Type: TInterface (Name {namespace = "Gio", name = "ApplicationFlags"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

getApplicationFlags :: (MonadIO m, IsApplication o) => o -> m [Gio.Flags.ApplicationFlags]
getApplicationFlags obj = liftIO $ getObjectPropertyFlags obj "flags"

setApplicationFlags :: (MonadIO m, IsApplication o) => o -> [Gio.Flags.ApplicationFlags] -> m ()
setApplicationFlags obj val = liftIO $ setObjectPropertyFlags obj "flags" val

constructApplicationFlags :: (IsApplication o) => [Gio.Flags.ApplicationFlags] -> IO (GValueConstruct o)
constructApplicationFlags val = constructObjectPropertyFlags "flags" val

data ApplicationFlagsPropertyInfo
instance AttrInfo ApplicationFlagsPropertyInfo where
    type AttrAllowedOps ApplicationFlagsPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint ApplicationFlagsPropertyInfo = (~) [Gio.Flags.ApplicationFlags]
    type AttrBaseTypeConstraint ApplicationFlagsPropertyInfo = IsApplication
    type AttrGetType ApplicationFlagsPropertyInfo = [Gio.Flags.ApplicationFlags]
    type AttrLabel ApplicationFlagsPropertyInfo = "flags"
    type AttrOrigin ApplicationFlagsPropertyInfo = Application
    attrGet _ = getApplicationFlags
    attrSet _ = setApplicationFlags
    attrConstruct _ = constructApplicationFlags
    attrClear _ = undefined

-- VVV Prop "inactivity-timeout"
   -- Type: TBasicType TUInt
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

getApplicationInactivityTimeout :: (MonadIO m, IsApplication o) => o -> m Word32
getApplicationInactivityTimeout obj = liftIO $ getObjectPropertyUInt32 obj "inactivity-timeout"

setApplicationInactivityTimeout :: (MonadIO m, IsApplication o) => o -> Word32 -> m ()
setApplicationInactivityTimeout obj val = liftIO $ setObjectPropertyUInt32 obj "inactivity-timeout" val

constructApplicationInactivityTimeout :: (IsApplication o) => Word32 -> IO (GValueConstruct o)
constructApplicationInactivityTimeout val = constructObjectPropertyUInt32 "inactivity-timeout" val

data ApplicationInactivityTimeoutPropertyInfo
instance AttrInfo ApplicationInactivityTimeoutPropertyInfo where
    type AttrAllowedOps ApplicationInactivityTimeoutPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint ApplicationInactivityTimeoutPropertyInfo = (~) Word32
    type AttrBaseTypeConstraint ApplicationInactivityTimeoutPropertyInfo = IsApplication
    type AttrGetType ApplicationInactivityTimeoutPropertyInfo = Word32
    type AttrLabel ApplicationInactivityTimeoutPropertyInfo = "inactivity-timeout"
    type AttrOrigin ApplicationInactivityTimeoutPropertyInfo = Application
    attrGet _ = getApplicationInactivityTimeout
    attrSet _ = setApplicationInactivityTimeout
    attrConstruct _ = constructApplicationInactivityTimeout
    attrClear _ = undefined

-- VVV Prop "is-busy"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

getApplicationIsBusy :: (MonadIO m, IsApplication o) => o -> m Bool
getApplicationIsBusy obj = liftIO $ getObjectPropertyBool obj "is-busy"

data ApplicationIsBusyPropertyInfo
instance AttrInfo ApplicationIsBusyPropertyInfo where
    type AttrAllowedOps ApplicationIsBusyPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint ApplicationIsBusyPropertyInfo = (~) ()
    type AttrBaseTypeConstraint ApplicationIsBusyPropertyInfo = IsApplication
    type AttrGetType ApplicationIsBusyPropertyInfo = Bool
    type AttrLabel ApplicationIsBusyPropertyInfo = "is-busy"
    type AttrOrigin ApplicationIsBusyPropertyInfo = Application
    attrGet _ = getApplicationIsBusy
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "is-registered"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

getApplicationIsRegistered :: (MonadIO m, IsApplication o) => o -> m Bool
getApplicationIsRegistered obj = liftIO $ getObjectPropertyBool obj "is-registered"

data ApplicationIsRegisteredPropertyInfo
instance AttrInfo ApplicationIsRegisteredPropertyInfo where
    type AttrAllowedOps ApplicationIsRegisteredPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint ApplicationIsRegisteredPropertyInfo = (~) ()
    type AttrBaseTypeConstraint ApplicationIsRegisteredPropertyInfo = IsApplication
    type AttrGetType ApplicationIsRegisteredPropertyInfo = Bool
    type AttrLabel ApplicationIsRegisteredPropertyInfo = "is-registered"
    type AttrOrigin ApplicationIsRegisteredPropertyInfo = Application
    attrGet _ = getApplicationIsRegistered
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "is-remote"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

getApplicationIsRemote :: (MonadIO m, IsApplication o) => o -> m Bool
getApplicationIsRemote obj = liftIO $ getObjectPropertyBool obj "is-remote"

data ApplicationIsRemotePropertyInfo
instance AttrInfo ApplicationIsRemotePropertyInfo where
    type AttrAllowedOps ApplicationIsRemotePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint ApplicationIsRemotePropertyInfo = (~) ()
    type AttrBaseTypeConstraint ApplicationIsRemotePropertyInfo = IsApplication
    type AttrGetType ApplicationIsRemotePropertyInfo = Bool
    type AttrLabel ApplicationIsRemotePropertyInfo = "is-remote"
    type AttrOrigin ApplicationIsRemotePropertyInfo = Application
    attrGet _ = getApplicationIsRemote
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "resource-base-path"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just True,Just True)

getApplicationResourceBasePath :: (MonadIO m, IsApplication o) => o -> m (Maybe T.Text)
getApplicationResourceBasePath obj = liftIO $ getObjectPropertyString obj "resource-base-path"

setApplicationResourceBasePath :: (MonadIO m, IsApplication o) => o -> T.Text -> m ()
setApplicationResourceBasePath obj val = liftIO $ setObjectPropertyString obj "resource-base-path" (Just val)

constructApplicationResourceBasePath :: (IsApplication o) => T.Text -> IO (GValueConstruct o)
constructApplicationResourceBasePath val = constructObjectPropertyString "resource-base-path" (Just val)

clearApplicationResourceBasePath :: (MonadIO m, IsApplication o) => o -> m ()
clearApplicationResourceBasePath obj = liftIO $ setObjectPropertyString obj "resource-base-path" (Nothing :: Maybe T.Text)

data ApplicationResourceBasePathPropertyInfo
instance AttrInfo ApplicationResourceBasePathPropertyInfo where
    type AttrAllowedOps ApplicationResourceBasePathPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint ApplicationResourceBasePathPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint ApplicationResourceBasePathPropertyInfo = IsApplication
    type AttrGetType ApplicationResourceBasePathPropertyInfo = (Maybe T.Text)
    type AttrLabel ApplicationResourceBasePathPropertyInfo = "resource-base-path"
    type AttrOrigin ApplicationResourceBasePathPropertyInfo = Application
    attrGet _ = getApplicationResourceBasePath
    attrSet _ = setApplicationResourceBasePath
    attrConstruct _ = constructApplicationResourceBasePath
    attrClear _ = clearApplicationResourceBasePath

instance O.HasAttributeList Application
type instance O.AttributeList Application = ApplicationAttributeList
type ApplicationAttributeList = ('[ '("actionGroup", ApplicationActionGroupPropertyInfo), '("applicationId", ApplicationApplicationIdPropertyInfo), '("flags", ApplicationFlagsPropertyInfo), '("inactivityTimeout", ApplicationInactivityTimeoutPropertyInfo), '("isBusy", ApplicationIsBusyPropertyInfo), '("isRegistered", ApplicationIsRegisteredPropertyInfo), '("isRemote", ApplicationIsRemotePropertyInfo), '("resourceBasePath", ApplicationResourceBasePathPropertyInfo)] :: [(Symbol, *)])

applicationActionGroup :: AttrLabelProxy "actionGroup"
applicationActionGroup = AttrLabelProxy

applicationApplicationId :: AttrLabelProxy "applicationId"
applicationApplicationId = AttrLabelProxy

applicationFlags :: AttrLabelProxy "flags"
applicationFlags = AttrLabelProxy

applicationInactivityTimeout :: AttrLabelProxy "inactivityTimeout"
applicationInactivityTimeout = AttrLabelProxy

applicationIsBusy :: AttrLabelProxy "isBusy"
applicationIsBusy = AttrLabelProxy

applicationIsRegistered :: AttrLabelProxy "isRegistered"
applicationIsRegistered = AttrLabelProxy

applicationIsRemote :: AttrLabelProxy "isRemote"
applicationIsRemote = AttrLabelProxy

applicationResourceBasePath :: AttrLabelProxy "resourceBasePath"
applicationResourceBasePath = AttrLabelProxy

data ApplicationActivateSignalInfo
instance SignalInfo ApplicationActivateSignalInfo where
    type HaskellCallbackType ApplicationActivateSignalInfo = ApplicationActivateCallback
    connectSignal _ = connectApplicationActivate

data ApplicationCommandLineSignalInfo
instance SignalInfo ApplicationCommandLineSignalInfo where
    type HaskellCallbackType ApplicationCommandLineSignalInfo = ApplicationCommandLineCallback
    connectSignal _ = connectApplicationCommandLine

data ApplicationHandleLocalOptionsSignalInfo
instance SignalInfo ApplicationHandleLocalOptionsSignalInfo where
    type HaskellCallbackType ApplicationHandleLocalOptionsSignalInfo = ApplicationHandleLocalOptionsCallback
    connectSignal _ = connectApplicationHandleLocalOptions

data ApplicationOpenSignalInfo
instance SignalInfo ApplicationOpenSignalInfo where
    type HaskellCallbackType ApplicationOpenSignalInfo = ApplicationOpenCallback
    connectSignal _ = connectApplicationOpen

data ApplicationShutdownSignalInfo
instance SignalInfo ApplicationShutdownSignalInfo where
    type HaskellCallbackType ApplicationShutdownSignalInfo = ApplicationShutdownCallback
    connectSignal _ = connectApplicationShutdown

data ApplicationStartupSignalInfo
instance SignalInfo ApplicationStartupSignalInfo where
    type HaskellCallbackType ApplicationStartupSignalInfo = ApplicationStartupCallback
    connectSignal _ = connectApplicationStartup

type instance O.SignalList Application = ApplicationSignalList
type ApplicationSignalList = ('[ '("actionAdded", Gio.ActionGroup.ActionGroupActionAddedSignalInfo), '("actionEnabledChanged", Gio.ActionGroup.ActionGroupActionEnabledChangedSignalInfo), '("actionRemoved", Gio.ActionGroup.ActionGroupActionRemovedSignalInfo), '("actionStateChanged", Gio.ActionGroup.ActionGroupActionStateChangedSignalInfo), '("activate", ApplicationActivateSignalInfo), '("commandLine", ApplicationCommandLineSignalInfo), '("handleLocalOptions", ApplicationHandleLocalOptionsSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("open", ApplicationOpenSignalInfo), '("shutdown", ApplicationShutdownSignalInfo), '("startup", ApplicationStartupSignalInfo)] :: [(Symbol, *)])

-- method Application::new
-- method type : Constructor
-- Args : [Arg {argCName = "application_id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the application id", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "ApplicationFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the application flags", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "Application"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_application_new" g_application_new :: 
    CString ->                              -- application_id : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "ApplicationFlags"})
    IO (Ptr Application)

{- |
Creates a new 'GI.Gio.Objects.Application.Application' instance.

If non-'Nothing', the application id must be valid.  See
'GI.Gio.Objects.Application.applicationIdIsValid'.

If no application ID is given then some features of 'GI.Gio.Objects.Application.Application'
(most notably application uniqueness) will be disabled.
-}
applicationNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe (T.Text)
    {- ^ /@applicationId@/: the application id -}
    -> [Gio.Flags.ApplicationFlags]
    {- ^ /@flags@/: the application flags -}
    -> m Application
    {- ^ __Returns:__ a new 'GI.Gio.Objects.Application.Application' instance -}
applicationNew applicationId flags = liftIO $ do
    maybeApplicationId <- case applicationId of
        Nothing -> return nullPtr
        Just jApplicationId -> do
            jApplicationId' <- textToCString jApplicationId
            return jApplicationId'
    let flags' = gflagsToWord flags
    result <- g_application_new maybeApplicationId flags'
    checkUnexpectedReturnNULL "applicationNew" result
    result' <- (wrapObject Application) result
    freeMem maybeApplicationId
    return result'

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

foreign import ccall "g_application_activate" g_application_activate :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    IO ()

{- |
Activates the application.

In essence, this results in the 'GI.Gio.Objects.Application.Application'::@/activate/@ signal being
emitted in the primary instance.

The application must be registered before calling this function.

@since 2.28
-}
applicationActivate ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> m ()
applicationActivate application = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    g_application_activate application'
    touchManagedPtr application
    return ()

data ApplicationActivateMethodInfo
instance (signature ~ (m ()), MonadIO m, IsApplication a) => O.MethodInfo ApplicationActivateMethodInfo a signature where
    overloadedMethod _ = applicationActivate

-- method Application::add_main_option
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "application", argType = TInterface (Name {namespace = "Gio", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GApplication", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "long_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the long name of an option used to specify it in a commandline", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "short_name", argType = TBasicType TInt8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the short name of an option", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "GLib", name = "OptionFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags from #GOptionFlags", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "arg", argType = TInterface (Name {namespace = "GLib", name = "OptionArg"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the type of the option, as a #GOptionArg", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "description", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the description for the option in `--help` output", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "arg_description", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the placeholder to use for the extra argument\n   parsed by the option in `--help` output", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_application_add_main_option" g_application_add_main_option :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    CString ->                              -- long_name : TBasicType TUTF8
    Int8 ->                                 -- short_name : TBasicType TInt8
    CUInt ->                                -- flags : TInterface (Name {namespace = "GLib", name = "OptionFlags"})
    CUInt ->                                -- arg : TInterface (Name {namespace = "GLib", name = "OptionArg"})
    CString ->                              -- description : TBasicType TUTF8
    CString ->                              -- arg_description : TBasicType TUTF8
    IO ()

{- |
Add an option to be handled by /@application@/.

Calling this function is the equivalent of calling
'GI.Gio.Objects.Application.applicationAddMainOptionEntries' with a single 'GI.GLib.Structs.OptionEntry.OptionEntry'
that has its arg_data member set to 'Nothing'.

The parsed arguments will be packed into a 'GI.GLib.Structs.VariantDict.VariantDict' which
is passed to 'GI.Gio.Objects.Application.Application'::@/handle-local-options/@. If
'GI.Gio.Flags.ApplicationFlagsHandlesCommandLine' is set, then it will also
be sent to the primary instance. See
'GI.Gio.Objects.Application.applicationAddMainOptionEntries' for more details.

See 'GI.GLib.Structs.OptionEntry.OptionEntry' for more documentation of the arguments.

@since 2.42
-}
applicationAddMainOption ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: the 'GI.Gio.Objects.Application.Application' -}
    -> T.Text
    {- ^ /@longName@/: the long name of an option used to specify it in a commandline -}
    -> Int8
    {- ^ /@shortName@/: the short name of an option -}
    -> [GLib.Flags.OptionFlags]
    {- ^ /@flags@/: flags from 'GI.GLib.Flags.OptionFlags' -}
    -> GLib.Enums.OptionArg
    {- ^ /@arg@/: the type of the option, as a 'GI.GLib.Enums.OptionArg' -}
    -> T.Text
    {- ^ /@description@/: the description for the option in @--help@ output -}
    -> Maybe (T.Text)
    {- ^ /@argDescription@/: the placeholder to use for the extra argument
   parsed by the option in @--help@ output -}
    -> m ()
applicationAddMainOption application longName shortName flags arg description argDescription = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    longName' <- textToCString longName
    let flags' = gflagsToWord flags
    let arg' = (fromIntegral . fromEnum) arg
    description' <- textToCString description
    maybeArgDescription <- case argDescription of
        Nothing -> return nullPtr
        Just jArgDescription -> do
            jArgDescription' <- textToCString jArgDescription
            return jArgDescription'
    g_application_add_main_option application' longName' shortName flags' arg' description' maybeArgDescription
    touchManagedPtr application
    freeMem longName'
    freeMem description'
    freeMem maybeArgDescription
    return ()

data ApplicationAddMainOptionMethodInfo
instance (signature ~ (T.Text -> Int8 -> [GLib.Flags.OptionFlags] -> GLib.Enums.OptionArg -> T.Text -> Maybe (T.Text) -> m ()), MonadIO m, IsApplication a) => O.MethodInfo ApplicationAddMainOptionMethodInfo a signature where
    overloadedMethod _ = applicationAddMainOption

-- method Application::add_main_option_entries
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "application", argType = TInterface (Name {namespace = "Gio", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GApplication", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "entries", argType = TCArray True (-1) (-1) (TInterface (Name {namespace = "GLib", name = "OptionEntry"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a\n          %NULL-terminated list of #GOptionEntrys", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_application_add_main_option_entries" g_application_add_main_option_entries :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    Ptr (Ptr GLib.OptionEntry.OptionEntry) -> -- entries : TCArray True (-1) (-1) (TInterface (Name {namespace = "GLib", name = "OptionEntry"}))
    IO ()

{- |
Adds main option entries to be handled by /@application@/.

This function is comparable to 'GI.GLib.Structs.OptionContext.optionContextAddMainEntries'.

After the commandline arguments are parsed, the
'GI.Gio.Objects.Application.Application'::@/handle-local-options/@ signal will be emitted.  At this
point, the application can inspect the values pointed to by /@argData@/
in the given @/GOptionEntrys/@.

Unlike 'GI.GLib.Structs.OptionContext.OptionContext', 'GI.Gio.Objects.Application.Application' supports giving a 'Nothing'
/@argData@/ for a non-callback 'GI.GLib.Structs.OptionEntry.OptionEntry'.  This results in the
argument in question being packed into a 'GI.GLib.Structs.VariantDict.VariantDict' which is also
passed to 'GI.Gio.Objects.Application.Application'::@/handle-local-options/@, where it can be
inspected and modified.  If 'GI.Gio.Flags.ApplicationFlagsHandlesCommandLine' is
set, then the resulting dictionary is sent to the primary instance,
where 'GI.Gio.Objects.ApplicationCommandLine.applicationCommandLineGetOptionsDict' will return it.
This \"packing\" is done according to the type of the argument --
booleans for normal flags, strings for strings, bytestrings for
filenames, etc.  The packing only occurs if the flag is given (ie: we
do not pack a \"false\" 'GVariant' in the case that a flag is missing).

In general, it is recommended that all commandline arguments are
parsed locally.  The options dictionary should then be used to
transmit the result of the parsing to the primary instance, where
@/g_variant_dict_lookup()/@ can be used.  For local options, it is
possible to either use /@argData@/ in the usual way, or to consult (and
potentially remove) the option from the options dictionary.

This function is new in GLib 2.40.  Before then, the only real choice
was to send all of the commandline arguments (options and all) to the
primary instance for handling.  'GI.Gio.Objects.Application.Application' ignored them completely
on the local side.  Calling this function \"opts in\" to the new
behaviour, and in particular, means that unrecognised options will be
treated as errors.  Unrecognised options have never been ignored when
'GI.Gio.Flags.ApplicationFlagsHandlesCommandLine' is unset.

If 'GI.Gio.Objects.Application.Application'::@/handle-local-options/@ needs to see the list of
filenames, then the use of 'GI.GLib.Constants.OPTION_REMAINING' is recommended.  If
/@argData@/ is 'Nothing' then 'GI.GLib.Constants.OPTION_REMAINING' can be used as a key into
the options dictionary.  If you do use 'GI.GLib.Constants.OPTION_REMAINING' then you
need to handle these arguments for yourself because once they are
consumed, they will no longer be visible to the default handling
(which treats them as filenames to be opened).

It is important to use the proper GVariant format when retrieving
the options with @/g_variant_dict_lookup()/@:

* for 'GI.GLib.Enums.OptionArgNone', use b
* for 'GI.GLib.Enums.OptionArgString', use &s
* for 'GI.GLib.Enums.OptionArgInt', use i
* for 'GI.GLib.Enums.OptionArgInt64', use x
* for 'GI.GLib.Enums.OptionArgDouble', use d
* for 'GI.GLib.Enums.OptionArgFilename', use ^ay
* for 'GI.GLib.Enums.OptionArgStringArray', use &as
* for 'GI.GLib.Enums.OptionArgFilenameArray', use ^aay

@since 2.40
-}
applicationAddMainOptionEntries ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> [GLib.OptionEntry.OptionEntry]
    {- ^ /@entries@/: a
          'Nothing'-terminated list of @/GOptionEntrys/@ -}
    -> m ()
applicationAddMainOptionEntries application entries = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    entries' <- mapM unsafeManagedPtrGetPtr entries
    entries'' <- packZeroTerminatedPtrArray entries'
    g_application_add_main_option_entries application' entries''
    touchManagedPtr application
    mapM_ touchManagedPtr entries
    freeMem entries''
    return ()

data ApplicationAddMainOptionEntriesMethodInfo
instance (signature ~ ([GLib.OptionEntry.OptionEntry] -> m ()), MonadIO m, IsApplication a) => O.MethodInfo ApplicationAddMainOptionEntriesMethodInfo a signature where
    overloadedMethod _ = applicationAddMainOptionEntries

-- method Application::add_option_group
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "application", argType = TInterface (Name {namespace = "Gio", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GApplication", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group", argType = TInterface (Name {namespace = "GLib", name = "OptionGroup"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GOptionGroup", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_application_add_option_group" g_application_add_option_group :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    Ptr GLib.OptionGroup.OptionGroup ->     -- group : TInterface (Name {namespace = "GLib", name = "OptionGroup"})
    IO ()

{- |
Adds a 'GI.GLib.Structs.OptionGroup.OptionGroup' to the commandline handling of /@application@/.

This function is comparable to 'GI.GLib.Structs.OptionContext.optionContextAddGroup'.

Unlike 'GI.Gio.Objects.Application.applicationAddMainOptionEntries', this function does
not deal with 'Nothing' /@argData@/ and never transmits options to the
primary instance.

The reason for that is because, by the time the options arrive at the
primary instance, it is typically too late to do anything with them.
Taking the GTK option group as an example: GTK will already have been
initialised by the time the 'GI.Gio.Objects.Application.Application'::@/command-line/@ handler runs.
In the case that this is not the first-running instance of the
application, the existing instance may already have been running for
a very long time.

This means that the options from 'GI.GLib.Structs.OptionGroup.OptionGroup' are only really usable
in the case that the instance of the application being run is the
first instance.  Passing options like @--display=@ or @--gdk-debug=@
on future runs will have no effect on the existing primary instance.

Calling this function will cause the options in the supplied option
group to be parsed, but it does not cause you to be \"opted in\" to the
new functionality whereby unrecognised options are rejected even if
'GI.Gio.Flags.ApplicationFlagsHandlesCommandLine' was given.

@since 2.40
-}
applicationAddOptionGroup ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: the 'GI.Gio.Objects.Application.Application' -}
    -> GLib.OptionGroup.OptionGroup
    {- ^ /@group@/: a 'GI.GLib.Structs.OptionGroup.OptionGroup' -}
    -> m ()
applicationAddOptionGroup application group = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    group' <- B.ManagedPtr.disownBoxed group
    g_application_add_option_group application' group'
    touchManagedPtr application
    touchManagedPtr group
    return ()

data ApplicationAddOptionGroupMethodInfo
instance (signature ~ (GLib.OptionGroup.OptionGroup -> m ()), MonadIO m, IsApplication a) => O.MethodInfo ApplicationAddOptionGroupMethodInfo a signature where
    overloadedMethod _ = applicationAddOptionGroup

-- method Application::bind_busy_property
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "application", argType = TInterface (Name {namespace = "Gio", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GApplication", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "object", argType = TInterface (Name {namespace = "GObject", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GObject", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a boolean property of @object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_application_bind_busy_property" g_application_bind_busy_property :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    Ptr GObject.Object.Object ->            -- object : TInterface (Name {namespace = "GObject", name = "Object"})
    CString ->                              -- property : TBasicType TUTF8
    IO ()

{- |
Marks /@application@/ as busy (see 'GI.Gio.Objects.Application.applicationMarkBusy') while
/@property@/ on /@object@/ is 'True'.

The binding holds a reference to /@application@/ while it is active, but
not to /@object@/. Instead, the binding is destroyed when /@object@/ is
finalized.

@since 2.44
-}
applicationBindBusyProperty ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a, GObject.Object.IsObject b) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> b
    {- ^ /@object@/: a 'GI.GObject.Objects.Object.Object' -}
    -> T.Text
    {- ^ /@property@/: the name of a boolean property of /@object@/ -}
    -> m ()
applicationBindBusyProperty application object property = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    object' <- unsafeManagedPtrCastPtr object
    property' <- textToCString property
    g_application_bind_busy_property application' object' property'
    touchManagedPtr application
    touchManagedPtr object
    freeMem property'
    return ()

data ApplicationBindBusyPropertyMethodInfo
instance (signature ~ (b -> T.Text -> m ()), MonadIO m, IsApplication a, GObject.Object.IsObject b) => O.MethodInfo ApplicationBindBusyPropertyMethodInfo a signature where
    overloadedMethod _ = applicationBindBusyProperty

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

foreign import ccall "g_application_get_application_id" g_application_get_application_id :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    IO CString

{- |
Gets the unique identifier for /@application@/.

@since 2.28
-}
applicationGetApplicationId ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> m T.Text
    {- ^ __Returns:__ the identifier for /@application@/, owned by /@application@/ -}
applicationGetApplicationId application = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    result <- g_application_get_application_id application'
    checkUnexpectedReturnNULL "applicationGetApplicationId" result
    result' <- cstringToText result
    touchManagedPtr application
    return result'

data ApplicationGetApplicationIdMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsApplication a) => O.MethodInfo ApplicationGetApplicationIdMethodInfo a signature where
    overloadedMethod _ = applicationGetApplicationId

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

foreign import ccall "g_application_get_dbus_connection" g_application_get_dbus_connection :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    IO (Ptr Gio.DBusConnection.DBusConnection)

{- |
Gets the 'GI.Gio.Objects.DBusConnection.DBusConnection' being used by the application, or 'Nothing'.

If 'GI.Gio.Objects.Application.Application' is using its D-Bus backend then this function will
return the 'GI.Gio.Objects.DBusConnection.DBusConnection' being used for uniqueness and
communication with the desktop environment and other instances of the
application.

If 'GI.Gio.Objects.Application.Application' is not using D-Bus then this function will return
'Nothing'.  This includes the situation where the D-Bus backend would
normally be in use but we were unable to connect to the bus.

This function must not be called before the application has been
registered.  See 'GI.Gio.Objects.Application.applicationGetIsRegistered'.

@since 2.34
-}
applicationGetDbusConnection ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> m Gio.DBusConnection.DBusConnection
    {- ^ __Returns:__ a 'GI.Gio.Objects.DBusConnection.DBusConnection', or 'Nothing' -}
applicationGetDbusConnection application = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    result <- g_application_get_dbus_connection application'
    checkUnexpectedReturnNULL "applicationGetDbusConnection" result
    result' <- (newObject Gio.DBusConnection.DBusConnection) result
    touchManagedPtr application
    return result'

data ApplicationGetDbusConnectionMethodInfo
instance (signature ~ (m Gio.DBusConnection.DBusConnection), MonadIO m, IsApplication a) => O.MethodInfo ApplicationGetDbusConnectionMethodInfo a signature where
    overloadedMethod _ = applicationGetDbusConnection

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

foreign import ccall "g_application_get_dbus_object_path" g_application_get_dbus_object_path :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    IO CString

{- |
Gets the D-Bus object path being used by the application, or 'Nothing'.

If 'GI.Gio.Objects.Application.Application' is using its D-Bus backend then this function will
return the D-Bus object path that 'GI.Gio.Objects.Application.Application' is using.  If the
application is the primary instance then there is an object published
at this path.  If the application is not the primary instance then
the result of this function is undefined.

If 'GI.Gio.Objects.Application.Application' is not using D-Bus then this function will return
'Nothing'.  This includes the situation where the D-Bus backend would
normally be in use but we were unable to connect to the bus.

This function must not be called before the application has been
registered.  See 'GI.Gio.Objects.Application.applicationGetIsRegistered'.

@since 2.34
-}
applicationGetDbusObjectPath ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> m T.Text
    {- ^ __Returns:__ the object path, or 'Nothing' -}
applicationGetDbusObjectPath application = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    result <- g_application_get_dbus_object_path application'
    checkUnexpectedReturnNULL "applicationGetDbusObjectPath" result
    result' <- cstringToText result
    touchManagedPtr application
    return result'

data ApplicationGetDbusObjectPathMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsApplication a) => O.MethodInfo ApplicationGetDbusObjectPathMethodInfo a signature where
    overloadedMethod _ = applicationGetDbusObjectPath

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

foreign import ccall "g_application_get_flags" g_application_get_flags :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    IO CUInt

{- |
Gets the flags for /@application@/.

See 'GI.Gio.Flags.ApplicationFlags'.

@since 2.28
-}
applicationGetFlags ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> m [Gio.Flags.ApplicationFlags]
    {- ^ __Returns:__ the flags for /@application@/ -}
applicationGetFlags application = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    result <- g_application_get_flags application'
    let result' = wordToGFlags result
    touchManagedPtr application
    return result'

data ApplicationGetFlagsMethodInfo
instance (signature ~ (m [Gio.Flags.ApplicationFlags]), MonadIO m, IsApplication a) => O.MethodInfo ApplicationGetFlagsMethodInfo a signature where
    overloadedMethod _ = applicationGetFlags

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

foreign import ccall "g_application_get_inactivity_timeout" g_application_get_inactivity_timeout :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    IO Word32

{- |
Gets the current inactivity timeout for the application.

This is the amount of time (in milliseconds) after the last call to
'GI.Gio.Objects.Application.applicationRelease' before the application stops running.

@since 2.28
-}
applicationGetInactivityTimeout ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> m Word32
    {- ^ __Returns:__ the timeout, in milliseconds -}
applicationGetInactivityTimeout application = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    result <- g_application_get_inactivity_timeout application'
    touchManagedPtr application
    return result

data ApplicationGetInactivityTimeoutMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsApplication a) => O.MethodInfo ApplicationGetInactivityTimeoutMethodInfo a signature where
    overloadedMethod _ = applicationGetInactivityTimeout

-- method Application::get_is_busy
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "application", argType = TInterface (Name {namespace = "Gio", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GApplication", 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 "g_application_get_is_busy" g_application_get_is_busy :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    IO CInt

{- |
Gets the application\'s current busy state, as set through
'GI.Gio.Objects.Application.applicationMarkBusy' or 'GI.Gio.Objects.Application.applicationBindBusyProperty'.

@since 2.44
-}
applicationGetIsBusy ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@application@/ is currenty marked as busy -}
applicationGetIsBusy application = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    result <- g_application_get_is_busy application'
    let result' = (/= 0) result
    touchManagedPtr application
    return result'

data ApplicationGetIsBusyMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsApplication a) => O.MethodInfo ApplicationGetIsBusyMethodInfo a signature where
    overloadedMethod _ = applicationGetIsBusy

-- method Application::get_is_registered
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "application", argType = TInterface (Name {namespace = "Gio", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GApplication", 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 "g_application_get_is_registered" g_application_get_is_registered :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    IO CInt

{- |
Checks if /@application@/ is registered.

An application is registered if 'GI.Gio.Objects.Application.applicationRegister' has been
successfully called.

@since 2.28
-}
applicationGetIsRegistered ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@application@/ is registered -}
applicationGetIsRegistered application = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    result <- g_application_get_is_registered application'
    let result' = (/= 0) result
    touchManagedPtr application
    return result'

data ApplicationGetIsRegisteredMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsApplication a) => O.MethodInfo ApplicationGetIsRegisteredMethodInfo a signature where
    overloadedMethod _ = applicationGetIsRegistered

-- method Application::get_is_remote
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "application", argType = TInterface (Name {namespace = "Gio", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GApplication", 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 "g_application_get_is_remote" g_application_get_is_remote :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    IO CInt

{- |
Checks if /@application@/ is remote.

If /@application@/ is remote then it means that another instance of
application already exists (the \'primary\' instance).  Calls to
perform actions on /@application@/ will result in the actions being
performed by the primary instance.

The value of this property cannot be accessed before
'GI.Gio.Objects.Application.applicationRegister' has been called.  See
'GI.Gio.Objects.Application.applicationGetIsRegistered'.

@since 2.28
-}
applicationGetIsRemote ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@application@/ is remote -}
applicationGetIsRemote application = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    result <- g_application_get_is_remote application'
    let result' = (/= 0) result
    touchManagedPtr application
    return result'

data ApplicationGetIsRemoteMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsApplication a) => O.MethodInfo ApplicationGetIsRemoteMethodInfo a signature where
    overloadedMethod _ = applicationGetIsRemote

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

foreign import ccall "g_application_get_resource_base_path" g_application_get_resource_base_path :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    IO CString

{- |
Gets the resource base path of /@application@/.

See 'GI.Gio.Objects.Application.applicationSetResourceBasePath' for more information.

@since 2.42
-}
applicationGetResourceBasePath ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ the base resource path, if one is set -}
applicationGetResourceBasePath application = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    result <- g_application_get_resource_base_path application'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    touchManagedPtr application
    return maybeResult

data ApplicationGetResourceBasePathMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsApplication a) => O.MethodInfo ApplicationGetResourceBasePathMethodInfo a signature where
    overloadedMethod _ = applicationGetResourceBasePath

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

foreign import ccall "g_application_hold" g_application_hold :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    IO ()

{- |
Increases the use count of /@application@/.

Use this function to indicate that the application has a reason to
continue to run.  For example, 'GI.Gio.Objects.Application.applicationHold' is called by GTK+
when a toplevel window is on the screen.

To cancel the hold, call 'GI.Gio.Objects.Application.applicationRelease'.
-}
applicationHold ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> m ()
applicationHold application = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    g_application_hold application'
    touchManagedPtr application
    return ()

data ApplicationHoldMethodInfo
instance (signature ~ (m ()), MonadIO m, IsApplication a) => O.MethodInfo ApplicationHoldMethodInfo a signature where
    overloadedMethod _ = applicationHold

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

foreign import ccall "g_application_mark_busy" g_application_mark_busy :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    IO ()

{- |
Increases the busy count of /@application@/.

Use this function to indicate that the application is busy, for instance
while a long running operation is pending.

The busy state will be exposed to other processes, so a session shell will
use that information to indicate the state to the user (e.g. with a
spinner).

To cancel the busy indication, use 'GI.Gio.Objects.Application.applicationUnmarkBusy'.

@since 2.38
-}
applicationMarkBusy ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> m ()
applicationMarkBusy application = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    g_application_mark_busy application'
    touchManagedPtr application
    return ()

data ApplicationMarkBusyMethodInfo
instance (signature ~ (m ()), MonadIO m, IsApplication a) => O.MethodInfo ApplicationMarkBusyMethodInfo a signature where
    overloadedMethod _ = applicationMarkBusy

-- method Application::open
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "application", argType = TInterface (Name {namespace = "Gio", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GApplication", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "files", argType = TCArray False (-1) 2 (TInterface (Name {namespace = "Gio", name = "File"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an array of #GFiles to open", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_files", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of the @files array", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "hint", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a hint (or \"\"), but never %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "n_files", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of the @files array", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_application_open" g_application_open :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    Ptr (Ptr Gio.File.File) ->              -- files : TCArray False (-1) 2 (TInterface (Name {namespace = "Gio", name = "File"}))
    Int32 ->                                -- n_files : TBasicType TInt
    CString ->                              -- hint : TBasicType TUTF8
    IO ()

{- |
Opens the given files.

In essence, this results in the 'GI.Gio.Objects.Application.Application'::@/open/@ signal being emitted
in the primary instance.

/@nFiles@/ must be greater than zero.

/@hint@/ is simply passed through to the ::open signal.  It is
intended to be used by applications that have multiple modes for
opening files (eg: \"view\" vs \"edit\", etc).  Unless you have a need
for this functionality, you should use \"\".

The application must be registered before calling this function
and it must have the 'GI.Gio.Flags.ApplicationFlagsHandlesOpen' flag set.

@since 2.28
-}
applicationOpen ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> [Gio.File.File]
    {- ^ /@files@/: an array of @/GFiles/@ to open -}
    -> T.Text
    {- ^ /@hint@/: a hint (or \"\"), but never 'Nothing' -}
    -> m ()
applicationOpen application files hint = liftIO $ do
    let nFiles = fromIntegral $ length files
    application' <- unsafeManagedPtrCastPtr application
    files' <- mapM unsafeManagedPtrCastPtr files
    files'' <- packPtrArray files'
    hint' <- textToCString hint
    g_application_open application' files'' nFiles hint'
    touchManagedPtr application
    mapM_ touchManagedPtr files
    freeMem files''
    freeMem hint'
    return ()

data ApplicationOpenMethodInfo
instance (signature ~ ([Gio.File.File] -> T.Text -> m ()), MonadIO m, IsApplication a) => O.MethodInfo ApplicationOpenMethodInfo a signature where
    overloadedMethod _ = applicationOpen

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

foreign import ccall "g_application_quit" g_application_quit :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    IO ()

{- |
Immediately quits the application.

Upon return to the mainloop, 'GI.Gio.Objects.Application.applicationRun' will return,
calling only the \'shutdown\' function before doing so.

The hold count is ignored.

The result of calling 'GI.Gio.Objects.Application.applicationRun' again after it returns is
unspecified.

@since 2.32
-}
applicationQuit ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> m ()
applicationQuit application = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    g_application_quit application'
    touchManagedPtr application
    return ()

data ApplicationQuitMethodInfo
instance (signature ~ (m ()), MonadIO m, IsApplication a) => O.MethodInfo ApplicationQuitMethodInfo a signature where
    overloadedMethod _ = applicationQuit

-- method Application::register
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "application", argType = TInterface (Name {namespace = "Gio", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GApplication", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GCancellable, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_application_register" g_application_register :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Attempts registration of the application.

This is the point at which the application discovers if it is the
primary instance or merely acting as a remote for an already-existing
primary instance.  This is implemented by attempting to acquire the
application identifier as a unique bus name on the session bus using
GDBus.

If there is no application ID or if 'GI.Gio.Flags.ApplicationFlagsNonUnique' was
given, then this process will always become the primary instance.

Due to the internal architecture of GDBus, method calls can be
dispatched at any time (even if a main loop is not running).  For
this reason, you must ensure that any object paths that you wish to
register are registered before calling this function.

If the application has already been registered then 'True' is
returned with no work performed.

The 'GI.Gio.Objects.Application.Application'::@/startup/@ signal is emitted if registration succeeds
and /@application@/ is the primary instance (including the non-unique
case).

In the event of an error (such as /@cancellable@/ being cancelled, or a
failure to connect to the session bus), 'False' is returned and /@error@/
is set appropriately.

Note: the return value of this function is not an indicator that this
instance is or is not the primary instance of the application.  See
'GI.Gio.Objects.Application.applicationGetIsRemote' for that.

@since 2.28
-}
applicationRegister ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> Maybe (b)
    {- ^ /@cancellable@/: a 'GI.Gio.Objects.Cancellable.Cancellable', or 'Nothing' -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
applicationRegister application cancellable = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ g_application_register application' maybeCancellable
        touchManagedPtr application
        whenJust cancellable touchManagedPtr
        return ()
     ) (do
        return ()
     )

data ApplicationRegisterMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsApplication a, Gio.Cancellable.IsCancellable b) => O.MethodInfo ApplicationRegisterMethodInfo a signature where
    overloadedMethod _ = applicationRegister

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

foreign import ccall "g_application_release" g_application_release :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    IO ()

{- |
Decrease the use count of /@application@/.

When the use count reaches zero, the application will stop running.

Never call this function except to cancel the effect of a previous
call to 'GI.Gio.Objects.Application.applicationHold'.
-}
applicationRelease ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> m ()
applicationRelease application = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    g_application_release application'
    touchManagedPtr application
    return ()

data ApplicationReleaseMethodInfo
instance (signature ~ (m ()), MonadIO m, IsApplication a) => O.MethodInfo ApplicationReleaseMethodInfo a signature where
    overloadedMethod _ = applicationRelease

-- method Application::run
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "application", argType = TInterface (Name {namespace = "Gio", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GApplication", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "argc", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the argc from main() (or 0 if @argv is %NULL)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "argv", argType = TCArray False (-1) 1 (TBasicType TUTF8), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the argv from main(), or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "argc", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the argc from main() (or 0 if @argv is %NULL)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_application_run" g_application_run :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    Int32 ->                                -- argc : TBasicType TInt
    Ptr CString ->                          -- argv : TCArray False (-1) 1 (TBasicType TUTF8)
    IO Int32

{- |
Runs the application.

This function is intended to be run from @/main()/@ and its return value
is intended to be returned by @/main()/@. Although you are expected to pass
the /@argc@/, /@argv@/ parameters from @/main()/@ to this function, it is possible
to pass 'Nothing' if /@argv@/ is not available or commandline handling is not
required.  Note that on Windows, /@argc@/ and /@argv@/ are ignored, and
@/g_win32_get_command_line()/@ is called internally (for proper support
of Unicode commandline arguments).

'GI.Gio.Objects.Application.Application' will attempt to parse the commandline arguments.  You
can add commandline flags to the list of recognised options by way of
'GI.Gio.Objects.Application.applicationAddMainOptionEntries'.  After this, the
'GI.Gio.Objects.Application.Application'::@/handle-local-options/@ signal is emitted, from which the
application can inspect the values of its @/GOptionEntrys/@.

'GI.Gio.Objects.Application.Application'::@/handle-local-options/@ is a good place to handle options
such as @--version@, where an immediate reply from the local process is
desired (instead of communicating with an already-running instance).
A 'GI.Gio.Objects.Application.Application'::@/handle-local-options/@ handler can stop further processing
by returning a non-negative value, which then becomes the exit status of
the process.

What happens next depends on the flags: if
'GI.Gio.Flags.ApplicationFlagsHandlesCommandLine' was specified then the remaining
commandline arguments are sent to the primary instance, where a
'GI.Gio.Objects.Application.Application'::@/command-line/@ signal is emitted.  Otherwise, the
remaining commandline arguments are assumed to be a list of files.
If there are no files listed, the application is activated via the
'GI.Gio.Objects.Application.Application'::@/activate/@ signal.  If there are one or more files, and
'GI.Gio.Flags.ApplicationFlagsHandlesOpen' was specified then the files are opened
via the 'GI.Gio.Objects.Application.Application'::@/open/@ signal.

If you are interested in doing more complicated local handling of the
commandline then you should implement your own 'GI.Gio.Objects.Application.Application' subclass
and override @/local_command_line()/@. In this case, you most likely want
to return 'True' from your @/local_command_line()/@ implementation to
suppress the default handling. See
[gapplication-example-cmdline2.c][gapplication-example-cmdline2]
for an example.

If, after the above is done, the use count of the application is zero
then the exit status is returned immediately.  If the use count is
non-zero then the default main context is iterated until the use count
falls to zero, at which point 0 is returned.

If the 'GI.Gio.Flags.ApplicationFlagsIsService' flag is set, then the service will
run for as much as 10 seconds with a use count of zero while waiting
for the message that caused the activation to arrive.  After that,
if the use count falls to zero the application will exit immediately,
except in the case that 'GI.Gio.Objects.Application.applicationSetInactivityTimeout' is in
use.

This function sets the prgname ('GI.GLib.Functions.setPrgname'), if not already set,
to the basename of argv[0].

Much like 'GI.GLib.Structs.MainLoop.mainLoopRun', this function will acquire the main context
for the duration that the application is running.

Since 2.40, applications that are not explicitly flagged as services
or launchers (ie: neither 'GI.Gio.Flags.ApplicationFlagsIsService' or
'GI.Gio.Flags.ApplicationFlagsIsLauncher' are given as flags) will check (from the
default handler for local_command_line) if \"--gapplication-service\"
was given in the command line.  If this flag is present then normal
commandline processing is interrupted and the
'GI.Gio.Flags.ApplicationFlagsIsService' flag is set.  This provides a \"compromise\"
solution whereby running an application directly from the commandline
will invoke it in the normal way (which can be useful for debugging)
while still allowing applications to be D-Bus activated in service
mode.  The D-Bus service file should invoke the executable with
\"--gapplication-service\" as the sole commandline argument.  This
approach is suitable for use by most graphical applications but
should not be used from applications like editors that need precise
control over when processes invoked via the commandline will exit and
what their exit status will be.

@since 2.28
-}
applicationRun ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> Maybe ([T.Text])
    {- ^ /@argv@/: the argv from @/main()/@, or 'Nothing' -}
    -> m Int32
    {- ^ __Returns:__ the exit status -}
applicationRun application argv = liftIO $ do
    let argc = case argv of
            Nothing -> 0
            Just jArgv -> fromIntegral $ length jArgv
    application' <- unsafeManagedPtrCastPtr application
    maybeArgv <- case argv of
        Nothing -> return nullPtr
        Just jArgv -> do
            jArgv' <- packUTF8CArray jArgv
            return jArgv'
    result <- g_application_run application' argc maybeArgv
    touchManagedPtr application
    (mapCArrayWithLength argc) freeMem maybeArgv
    freeMem maybeArgv
    return result

data ApplicationRunMethodInfo
instance (signature ~ (Maybe ([T.Text]) -> m Int32), MonadIO m, IsApplication a) => O.MethodInfo ApplicationRunMethodInfo a signature where
    overloadedMethod _ = applicationRun

-- method Application::send_notification
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "application", argType = TInterface (Name {namespace = "Gio", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GApplication", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "id of the notification, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "notification", argType = TInterface (Name {namespace = "Gio", name = "Notification"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GNotification to send", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_application_send_notification" g_application_send_notification :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    CString ->                              -- id : TBasicType TUTF8
    Ptr Gio.Notification.Notification ->    -- notification : TInterface (Name {namespace = "Gio", name = "Notification"})
    IO ()

{- |
Sends a notification on behalf of /@application@/ to the desktop shell.
There is no guarantee that the notification is displayed immediately,
or even at all.

Notifications may persist after the application exits. It will be
D-Bus-activated when the notification or one of its actions is
activated.

Modifying /@notification@/ after this call has no effect. However, the
object can be reused for a later call to this function.

/@id@/ may be any string that uniquely identifies the event for the
application. It does not need to be in any special format. For
example, \"new-message\" might be appropriate for a notification about
new messages.

If a previous notification was sent with the same /@id@/, it will be
replaced with /@notification@/ and shown again as if it was a new
notification. This works even for notifications sent from a previous
execution of the application, as long as /@id@/ is the same string.

/@id@/ may be 'Nothing', but it is impossible to replace or withdraw
notifications without an id.

If /@notification@/ is no longer relevant, it can be withdrawn with
'GI.Gio.Objects.Application.applicationWithdrawNotification'.

@since 2.40
-}
applicationSendNotification ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a, Gio.Notification.IsNotification b) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> Maybe (T.Text)
    {- ^ /@id@/: id of the notification, or 'Nothing' -}
    -> b
    {- ^ /@notification@/: the 'GI.Gio.Objects.Notification.Notification' to send -}
    -> m ()
applicationSendNotification application id notification = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    maybeId <- case id of
        Nothing -> return nullPtr
        Just jId -> do
            jId' <- textToCString jId
            return jId'
    notification' <- unsafeManagedPtrCastPtr notification
    g_application_send_notification application' maybeId notification'
    touchManagedPtr application
    touchManagedPtr notification
    freeMem maybeId
    return ()

data ApplicationSendNotificationMethodInfo
instance (signature ~ (Maybe (T.Text) -> b -> m ()), MonadIO m, IsApplication a, Gio.Notification.IsNotification b) => O.MethodInfo ApplicationSendNotificationMethodInfo a signature where
    overloadedMethod _ = applicationSendNotification

-- method Application::set_action_group
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "application", argType = TInterface (Name {namespace = "Gio", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GApplication", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "action_group", argType = TInterface (Name {namespace = "Gio", name = "ActionGroup"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GActionGroup, 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 "g_application_set_action_group" g_application_set_action_group :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    Ptr Gio.ActionGroup.ActionGroup ->      -- action_group : TInterface (Name {namespace = "Gio", name = "ActionGroup"})
    IO ()

{-# DEPRECATED applicationSetActionGroup ["(Since version 2.32)","Use the 'GI.Gio.Interfaces.ActionMap.ActionMap' interface instead.  Never ever","mix use of this API with use of 'GI.Gio.Interfaces.ActionMap.ActionMap' on the same /@application@/","or things will go very badly wrong.  This function is known to","introduce buggy behaviour (ie: signals not emitted on changes to the","action group), so you should really use 'GI.Gio.Interfaces.ActionMap.ActionMap' instead."] #-}
{- |
This used to be how actions were associated with a 'GI.Gio.Objects.Application.Application'.
Now there is 'GI.Gio.Interfaces.ActionMap.ActionMap' for that.

@since 2.28
-}
applicationSetActionGroup ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a, Gio.ActionGroup.IsActionGroup b) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> Maybe (b)
    {- ^ /@actionGroup@/: a 'GI.Gio.Interfaces.ActionGroup.ActionGroup', or 'Nothing' -}
    -> m ()
applicationSetActionGroup application actionGroup = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    maybeActionGroup <- case actionGroup of
        Nothing -> return nullPtr
        Just jActionGroup -> do
            jActionGroup' <- unsafeManagedPtrCastPtr jActionGroup
            return jActionGroup'
    g_application_set_action_group application' maybeActionGroup
    touchManagedPtr application
    whenJust actionGroup touchManagedPtr
    return ()

data ApplicationSetActionGroupMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsApplication a, Gio.ActionGroup.IsActionGroup b) => O.MethodInfo ApplicationSetActionGroupMethodInfo a signature where
    overloadedMethod _ = applicationSetActionGroup

-- method Application::set_application_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "application", argType = TInterface (Name {namespace = "Gio", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GApplication", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "application_id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the identifier for @application", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_application_set_application_id" g_application_set_application_id :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    CString ->                              -- application_id : TBasicType TUTF8
    IO ()

{- |
Sets the unique identifier for /@application@/.

The application id can only be modified if /@application@/ has not yet
been registered.

If non-'Nothing', the application id must be valid.  See
'GI.Gio.Objects.Application.applicationIdIsValid'.

@since 2.28
-}
applicationSetApplicationId ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> Maybe (T.Text)
    {- ^ /@applicationId@/: the identifier for /@application@/ -}
    -> m ()
applicationSetApplicationId application applicationId = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    maybeApplicationId <- case applicationId of
        Nothing -> return nullPtr
        Just jApplicationId -> do
            jApplicationId' <- textToCString jApplicationId
            return jApplicationId'
    g_application_set_application_id application' maybeApplicationId
    touchManagedPtr application
    freeMem maybeApplicationId
    return ()

data ApplicationSetApplicationIdMethodInfo
instance (signature ~ (Maybe (T.Text) -> m ()), MonadIO m, IsApplication a) => O.MethodInfo ApplicationSetApplicationIdMethodInfo a signature where
    overloadedMethod _ = applicationSetApplicationId

-- method Application::set_default
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "application", argType = TInterface (Name {namespace = "Gio", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the application to set as default, 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 "g_application_set_default" g_application_set_default :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    IO ()

{- |
Sets or unsets the default application for the process, as returned
by 'GI.Gio.Objects.Application.applicationGetDefault'.

This function does not take its own reference on /@application@/.  If
/@application@/ is destroyed then the default application will revert
back to 'Nothing'.

@since 2.32
-}
applicationSetDefault ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: the application to set as default, or 'Nothing' -}
    -> m ()
applicationSetDefault application = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    g_application_set_default application'
    touchManagedPtr application
    return ()

data ApplicationSetDefaultMethodInfo
instance (signature ~ (m ()), MonadIO m, IsApplication a) => O.MethodInfo ApplicationSetDefaultMethodInfo a signature where
    overloadedMethod _ = applicationSetDefault

-- method Application::set_flags
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "application", argType = TInterface (Name {namespace = "Gio", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GApplication", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "ApplicationFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the flags for @application", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_application_set_flags" g_application_set_flags :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "ApplicationFlags"})
    IO ()

{- |
Sets the flags for /@application@/.

The flags can only be modified if /@application@/ has not yet been
registered.

See 'GI.Gio.Flags.ApplicationFlags'.

@since 2.28
-}
applicationSetFlags ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> [Gio.Flags.ApplicationFlags]
    {- ^ /@flags@/: the flags for /@application@/ -}
    -> m ()
applicationSetFlags application flags = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    let flags' = gflagsToWord flags
    g_application_set_flags application' flags'
    touchManagedPtr application
    return ()

data ApplicationSetFlagsMethodInfo
instance (signature ~ ([Gio.Flags.ApplicationFlags] -> m ()), MonadIO m, IsApplication a) => O.MethodInfo ApplicationSetFlagsMethodInfo a signature where
    overloadedMethod _ = applicationSetFlags

-- method Application::set_inactivity_timeout
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "application", argType = TInterface (Name {namespace = "Gio", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GApplication", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "inactivity_timeout", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the timeout, in milliseconds", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_application_set_inactivity_timeout" g_application_set_inactivity_timeout :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    Word32 ->                               -- inactivity_timeout : TBasicType TUInt
    IO ()

{- |
Sets the current inactivity timeout for the application.

This is the amount of time (in milliseconds) after the last call to
'GI.Gio.Objects.Application.applicationRelease' before the application stops running.

This call has no side effects of its own.  The value set here is only
used for next time 'GI.Gio.Objects.Application.applicationRelease' drops the use count to
zero.  Any timeouts currently in progress are not impacted.

@since 2.28
-}
applicationSetInactivityTimeout ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> Word32
    {- ^ /@inactivityTimeout@/: the timeout, in milliseconds -}
    -> m ()
applicationSetInactivityTimeout application inactivityTimeout = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    g_application_set_inactivity_timeout application' inactivityTimeout
    touchManagedPtr application
    return ()

data ApplicationSetInactivityTimeoutMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m, IsApplication a) => O.MethodInfo ApplicationSetInactivityTimeoutMethodInfo a signature where
    overloadedMethod _ = applicationSetInactivityTimeout

-- method Application::set_resource_base_path
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "application", argType = TInterface (Name {namespace = "Gio", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GApplication", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "resource_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the resource path to use", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_application_set_resource_base_path" g_application_set_resource_base_path :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    CString ->                              -- resource_path : TBasicType TUTF8
    IO ()

{- |
Sets (or unsets) the base resource path of /@application@/.

The path is used to automatically load various [application
resources][gresource] such as menu layouts and action descriptions.
The various types of resources will be found at fixed names relative
to the given base path.

By default, the resource base path is determined from the application
ID by prefixing \'\/\' and replacing each \'.\' with \'\/\'.  This is done at
the time that the 'GI.Gio.Objects.Application.Application' object is constructed.  Changes to
the application ID after that point will not have an impact on the
resource base path.

As an example, if the application has an ID of \"org.example.app\" then
the default resource base path will be \"\/org\/example\/app\".  If this
is a @/GtkApplication/@ (and you have not manually changed the path)
then Gtk will then search for the menus of the application at
\"\/org\/example\/app\/gtk\/menus.ui\".

See 'GI.Gio.Structs.Resource.Resource' for more information about adding resources to your
application.

You can disable automatic resource loading functionality by setting
the path to 'Nothing'.

Changing the resource base path once the application is running is
not recommended.  The point at which the resource path is consulted
for forming paths for various purposes is unspecified.  When writing
a sub-class of 'GI.Gio.Objects.Application.Application' you should either set the
'GI.Gio.Objects.Application.Application':@/resource-base-path/@ property at construction time, or call
this function during the instance initialization. Alternatively, you
can call this function in the 'GI.Gio.Structs.ApplicationClass.ApplicationClass'.@/startup/@ virtual function,
before chaining up to the parent implementation.

@since 2.42
-}
applicationSetResourceBasePath ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> Maybe (T.Text)
    {- ^ /@resourcePath@/: the resource path to use -}
    -> m ()
applicationSetResourceBasePath application resourcePath = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    maybeResourcePath <- case resourcePath of
        Nothing -> return nullPtr
        Just jResourcePath -> do
            jResourcePath' <- textToCString jResourcePath
            return jResourcePath'
    g_application_set_resource_base_path application' maybeResourcePath
    touchManagedPtr application
    freeMem maybeResourcePath
    return ()

data ApplicationSetResourceBasePathMethodInfo
instance (signature ~ (Maybe (T.Text) -> m ()), MonadIO m, IsApplication a) => O.MethodInfo ApplicationSetResourceBasePathMethodInfo a signature where
    overloadedMethod _ = applicationSetResourceBasePath

-- method Application::unbind_busy_property
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "application", argType = TInterface (Name {namespace = "Gio", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GApplication", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "object", argType = TInterface (Name {namespace = "GObject", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GObject", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a boolean property of @object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_application_unbind_busy_property" g_application_unbind_busy_property :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    Ptr GObject.Object.Object ->            -- object : TInterface (Name {namespace = "GObject", name = "Object"})
    CString ->                              -- property : TBasicType TUTF8
    IO ()

{- |
Destroys a binding between /@property@/ and the busy state of
/@application@/ that was previously created with
'GI.Gio.Objects.Application.applicationBindBusyProperty'.

@since 2.44
-}
applicationUnbindBusyProperty ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a, GObject.Object.IsObject b) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> b
    {- ^ /@object@/: a 'GI.GObject.Objects.Object.Object' -}
    -> T.Text
    {- ^ /@property@/: the name of a boolean property of /@object@/ -}
    -> m ()
applicationUnbindBusyProperty application object property = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    object' <- unsafeManagedPtrCastPtr object
    property' <- textToCString property
    g_application_unbind_busy_property application' object' property'
    touchManagedPtr application
    touchManagedPtr object
    freeMem property'
    return ()

data ApplicationUnbindBusyPropertyMethodInfo
instance (signature ~ (b -> T.Text -> m ()), MonadIO m, IsApplication a, GObject.Object.IsObject b) => O.MethodInfo ApplicationUnbindBusyPropertyMethodInfo a signature where
    overloadedMethod _ = applicationUnbindBusyProperty

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

foreign import ccall "g_application_unmark_busy" g_application_unmark_busy :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    IO ()

{- |
Decreases the busy count of /@application@/.

When the busy count reaches zero, the new state will be propagated
to other processes.

This function must only be called to cancel the effect of a previous
call to 'GI.Gio.Objects.Application.applicationMarkBusy'.

@since 2.38
-}
applicationUnmarkBusy ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> m ()
applicationUnmarkBusy application = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    g_application_unmark_busy application'
    touchManagedPtr application
    return ()

data ApplicationUnmarkBusyMethodInfo
instance (signature ~ (m ()), MonadIO m, IsApplication a) => O.MethodInfo ApplicationUnmarkBusyMethodInfo a signature where
    overloadedMethod _ = applicationUnmarkBusy

-- method Application::withdraw_notification
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "application", argType = TInterface (Name {namespace = "Gio", name = "Application"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GApplication", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "id of a previously sent notification", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_application_withdraw_notification" g_application_withdraw_notification :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    CString ->                              -- id : TBasicType TUTF8
    IO ()

{- |
Withdraws a notification that was sent with
'GI.Gio.Objects.Application.applicationSendNotification'.

This call does nothing if a notification with /@id@/ doesn\'t exist or
the notification was never sent.

This function works even for notifications sent in previous
executions of this application, as long /@id@/ is the same as it was for
the sent notification.

Note that notifications are dismissed when the user clicks on one
of the buttons in a notification or triggers its default action, so
there is no need to explicitly withdraw the notification in that case.

@since 2.40
-}
applicationWithdrawNotification ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
    -> T.Text
    {- ^ /@id@/: id of a previously sent notification -}
    -> m ()
applicationWithdrawNotification application id = liftIO $ do
    application' <- unsafeManagedPtrCastPtr application
    id' <- textToCString id
    g_application_withdraw_notification application' id'
    touchManagedPtr application
    freeMem id'
    return ()

data ApplicationWithdrawNotificationMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsApplication a) => O.MethodInfo ApplicationWithdrawNotificationMethodInfo a signature where
    overloadedMethod _ = applicationWithdrawNotification

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

foreign import ccall "g_application_get_default" g_application_get_default :: 
    IO (Ptr Application)

{- |
Returns the default 'GI.Gio.Objects.Application.Application' instance for this process.

Normally there is only one 'GI.Gio.Objects.Application.Application' per process and it becomes
the default when it is created.  You can exercise more control over
this by using 'GI.Gio.Objects.Application.applicationSetDefault'.

If there is no default application then 'Nothing' is returned.

@since 2.32
-}
applicationGetDefault ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Application
    {- ^ __Returns:__ the default application for this process, or 'Nothing' -}
applicationGetDefault  = liftIO $ do
    result <- g_application_get_default
    checkUnexpectedReturnNULL "applicationGetDefault" result
    result' <- (newObject Application) result
    return result'

-- method Application::id_is_valid
-- method type : MemberFunction
-- Args : [Arg {argCName = "application_id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a potential application identifier", 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 "g_application_id_is_valid" g_application_id_is_valid :: 
    CString ->                              -- application_id : TBasicType TUTF8
    IO CInt

{- |
Checks if /@applicationId@/ is a valid application identifier.

A valid ID is required for calls to 'GI.Gio.Objects.Application.applicationNew' and
'GI.Gio.Objects.Application.applicationSetApplicationId'.

For convenience, the restrictions on application identifiers are
reproduced here:

* Application identifiers must contain only the ASCII characters
\"[A-Z][a-z][0-9]_-.\" and must not begin with a digit.
* Application identifiers must contain at least one \'.\' (period)
character (and thus at least three elements).
* Application identifiers must not begin or end with a \'.\' (period)
character.
* Application identifiers must not contain consecutive \'.\' (period)
characters.
* Application identifiers must not exceed 255 characters.
-}
applicationIdIsValid ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@applicationId@/: a potential application identifier -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@applicationId@/ is valid -}
applicationIdIsValid applicationId = liftIO $ do
    applicationId' <- textToCString applicationId
    result <- g_application_id_is_valid applicationId'
    let result' = (/= 0) result
    freeMem applicationId'
    return result'