{- |
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 the same as
that of of a
<https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus D-Bus well-known bus name>.
Examples include: @com.example.MyApp@, @org.example.internal_apps.Calculator@,
@org._7_zip.Archiver@.
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>.

/Since: 2.28/
-}

#define ENABLE_OVERLOADING \
       (!defined(__HADDOCK_VERSION__))

module GI.Gio.Objects.Application
    ( 

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


 -- * Methods
-- ** activate #method:activate#

#if ENABLE_OVERLOADING
    ApplicationActivateMethodInfo           ,
#endif
    applicationActivate                     ,


-- ** addMainOption #method:addMainOption#

#if ENABLE_OVERLOADING
    ApplicationAddMainOptionMethodInfo      ,
#endif
    applicationAddMainOption                ,


-- ** addMainOptionEntries #method:addMainOptionEntries#

#if ENABLE_OVERLOADING
    ApplicationAddMainOptionEntriesMethodInfo,
#endif
    applicationAddMainOptionEntries         ,


-- ** addOptionGroup #method:addOptionGroup#

#if ENABLE_OVERLOADING
    ApplicationAddOptionGroupMethodInfo     ,
#endif
    applicationAddOptionGroup               ,


-- ** bindBusyProperty #method:bindBusyProperty#

#if ENABLE_OVERLOADING
    ApplicationBindBusyPropertyMethodInfo   ,
#endif
    applicationBindBusyProperty             ,


-- ** getApplicationId #method:getApplicationId#

#if ENABLE_OVERLOADING
    ApplicationGetApplicationIdMethodInfo   ,
#endif
    applicationGetApplicationId             ,


-- ** getDbusConnection #method:getDbusConnection#

#if ENABLE_OVERLOADING
    ApplicationGetDbusConnectionMethodInfo  ,
#endif
    applicationGetDbusConnection            ,


-- ** getDbusObjectPath #method:getDbusObjectPath#

#if ENABLE_OVERLOADING
    ApplicationGetDbusObjectPathMethodInfo  ,
#endif
    applicationGetDbusObjectPath            ,


-- ** getDefault #method:getDefault#

    applicationGetDefault                   ,


-- ** getFlags #method:getFlags#

#if ENABLE_OVERLOADING
    ApplicationGetFlagsMethodInfo           ,
#endif
    applicationGetFlags                     ,


-- ** getInactivityTimeout #method:getInactivityTimeout#

#if ENABLE_OVERLOADING
    ApplicationGetInactivityTimeoutMethodInfo,
#endif
    applicationGetInactivityTimeout         ,


-- ** getIsBusy #method:getIsBusy#

#if ENABLE_OVERLOADING
    ApplicationGetIsBusyMethodInfo          ,
#endif
    applicationGetIsBusy                    ,


-- ** getIsRegistered #method:getIsRegistered#

#if ENABLE_OVERLOADING
    ApplicationGetIsRegisteredMethodInfo    ,
#endif
    applicationGetIsRegistered              ,


-- ** getIsRemote #method:getIsRemote#

#if ENABLE_OVERLOADING
    ApplicationGetIsRemoteMethodInfo        ,
#endif
    applicationGetIsRemote                  ,


-- ** getResourceBasePath #method:getResourceBasePath#

#if ENABLE_OVERLOADING
    ApplicationGetResourceBasePathMethodInfo,
#endif
    applicationGetResourceBasePath          ,


-- ** hold #method:hold#

#if ENABLE_OVERLOADING
    ApplicationHoldMethodInfo               ,
#endif
    applicationHold                         ,


-- ** idIsValid #method:idIsValid#

    applicationIdIsValid                    ,


-- ** markBusy #method:markBusy#

#if ENABLE_OVERLOADING
    ApplicationMarkBusyMethodInfo           ,
#endif
    applicationMarkBusy                     ,


-- ** new #method:new#

    applicationNew                          ,


-- ** open #method:open#

#if ENABLE_OVERLOADING
    ApplicationOpenMethodInfo               ,
#endif
    applicationOpen                         ,


-- ** quit #method:quit#

#if ENABLE_OVERLOADING
    ApplicationQuitMethodInfo               ,
#endif
    applicationQuit                         ,


-- ** register #method:register#

#if ENABLE_OVERLOADING
    ApplicationRegisterMethodInfo           ,
#endif
    applicationRegister                     ,


-- ** release #method:release#

#if ENABLE_OVERLOADING
    ApplicationReleaseMethodInfo            ,
#endif
    applicationRelease                      ,


-- ** run #method:run#

#if ENABLE_OVERLOADING
    ApplicationRunMethodInfo                ,
#endif
    applicationRun                          ,


-- ** sendNotification #method:sendNotification#

#if ENABLE_OVERLOADING
    ApplicationSendNotificationMethodInfo   ,
#endif
    applicationSendNotification             ,


-- ** setActionGroup #method:setActionGroup#

#if ENABLE_OVERLOADING
    ApplicationSetActionGroupMethodInfo     ,
#endif
    applicationSetActionGroup               ,


-- ** setApplicationId #method:setApplicationId#

#if ENABLE_OVERLOADING
    ApplicationSetApplicationIdMethodInfo   ,
#endif
    applicationSetApplicationId             ,


-- ** setDefault #method:setDefault#

#if ENABLE_OVERLOADING
    ApplicationSetDefaultMethodInfo         ,
#endif
    applicationSetDefault                   ,


-- ** setFlags #method:setFlags#

#if ENABLE_OVERLOADING
    ApplicationSetFlagsMethodInfo           ,
#endif
    applicationSetFlags                     ,


-- ** setInactivityTimeout #method:setInactivityTimeout#

#if ENABLE_OVERLOADING
    ApplicationSetInactivityTimeoutMethodInfo,
#endif
    applicationSetInactivityTimeout         ,


-- ** setOptionContextDescription #method:setOptionContextDescription#

#if ENABLE_OVERLOADING
    ApplicationSetOptionContextDescriptionMethodInfo,
#endif
    applicationSetOptionContextDescription  ,


-- ** setOptionContextParameterString #method:setOptionContextParameterString#

#if ENABLE_OVERLOADING
    ApplicationSetOptionContextParameterStringMethodInfo,
#endif
    applicationSetOptionContextParameterString,


-- ** setOptionContextSummary #method:setOptionContextSummary#

#if ENABLE_OVERLOADING
    ApplicationSetOptionContextSummaryMethodInfo,
#endif
    applicationSetOptionContextSummary      ,


-- ** setResourceBasePath #method:setResourceBasePath#

#if ENABLE_OVERLOADING
    ApplicationSetResourceBasePathMethodInfo,
#endif
    applicationSetResourceBasePath          ,


-- ** unbindBusyProperty #method:unbindBusyProperty#

#if ENABLE_OVERLOADING
    ApplicationUnbindBusyPropertyMethodInfo ,
#endif
    applicationUnbindBusyProperty           ,


-- ** unmarkBusy #method:unmarkBusy#

#if ENABLE_OVERLOADING
    ApplicationUnmarkBusyMethodInfo         ,
#endif
    applicationUnmarkBusy                   ,


-- ** withdrawNotification #method:withdrawNotification#

#if ENABLE_OVERLOADING
    ApplicationWithdrawNotificationMethodInfo,
#endif
    applicationWithdrawNotification         ,




 -- * Properties
-- ** actionGroup #attr:actionGroup#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    ApplicationActionGroupPropertyInfo      ,
#endif
#if ENABLE_OVERLOADING
    applicationActionGroup                  ,
#endif
    clearApplicationActionGroup             ,
    constructApplicationActionGroup         ,
    setApplicationActionGroup               ,


-- ** applicationId #attr:applicationId#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    ApplicationApplicationIdPropertyInfo    ,
#endif
#if ENABLE_OVERLOADING
    applicationApplicationId                ,
#endif
    clearApplicationApplicationId           ,
    constructApplicationApplicationId       ,
    getApplicationApplicationId             ,
    setApplicationApplicationId             ,


-- ** flags #attr:flags#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    ApplicationFlagsPropertyInfo            ,
#endif
#if ENABLE_OVERLOADING
    applicationFlags                        ,
#endif
    constructApplicationFlags               ,
    getApplicationFlags                     ,
    setApplicationFlags                     ,


-- ** inactivityTimeout #attr:inactivityTimeout#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    ApplicationInactivityTimeoutPropertyInfo,
#endif
#if ENABLE_OVERLOADING
    applicationInactivityTimeout            ,
#endif
    constructApplicationInactivityTimeout   ,
    getApplicationInactivityTimeout         ,
    setApplicationInactivityTimeout         ,


-- ** isBusy #attr:isBusy#
{- | Whether the application is currently marked as busy through
'GI.Gio.Objects.Application.applicationMarkBusy' or 'GI.Gio.Objects.Application.applicationBindBusyProperty'.

/Since: 2.44/
-}
#if ENABLE_OVERLOADING
    ApplicationIsBusyPropertyInfo           ,
#endif
#if ENABLE_OVERLOADING
    applicationIsBusy                       ,
#endif
    getApplicationIsBusy                    ,


-- ** isRegistered #attr:isRegistered#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    ApplicationIsRegisteredPropertyInfo     ,
#endif
#if ENABLE_OVERLOADING
    applicationIsRegistered                 ,
#endif
    getApplicationIsRegistered              ,


-- ** isRemote #attr:isRemote#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    ApplicationIsRemotePropertyInfo         ,
#endif
#if ENABLE_OVERLOADING
    applicationIsRemote                     ,
#endif
    getApplicationIsRemote                  ,


-- ** resourceBasePath #attr:resourceBasePath#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    ApplicationResourceBasePathPropertyInfo ,
#endif
#if ENABLE_OVERLOADING
    applicationResourceBasePath             ,
#endif
    clearApplicationResourceBasePath        ,
    constructApplicationResourceBasePath    ,
    getApplicationResourceBasePath          ,
    setApplicationResourceBasePath          ,




 -- * Signals
-- ** activate #signal:activate#

    ApplicationActivateCallback             ,
#if ENABLE_OVERLOADING
    ApplicationActivateSignalInfo           ,
#endif
    C_ApplicationActivateCallback           ,
    afterApplicationActivate                ,
    genClosure_ApplicationActivate          ,
    mk_ApplicationActivateCallback          ,
    noApplicationActivateCallback           ,
    onApplicationActivate                   ,
    wrap_ApplicationActivateCallback        ,


-- ** commandLine #signal:commandLine#

    ApplicationCommandLineCallback          ,
#if ENABLE_OVERLOADING
    ApplicationCommandLineSignalInfo        ,
#endif
    C_ApplicationCommandLineCallback        ,
    afterApplicationCommandLine             ,
    genClosure_ApplicationCommandLine       ,
    mk_ApplicationCommandLineCallback       ,
    noApplicationCommandLineCallback        ,
    onApplicationCommandLine                ,
    wrap_ApplicationCommandLineCallback     ,


-- ** handleLocalOptions #signal:handleLocalOptions#

    ApplicationHandleLocalOptionsCallback   ,
#if ENABLE_OVERLOADING
    ApplicationHandleLocalOptionsSignalInfo ,
#endif
    C_ApplicationHandleLocalOptionsCallback ,
    afterApplicationHandleLocalOptions      ,
    genClosure_ApplicationHandleLocalOptions,
    mk_ApplicationHandleLocalOptionsCallback,
    noApplicationHandleLocalOptionsCallback ,
    onApplicationHandleLocalOptions         ,
    wrap_ApplicationHandleLocalOptionsCallback,


-- ** nameLost #signal:nameLost#

    ApplicationNameLostCallback             ,
#if ENABLE_OVERLOADING
    ApplicationNameLostSignalInfo           ,
#endif
    C_ApplicationNameLostCallback           ,
    afterApplicationNameLost                ,
    genClosure_ApplicationNameLost          ,
    mk_ApplicationNameLostCallback          ,
    noApplicationNameLostCallback           ,
    onApplicationNameLost                   ,
    wrap_ApplicationNameLostCallback        ,


-- ** open #signal:open#

    ApplicationOpenCallback                 ,
#if ENABLE_OVERLOADING
    ApplicationOpenSignalInfo               ,
#endif
    C_ApplicationOpenCallback               ,
    afterApplicationOpen                    ,
    genClosure_ApplicationOpen              ,
    mk_ApplicationOpenCallback              ,
    noApplicationOpenCallback               ,
    onApplicationOpen                       ,
    wrap_ApplicationOpenCallback            ,


-- ** shutdown #signal:shutdown#

    ApplicationShutdownCallback             ,
#if ENABLE_OVERLOADING
    ApplicationShutdownSignalInfo           ,
#endif
    C_ApplicationShutdownCallback           ,
    afterApplicationShutdown                ,
    genClosure_ApplicationShutdown          ,
    mk_ApplicationShutdownCallback          ,
    noApplicationShutdownCallback           ,
    onApplicationShutdown                   ,
    wrap_ApplicationShutdownCallback        ,


-- ** startup #signal:startup#

    ApplicationStartupCallback              ,
#if ENABLE_OVERLOADING
    ApplicationStartupSignalInfo            ,
#endif
    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.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.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

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

instance GObject Application where
    gobjectType :: Application -> IO GType
gobjectType _ = IO GType
c_g_application_get_type
    

-- | Type class for types which can be safely cast to `Application`, for instance with `toApplication`.
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

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

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

#if ENABLE_OVERLOADING
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 "getv" o = GObject.Object.ObjectGetvMethodInfo
    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 "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 "setOptionContextDescription" o = ApplicationSetOptionContextDescriptionMethodInfo
    ResolveApplicationMethod "setOptionContextParameterString" o = ApplicationSetOptionContextParameterStringMethodInfo
    ResolveApplicationMethod "setOptionContextSummary" o = ApplicationSetOptionContextSummaryMethodInfo
    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
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif

#endif

-- signal Application::activate
{- |
The ::activate signal is emitted on the primary instance when an
activation occurs. See 'GI.Gio.Objects.Application.applicationActivate'.
-}
type ApplicationActivateCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ApplicationActivateCallback`@.
noApplicationActivateCallback :: Maybe ApplicationActivateCallback
noApplicationActivateCallback :: Maybe ApplicationActivateCallback
noApplicationActivateCallback = Maybe ApplicationActivateCallback
forall a. Maybe a
Nothing

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

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

-- | Wrap the callback into a `Closure`.
genClosure_ApplicationActivate :: ApplicationActivateCallback -> IO Closure
genClosure_ApplicationActivate :: ApplicationActivateCallback -> IO Closure
genClosure_ApplicationActivate cb :: ApplicationActivateCallback
cb = do
    let cb' :: C_ApplicationActivateCallback
cb' = ApplicationActivateCallback -> C_ApplicationActivateCallback
wrap_ApplicationActivateCallback ApplicationActivateCallback
cb
    C_ApplicationActivateCallback
-> IO (FunPtr C_ApplicationActivateCallback)
mk_ApplicationActivateCallback C_ApplicationActivateCallback
cb' IO (FunPtr C_ApplicationActivateCallback)
-> (FunPtr C_ApplicationActivateCallback -> IO Closure)
-> IO Closure
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ApplicationActivateCallback -> IO Closure
forall a. FunPtr a -> IO Closure
newCClosure


-- | Wrap a `ApplicationActivateCallback` into a `C_ApplicationActivateCallback`.
wrap_ApplicationActivateCallback ::
    ApplicationActivateCallback ->
    C_ApplicationActivateCallback
wrap_ApplicationActivateCallback :: ApplicationActivateCallback -> C_ApplicationActivateCallback
wrap_ApplicationActivateCallback _cb :: ApplicationActivateCallback
_cb _ _ = do
    ApplicationActivateCallback
_cb 


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

@
'Data.GI.Base.Signals.on' application #activate callback
@
-}
onApplicationActivate :: (IsApplication a, MonadIO m) => a -> ApplicationActivateCallback -> m SignalHandlerId
onApplicationActivate :: a -> ApplicationActivateCallback -> m SignalHandlerId
onApplicationActivate obj :: a
obj cb :: ApplicationActivateCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ApplicationActivateCallback
cb' = ApplicationActivateCallback -> C_ApplicationActivateCallback
wrap_ApplicationActivateCallback ApplicationActivateCallback
cb
    FunPtr C_ApplicationActivateCallback
cb'' <- C_ApplicationActivateCallback
-> IO (FunPtr C_ApplicationActivateCallback)
mk_ApplicationActivateCallback C_ApplicationActivateCallback
cb'
    a
-> String
-> FunPtr C_ApplicationActivateCallback
-> SignalConnectMode
-> IO SignalHandlerId
forall o a.
GObject o =>
o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId
connectSignalFunPtr a
obj "activate" FunPtr C_ApplicationActivateCallback
cb'' SignalConnectMode
SignalConnectBefore

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

@
'Data.GI.Base.Signals.after' application #activate callback
@
-}
afterApplicationActivate :: (IsApplication a, MonadIO m) => a -> ApplicationActivateCallback -> m SignalHandlerId
afterApplicationActivate :: a -> ApplicationActivateCallback -> m SignalHandlerId
afterApplicationActivate obj :: a
obj cb :: ApplicationActivateCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ApplicationActivateCallback
cb' = ApplicationActivateCallback -> C_ApplicationActivateCallback
wrap_ApplicationActivateCallback ApplicationActivateCallback
cb
    FunPtr C_ApplicationActivateCallback
cb'' <- C_ApplicationActivateCallback
-> IO (FunPtr C_ApplicationActivateCallback)
mk_ApplicationActivateCallback C_ApplicationActivateCallback
cb'
    a
-> String
-> FunPtr C_ApplicationActivateCallback
-> SignalConnectMode
-> IO SignalHandlerId
forall o a.
GObject o =>
o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId
connectSignalFunPtr a
obj "activate" FunPtr C_ApplicationActivateCallback
cb'' SignalConnectMode
SignalConnectAfter


-- signal Application::command-line
{- |
The ::command-line signal is emitted on the primary instance when
a commandline is not handled locally. See 'GI.Gio.Objects.Application.applicationRun' and
the 'GI.Gio.Objects.ApplicationCommandLine.ApplicationCommandLine' documentation for more information.
-}
type ApplicationCommandLineCallback =
    Gio.ApplicationCommandLine.ApplicationCommandLine
    {- ^ /@commandLine@/: a 'GI.Gio.Objects.ApplicationCommandLine.ApplicationCommandLine' representing the
    passed commandline -}
    -> IO Int32
    {- ^ __Returns:__ An integer that is set as the exit status for the calling
  process. See 'GI.Gio.Objects.ApplicationCommandLine.applicationCommandLineSetExitStatus'. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `ApplicationCommandLineCallback`@.
noApplicationCommandLineCallback :: Maybe ApplicationCommandLineCallback
noApplicationCommandLineCallback :: Maybe ApplicationCommandLineCallback
noApplicationCommandLineCallback = Maybe ApplicationCommandLineCallback
forall a. Maybe a
Nothing

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

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

-- | Wrap the callback into a `Closure`.
genClosure_ApplicationCommandLine :: ApplicationCommandLineCallback -> IO Closure
genClosure_ApplicationCommandLine :: ApplicationCommandLineCallback -> IO Closure
genClosure_ApplicationCommandLine cb :: ApplicationCommandLineCallback
cb = do
    let cb' :: C_ApplicationCommandLineCallback
cb' = ApplicationCommandLineCallback -> C_ApplicationCommandLineCallback
wrap_ApplicationCommandLineCallback ApplicationCommandLineCallback
cb
    C_ApplicationCommandLineCallback
-> IO (FunPtr C_ApplicationCommandLineCallback)
mk_ApplicationCommandLineCallback C_ApplicationCommandLineCallback
cb' IO (FunPtr C_ApplicationCommandLineCallback)
-> (FunPtr C_ApplicationCommandLineCallback -> IO Closure)
-> IO Closure
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ApplicationCommandLineCallback -> IO Closure
forall a. FunPtr a -> IO Closure
newCClosure


-- | Wrap a `ApplicationCommandLineCallback` into a `C_ApplicationCommandLineCallback`.
wrap_ApplicationCommandLineCallback ::
    ApplicationCommandLineCallback ->
    C_ApplicationCommandLineCallback
wrap_ApplicationCommandLineCallback :: ApplicationCommandLineCallback -> C_ApplicationCommandLineCallback
wrap_ApplicationCommandLineCallback _cb :: ApplicationCommandLineCallback
_cb _ commandLine :: Ptr ApplicationCommandLine
commandLine _ = do
    ApplicationCommandLine
commandLine' <- ((ManagedPtr ApplicationCommandLine -> ApplicationCommandLine)
-> Ptr ApplicationCommandLine -> IO ApplicationCommandLine
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr ApplicationCommandLine -> ApplicationCommandLine
Gio.ApplicationCommandLine.ApplicationCommandLine) Ptr ApplicationCommandLine
commandLine
    Int32
result <- ApplicationCommandLineCallback
_cb  ApplicationCommandLine
commandLine'
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


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

@
'Data.GI.Base.Signals.on' application #commandLine callback
@
-}
onApplicationCommandLine :: (IsApplication a, MonadIO m) => a -> ApplicationCommandLineCallback -> m SignalHandlerId
onApplicationCommandLine :: a -> ApplicationCommandLineCallback -> m SignalHandlerId
onApplicationCommandLine obj :: a
obj cb :: ApplicationCommandLineCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ApplicationCommandLineCallback
cb' = ApplicationCommandLineCallback -> C_ApplicationCommandLineCallback
wrap_ApplicationCommandLineCallback ApplicationCommandLineCallback
cb
    FunPtr C_ApplicationCommandLineCallback
cb'' <- C_ApplicationCommandLineCallback
-> IO (FunPtr C_ApplicationCommandLineCallback)
mk_ApplicationCommandLineCallback C_ApplicationCommandLineCallback
cb'
    a
-> String
-> FunPtr C_ApplicationCommandLineCallback
-> SignalConnectMode
-> IO SignalHandlerId
forall o a.
GObject o =>
o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId
connectSignalFunPtr a
obj "command-line" FunPtr C_ApplicationCommandLineCallback
cb'' SignalConnectMode
SignalConnectBefore

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

@
'Data.GI.Base.Signals.after' application #commandLine callback
@
-}
afterApplicationCommandLine :: (IsApplication a, MonadIO m) => a -> ApplicationCommandLineCallback -> m SignalHandlerId
afterApplicationCommandLine :: a -> ApplicationCommandLineCallback -> m SignalHandlerId
afterApplicationCommandLine obj :: a
obj cb :: ApplicationCommandLineCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ApplicationCommandLineCallback
cb' = ApplicationCommandLineCallback -> C_ApplicationCommandLineCallback
wrap_ApplicationCommandLineCallback ApplicationCommandLineCallback
cb
    FunPtr C_ApplicationCommandLineCallback
cb'' <- C_ApplicationCommandLineCallback
-> IO (FunPtr C_ApplicationCommandLineCallback)
mk_ApplicationCommandLineCallback C_ApplicationCommandLineCallback
cb'
    a
-> String
-> FunPtr C_ApplicationCommandLineCallback
-> SignalConnectMode
-> IO SignalHandlerId
forall o a.
GObject o =>
o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId
connectSignalFunPtr a
obj "command-line" FunPtr C_ApplicationCommandLineCallback
cb'' SignalConnectMode
SignalConnectAfter


-- signal Application::handle-local-options
{- |
The ::handle-local-options signal is emitted on the local instance
after the parsing of the commandline options has occurred.

You can add options to be recognised during commandline option
parsing using 'GI.Gio.Objects.Application.applicationAddMainOptionEntries' and
'GI.Gio.Objects.Application.applicationAddOptionGroup'.

Signal handlers can inspect /@options@/ (along with values pointed to
from the /@argData@/ of an installed @/GOptionEntrys/@) in order to
decide to perform certain actions, including direct local handling
(which may be useful for options like --version).

In the event that the application is marked
'GI.Gio.Flags.ApplicationFlagsHandlesCommandLine' the \"normal processing\" will
send the /@options@/ dictionary to the primary instance where it can be
read with 'GI.Gio.Objects.ApplicationCommandLine.applicationCommandLineGetOptionsDict'.  The signal
handler can modify the dictionary before returning, and the
modified dictionary will be sent.

In the event that 'GI.Gio.Flags.ApplicationFlagsHandlesCommandLine' is not set,
\"normal processing\" will treat the remaining uncollected command
line arguments as filenames or URIs.  If there are no arguments,
the application is activated by 'GI.Gio.Objects.Application.applicationActivate'.  One or
more arguments results in a call to 'GI.Gio.Objects.Application.applicationOpen'.

If you want to handle the local commandline arguments for yourself
by converting them to calls to 'GI.Gio.Objects.Application.applicationOpen' or
'GI.Gio.Interfaces.ActionGroup.actionGroupActivateAction' then you must be sure to register
the application first.  You should probably not call
'GI.Gio.Objects.Application.applicationActivate' for yourself, however: just return -1 and
allow the default handler to do it for you.  This will ensure that
the @--gapplication-service@ switch works properly (i.e. no activation
in that case).

Note that this signal is emitted from the default implementation of
@/local_command_line()/@.  If you override that function and don\'t
chain up then this signal will never be emitted.

You can override @/local_command_line()/@ if you need more powerful
capabilities than what is provided here, but this should not
normally be required.

/Since: 2.40/
-}
type ApplicationHandleLocalOptionsCallback =
    GLib.VariantDict.VariantDict
    {- ^ /@options@/: the options dictionary -}
    -> IO Int32
    {- ^ __Returns:__ an exit code. If you have handled your options and want
to exit the process, return a non-negative option, 0 for success,
and a positive value for failure. To continue, return -1 to let
the default option processing continue. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `ApplicationHandleLocalOptionsCallback`@.
noApplicationHandleLocalOptionsCallback :: Maybe ApplicationHandleLocalOptionsCallback
noApplicationHandleLocalOptionsCallback :: Maybe ApplicationHandleLocalOptionsCallback
noApplicationHandleLocalOptionsCallback = Maybe ApplicationHandleLocalOptionsCallback
forall a. Maybe a
Nothing

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

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

-- | Wrap the callback into a `Closure`.
genClosure_ApplicationHandleLocalOptions :: ApplicationHandleLocalOptionsCallback -> IO Closure
genClosure_ApplicationHandleLocalOptions :: ApplicationHandleLocalOptionsCallback -> IO Closure
genClosure_ApplicationHandleLocalOptions cb :: ApplicationHandleLocalOptionsCallback
cb = do
    let cb' :: C_ApplicationHandleLocalOptionsCallback
cb' = ApplicationHandleLocalOptionsCallback
-> C_ApplicationHandleLocalOptionsCallback
wrap_ApplicationHandleLocalOptionsCallback ApplicationHandleLocalOptionsCallback
cb
    C_ApplicationHandleLocalOptionsCallback
-> IO (FunPtr C_ApplicationHandleLocalOptionsCallback)
mk_ApplicationHandleLocalOptionsCallback C_ApplicationHandleLocalOptionsCallback
cb' IO (FunPtr C_ApplicationHandleLocalOptionsCallback)
-> (FunPtr C_ApplicationHandleLocalOptionsCallback -> IO Closure)
-> IO Closure
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ApplicationHandleLocalOptionsCallback -> IO Closure
forall a. FunPtr a -> IO Closure
newCClosure


-- | Wrap a `ApplicationHandleLocalOptionsCallback` into a `C_ApplicationHandleLocalOptionsCallback`.
wrap_ApplicationHandleLocalOptionsCallback ::
    ApplicationHandleLocalOptionsCallback ->
    C_ApplicationHandleLocalOptionsCallback
wrap_ApplicationHandleLocalOptionsCallback :: ApplicationHandleLocalOptionsCallback
-> C_ApplicationHandleLocalOptionsCallback
wrap_ApplicationHandleLocalOptionsCallback _cb :: ApplicationHandleLocalOptionsCallback
_cb _ options :: Ptr VariantDict
options _ = do
    (ManagedPtr VariantDict -> VariantDict)
-> Ptr VariantDict
-> ApplicationHandleLocalOptionsCallback
-> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr VariantDict -> VariantDict
GLib.VariantDict.VariantDict Ptr VariantDict
options (ApplicationHandleLocalOptionsCallback -> IO Int32)
-> ApplicationHandleLocalOptionsCallback -> IO Int32
forall a b. (a -> b) -> a -> b
$ \options' :: VariantDict
options' -> do
        Int32
result <- ApplicationHandleLocalOptionsCallback
_cb  VariantDict
options'
        Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


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

@
'Data.GI.Base.Signals.on' application #handleLocalOptions callback
@
-}
onApplicationHandleLocalOptions :: (IsApplication a, MonadIO m) => a -> ApplicationHandleLocalOptionsCallback -> m SignalHandlerId
onApplicationHandleLocalOptions :: a -> ApplicationHandleLocalOptionsCallback -> m SignalHandlerId
onApplicationHandleLocalOptions obj :: a
obj cb :: ApplicationHandleLocalOptionsCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ApplicationHandleLocalOptionsCallback
cb' = ApplicationHandleLocalOptionsCallback
-> C_ApplicationHandleLocalOptionsCallback
wrap_ApplicationHandleLocalOptionsCallback ApplicationHandleLocalOptionsCallback
cb
    FunPtr C_ApplicationHandleLocalOptionsCallback
cb'' <- C_ApplicationHandleLocalOptionsCallback
-> IO (FunPtr C_ApplicationHandleLocalOptionsCallback)
mk_ApplicationHandleLocalOptionsCallback C_ApplicationHandleLocalOptionsCallback
cb'
    a
-> String
-> FunPtr C_ApplicationHandleLocalOptionsCallback
-> SignalConnectMode
-> IO SignalHandlerId
forall o a.
GObject o =>
o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId
connectSignalFunPtr a
obj "handle-local-options" FunPtr C_ApplicationHandleLocalOptionsCallback
cb'' SignalConnectMode
SignalConnectBefore

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

@
'Data.GI.Base.Signals.after' application #handleLocalOptions callback
@
-}
afterApplicationHandleLocalOptions :: (IsApplication a, MonadIO m) => a -> ApplicationHandleLocalOptionsCallback -> m SignalHandlerId
afterApplicationHandleLocalOptions :: a -> ApplicationHandleLocalOptionsCallback -> m SignalHandlerId
afterApplicationHandleLocalOptions obj :: a
obj cb :: ApplicationHandleLocalOptionsCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ApplicationHandleLocalOptionsCallback
cb' = ApplicationHandleLocalOptionsCallback
-> C_ApplicationHandleLocalOptionsCallback
wrap_ApplicationHandleLocalOptionsCallback ApplicationHandleLocalOptionsCallback
cb
    FunPtr C_ApplicationHandleLocalOptionsCallback
cb'' <- C_ApplicationHandleLocalOptionsCallback
-> IO (FunPtr C_ApplicationHandleLocalOptionsCallback)
mk_ApplicationHandleLocalOptionsCallback C_ApplicationHandleLocalOptionsCallback
cb'
    a
-> String
-> FunPtr C_ApplicationHandleLocalOptionsCallback
-> SignalConnectMode
-> IO SignalHandlerId
forall o a.
GObject o =>
o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId
connectSignalFunPtr a
obj "handle-local-options" FunPtr C_ApplicationHandleLocalOptionsCallback
cb'' SignalConnectMode
SignalConnectAfter


-- signal Application::name-lost
{- |
The ::name-lost signal is emitted only on the registered primary instance
when a new instance has taken over. This can only happen if the application
is using the 'GI.Gio.Flags.ApplicationFlagsAllowReplacement' flag.

The default handler for this signal calls 'GI.Gio.Objects.Application.applicationQuit'.

/Since: 2.60/
-}
type ApplicationNameLostCallback =
    IO Bool
    {- ^ __Returns:__ 'True' if the signal has been handled -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `ApplicationNameLostCallback`@.
noApplicationNameLostCallback :: Maybe ApplicationNameLostCallback
noApplicationNameLostCallback :: Maybe ApplicationNameLostCallback
noApplicationNameLostCallback = Maybe ApplicationNameLostCallback
forall a. Maybe a
Nothing

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

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

-- | Wrap the callback into a `Closure`.
genClosure_ApplicationNameLost :: ApplicationNameLostCallback -> IO Closure
genClosure_ApplicationNameLost :: ApplicationNameLostCallback -> IO Closure
genClosure_ApplicationNameLost cb :: ApplicationNameLostCallback
cb = do
    let cb' :: C_ApplicationNameLostCallback
cb' = ApplicationNameLostCallback -> C_ApplicationNameLostCallback
wrap_ApplicationNameLostCallback ApplicationNameLostCallback
cb
    C_ApplicationNameLostCallback
-> IO (FunPtr C_ApplicationNameLostCallback)
mk_ApplicationNameLostCallback C_ApplicationNameLostCallback
cb' IO (FunPtr C_ApplicationNameLostCallback)
-> (FunPtr C_ApplicationNameLostCallback -> IO Closure)
-> IO Closure
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ApplicationNameLostCallback -> IO Closure
forall a. FunPtr a -> IO Closure
newCClosure


-- | Wrap a `ApplicationNameLostCallback` into a `C_ApplicationNameLostCallback`.
wrap_ApplicationNameLostCallback ::
    ApplicationNameLostCallback ->
    C_ApplicationNameLostCallback
wrap_ApplicationNameLostCallback :: ApplicationNameLostCallback -> C_ApplicationNameLostCallback
wrap_ApplicationNameLostCallback _cb :: ApplicationNameLostCallback
_cb _ _ = do
    Bool
result <- ApplicationNameLostCallback
_cb 
    let result' :: CInt
result' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
result
    CInt -> IO CInt
forall (m :: * -> *) a. Monad m => a -> m a
return CInt
result'


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

@
'Data.GI.Base.Signals.on' application #nameLost callback
@
-}
onApplicationNameLost :: (IsApplication a, MonadIO m) => a -> ApplicationNameLostCallback -> m SignalHandlerId
onApplicationNameLost :: a -> ApplicationNameLostCallback -> m SignalHandlerId
onApplicationNameLost obj :: a
obj cb :: ApplicationNameLostCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ApplicationNameLostCallback
cb' = ApplicationNameLostCallback -> C_ApplicationNameLostCallback
wrap_ApplicationNameLostCallback ApplicationNameLostCallback
cb
    FunPtr C_ApplicationNameLostCallback
cb'' <- C_ApplicationNameLostCallback
-> IO (FunPtr C_ApplicationNameLostCallback)
mk_ApplicationNameLostCallback C_ApplicationNameLostCallback
cb'
    a
-> String
-> FunPtr C_ApplicationNameLostCallback
-> SignalConnectMode
-> IO SignalHandlerId
forall o a.
GObject o =>
o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId
connectSignalFunPtr a
obj "name-lost" FunPtr C_ApplicationNameLostCallback
cb'' SignalConnectMode
SignalConnectBefore

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

@
'Data.GI.Base.Signals.after' application #nameLost callback
@
-}
afterApplicationNameLost :: (IsApplication a, MonadIO m) => a -> ApplicationNameLostCallback -> m SignalHandlerId
afterApplicationNameLost :: a -> ApplicationNameLostCallback -> m SignalHandlerId
afterApplicationNameLost obj :: a
obj cb :: ApplicationNameLostCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ApplicationNameLostCallback
cb' = ApplicationNameLostCallback -> C_ApplicationNameLostCallback
wrap_ApplicationNameLostCallback ApplicationNameLostCallback
cb
    FunPtr C_ApplicationNameLostCallback
cb'' <- C_ApplicationNameLostCallback
-> IO (FunPtr C_ApplicationNameLostCallback)
mk_ApplicationNameLostCallback C_ApplicationNameLostCallback
cb'
    a
-> String
-> FunPtr C_ApplicationNameLostCallback
-> SignalConnectMode
-> IO SignalHandlerId
forall o a.
GObject o =>
o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId
connectSignalFunPtr a
obj "name-lost" FunPtr C_ApplicationNameLostCallback
cb'' SignalConnectMode
SignalConnectAfter


-- signal Application::open
{- |
The ::open signal is emitted on the primary instance when there are
files to open. See 'GI.Gio.Objects.Application.applicationOpen' for more information.
-}
type ApplicationOpenCallback =
    [Gio.File.File]
    {- ^ /@files@/: an array of @/GFiles/@ -}
    -> T.Text
    {- ^ /@hint@/: a hint provided by the calling instance -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ApplicationOpenCallback`@.
noApplicationOpenCallback :: Maybe ApplicationOpenCallback
noApplicationOpenCallback :: Maybe ApplicationOpenCallback
noApplicationOpenCallback = Maybe ApplicationOpenCallback
forall a. Maybe a
Nothing

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

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

-- | Wrap the callback into a `Closure`.
genClosure_ApplicationOpen :: ApplicationOpenCallback -> IO Closure
genClosure_ApplicationOpen :: ApplicationOpenCallback -> IO Closure
genClosure_ApplicationOpen cb :: ApplicationOpenCallback
cb = do
    let cb' :: C_ApplicationOpenCallback
cb' = ApplicationOpenCallback -> C_ApplicationOpenCallback
wrap_ApplicationOpenCallback ApplicationOpenCallback
cb
    C_ApplicationOpenCallback -> IO (FunPtr C_ApplicationOpenCallback)
mk_ApplicationOpenCallback C_ApplicationOpenCallback
cb' IO (FunPtr C_ApplicationOpenCallback)
-> (FunPtr C_ApplicationOpenCallback -> IO Closure) -> IO Closure
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ApplicationOpenCallback -> IO Closure
forall a. FunPtr a -> IO Closure
newCClosure


-- | Wrap a `ApplicationOpenCallback` into a `C_ApplicationOpenCallback`.
wrap_ApplicationOpenCallback ::
    ApplicationOpenCallback ->
    C_ApplicationOpenCallback
wrap_ApplicationOpenCallback :: ApplicationOpenCallback -> C_ApplicationOpenCallback
wrap_ApplicationOpenCallback _cb :: ApplicationOpenCallback
_cb _ files :: Ptr (Ptr File)
files nFiles :: Int32
nFiles hint :: CString
hint _ = do
    [Ptr File]
files' <- (Int32 -> Ptr (Ptr File) -> IO [Ptr File]
forall a b. Integral a => a -> Ptr (Ptr b) -> IO [Ptr b]
unpackPtrArrayWithLength Int32
nFiles) Ptr (Ptr File)
files
    [File]
files'' <- (Ptr File -> IO File) -> [Ptr File] -> IO [File]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr File -> File
Gio.File.File) [Ptr File]
files'
    Text
hint' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
hint
    ApplicationOpenCallback
_cb  [File]
files'' Text
hint'


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

@
'Data.GI.Base.Signals.on' application #open callback
@
-}
onApplicationOpen :: (IsApplication a, MonadIO m) => a -> ApplicationOpenCallback -> m SignalHandlerId
onApplicationOpen :: a -> ApplicationOpenCallback -> m SignalHandlerId
onApplicationOpen obj :: a
obj cb :: ApplicationOpenCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ApplicationOpenCallback
cb' = ApplicationOpenCallback -> C_ApplicationOpenCallback
wrap_ApplicationOpenCallback ApplicationOpenCallback
cb
    FunPtr C_ApplicationOpenCallback
cb'' <- C_ApplicationOpenCallback -> IO (FunPtr C_ApplicationOpenCallback)
mk_ApplicationOpenCallback C_ApplicationOpenCallback
cb'
    a
-> String
-> FunPtr C_ApplicationOpenCallback
-> SignalConnectMode
-> IO SignalHandlerId
forall o a.
GObject o =>
o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId
connectSignalFunPtr a
obj "open" FunPtr C_ApplicationOpenCallback
cb'' SignalConnectMode
SignalConnectBefore

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

@
'Data.GI.Base.Signals.after' application #open callback
@
-}
afterApplicationOpen :: (IsApplication a, MonadIO m) => a -> ApplicationOpenCallback -> m SignalHandlerId
afterApplicationOpen :: a -> ApplicationOpenCallback -> m SignalHandlerId
afterApplicationOpen obj :: a
obj cb :: ApplicationOpenCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ApplicationOpenCallback
cb' = ApplicationOpenCallback -> C_ApplicationOpenCallback
wrap_ApplicationOpenCallback ApplicationOpenCallback
cb
    FunPtr C_ApplicationOpenCallback
cb'' <- C_ApplicationOpenCallback -> IO (FunPtr C_ApplicationOpenCallback)
mk_ApplicationOpenCallback C_ApplicationOpenCallback
cb'
    a
-> String
-> FunPtr C_ApplicationOpenCallback
-> SignalConnectMode
-> IO SignalHandlerId
forall o a.
GObject o =>
o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId
connectSignalFunPtr a
obj "open" FunPtr C_ApplicationOpenCallback
cb'' SignalConnectMode
SignalConnectAfter


-- signal Application::shutdown
{- |
The ::shutdown signal is emitted only on the registered primary instance
immediately after the main loop terminates.
-}
type ApplicationShutdownCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ApplicationShutdownCallback`@.
noApplicationShutdownCallback :: Maybe ApplicationShutdownCallback
noApplicationShutdownCallback :: Maybe ApplicationActivateCallback
noApplicationShutdownCallback = Maybe ApplicationActivateCallback
forall a. Maybe a
Nothing

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

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

-- | Wrap the callback into a `Closure`.
genClosure_ApplicationShutdown :: ApplicationShutdownCallback -> IO Closure
genClosure_ApplicationShutdown :: ApplicationActivateCallback -> IO Closure
genClosure_ApplicationShutdown cb :: ApplicationActivateCallback
cb = do
    let cb' :: C_ApplicationActivateCallback
cb' = ApplicationActivateCallback -> C_ApplicationActivateCallback
wrap_ApplicationShutdownCallback ApplicationActivateCallback
cb
    C_ApplicationActivateCallback
-> IO (FunPtr C_ApplicationActivateCallback)
mk_ApplicationShutdownCallback C_ApplicationActivateCallback
cb' IO (FunPtr C_ApplicationActivateCallback)
-> (FunPtr C_ApplicationActivateCallback -> IO Closure)
-> IO Closure
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ApplicationActivateCallback -> IO Closure
forall a. FunPtr a -> IO Closure
newCClosure


-- | Wrap a `ApplicationShutdownCallback` into a `C_ApplicationShutdownCallback`.
wrap_ApplicationShutdownCallback ::
    ApplicationShutdownCallback ->
    C_ApplicationShutdownCallback
wrap_ApplicationShutdownCallback :: ApplicationActivateCallback -> C_ApplicationActivateCallback
wrap_ApplicationShutdownCallback _cb :: ApplicationActivateCallback
_cb _ _ = do
    ApplicationActivateCallback
_cb 


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

@
'Data.GI.Base.Signals.on' application #shutdown callback
@
-}
onApplicationShutdown :: (IsApplication a, MonadIO m) => a -> ApplicationShutdownCallback -> m SignalHandlerId
onApplicationShutdown :: a -> ApplicationActivateCallback -> m SignalHandlerId
onApplicationShutdown obj :: a
obj cb :: ApplicationActivateCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ApplicationActivateCallback
cb' = ApplicationActivateCallback -> C_ApplicationActivateCallback
wrap_ApplicationShutdownCallback ApplicationActivateCallback
cb
    FunPtr C_ApplicationActivateCallback
cb'' <- C_ApplicationActivateCallback
-> IO (FunPtr C_ApplicationActivateCallback)
mk_ApplicationShutdownCallback C_ApplicationActivateCallback
cb'
    a
-> String
-> FunPtr C_ApplicationActivateCallback
-> SignalConnectMode
-> IO SignalHandlerId
forall o a.
GObject o =>
o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId
connectSignalFunPtr a
obj "shutdown" FunPtr C_ApplicationActivateCallback
cb'' SignalConnectMode
SignalConnectBefore

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

@
'Data.GI.Base.Signals.after' application #shutdown callback
@
-}
afterApplicationShutdown :: (IsApplication a, MonadIO m) => a -> ApplicationShutdownCallback -> m SignalHandlerId
afterApplicationShutdown :: a -> ApplicationActivateCallback -> m SignalHandlerId
afterApplicationShutdown obj :: a
obj cb :: ApplicationActivateCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ApplicationActivateCallback
cb' = ApplicationActivateCallback -> C_ApplicationActivateCallback
wrap_ApplicationShutdownCallback ApplicationActivateCallback
cb
    FunPtr C_ApplicationActivateCallback
cb'' <- C_ApplicationActivateCallback
-> IO (FunPtr C_ApplicationActivateCallback)
mk_ApplicationShutdownCallback C_ApplicationActivateCallback
cb'
    a
-> String
-> FunPtr C_ApplicationActivateCallback
-> SignalConnectMode
-> IO SignalHandlerId
forall o a.
GObject o =>
o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId
connectSignalFunPtr a
obj "shutdown" FunPtr C_ApplicationActivateCallback
cb'' SignalConnectMode
SignalConnectAfter


-- signal Application::startup
{- |
The ::startup signal is emitted on the primary instance immediately
after registration. See 'GI.Gio.Objects.Application.applicationRegister'.
-}
type ApplicationStartupCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ApplicationStartupCallback`@.
noApplicationStartupCallback :: Maybe ApplicationStartupCallback
noApplicationStartupCallback :: Maybe ApplicationActivateCallback
noApplicationStartupCallback = Maybe ApplicationActivateCallback
forall a. Maybe a
Nothing

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

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

-- | Wrap the callback into a `Closure`.
genClosure_ApplicationStartup :: ApplicationStartupCallback -> IO Closure
genClosure_ApplicationStartup :: ApplicationActivateCallback -> IO Closure
genClosure_ApplicationStartup cb :: ApplicationActivateCallback
cb = do
    let cb' :: C_ApplicationActivateCallback
cb' = ApplicationActivateCallback -> C_ApplicationActivateCallback
wrap_ApplicationStartupCallback ApplicationActivateCallback
cb
    C_ApplicationActivateCallback
-> IO (FunPtr C_ApplicationActivateCallback)
mk_ApplicationStartupCallback C_ApplicationActivateCallback
cb' IO (FunPtr C_ApplicationActivateCallback)
-> (FunPtr C_ApplicationActivateCallback -> IO Closure)
-> IO Closure
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ApplicationActivateCallback -> IO Closure
forall a. FunPtr a -> IO Closure
newCClosure


-- | Wrap a `ApplicationStartupCallback` into a `C_ApplicationStartupCallback`.
wrap_ApplicationStartupCallback ::
    ApplicationStartupCallback ->
    C_ApplicationStartupCallback
wrap_ApplicationStartupCallback :: ApplicationActivateCallback -> C_ApplicationActivateCallback
wrap_ApplicationStartupCallback _cb :: ApplicationActivateCallback
_cb _ _ = do
    ApplicationActivateCallback
_cb 


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

@
'Data.GI.Base.Signals.on' application #startup callback
@
-}
onApplicationStartup :: (IsApplication a, MonadIO m) => a -> ApplicationStartupCallback -> m SignalHandlerId
onApplicationStartup :: a -> ApplicationActivateCallback -> m SignalHandlerId
onApplicationStartup obj :: a
obj cb :: ApplicationActivateCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ApplicationActivateCallback
cb' = ApplicationActivateCallback -> C_ApplicationActivateCallback
wrap_ApplicationStartupCallback ApplicationActivateCallback
cb
    FunPtr C_ApplicationActivateCallback
cb'' <- C_ApplicationActivateCallback
-> IO (FunPtr C_ApplicationActivateCallback)
mk_ApplicationStartupCallback C_ApplicationActivateCallback
cb'
    a
-> String
-> FunPtr C_ApplicationActivateCallback
-> SignalConnectMode
-> IO SignalHandlerId
forall o a.
GObject o =>
o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId
connectSignalFunPtr a
obj "startup" FunPtr C_ApplicationActivateCallback
cb'' SignalConnectMode
SignalConnectBefore

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

@
'Data.GI.Base.Signals.after' application #startup callback
@
-}
afterApplicationStartup :: (IsApplication a, MonadIO m) => a -> ApplicationStartupCallback -> m SignalHandlerId
afterApplicationStartup :: a -> ApplicationActivateCallback -> m SignalHandlerId
afterApplicationStartup obj :: a
obj cb :: ApplicationActivateCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ApplicationActivateCallback
cb' = ApplicationActivateCallback -> C_ApplicationActivateCallback
wrap_ApplicationStartupCallback ApplicationActivateCallback
cb
    FunPtr C_ApplicationActivateCallback
cb'' <- C_ApplicationActivateCallback
-> IO (FunPtr C_ApplicationActivateCallback)
mk_ApplicationStartupCallback C_ApplicationActivateCallback
cb'
    a
-> String
-> FunPtr C_ApplicationActivateCallback
-> SignalConnectMode
-> IO SignalHandlerId
forall o a.
GObject o =>
o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId
connectSignalFunPtr a
obj "startup" FunPtr C_ApplicationActivateCallback
cb'' SignalConnectMode
SignalConnectAfter


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

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

@
'Data.GI.Base.Attributes.set' application [ #actionGroup 'Data.GI.Base.Attributes.:=' value ]
@
-}
setApplicationActionGroup :: (MonadIO m, IsApplication o, Gio.ActionGroup.IsActionGroup a) => o -> a -> m ()
setApplicationActionGroup :: o -> a -> m ()
setApplicationActionGroup obj :: o
obj val :: a
val = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe a -> ApplicationActivateCallback
forall a b.
(GObject a, GObject b) =>
a -> String -> Maybe b -> ApplicationActivateCallback
setObjectPropertyObject o
obj "action-group" (a -> Maybe a
forall a. a -> Maybe a
Just a
val)

{- |
Construct a `GValueConstruct` with valid value for the “@action-group@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructApplicationActionGroup :: (IsApplication o, Gio.ActionGroup.IsActionGroup a) => a -> IO (GValueConstruct o)
constructApplicationActionGroup :: a -> IO (GValueConstruct o)
constructApplicationActionGroup val :: a
val = String -> Maybe a -> IO (GValueConstruct o)
forall a o.
GObject a =>
String -> Maybe a -> IO (GValueConstruct o)
constructObjectPropertyObject "action-group" (a -> Maybe a
forall a. a -> Maybe a
Just a
val)

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

@
'Data.GI.Base.Attributes.clear' #actionGroup
@
-}
clearApplicationActionGroup :: (MonadIO m, IsApplication o) => o -> m ()
clearApplicationActionGroup :: o -> m ()
clearApplicationActionGroup obj :: o
obj = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe ActionGroup -> ApplicationActivateCallback
forall a b.
(GObject a, GObject b) =>
a -> String -> Maybe b -> ApplicationActivateCallback
setObjectPropertyObject o
obj "action-group" (Maybe ActionGroup
forall a. Maybe a
Nothing :: Maybe Gio.ActionGroup.ActionGroup)

#if ENABLE_OVERLOADING
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
#endif

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

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

@
'Data.GI.Base.Attributes.get' application #applicationId
@
-}
getApplicationApplicationId :: (MonadIO m, IsApplication o) => o -> m T.Text
getApplicationApplicationId :: o -> m Text
getApplicationApplicationId obj :: o
obj = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ Text -> IO (Maybe Text) -> IO Text
forall a. HasCallStack => Text -> IO (Maybe a) -> IO a
checkUnexpectedNothing "getApplicationApplicationId" (IO (Maybe Text) -> IO Text) -> IO (Maybe Text) -> IO Text
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe Text)
forall a. GObject a => a -> String -> IO (Maybe Text)
getObjectPropertyString o
obj "application-id"

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

@
'Data.GI.Base.Attributes.set' application [ #applicationId 'Data.GI.Base.Attributes.:=' value ]
@
-}
setApplicationApplicationId :: (MonadIO m, IsApplication o) => o -> T.Text -> m ()
setApplicationApplicationId :: o -> Text -> m ()
setApplicationApplicationId obj :: o
obj val :: Text
val = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe Text -> ApplicationActivateCallback
forall a.
GObject a =>
a -> String -> Maybe Text -> ApplicationActivateCallback
setObjectPropertyString o
obj "application-id" (Text -> Maybe Text
forall a. a -> Maybe a
Just Text
val)

{- |
Construct a `GValueConstruct` with valid value for the “@application-id@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructApplicationApplicationId :: (IsApplication o) => T.Text -> IO (GValueConstruct o)
constructApplicationApplicationId :: Text -> IO (GValueConstruct o)
constructApplicationApplicationId val :: Text
val = String -> Maybe Text -> IO (GValueConstruct o)
forall o. String -> Maybe Text -> IO (GValueConstruct o)
constructObjectPropertyString "application-id" (Text -> Maybe Text
forall a. a -> Maybe a
Just Text
val)

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

@
'Data.GI.Base.Attributes.clear' #applicationId
@
-}
clearApplicationApplicationId :: (MonadIO m, IsApplication o) => o -> m ()
clearApplicationApplicationId :: o -> m ()
clearApplicationApplicationId obj :: o
obj = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe Text -> ApplicationActivateCallback
forall a.
GObject a =>
a -> String -> Maybe Text -> ApplicationActivateCallback
setObjectPropertyString o
obj "application-id" (Maybe Text
forall a. Maybe a
Nothing :: Maybe T.Text)

#if ENABLE_OVERLOADING
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
#endif

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

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

@
'Data.GI.Base.Attributes.get' application #flags
@
-}
getApplicationFlags :: (MonadIO m, IsApplication o) => o -> m [Gio.Flags.ApplicationFlags]
getApplicationFlags :: o -> m [ApplicationFlags]
getApplicationFlags obj :: o
obj = IO [ApplicationFlags] -> m [ApplicationFlags]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [ApplicationFlags] -> m [ApplicationFlags])
-> IO [ApplicationFlags] -> m [ApplicationFlags]
forall a b. (a -> b) -> a -> b
$ o -> String -> IO [ApplicationFlags]
forall a b.
(GObject a, IsGFlag b, BoxedFlags b) =>
a -> String -> IO [b]
getObjectPropertyFlags o
obj "flags"

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

@
'Data.GI.Base.Attributes.set' application [ #flags 'Data.GI.Base.Attributes.:=' value ]
@
-}
setApplicationFlags :: (MonadIO m, IsApplication o) => o -> [Gio.Flags.ApplicationFlags] -> m ()
setApplicationFlags :: o -> [ApplicationFlags] -> m ()
setApplicationFlags obj :: o
obj val :: [ApplicationFlags]
val = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> [ApplicationFlags] -> ApplicationActivateCallback
forall a b.
(IsGFlag b, BoxedFlags b, GObject a) =>
a -> String -> [b] -> ApplicationActivateCallback
setObjectPropertyFlags o
obj "flags" [ApplicationFlags]
val

{- |
Construct a `GValueConstruct` with valid value for the “@flags@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructApplicationFlags :: (IsApplication o) => [Gio.Flags.ApplicationFlags] -> IO (GValueConstruct o)
constructApplicationFlags :: [ApplicationFlags] -> IO (GValueConstruct o)
constructApplicationFlags val :: [ApplicationFlags]
val = String -> [ApplicationFlags] -> IO (GValueConstruct o)
forall a o.
(IsGFlag a, BoxedFlags a) =>
String -> [a] -> IO (GValueConstruct o)
constructObjectPropertyFlags "flags" [ApplicationFlags]
val

#if ENABLE_OVERLOADING
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
#endif

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

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

@
'Data.GI.Base.Attributes.get' application #inactivityTimeout
@
-}
getApplicationInactivityTimeout :: (MonadIO m, IsApplication o) => o -> m Word32
getApplicationInactivityTimeout :: o -> m Word32
getApplicationInactivityTimeout obj :: o
obj = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Word32
forall a. GObject a => a -> String -> IO Word32
getObjectPropertyUInt32 o
obj "inactivity-timeout"

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

@
'Data.GI.Base.Attributes.set' application [ #inactivityTimeout 'Data.GI.Base.Attributes.:=' value ]
@
-}
setApplicationInactivityTimeout :: (MonadIO m, IsApplication o) => o -> Word32 -> m ()
setApplicationInactivityTimeout :: o -> Word32 -> m ()
setApplicationInactivityTimeout obj :: o
obj val :: Word32
val = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Word32 -> ApplicationActivateCallback
forall a.
GObject a =>
a -> String -> Word32 -> ApplicationActivateCallback
setObjectPropertyUInt32 o
obj "inactivity-timeout" Word32
val

{- |
Construct a `GValueConstruct` with valid value for the “@inactivity-timeout@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructApplicationInactivityTimeout :: (IsApplication o) => Word32 -> IO (GValueConstruct o)
constructApplicationInactivityTimeout :: Word32 -> IO (GValueConstruct o)
constructApplicationInactivityTimeout val :: Word32
val = String -> Word32 -> IO (GValueConstruct o)
forall o. String -> Word32 -> IO (GValueConstruct o)
constructObjectPropertyUInt32 "inactivity-timeout" Word32
val

#if ENABLE_OVERLOADING
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
#endif

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

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

@
'Data.GI.Base.Attributes.get' application #isBusy
@
-}
getApplicationIsBusy :: (MonadIO m, IsApplication o) => o -> m Bool
getApplicationIsBusy :: o -> m Bool
getApplicationIsBusy obj :: o
obj = ApplicationNameLostCallback -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationNameLostCallback -> m Bool)
-> ApplicationNameLostCallback -> m Bool
forall a b. (a -> b) -> a -> b
$ o -> String -> ApplicationNameLostCallback
forall a. GObject a => a -> String -> ApplicationNameLostCallback
getObjectPropertyBool o
obj "is-busy"

#if ENABLE_OVERLOADING
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
#endif

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

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

@
'Data.GI.Base.Attributes.get' application #isRegistered
@
-}
getApplicationIsRegistered :: (MonadIO m, IsApplication o) => o -> m Bool
getApplicationIsRegistered :: o -> m Bool
getApplicationIsRegistered obj :: o
obj = ApplicationNameLostCallback -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationNameLostCallback -> m Bool)
-> ApplicationNameLostCallback -> m Bool
forall a b. (a -> b) -> a -> b
$ o -> String -> ApplicationNameLostCallback
forall a. GObject a => a -> String -> ApplicationNameLostCallback
getObjectPropertyBool o
obj "is-registered"

#if ENABLE_OVERLOADING
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
#endif

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

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

@
'Data.GI.Base.Attributes.get' application #isRemote
@
-}
getApplicationIsRemote :: (MonadIO m, IsApplication o) => o -> m Bool
getApplicationIsRemote :: o -> m Bool
getApplicationIsRemote obj :: o
obj = ApplicationNameLostCallback -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationNameLostCallback -> m Bool)
-> ApplicationNameLostCallback -> m Bool
forall a b. (a -> b) -> a -> b
$ o -> String -> ApplicationNameLostCallback
forall a. GObject a => a -> String -> ApplicationNameLostCallback
getObjectPropertyBool o
obj "is-remote"

#if ENABLE_OVERLOADING
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
#endif

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

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

@
'Data.GI.Base.Attributes.get' application #resourceBasePath
@
-}
getApplicationResourceBasePath :: (MonadIO m, IsApplication o) => o -> m (Maybe T.Text)
getApplicationResourceBasePath :: o -> m (Maybe Text)
getApplicationResourceBasePath obj :: o
obj = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe Text)
forall a. GObject a => a -> String -> IO (Maybe Text)
getObjectPropertyString o
obj "resource-base-path"

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

@
'Data.GI.Base.Attributes.set' application [ #resourceBasePath 'Data.GI.Base.Attributes.:=' value ]
@
-}
setApplicationResourceBasePath :: (MonadIO m, IsApplication o) => o -> T.Text -> m ()
setApplicationResourceBasePath :: o -> Text -> m ()
setApplicationResourceBasePath obj :: o
obj val :: Text
val = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe Text -> ApplicationActivateCallback
forall a.
GObject a =>
a -> String -> Maybe Text -> ApplicationActivateCallback
setObjectPropertyString o
obj "resource-base-path" (Text -> Maybe Text
forall a. a -> Maybe a
Just Text
val)

{- |
Construct a `GValueConstruct` with valid value for the “@resource-base-path@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructApplicationResourceBasePath :: (IsApplication o) => T.Text -> IO (GValueConstruct o)
constructApplicationResourceBasePath :: Text -> IO (GValueConstruct o)
constructApplicationResourceBasePath val :: Text
val = String -> Maybe Text -> IO (GValueConstruct o)
forall o. String -> Maybe Text -> IO (GValueConstruct o)
constructObjectPropertyString "resource-base-path" (Text -> Maybe Text
forall a. a -> Maybe a
Just Text
val)

{- |
Set the value of the “@resource-base-path@” property to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #resourceBasePath
@
-}
clearApplicationResourceBasePath :: (MonadIO m, IsApplication o) => o -> m ()
clearApplicationResourceBasePath :: o -> m ()
clearApplicationResourceBasePath obj :: o
obj = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe Text -> ApplicationActivateCallback
forall a.
GObject a =>
a -> String -> Maybe Text -> ApplicationActivateCallback
setObjectPropertyString o
obj "resource-base-path" (Maybe Text
forall a. Maybe a
Nothing :: Maybe T.Text)

#if ENABLE_OVERLOADING
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
#endif

#if ENABLE_OVERLOADING
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, *)])
#endif

#if ENABLE_OVERLOADING
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

#endif

#if ENABLE_OVERLOADING
data ApplicationActivateSignalInfo
instance SignalInfo ApplicationActivateSignalInfo where
    type HaskellCallbackType ApplicationActivateSignalInfo = ApplicationActivateCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_ApplicationActivateCallback cb
        cb'' <- mk_ApplicationActivateCallback cb'
        connectSignalFunPtr obj "activate" cb'' connectMode

data ApplicationCommandLineSignalInfo
instance SignalInfo ApplicationCommandLineSignalInfo where
    type HaskellCallbackType ApplicationCommandLineSignalInfo = ApplicationCommandLineCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_ApplicationCommandLineCallback cb
        cb'' <- mk_ApplicationCommandLineCallback cb'
        connectSignalFunPtr obj "command-line" cb'' connectMode

data ApplicationHandleLocalOptionsSignalInfo
instance SignalInfo ApplicationHandleLocalOptionsSignalInfo where
    type HaskellCallbackType ApplicationHandleLocalOptionsSignalInfo = ApplicationHandleLocalOptionsCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_ApplicationHandleLocalOptionsCallback cb
        cb'' <- mk_ApplicationHandleLocalOptionsCallback cb'
        connectSignalFunPtr obj "handle-local-options" cb'' connectMode

data ApplicationNameLostSignalInfo
instance SignalInfo ApplicationNameLostSignalInfo where
    type HaskellCallbackType ApplicationNameLostSignalInfo = ApplicationNameLostCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_ApplicationNameLostCallback cb
        cb'' <- mk_ApplicationNameLostCallback cb'
        connectSignalFunPtr obj "name-lost" cb'' connectMode

data ApplicationOpenSignalInfo
instance SignalInfo ApplicationOpenSignalInfo where
    type HaskellCallbackType ApplicationOpenSignalInfo = ApplicationOpenCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_ApplicationOpenCallback cb
        cb'' <- mk_ApplicationOpenCallback cb'
        connectSignalFunPtr obj "open" cb'' connectMode

data ApplicationShutdownSignalInfo
instance SignalInfo ApplicationShutdownSignalInfo where
    type HaskellCallbackType ApplicationShutdownSignalInfo = ApplicationShutdownCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_ApplicationShutdownCallback cb
        cb'' <- mk_ApplicationShutdownCallback cb'
        connectSignalFunPtr obj "shutdown" cb'' connectMode

data ApplicationStartupSignalInfo
instance SignalInfo ApplicationStartupSignalInfo where
    type HaskellCallbackType ApplicationStartupSignalInfo = ApplicationStartupCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_ApplicationStartupCallback cb
        cb'' <- mk_ApplicationStartupCallback cb'
        connectSignalFunPtr obj "startup" cb'' connectMode

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), '("nameLost", ApplicationNameLostSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("open", ApplicationOpenSignalInfo), '("shutdown", ApplicationShutdownSignalInfo), '("startup", ApplicationStartupSignalInfo)] :: [(Symbol, *)])

#endif

-- 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 (Maybe Application)
    {- ^ __Returns:__ a new 'GI.Gio.Objects.Application.Application' instance -}
applicationNew :: Maybe Text -> [ApplicationFlags] -> m (Maybe Application)
applicationNew applicationId :: Maybe Text
applicationId flags :: [ApplicationFlags]
flags = IO (Maybe Application) -> m (Maybe Application)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Application) -> m (Maybe Application))
-> IO (Maybe Application) -> m (Maybe Application)
forall a b. (a -> b) -> a -> b
$ do
    CString
maybeApplicationId <- case Maybe Text
applicationId of
        Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just jApplicationId :: Text
jApplicationId -> do
            CString
jApplicationId' <- Text -> IO CString
textToCString Text
jApplicationId
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jApplicationId'
    let flags' :: CUInt
flags' = [ApplicationFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [ApplicationFlags]
flags
    Ptr Application
result <- CString -> CUInt -> IO (Ptr Application)
g_application_new CString
maybeApplicationId CUInt
flags'
    Maybe Application
maybeResult <- Ptr Application
-> (Ptr Application -> IO Application) -> IO (Maybe Application)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Application
result ((Ptr Application -> IO Application) -> IO (Maybe Application))
-> (Ptr Application -> IO Application) -> IO (Maybe Application)
forall a b. (a -> b) -> a -> b
$ \result' :: Ptr Application
result' -> do
        Application
result'' <- ((ManagedPtr Application -> Application)
-> Ptr Application -> IO Application
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Application -> Application
Application) Ptr Application
result'
        Application -> IO Application
forall (m :: * -> *) a. Monad m => a -> m a
return Application
result''
    CString -> ApplicationActivateCallback
forall a. Ptr a -> ApplicationActivateCallback
freeMem CString
maybeApplicationId
    Maybe Application -> IO (Maybe Application)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Application
maybeResult

#if ENABLE_OVERLOADING
#endif

-- 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 :: a -> m ()
applicationActivate application :: a
application = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    Ptr Application -> ApplicationActivateCallback
g_application_activate Ptr Application
application'
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- 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 :: a
-> Text
-> Int8
-> [OptionFlags]
-> OptionArg
-> Text
-> Maybe Text
-> m ()
applicationAddMainOption application :: a
application longName :: Text
longName shortName :: Int8
shortName flags :: [OptionFlags]
flags arg :: OptionArg
arg description :: Text
description argDescription :: Maybe Text
argDescription = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    CString
longName' <- Text -> IO CString
textToCString Text
longName
    let flags' :: CUInt
flags' = [OptionFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [OptionFlags]
flags
    let arg' :: CUInt
arg' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (OptionArg -> Int) -> OptionArg -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OptionArg -> Int
forall a. Enum a => a -> Int
fromEnum) OptionArg
arg
    CString
description' <- Text -> IO CString
textToCString Text
description
    CString
maybeArgDescription <- case Maybe Text
argDescription of
        Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just jArgDescription :: Text
jArgDescription -> do
            CString
jArgDescription' <- Text -> IO CString
textToCString Text
jArgDescription
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jArgDescription'
    Ptr Application
-> CString
-> Int8
-> CUInt
-> CUInt
-> CString
-> CString
-> ApplicationActivateCallback
g_application_add_main_option Ptr Application
application' CString
longName' Int8
shortName CUInt
flags' CUInt
arg' CString
description' CString
maybeArgDescription
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    CString -> ApplicationActivateCallback
forall a. Ptr a -> ApplicationActivateCallback
freeMem CString
longName'
    CString -> ApplicationActivateCallback
forall a. Ptr a -> ApplicationActivateCallback
freeMem CString
description'
    CString -> ApplicationActivateCallback
forall a. Ptr a -> ApplicationActivateCallback
freeMem CString
maybeArgDescription
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
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

#endif

-- 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 @^a&s@
* for 'GI.GLib.Enums.OptionArgFilenameArray', use @^a&ay@


/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 :: a -> [OptionEntry] -> m ()
applicationAddMainOptionEntries application :: a
application entries :: [OptionEntry]
entries = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    [Ptr OptionEntry]
entries' <- (OptionEntry -> IO (Ptr OptionEntry))
-> [OptionEntry] -> IO [Ptr OptionEntry]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM OptionEntry -> IO (Ptr OptionEntry)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr [OptionEntry]
entries
    Ptr (Ptr OptionEntry)
entries'' <- [Ptr OptionEntry] -> IO (Ptr (Ptr OptionEntry))
forall a. [Ptr a] -> IO (Ptr (Ptr a))
packZeroTerminatedPtrArray [Ptr OptionEntry]
entries'
    Ptr Application
-> Ptr (Ptr OptionEntry) -> ApplicationActivateCallback
g_application_add_main_option_entries Ptr Application
application' Ptr (Ptr OptionEntry)
entries''
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    (OptionEntry -> ApplicationActivateCallback)
-> [OptionEntry] -> ApplicationActivateCallback
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ OptionEntry -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr [OptionEntry]
entries
    Ptr (Ptr OptionEntry) -> ApplicationActivateCallback
forall a. Ptr a -> ApplicationActivateCallback
freeMem Ptr (Ptr OptionEntry)
entries''
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- 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 :: a -> OptionGroup -> m ()
applicationAddOptionGroup application :: a
application group :: OptionGroup
group = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    Ptr OptionGroup
group' <- OptionGroup -> IO (Ptr OptionGroup)
forall a. (HasCallStack, BoxedObject a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed OptionGroup
group
    Ptr Application -> Ptr OptionGroup -> ApplicationActivateCallback
g_application_add_option_group Ptr Application
application' Ptr OptionGroup
group'
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    OptionGroup -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr OptionGroup
group
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- 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 :: a -> b -> Text -> m ()
applicationBindBusyProperty application :: a
application object :: b
object property :: Text
property = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    Ptr Object
object' <- b -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
object
    CString
property' <- Text -> IO CString
textToCString Text
property
    Ptr Application
-> Ptr Object -> CString -> ApplicationActivateCallback
g_application_bind_busy_property Ptr Application
application' Ptr Object
object' CString
property'
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    b -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr b
object
    CString -> ApplicationActivateCallback
forall a. Ptr a -> ApplicationActivateCallback
freeMem CString
property'
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- 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 :: a -> m Text
applicationGetApplicationId application :: a
application = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    CString
result <- Ptr Application -> IO CString
g_application_get_application_id Ptr Application
application'
    Text -> CString -> ApplicationActivateCallback
forall a.
HasCallStack =>
Text -> Ptr a -> ApplicationActivateCallback
checkUnexpectedReturnNULL "applicationGetApplicationId" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

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

#endif

-- 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 :: a -> m DBusConnection
applicationGetDbusConnection application :: a
application = IO DBusConnection -> m DBusConnection
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DBusConnection -> m DBusConnection)
-> IO DBusConnection -> m DBusConnection
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    Ptr DBusConnection
result <- Ptr Application -> IO (Ptr DBusConnection)
g_application_get_dbus_connection Ptr Application
application'
    Text -> Ptr DBusConnection -> ApplicationActivateCallback
forall a.
HasCallStack =>
Text -> Ptr a -> ApplicationActivateCallback
checkUnexpectedReturnNULL "applicationGetDbusConnection" Ptr DBusConnection
result
    DBusConnection
result' <- ((ManagedPtr DBusConnection -> DBusConnection)
-> Ptr DBusConnection -> IO DBusConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DBusConnection -> DBusConnection
Gio.DBusConnection.DBusConnection) Ptr DBusConnection
result
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    DBusConnection -> IO DBusConnection
forall (m :: * -> *) a. Monad m => a -> m a
return DBusConnection
result'

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

#endif

-- 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 :: a -> m Text
applicationGetDbusObjectPath application :: a
application = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    CString
result <- Ptr Application -> IO CString
g_application_get_dbus_object_path Ptr Application
application'
    Text -> CString -> ApplicationActivateCallback
forall a.
HasCallStack =>
Text -> Ptr a -> ApplicationActivateCallback
checkUnexpectedReturnNULL "applicationGetDbusObjectPath" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

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

#endif

-- 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 :: a -> m [ApplicationFlags]
applicationGetFlags application :: a
application = IO [ApplicationFlags] -> m [ApplicationFlags]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [ApplicationFlags] -> m [ApplicationFlags])
-> IO [ApplicationFlags] -> m [ApplicationFlags]
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    CUInt
result <- Ptr Application -> IO CUInt
g_application_get_flags Ptr Application
application'
    let result' :: [ApplicationFlags]
result' = CUInt -> [ApplicationFlags]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
result
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    [ApplicationFlags] -> IO [ApplicationFlags]
forall (m :: * -> *) a. Monad m => a -> m a
return [ApplicationFlags]
result'

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

#endif

-- 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 :: a -> m Word32
applicationGetInactivityTimeout application :: a
application = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    Word32
result <- Ptr Application -> IO Word32
g_application_get_inactivity_timeout Ptr Application
application'
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result

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

#endif

-- 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 :: a -> m Bool
applicationGetIsBusy application :: a
application = ApplicationNameLostCallback -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationNameLostCallback -> m Bool)
-> ApplicationNameLostCallback -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    CInt
result <- Ptr Application -> IO CInt
g_application_get_is_busy Ptr Application
application'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    Bool -> ApplicationNameLostCallback
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

#endif

-- 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 :: a -> m Bool
applicationGetIsRegistered application :: a
application = ApplicationNameLostCallback -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationNameLostCallback -> m Bool)
-> ApplicationNameLostCallback -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    CInt
result <- Ptr Application -> IO CInt
g_application_get_is_registered Ptr Application
application'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    Bool -> ApplicationNameLostCallback
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

#endif

-- 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 :: a -> m Bool
applicationGetIsRemote application :: a
application = ApplicationNameLostCallback -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationNameLostCallback -> m Bool)
-> ApplicationNameLostCallback -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    CInt
result <- Ptr Application -> IO CInt
g_application_get_is_remote Ptr Application
application'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    Bool -> ApplicationNameLostCallback
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

#endif

-- 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 :: a -> m (Maybe Text)
applicationGetResourceBasePath application :: a
application = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    CString
result <- Ptr Application -> IO CString
g_application_get_resource_base_path Ptr Application
application'
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \result' :: CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult

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

#endif

-- 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 :: a -> m ()
applicationHold application :: a
application = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    Ptr Application -> ApplicationActivateCallback
g_application_hold Ptr Application
application'
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- 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 :: a -> m ()
applicationMarkBusy application :: a
application = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    Ptr Application -> ApplicationActivateCallback
g_application_mark_busy Ptr Application
application'
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- 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 :: a -> [File] -> Text -> m ()
applicationOpen application :: a
application files :: [File]
files hint :: Text
hint = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    let nFiles :: Int32
nFiles = Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [File] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [File]
files
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    [Ptr File]
files' <- (File -> IO (Ptr File)) -> [File] -> IO [Ptr File]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM File -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr [File]
files
    Ptr (Ptr File)
files'' <- [Ptr File] -> IO (Ptr (Ptr File))
forall a. [Ptr a] -> IO (Ptr (Ptr a))
packPtrArray [Ptr File]
files'
    CString
hint' <- Text -> IO CString
textToCString Text
hint
    Ptr Application
-> Ptr (Ptr File)
-> Int32
-> CString
-> ApplicationActivateCallback
g_application_open Ptr Application
application' Ptr (Ptr File)
files'' Int32
nFiles CString
hint'
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    (File -> ApplicationActivateCallback)
-> [File] -> ApplicationActivateCallback
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ File -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr [File]
files
    Ptr (Ptr File) -> ApplicationActivateCallback
forall a. Ptr a -> ApplicationActivateCallback
freeMem Ptr (Ptr File)
files''
    CString -> ApplicationActivateCallback
forall a. Ptr a -> ApplicationActivateCallback
freeMem CString
hint'
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- 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.
Take care if your code has called 'GI.Gio.Objects.Application.applicationHold' on the application and
is therefore still expecting it to exist.
(Note that you may have called 'GI.Gio.Objects.Application.applicationHold' indirectly, for example
through @/gtk_application_add_window()/@.)

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 :: a -> m ()
applicationQuit application :: a
application = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    Ptr Application -> ApplicationActivateCallback
g_application_quit Ptr Application
application'
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- 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 :: a -> Maybe b -> m ()
applicationRegister application :: a
application cancellable :: Maybe b
cancellable = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just jCancellable :: b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    ApplicationActivateCallback
-> ApplicationActivateCallback -> ApplicationActivateCallback
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Application -> Ptr Cancellable -> Ptr (Ptr GError) -> IO CInt
g_application_register Ptr Application
application' Ptr Cancellable
maybeCancellable
        a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
        Maybe b
-> (b -> ApplicationActivateCallback)
-> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr
        () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

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

#endif

-- 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 :: a -> m ()
applicationRelease application :: a
application = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    Ptr Application -> ApplicationActivateCallback
g_application_release Ptr Application
application'
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- 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 TFileName), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "\n    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 TFileName)
    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 ([[Char]])
    {- ^ /@argv@/: 
    the argv from @/main()/@, or 'Nothing' -}
    -> m Int32
    {- ^ __Returns:__ the exit status -}
applicationRun :: a -> Maybe [String] -> m Int32
applicationRun application :: a
application argv :: Maybe [String]
argv = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    let argc :: Int32
argc = case Maybe [String]
argv of
            Nothing -> 0
            Just jArgv :: [String]
jArgv -> Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [String] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [String]
jArgv
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    Ptr CString
maybeArgv <- case Maybe [String]
argv of
        Nothing -> Ptr CString -> IO (Ptr CString)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CString
forall a. Ptr a
nullPtr
        Just jArgv :: [String]
jArgv -> do
            Ptr CString
jArgv' <- [String] -> IO (Ptr CString)
packFileNameArray [String]
jArgv
            Ptr CString -> IO (Ptr CString)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CString
jArgv'
    Int32
result <- Ptr Application -> Int32 -> Ptr CString -> IO Int32
g_application_run Ptr Application
application' Int32
argc Ptr CString
maybeArgv
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    (Int32
-> (CString -> ApplicationActivateCallback)
-> Ptr CString
-> ApplicationActivateCallback
forall a b c.
(Storable a, Integral b) =>
b -> (a -> IO c) -> Ptr a -> ApplicationActivateCallback
mapCArrayWithLength Int32
argc) CString -> ApplicationActivateCallback
forall a. Ptr a -> ApplicationActivateCallback
freeMem Ptr CString
maybeArgv
    Ptr CString -> ApplicationActivateCallback
forall a. Ptr a -> ApplicationActivateCallback
freeMem Ptr CString
maybeArgv
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

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

#endif

-- 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 :: a -> Maybe Text -> b -> m ()
applicationSendNotification application :: a
application id :: Maybe Text
id notification :: b
notification = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    CString
maybeId <- case Maybe Text
id of
        Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just jId :: Text
jId -> do
            CString
jId' <- Text -> IO CString
textToCString Text
jId
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jId'
    Ptr Notification
notification' <- b -> IO (Ptr Notification)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
notification
    Ptr Application
-> CString -> Ptr Notification -> ApplicationActivateCallback
g_application_send_notification Ptr Application
application' CString
maybeId Ptr Notification
notification'
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    b -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr b
notification
    CString -> ApplicationActivateCallback
forall a. Ptr a -> ApplicationActivateCallback
freeMem CString
maybeId
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
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

#endif

-- 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 :: a -> Maybe b -> m ()
applicationSetActionGroup application :: a
application actionGroup :: Maybe b
actionGroup = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    Ptr ActionGroup
maybeActionGroup <- case Maybe b
actionGroup of
        Nothing -> Ptr ActionGroup -> IO (Ptr ActionGroup)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ActionGroup
forall a. Ptr a
nullPtr
        Just jActionGroup :: b
jActionGroup -> do
            Ptr ActionGroup
jActionGroup' <- b -> IO (Ptr ActionGroup)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jActionGroup
            Ptr ActionGroup -> IO (Ptr ActionGroup)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ActionGroup
jActionGroup'
    Ptr Application -> Ptr ActionGroup -> ApplicationActivateCallback
g_application_set_action_group Ptr Application
application' Ptr ActionGroup
maybeActionGroup
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    Maybe b
-> (b -> ApplicationActivateCallback)
-> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
actionGroup b -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- 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 :: a -> Maybe Text -> m ()
applicationSetApplicationId application :: a
application applicationId :: Maybe Text
applicationId = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    CString
maybeApplicationId <- case Maybe Text
applicationId of
        Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just jApplicationId :: Text
jApplicationId -> do
            CString
jApplicationId' <- Text -> IO CString
textToCString Text
jApplicationId
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jApplicationId'
    Ptr Application -> CString -> ApplicationActivateCallback
g_application_set_application_id Ptr Application
application' CString
maybeApplicationId
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    CString -> ApplicationActivateCallback
forall a. Ptr a -> ApplicationActivateCallback
freeMem CString
maybeApplicationId
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- 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 :: a -> m ()
applicationSetDefault application :: a
application = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    Ptr Application -> ApplicationActivateCallback
g_application_set_default Ptr Application
application'
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- 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 :: a -> [ApplicationFlags] -> m ()
applicationSetFlags application :: a
application flags :: [ApplicationFlags]
flags = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    let flags' :: CUInt
flags' = [ApplicationFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [ApplicationFlags]
flags
    Ptr Application -> CUInt -> ApplicationActivateCallback
g_application_set_flags Ptr Application
application' CUInt
flags'
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- 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 :: a -> Word32 -> m ()
applicationSetInactivityTimeout application :: a
application inactivityTimeout :: Word32
inactivityTimeout = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    Ptr Application -> Word32 -> ApplicationActivateCallback
g_application_set_inactivity_timeout Ptr Application
application' Word32
inactivityTimeout
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- method Application::set_option_context_description
-- 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 = "description", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a string to be shown in `--help` output\n after the list of options, 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_option_context_description" g_application_set_option_context_description :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    CString ->                              -- description : TBasicType TUTF8
    IO ()

{- |
Adds a description to the /@application@/ option context.

See 'GI.GLib.Structs.OptionContext.optionContextSetDescription' for more information.

/Since: 2.56/
-}
applicationSetOptionContextDescription ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: the 'GI.Gio.Objects.Application.Application' -}
    -> Maybe (T.Text)
    {- ^ /@description@/: a string to be shown in @--help@ output
 after the list of options, or 'Nothing' -}
    -> m ()
applicationSetOptionContextDescription :: a -> Maybe Text -> m ()
applicationSetOptionContextDescription application :: a
application description :: Maybe Text
description = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    CString
maybeDescription <- case Maybe Text
description of
        Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just jDescription :: Text
jDescription -> do
            CString
jDescription' <- Text -> IO CString
textToCString Text
jDescription
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jDescription'
    Ptr Application -> CString -> ApplicationActivateCallback
g_application_set_option_context_description Ptr Application
application' CString
maybeDescription
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    CString -> ApplicationActivateCallback
forall a. Ptr a -> ApplicationActivateCallback
freeMem CString
maybeDescription
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- method Application::set_option_context_parameter_string
-- 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 = "parameter_string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a string which is displayed\n  in the first line of `--help` output, after the usage summary `programname [OPTION...]`.", 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_option_context_parameter_string" g_application_set_option_context_parameter_string :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    CString ->                              -- parameter_string : TBasicType TUTF8
    IO ()

{- |
Sets the parameter string to be used by the commandline handling of /@application@/.

This function registers the argument to be passed to @/g_option_context_new()/@
when the internal 'GI.GLib.Structs.OptionContext.OptionContext' of /@application@/ is created.

See @/g_option_context_new()/@ for more information about /@parameterString@/.

/Since: 2.56/
-}
applicationSetOptionContextParameterString ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: the 'GI.Gio.Objects.Application.Application' -}
    -> Maybe (T.Text)
    {- ^ /@parameterString@/: a string which is displayed
  in the first line of @--help@ output, after the usage summary @programname [OPTION...]@. -}
    -> m ()
applicationSetOptionContextParameterString :: a -> Maybe Text -> m ()
applicationSetOptionContextParameterString application :: a
application parameterString :: Maybe Text
parameterString = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    CString
maybeParameterString <- case Maybe Text
parameterString of
        Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just jParameterString :: Text
jParameterString -> do
            CString
jParameterString' <- Text -> IO CString
textToCString Text
jParameterString
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jParameterString'
    Ptr Application -> CString -> ApplicationActivateCallback
g_application_set_option_context_parameter_string Ptr Application
application' CString
maybeParameterString
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    CString -> ApplicationActivateCallback
forall a. Ptr a -> ApplicationActivateCallback
freeMem CString
maybeParameterString
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- method Application::set_option_context_summary
-- 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 = "summary", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a string to be shown in `--help` output\n before the list of options, 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_option_context_summary" g_application_set_option_context_summary :: 
    Ptr Application ->                      -- application : TInterface (Name {namespace = "Gio", name = "Application"})
    CString ->                              -- summary : TBasicType TUTF8
    IO ()

{- |
Adds a summary to the /@application@/ option context.

See 'GI.GLib.Structs.OptionContext.optionContextSetSummary' for more information.

/Since: 2.56/
-}
applicationSetOptionContextSummary ::
    (B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
    a
    {- ^ /@application@/: the 'GI.Gio.Objects.Application.Application' -}
    -> Maybe (T.Text)
    {- ^ /@summary@/: a string to be shown in @--help@ output
 before the list of options, or 'Nothing' -}
    -> m ()
applicationSetOptionContextSummary :: a -> Maybe Text -> m ()
applicationSetOptionContextSummary application :: a
application summary :: Maybe Text
summary = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    CString
maybeSummary <- case Maybe Text
summary of
        Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just jSummary :: Text
jSummary -> do
            CString
jSummary' <- Text -> IO CString
textToCString Text
jSummary
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jSummary'
    Ptr Application -> CString -> ApplicationActivateCallback
g_application_set_option_context_summary Ptr Application
application' CString
maybeSummary
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    CString -> ApplicationActivateCallback
forall a. Ptr a -> ApplicationActivateCallback
freeMem CString
maybeSummary
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- 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 :: a -> Maybe Text -> m ()
applicationSetResourceBasePath application :: a
application resourcePath :: Maybe Text
resourcePath = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    CString
maybeResourcePath <- case Maybe Text
resourcePath of
        Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just jResourcePath :: Text
jResourcePath -> do
            CString
jResourcePath' <- Text -> IO CString
textToCString Text
jResourcePath
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jResourcePath'
    Ptr Application -> CString -> ApplicationActivateCallback
g_application_set_resource_base_path Ptr Application
application' CString
maybeResourcePath
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    CString -> ApplicationActivateCallback
forall a. Ptr a -> ApplicationActivateCallback
freeMem CString
maybeResourcePath
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- 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 :: a -> b -> Text -> m ()
applicationUnbindBusyProperty application :: a
application object :: b
object property :: Text
property = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    Ptr Object
object' <- b -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
object
    CString
property' <- Text -> IO CString
textToCString Text
property
    Ptr Application
-> Ptr Object -> CString -> ApplicationActivateCallback
g_application_unbind_busy_property Ptr Application
application' Ptr Object
object' CString
property'
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    b -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr b
object
    CString -> ApplicationActivateCallback
forall a. Ptr a -> ApplicationActivateCallback
freeMem CString
property'
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- 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 :: a -> m ()
applicationUnmarkBusy application :: a
application = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    Ptr Application -> ApplicationActivateCallback
g_application_unmark_busy Ptr Application
application'
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- 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 :: a -> Text -> m ()
applicationWithdrawNotification application :: a
application id :: Text
id = ApplicationActivateCallback -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationActivateCallback -> m ())
-> ApplicationActivateCallback -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
application' <- a -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
application
    CString
id' <- Text -> IO CString
textToCString Text
id
    Ptr Application -> CString -> ApplicationActivateCallback
g_application_withdraw_notification Ptr Application
application' CString
id'
    a -> ApplicationActivateCallback
forall a. ManagedPtrNewtype a => a -> ApplicationActivateCallback
touchManagedPtr a
application
    CString -> ApplicationActivateCallback
forall a. Ptr a -> ApplicationActivateCallback
freeMem CString
id'
    () -> ApplicationActivateCallback
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif

-- 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 :: m Application
applicationGetDefault  = IO Application -> m Application
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Application -> m Application)
-> IO Application -> m Application
forall a b. (a -> b) -> a -> b
$ do
    Ptr Application
result <- IO (Ptr Application)
g_application_get_default
    Text -> Ptr Application -> ApplicationActivateCallback
forall a.
HasCallStack =>
Text -> Ptr a -> ApplicationActivateCallback
checkUnexpectedReturnNULL "applicationGetDefault" Ptr Application
result
    Application
result' <- ((ManagedPtr Application -> Application)
-> Ptr Application -> IO Application
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Application -> Application
Application) Ptr Application
result
    Application -> IO Application
forall (m :: * -> *) a. Monad m => a -> m a
return Application
result'

#if ENABLE_OVERLOADING
#endif

-- 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'.

Application identifiers follow the same format as
<https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus D-Bus well-known bus names>.
For convenience, the restrictions on application identifiers are
reproduced here:

* Application identifiers are composed of 1 or more elements separated by a
period (@.@) character. All elements must contain at least one character.
* Each element must only contain the ASCII characters @[A-Z][a-z][0-9]_-@,
with @-@ discouraged in new application identifiers. Each element must not
begin with a digit.
* Application identifiers must contain at least one @.@ (period) character
(and thus at least two elements).
* Application identifiers must not begin with a @.@ (period) character.
* Application identifiers must not exceed 255 characters.


Note that the hyphen (@-@) character is allowed in application identifiers,
but is problematic or not allowed in various specifications and APIs that
refer to D-Bus, such as
<http://docs.flatpak.org/en/latest/introduction.html#identifiers Flatpak application IDs>,
the
<https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#dbus `DBusActivatable` interface in the Desktop Entry Specification>,
and the convention that an application\'s \"main\" interface and object path
resemble its application identifier and bus name. To avoid situations that
require special-case handling, it is recommended that new application
identifiers consistently replace hyphens with underscores.

Like D-Bus interface names, application identifiers should start with the
reversed DNS domain name of the author of the interface (in lower-case), and
it is conventional for the rest of the application identifier to consist of
words run together, with initial capital letters.

As with D-Bus interface names, if the author\'s DNS domain name contains
hyphen\/minus characters they should be replaced by underscores, and if it
contains leading digits they should be escaped by prepending an underscore.
For example, if the owner of 7-zip.org used an application identifier for an
archiving application, it might be named @org._7_zip.Archiver@.
-}
applicationIdIsValid ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@applicationId@/: a potential application identifier -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@applicationId@/ is valid -}
applicationIdIsValid :: Text -> m Bool
applicationIdIsValid applicationId :: Text
applicationId = ApplicationNameLostCallback -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ApplicationNameLostCallback -> m Bool)
-> ApplicationNameLostCallback -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CString
applicationId' <- Text -> IO CString
textToCString Text
applicationId
    CInt
result <- CString -> IO CInt
g_application_id_is_valid CString
applicationId'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
    CString -> ApplicationActivateCallback
forall a. Ptr a -> ApplicationActivateCallback
freeMem CString
applicationId'
    Bool -> ApplicationNameLostCallback
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if ENABLE_OVERLOADING
#endif