gi-gio-2.0.20: GI/Gio/Objects/Application.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)
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 (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !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.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GI.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 = c_g_application_get_type
-- | Type class for types which can be safely cast to `Application`, for instance with `toApplication`.
class (GObject o, O.IsDescendantOf Application o) => IsApplication o
instance (GObject o, O.IsDescendantOf Application o) => IsApplication o
instance O.HasParentTypes Application
type instance O.ParentTypes Application = '[GObject.Object.Object, Gio.ActionGroup.ActionGroup, Gio.ActionMap.ActionMap]
-- | Cast to `Application`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toApplication :: (MonadIO m, IsApplication o) => o -> m Application
toApplication = liftIO . unsafeCastTo Application
-- | A convenience alias for `Nothing` :: `Maybe` `Application`.
noApplication :: Maybe Application
noApplication = Nothing
#if ENABLE_OVERLOADING
type family ResolveApplicationMethod (t :: Symbol) (o :: *) :: * where
ResolveApplicationMethod "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) => OL.IsLabel t (Application -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
-- signal Application::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 = 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 `GClosure`.
genClosure_ApplicationActivate :: MonadIO m => ApplicationActivateCallback -> m (GClosure C_ApplicationActivateCallback)
genClosure_ApplicationActivate cb = liftIO $ do
let cb' = wrap_ApplicationActivateCallback cb
mk_ApplicationActivateCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `ApplicationActivateCallback` into a `C_ApplicationActivateCallback`.
wrap_ApplicationActivateCallback ::
ApplicationActivateCallback ->
C_ApplicationActivateCallback
wrap_ApplicationActivateCallback _cb _ _ = do
_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 obj cb = liftIO $ do
let cb' = wrap_ApplicationActivateCallback cb
cb'' <- mk_ApplicationActivateCallback cb'
connectSignalFunPtr obj "activate" cb'' 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 obj cb = liftIO $ do
let cb' = wrap_ApplicationActivateCallback cb
cb'' <- mk_ApplicationActivateCallback cb'
connectSignalFunPtr obj "activate" cb'' 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 = 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 `GClosure`.
genClosure_ApplicationCommandLine :: MonadIO m => ApplicationCommandLineCallback -> m (GClosure C_ApplicationCommandLineCallback)
genClosure_ApplicationCommandLine cb = liftIO $ do
let cb' = wrap_ApplicationCommandLineCallback cb
mk_ApplicationCommandLineCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `ApplicationCommandLineCallback` into a `C_ApplicationCommandLineCallback`.
wrap_ApplicationCommandLineCallback ::
ApplicationCommandLineCallback ->
C_ApplicationCommandLineCallback
wrap_ApplicationCommandLineCallback _cb _ commandLine _ = do
commandLine' <- (newObject Gio.ApplicationCommandLine.ApplicationCommandLine) commandLine
result <- _cb commandLine'
return 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 obj cb = liftIO $ do
let cb' = wrap_ApplicationCommandLineCallback cb
cb'' <- mk_ApplicationCommandLineCallback cb'
connectSignalFunPtr obj "command-line" cb'' 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 obj cb = liftIO $ do
let cb' = wrap_ApplicationCommandLineCallback cb
cb'' <- mk_ApplicationCommandLineCallback cb'
connectSignalFunPtr obj "command-line" cb'' 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 = 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 `GClosure`.
genClosure_ApplicationHandleLocalOptions :: MonadIO m => ApplicationHandleLocalOptionsCallback -> m (GClosure C_ApplicationHandleLocalOptionsCallback)
genClosure_ApplicationHandleLocalOptions cb = liftIO $ do
let cb' = wrap_ApplicationHandleLocalOptionsCallback cb
mk_ApplicationHandleLocalOptionsCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `ApplicationHandleLocalOptionsCallback` into a `C_ApplicationHandleLocalOptionsCallback`.
wrap_ApplicationHandleLocalOptionsCallback ::
ApplicationHandleLocalOptionsCallback ->
C_ApplicationHandleLocalOptionsCallback
wrap_ApplicationHandleLocalOptionsCallback _cb _ options _ = do
B.ManagedPtr.withTransient GLib.VariantDict.VariantDict options $ \options' -> do
result <- _cb options'
return 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 obj cb = liftIO $ do
let cb' = wrap_ApplicationHandleLocalOptionsCallback cb
cb'' <- mk_ApplicationHandleLocalOptionsCallback cb'
connectSignalFunPtr obj "handle-local-options" cb'' 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 obj cb = liftIO $ do
let cb' = wrap_ApplicationHandleLocalOptionsCallback cb
cb'' <- mk_ApplicationHandleLocalOptionsCallback cb'
connectSignalFunPtr obj "handle-local-options" cb'' 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 = 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 `GClosure`.
genClosure_ApplicationNameLost :: MonadIO m => ApplicationNameLostCallback -> m (GClosure C_ApplicationNameLostCallback)
genClosure_ApplicationNameLost cb = liftIO $ do
let cb' = wrap_ApplicationNameLostCallback cb
mk_ApplicationNameLostCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `ApplicationNameLostCallback` into a `C_ApplicationNameLostCallback`.
wrap_ApplicationNameLostCallback ::
ApplicationNameLostCallback ->
C_ApplicationNameLostCallback
wrap_ApplicationNameLostCallback _cb _ _ = do
result <- _cb
let result' = (fromIntegral . fromEnum) result
return 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 obj cb = liftIO $ do
let cb' = wrap_ApplicationNameLostCallback cb
cb'' <- mk_ApplicationNameLostCallback cb'
connectSignalFunPtr obj "name-lost" cb'' 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 obj cb = liftIO $ do
let cb' = wrap_ApplicationNameLostCallback cb
cb'' <- mk_ApplicationNameLostCallback cb'
connectSignalFunPtr obj "name-lost" cb'' 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 = 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 `GClosure`.
genClosure_ApplicationOpen :: MonadIO m => ApplicationOpenCallback -> m (GClosure C_ApplicationOpenCallback)
genClosure_ApplicationOpen cb = liftIO $ do
let cb' = wrap_ApplicationOpenCallback cb
mk_ApplicationOpenCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `ApplicationOpenCallback` into a `C_ApplicationOpenCallback`.
wrap_ApplicationOpenCallback ::
ApplicationOpenCallback ->
C_ApplicationOpenCallback
wrap_ApplicationOpenCallback _cb _ files nFiles hint _ = do
files' <- (unpackPtrArrayWithLength nFiles) files
files'' <- mapM (newObject Gio.File.File) files'
hint' <- cstringToText hint
_cb files'' 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 obj cb = liftIO $ do
let cb' = wrap_ApplicationOpenCallback cb
cb'' <- mk_ApplicationOpenCallback cb'
connectSignalFunPtr obj "open" cb'' 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 obj cb = liftIO $ do
let cb' = wrap_ApplicationOpenCallback cb
cb'' <- mk_ApplicationOpenCallback cb'
connectSignalFunPtr obj "open" cb'' 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 = 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 `GClosure`.
genClosure_ApplicationShutdown :: MonadIO m => ApplicationShutdownCallback -> m (GClosure C_ApplicationShutdownCallback)
genClosure_ApplicationShutdown cb = liftIO $ do
let cb' = wrap_ApplicationShutdownCallback cb
mk_ApplicationShutdownCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `ApplicationShutdownCallback` into a `C_ApplicationShutdownCallback`.
wrap_ApplicationShutdownCallback ::
ApplicationShutdownCallback ->
C_ApplicationShutdownCallback
wrap_ApplicationShutdownCallback _cb _ _ = do
_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 obj cb = liftIO $ do
let cb' = wrap_ApplicationShutdownCallback cb
cb'' <- mk_ApplicationShutdownCallback cb'
connectSignalFunPtr obj "shutdown" cb'' 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 obj cb = liftIO $ do
let cb' = wrap_ApplicationShutdownCallback cb
cb'' <- mk_ApplicationShutdownCallback cb'
connectSignalFunPtr obj "shutdown" cb'' 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 = 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 `GClosure`.
genClosure_ApplicationStartup :: MonadIO m => ApplicationStartupCallback -> m (GClosure C_ApplicationStartupCallback)
genClosure_ApplicationStartup cb = liftIO $ do
let cb' = wrap_ApplicationStartupCallback cb
mk_ApplicationStartupCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `ApplicationStartupCallback` into a `C_ApplicationStartupCallback`.
wrap_ApplicationStartupCallback ::
ApplicationStartupCallback ->
C_ApplicationStartupCallback
wrap_ApplicationStartupCallback _cb _ _ = do
_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 obj cb = liftIO $ do
let cb' = wrap_ApplicationStartupCallback cb
cb'' <- mk_ApplicationStartupCallback cb'
connectSignalFunPtr obj "startup" cb'' 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 obj cb = liftIO $ do
let cb' = wrap_ApplicationStartupCallback cb
cb'' <- mk_ApplicationStartupCallback cb'
connectSignalFunPtr obj "startup" cb'' 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 obj val = liftIO $ B.Properties.setObjectPropertyObject obj "action-group" (Just 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 val = B.Properties.constructObjectPropertyObject "action-group" (Just 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 obj = liftIO $ B.Properties.setObjectPropertyObject obj "action-group" (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 obj = liftIO $ checkUnexpectedNothing "getApplicationApplicationId" $ B.Properties.getObjectPropertyString 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 obj val = liftIO $ B.Properties.setObjectPropertyString obj "application-id" (Just 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 val = B.Properties.constructObjectPropertyString "application-id" (Just 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 obj = liftIO $ B.Properties.setObjectPropertyString obj "application-id" (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 obj = liftIO $ B.Properties.getObjectPropertyFlags 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 obj val = liftIO $ B.Properties.setObjectPropertyFlags obj "flags" 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 val = B.Properties.constructObjectPropertyFlags "flags" 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 obj = liftIO $ B.Properties.getObjectPropertyUInt32 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 obj val = liftIO $ B.Properties.setObjectPropertyUInt32 obj "inactivity-timeout" 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 val = B.Properties.constructObjectPropertyUInt32 "inactivity-timeout" 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 obj = liftIO $ B.Properties.getObjectPropertyBool 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 obj = liftIO $ B.Properties.getObjectPropertyBool 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 obj = liftIO $ B.Properties.getObjectPropertyBool 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 obj = liftIO $ B.Properties.getObjectPropertyString 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 obj val = liftIO $ B.Properties.setObjectPropertyString obj "resource-base-path" (Just 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 val = B.Properties.constructObjectPropertyString "resource-base-path" (Just 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 obj = liftIO $ B.Properties.setObjectPropertyString obj "resource-base-path" (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 applicationId flags = liftIO $ do
maybeApplicationId <- case applicationId of
Nothing -> return nullPtr
Just jApplicationId -> do
jApplicationId' <- textToCString jApplicationId
return jApplicationId'
let flags' = gflagsToWord flags
result <- g_application_new maybeApplicationId flags'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapObject Application) result'
return result''
freeMem maybeApplicationId
return 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 application = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
g_application_activate application'
touchManagedPtr application
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 application longName shortName flags arg description argDescription = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
longName' <- textToCString longName
let flags' = gflagsToWord flags
let arg' = (fromIntegral . fromEnum) arg
description' <- textToCString description
maybeArgDescription <- case argDescription of
Nothing -> return nullPtr
Just jArgDescription -> do
jArgDescription' <- textToCString jArgDescription
return jArgDescription'
g_application_add_main_option application' longName' shortName flags' arg' description' maybeArgDescription
touchManagedPtr application
freeMem longName'
freeMem description'
freeMem maybeArgDescription
return ()
#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 &as
* for 'GI.GLib.Enums.OptionArgFilenameArray', use ^aay
/Since: 2.40/
-}
applicationAddMainOptionEntries ::
(B.CallStack.HasCallStack, MonadIO m, IsApplication a) =>
a
{- ^ /@application@/: a 'GI.Gio.Objects.Application.Application' -}
-> [GLib.OptionEntry.OptionEntry]
{- ^ /@entries@/: a
'Nothing'-terminated list of @/GOptionEntrys/@ -}
-> m ()
applicationAddMainOptionEntries application entries = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
entries' <- mapM unsafeManagedPtrGetPtr entries
entries'' <- packZeroTerminatedPtrArray entries'
g_application_add_main_option_entries application' entries''
touchManagedPtr application
mapM_ touchManagedPtr entries
freeMem entries''
return ()
#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 application group = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
group' <- B.ManagedPtr.disownBoxed group
g_application_add_option_group application' group'
touchManagedPtr application
touchManagedPtr group
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 application object property = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
object' <- unsafeManagedPtrCastPtr object
property' <- textToCString property
g_application_bind_busy_property application' object' property'
touchManagedPtr application
touchManagedPtr object
freeMem property'
return ()
#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 application = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
result <- g_application_get_application_id application'
checkUnexpectedReturnNULL "applicationGetApplicationId" result
result' <- cstringToText result
touchManagedPtr application
return 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 application = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
result <- g_application_get_dbus_connection application'
checkUnexpectedReturnNULL "applicationGetDbusConnection" result
result' <- (newObject Gio.DBusConnection.DBusConnection) result
touchManagedPtr application
return result'
#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 application = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
result <- g_application_get_dbus_object_path application'
checkUnexpectedReturnNULL "applicationGetDbusObjectPath" result
result' <- cstringToText result
touchManagedPtr application
return 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 application = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
result <- g_application_get_flags application'
let result' = wordToGFlags result
touchManagedPtr application
return 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 application = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
result <- g_application_get_inactivity_timeout application'
touchManagedPtr application
return 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 application = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
result <- g_application_get_is_busy application'
let result' = (/= 0) result
touchManagedPtr application
return 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 application = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
result <- g_application_get_is_registered application'
let result' = (/= 0) result
touchManagedPtr application
return 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 application = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
result <- g_application_get_is_remote application'
let result' = (/= 0) result
touchManagedPtr application
return 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 application = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
result <- g_application_get_resource_base_path application'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- cstringToText result'
return result''
touchManagedPtr application
return maybeResult
#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 application = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
g_application_hold application'
touchManagedPtr application
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 application = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
g_application_mark_busy application'
touchManagedPtr application
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 application files hint = liftIO $ do
let nFiles = fromIntegral $ length files
application' <- unsafeManagedPtrCastPtr application
files' <- mapM unsafeManagedPtrCastPtr files
files'' <- packPtrArray files'
hint' <- textToCString hint
g_application_open application' files'' nFiles hint'
touchManagedPtr application
mapM_ touchManagedPtr files
freeMem files''
freeMem hint'
return ()
#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 application = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
g_application_quit application'
touchManagedPtr application
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 application cancellable = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
onException (do
_ <- propagateGError $ g_application_register application' maybeCancellable
touchManagedPtr application
whenJust cancellable touchManagedPtr
return ()
) (do
return ()
)
#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 application = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
g_application_release application'
touchManagedPtr application
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 application argv = liftIO $ do
let argc = case argv of
Nothing -> 0
Just jArgv -> fromIntegral $ length jArgv
application' <- unsafeManagedPtrCastPtr application
maybeArgv <- case argv of
Nothing -> return nullPtr
Just jArgv -> do
jArgv' <- packFileNameArray jArgv
return jArgv'
result <- g_application_run application' argc maybeArgv
touchManagedPtr application
(mapCArrayWithLength argc) freeMem maybeArgv
freeMem maybeArgv
return 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 application id notification = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
maybeId <- case id of
Nothing -> return nullPtr
Just jId -> do
jId' <- textToCString jId
return jId'
notification' <- unsafeManagedPtrCastPtr notification
g_application_send_notification application' maybeId notification'
touchManagedPtr application
touchManagedPtr notification
freeMem maybeId
return ()
#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 application actionGroup = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
maybeActionGroup <- case actionGroup of
Nothing -> return nullPtr
Just jActionGroup -> do
jActionGroup' <- unsafeManagedPtrCastPtr jActionGroup
return jActionGroup'
g_application_set_action_group application' maybeActionGroup
touchManagedPtr application
whenJust actionGroup touchManagedPtr
return ()
#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 application applicationId = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
maybeApplicationId <- case applicationId of
Nothing -> return nullPtr
Just jApplicationId -> do
jApplicationId' <- textToCString jApplicationId
return jApplicationId'
g_application_set_application_id application' maybeApplicationId
touchManagedPtr application
freeMem maybeApplicationId
return ()
#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 application = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
g_application_set_default application'
touchManagedPtr application
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 application flags = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
let flags' = gflagsToWord flags
g_application_set_flags application' flags'
touchManagedPtr application
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 application inactivityTimeout = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
g_application_set_inactivity_timeout application' inactivityTimeout
touchManagedPtr application
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 application description = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
maybeDescription <- case description of
Nothing -> return nullPtr
Just jDescription -> do
jDescription' <- textToCString jDescription
return jDescription'
g_application_set_option_context_description application' maybeDescription
touchManagedPtr application
freeMem maybeDescription
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 application parameterString = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
maybeParameterString <- case parameterString of
Nothing -> return nullPtr
Just jParameterString -> do
jParameterString' <- textToCString jParameterString
return jParameterString'
g_application_set_option_context_parameter_string application' maybeParameterString
touchManagedPtr application
freeMem maybeParameterString
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 application summary = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
maybeSummary <- case summary of
Nothing -> return nullPtr
Just jSummary -> do
jSummary' <- textToCString jSummary
return jSummary'
g_application_set_option_context_summary application' maybeSummary
touchManagedPtr application
freeMem maybeSummary
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 application resourcePath = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
maybeResourcePath <- case resourcePath of
Nothing -> return nullPtr
Just jResourcePath -> do
jResourcePath' <- textToCString jResourcePath
return jResourcePath'
g_application_set_resource_base_path application' maybeResourcePath
touchManagedPtr application
freeMem maybeResourcePath
return ()
#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 application object property = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
object' <- unsafeManagedPtrCastPtr object
property' <- textToCString property
g_application_unbind_busy_property application' object' property'
touchManagedPtr application
touchManagedPtr object
freeMem property'
return ()
#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 application = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
g_application_unmark_busy application'
touchManagedPtr application
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 application id = liftIO $ do
application' <- unsafeManagedPtrCastPtr application
id' <- textToCString id
g_application_withdraw_notification application' id'
touchManagedPtr application
freeMem id'
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 = liftIO $ do
result <- g_application_get_default
checkUnexpectedReturnNULL "applicationGetDefault" result
result' <- (newObject Application) result
return 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 applicationId = liftIO $ do
applicationId' <- textToCString applicationId
result <- g_application_id_is_valid applicationId'
let result' = (/= 0) result
freeMem applicationId'
return result'
#if ENABLE_OVERLOADING
#endif