gi-gio-2.0.20: GI/Gio/Interfaces/ActionGroup.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)
'GI.Gio.Interfaces.ActionGroup.ActionGroup' represents a group of actions. Actions can be used to
expose functionality in a structured way, either from one part of a
program to another, or to the outside world. Action groups are often
used together with a 'GI.Gio.Objects.MenuModel.MenuModel' that provides additional
representation data for displaying the actions to the user, e.g. in
a menu.
The main way to interact with the actions in a GActionGroup is to
activate them with 'GI.Gio.Interfaces.ActionGroup.actionGroupActivateAction'. Activating an
action may require a 'GVariant' parameter. The required type of the
parameter can be inquired with 'GI.Gio.Interfaces.ActionGroup.actionGroupGetActionParameterType'.
Actions may be disabled, see 'GI.Gio.Interfaces.ActionGroup.actionGroupGetActionEnabled'.
Activating a disabled action has no effect.
Actions may optionally have a state in the form of a 'GVariant'. The
current state of an action can be inquired with
'GI.Gio.Interfaces.ActionGroup.actionGroupGetActionState'. Activating a stateful action may
change its state, but it is also possible to set the state by calling
'GI.Gio.Interfaces.ActionGroup.actionGroupChangeActionState'.
As typical example, consider a text editing application which has an
option to change the current font to \'bold\'. A good way to represent
this would be a stateful action, with a boolean state. Activating the
action would toggle the state.
Each action in the group has a unique name (which is a string). All
method calls, except 'GI.Gio.Interfaces.ActionGroup.actionGroupListActions' take the name of
an action as an argument.
The 'GI.Gio.Interfaces.ActionGroup.ActionGroup' API is meant to be the \'public\' API to the action
group. The calls here are exactly the interaction that \'external
forces\' (eg: UI, incoming D-Bus messages, etc.) are supposed to have
with actions. \'Internal\' APIs (ie: ones meant only to be accessed by
the action group implementation) are found on subclasses. This is
why you will find - for example - 'GI.Gio.Interfaces.ActionGroup.actionGroupGetActionEnabled'
but not an equivalent @/set()/@ call.
Signals are emitted on the action group in response to state changes
on individual actions.
Implementations of 'GI.Gio.Interfaces.ActionGroup.ActionGroup' should provide implementations for
the virtual functions 'GI.Gio.Interfaces.ActionGroup.actionGroupListActions' and
'GI.Gio.Interfaces.ActionGroup.actionGroupQueryAction'. The other virtual functions should
not be implemented - their \"wrappers\" are actually implemented with
calls to 'GI.Gio.Interfaces.ActionGroup.actionGroupQueryAction'.
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gio.Interfaces.ActionGroup
(
-- * Exported types
ActionGroup(..) ,
noActionGroup ,
IsActionGroup ,
toActionGroup ,
-- * Methods
-- ** actionAdded #method:actionAdded#
#if ENABLE_OVERLOADING
ActionGroupActionAddedMethodInfo ,
#endif
actionGroupActionAdded ,
-- ** actionEnabledChanged #method:actionEnabledChanged#
#if ENABLE_OVERLOADING
ActionGroupActionEnabledChangedMethodInfo,
#endif
actionGroupActionEnabledChanged ,
-- ** actionRemoved #method:actionRemoved#
#if ENABLE_OVERLOADING
ActionGroupActionRemovedMethodInfo ,
#endif
actionGroupActionRemoved ,
-- ** actionStateChanged #method:actionStateChanged#
#if ENABLE_OVERLOADING
ActionGroupActionStateChangedMethodInfo ,
#endif
actionGroupActionStateChanged ,
-- ** activateAction #method:activateAction#
#if ENABLE_OVERLOADING
ActionGroupActivateActionMethodInfo ,
#endif
actionGroupActivateAction ,
-- ** changeActionState #method:changeActionState#
#if ENABLE_OVERLOADING
ActionGroupChangeActionStateMethodInfo ,
#endif
actionGroupChangeActionState ,
-- ** getActionEnabled #method:getActionEnabled#
#if ENABLE_OVERLOADING
ActionGroupGetActionEnabledMethodInfo ,
#endif
actionGroupGetActionEnabled ,
-- ** getActionParameterType #method:getActionParameterType#
#if ENABLE_OVERLOADING
ActionGroupGetActionParameterTypeMethodInfo,
#endif
actionGroupGetActionParameterType ,
-- ** getActionState #method:getActionState#
#if ENABLE_OVERLOADING
ActionGroupGetActionStateMethodInfo ,
#endif
actionGroupGetActionState ,
-- ** getActionStateHint #method:getActionStateHint#
#if ENABLE_OVERLOADING
ActionGroupGetActionStateHintMethodInfo ,
#endif
actionGroupGetActionStateHint ,
-- ** getActionStateType #method:getActionStateType#
#if ENABLE_OVERLOADING
ActionGroupGetActionStateTypeMethodInfo ,
#endif
actionGroupGetActionStateType ,
-- ** hasAction #method:hasAction#
#if ENABLE_OVERLOADING
ActionGroupHasActionMethodInfo ,
#endif
actionGroupHasAction ,
-- ** listActions #method:listActions#
#if ENABLE_OVERLOADING
ActionGroupListActionsMethodInfo ,
#endif
actionGroupListActions ,
-- ** queryAction #method:queryAction#
#if ENABLE_OVERLOADING
ActionGroupQueryActionMethodInfo ,
#endif
actionGroupQueryAction ,
-- * Signals
-- ** actionAdded #signal:actionAdded#
ActionGroupActionAddedCallback ,
#if ENABLE_OVERLOADING
ActionGroupActionAddedSignalInfo ,
#endif
C_ActionGroupActionAddedCallback ,
afterActionGroupActionAdded ,
genClosure_ActionGroupActionAdded ,
mk_ActionGroupActionAddedCallback ,
noActionGroupActionAddedCallback ,
onActionGroupActionAdded ,
wrap_ActionGroupActionAddedCallback ,
-- ** actionEnabledChanged #signal:actionEnabledChanged#
ActionGroupActionEnabledChangedCallback ,
#if ENABLE_OVERLOADING
ActionGroupActionEnabledChangedSignalInfo,
#endif
C_ActionGroupActionEnabledChangedCallback,
afterActionGroupActionEnabledChanged ,
genClosure_ActionGroupActionEnabledChanged,
mk_ActionGroupActionEnabledChangedCallback,
noActionGroupActionEnabledChangedCallback,
onActionGroupActionEnabledChanged ,
wrap_ActionGroupActionEnabledChangedCallback,
-- ** actionRemoved #signal:actionRemoved#
ActionGroupActionRemovedCallback ,
#if ENABLE_OVERLOADING
ActionGroupActionRemovedSignalInfo ,
#endif
C_ActionGroupActionRemovedCallback ,
afterActionGroupActionRemoved ,
genClosure_ActionGroupActionRemoved ,
mk_ActionGroupActionRemovedCallback ,
noActionGroupActionRemovedCallback ,
onActionGroupActionRemoved ,
wrap_ActionGroupActionRemovedCallback ,
-- ** actionStateChanged #signal:actionStateChanged#
ActionGroupActionStateChangedCallback ,
#if ENABLE_OVERLOADING
ActionGroupActionStateChangedSignalInfo ,
#endif
C_ActionGroupActionStateChangedCallback ,
afterActionGroupActionStateChanged ,
genClosure_ActionGroupActionStateChanged,
mk_ActionGroupActionStateChangedCallback,
noActionGroupActionStateChangedCallback ,
onActionGroupActionStateChanged ,
wrap_ActionGroupActionStateChangedCallback,
) 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.Structs.VariantType as GLib.VariantType
import qualified GI.GObject.Objects.Object as GObject.Object
-- interface ActionGroup
-- | Memory-managed wrapper type.
newtype ActionGroup = ActionGroup (ManagedPtr ActionGroup)
-- | A convenience alias for `Nothing` :: `Maybe` `ActionGroup`.
noActionGroup :: Maybe ActionGroup
noActionGroup = Nothing
-- signal ActionGroup::action-added
{- |
Signals that a new action was just added to the group.
This signal is emitted after the action has been added
and is now visible.
/Since: 2.28/
-}
type ActionGroupActionAddedCallback =
T.Text
{- ^ /@actionName@/: the name of the action in /@actionGroup@/ -}
-> IO ()
-- | A convenience synonym for @`Nothing` :: `Maybe` `ActionGroupActionAddedCallback`@.
noActionGroupActionAddedCallback :: Maybe ActionGroupActionAddedCallback
noActionGroupActionAddedCallback = Nothing
-- | Type for the callback on the (unwrapped) C side.
type C_ActionGroupActionAddedCallback =
Ptr () -> -- object
CString ->
Ptr () -> -- user_data
IO ()
-- | Generate a function pointer callable from C code, from a `C_ActionGroupActionAddedCallback`.
foreign import ccall "wrapper"
mk_ActionGroupActionAddedCallback :: C_ActionGroupActionAddedCallback -> IO (FunPtr C_ActionGroupActionAddedCallback)
-- | Wrap the callback into a `GClosure`.
genClosure_ActionGroupActionAdded :: MonadIO m => ActionGroupActionAddedCallback -> m (GClosure C_ActionGroupActionAddedCallback)
genClosure_ActionGroupActionAdded cb = liftIO $ do
let cb' = wrap_ActionGroupActionAddedCallback cb
mk_ActionGroupActionAddedCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `ActionGroupActionAddedCallback` into a `C_ActionGroupActionAddedCallback`.
wrap_ActionGroupActionAddedCallback ::
ActionGroupActionAddedCallback ->
C_ActionGroupActionAddedCallback
wrap_ActionGroupActionAddedCallback _cb _ actionName _ = do
actionName' <- cstringToText actionName
_cb actionName'
{- |
Connect a signal handler for the “@action-added@” 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' actionGroup #actionAdded callback
@
-}
onActionGroupActionAdded :: (IsActionGroup a, MonadIO m) => a -> ActionGroupActionAddedCallback -> m SignalHandlerId
onActionGroupActionAdded obj cb = liftIO $ do
let cb' = wrap_ActionGroupActionAddedCallback cb
cb'' <- mk_ActionGroupActionAddedCallback cb'
connectSignalFunPtr obj "action-added" cb'' SignalConnectBefore
{- |
Connect a signal handler for the “@action-added@” 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' actionGroup #actionAdded callback
@
-}
afterActionGroupActionAdded :: (IsActionGroup a, MonadIO m) => a -> ActionGroupActionAddedCallback -> m SignalHandlerId
afterActionGroupActionAdded obj cb = liftIO $ do
let cb' = wrap_ActionGroupActionAddedCallback cb
cb'' <- mk_ActionGroupActionAddedCallback cb'
connectSignalFunPtr obj "action-added" cb'' SignalConnectAfter
-- signal ActionGroup::action-enabled-changed
{- |
Signals that the enabled status of the named action has changed.
/Since: 2.28/
-}
type ActionGroupActionEnabledChangedCallback =
T.Text
{- ^ /@actionName@/: the name of the action in /@actionGroup@/ -}
-> Bool
{- ^ /@enabled@/: whether the action is enabled or not -}
-> IO ()
-- | A convenience synonym for @`Nothing` :: `Maybe` `ActionGroupActionEnabledChangedCallback`@.
noActionGroupActionEnabledChangedCallback :: Maybe ActionGroupActionEnabledChangedCallback
noActionGroupActionEnabledChangedCallback = Nothing
-- | Type for the callback on the (unwrapped) C side.
type C_ActionGroupActionEnabledChangedCallback =
Ptr () -> -- object
CString ->
CInt ->
Ptr () -> -- user_data
IO ()
-- | Generate a function pointer callable from C code, from a `C_ActionGroupActionEnabledChangedCallback`.
foreign import ccall "wrapper"
mk_ActionGroupActionEnabledChangedCallback :: C_ActionGroupActionEnabledChangedCallback -> IO (FunPtr C_ActionGroupActionEnabledChangedCallback)
-- | Wrap the callback into a `GClosure`.
genClosure_ActionGroupActionEnabledChanged :: MonadIO m => ActionGroupActionEnabledChangedCallback -> m (GClosure C_ActionGroupActionEnabledChangedCallback)
genClosure_ActionGroupActionEnabledChanged cb = liftIO $ do
let cb' = wrap_ActionGroupActionEnabledChangedCallback cb
mk_ActionGroupActionEnabledChangedCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `ActionGroupActionEnabledChangedCallback` into a `C_ActionGroupActionEnabledChangedCallback`.
wrap_ActionGroupActionEnabledChangedCallback ::
ActionGroupActionEnabledChangedCallback ->
C_ActionGroupActionEnabledChangedCallback
wrap_ActionGroupActionEnabledChangedCallback _cb _ actionName enabled _ = do
actionName' <- cstringToText actionName
let enabled' = (/= 0) enabled
_cb actionName' enabled'
{- |
Connect a signal handler for the “@action-enabled-changed@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.on' actionGroup #actionEnabledChanged callback
@
-}
onActionGroupActionEnabledChanged :: (IsActionGroup a, MonadIO m) => a -> ActionGroupActionEnabledChangedCallback -> m SignalHandlerId
onActionGroupActionEnabledChanged obj cb = liftIO $ do
let cb' = wrap_ActionGroupActionEnabledChangedCallback cb
cb'' <- mk_ActionGroupActionEnabledChangedCallback cb'
connectSignalFunPtr obj "action-enabled-changed" cb'' SignalConnectBefore
{- |
Connect a signal handler for the “@action-enabled-changed@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.after' actionGroup #actionEnabledChanged callback
@
-}
afterActionGroupActionEnabledChanged :: (IsActionGroup a, MonadIO m) => a -> ActionGroupActionEnabledChangedCallback -> m SignalHandlerId
afterActionGroupActionEnabledChanged obj cb = liftIO $ do
let cb' = wrap_ActionGroupActionEnabledChangedCallback cb
cb'' <- mk_ActionGroupActionEnabledChangedCallback cb'
connectSignalFunPtr obj "action-enabled-changed" cb'' SignalConnectAfter
-- signal ActionGroup::action-removed
{- |
Signals that an action is just about to be removed from the group.
This signal is emitted before the action is removed, so the action
is still visible and can be queried from the signal handler.
/Since: 2.28/
-}
type ActionGroupActionRemovedCallback =
T.Text
{- ^ /@actionName@/: the name of the action in /@actionGroup@/ -}
-> IO ()
-- | A convenience synonym for @`Nothing` :: `Maybe` `ActionGroupActionRemovedCallback`@.
noActionGroupActionRemovedCallback :: Maybe ActionGroupActionRemovedCallback
noActionGroupActionRemovedCallback = Nothing
-- | Type for the callback on the (unwrapped) C side.
type C_ActionGroupActionRemovedCallback =
Ptr () -> -- object
CString ->
Ptr () -> -- user_data
IO ()
-- | Generate a function pointer callable from C code, from a `C_ActionGroupActionRemovedCallback`.
foreign import ccall "wrapper"
mk_ActionGroupActionRemovedCallback :: C_ActionGroupActionRemovedCallback -> IO (FunPtr C_ActionGroupActionRemovedCallback)
-- | Wrap the callback into a `GClosure`.
genClosure_ActionGroupActionRemoved :: MonadIO m => ActionGroupActionRemovedCallback -> m (GClosure C_ActionGroupActionRemovedCallback)
genClosure_ActionGroupActionRemoved cb = liftIO $ do
let cb' = wrap_ActionGroupActionRemovedCallback cb
mk_ActionGroupActionRemovedCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `ActionGroupActionRemovedCallback` into a `C_ActionGroupActionRemovedCallback`.
wrap_ActionGroupActionRemovedCallback ::
ActionGroupActionRemovedCallback ->
C_ActionGroupActionRemovedCallback
wrap_ActionGroupActionRemovedCallback _cb _ actionName _ = do
actionName' <- cstringToText actionName
_cb actionName'
{- |
Connect a signal handler for the “@action-removed@” 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' actionGroup #actionRemoved callback
@
-}
onActionGroupActionRemoved :: (IsActionGroup a, MonadIO m) => a -> ActionGroupActionRemovedCallback -> m SignalHandlerId
onActionGroupActionRemoved obj cb = liftIO $ do
let cb' = wrap_ActionGroupActionRemovedCallback cb
cb'' <- mk_ActionGroupActionRemovedCallback cb'
connectSignalFunPtr obj "action-removed" cb'' SignalConnectBefore
{- |
Connect a signal handler for the “@action-removed@” 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' actionGroup #actionRemoved callback
@
-}
afterActionGroupActionRemoved :: (IsActionGroup a, MonadIO m) => a -> ActionGroupActionRemovedCallback -> m SignalHandlerId
afterActionGroupActionRemoved obj cb = liftIO $ do
let cb' = wrap_ActionGroupActionRemovedCallback cb
cb'' <- mk_ActionGroupActionRemovedCallback cb'
connectSignalFunPtr obj "action-removed" cb'' SignalConnectAfter
-- signal ActionGroup::action-state-changed
{- |
Signals that the state of the named action has changed.
/Since: 2.28/
-}
type ActionGroupActionStateChangedCallback =
T.Text
{- ^ /@actionName@/: the name of the action in /@actionGroup@/ -}
-> GVariant
{- ^ /@value@/: the new value of the state -}
-> IO ()
-- | A convenience synonym for @`Nothing` :: `Maybe` `ActionGroupActionStateChangedCallback`@.
noActionGroupActionStateChangedCallback :: Maybe ActionGroupActionStateChangedCallback
noActionGroupActionStateChangedCallback = Nothing
-- | Type for the callback on the (unwrapped) C side.
type C_ActionGroupActionStateChangedCallback =
Ptr () -> -- object
CString ->
Ptr GVariant ->
Ptr () -> -- user_data
IO ()
-- | Generate a function pointer callable from C code, from a `C_ActionGroupActionStateChangedCallback`.
foreign import ccall "wrapper"
mk_ActionGroupActionStateChangedCallback :: C_ActionGroupActionStateChangedCallback -> IO (FunPtr C_ActionGroupActionStateChangedCallback)
-- | Wrap the callback into a `GClosure`.
genClosure_ActionGroupActionStateChanged :: MonadIO m => ActionGroupActionStateChangedCallback -> m (GClosure C_ActionGroupActionStateChangedCallback)
genClosure_ActionGroupActionStateChanged cb = liftIO $ do
let cb' = wrap_ActionGroupActionStateChangedCallback cb
mk_ActionGroupActionStateChangedCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `ActionGroupActionStateChangedCallback` into a `C_ActionGroupActionStateChangedCallback`.
wrap_ActionGroupActionStateChangedCallback ::
ActionGroupActionStateChangedCallback ->
C_ActionGroupActionStateChangedCallback
wrap_ActionGroupActionStateChangedCallback _cb _ actionName value _ = do
actionName' <- cstringToText actionName
value' <- B.GVariant.newGVariantFromPtr value
_cb actionName' value'
{- |
Connect a signal handler for the “@action-state-changed@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.on' actionGroup #actionStateChanged callback
@
-}
onActionGroupActionStateChanged :: (IsActionGroup a, MonadIO m) => a -> ActionGroupActionStateChangedCallback -> m SignalHandlerId
onActionGroupActionStateChanged obj cb = liftIO $ do
let cb' = wrap_ActionGroupActionStateChangedCallback cb
cb'' <- mk_ActionGroupActionStateChangedCallback cb'
connectSignalFunPtr obj "action-state-changed" cb'' SignalConnectBefore
{- |
Connect a signal handler for the “@action-state-changed@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.after' actionGroup #actionStateChanged callback
@
-}
afterActionGroupActionStateChanged :: (IsActionGroup a, MonadIO m) => a -> ActionGroupActionStateChangedCallback -> m SignalHandlerId
afterActionGroupActionStateChanged obj cb = liftIO $ do
let cb' = wrap_ActionGroupActionStateChangedCallback cb
cb'' <- mk_ActionGroupActionStateChangedCallback cb'
connectSignalFunPtr obj "action-state-changed" cb'' SignalConnectAfter
#if ENABLE_OVERLOADING
data ActionGroupActionAddedSignalInfo
instance SignalInfo ActionGroupActionAddedSignalInfo where
type HaskellCallbackType ActionGroupActionAddedSignalInfo = ActionGroupActionAddedCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_ActionGroupActionAddedCallback cb
cb'' <- mk_ActionGroupActionAddedCallback cb'
connectSignalFunPtr obj "action-added" cb'' connectMode
data ActionGroupActionEnabledChangedSignalInfo
instance SignalInfo ActionGroupActionEnabledChangedSignalInfo where
type HaskellCallbackType ActionGroupActionEnabledChangedSignalInfo = ActionGroupActionEnabledChangedCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_ActionGroupActionEnabledChangedCallback cb
cb'' <- mk_ActionGroupActionEnabledChangedCallback cb'
connectSignalFunPtr obj "action-enabled-changed" cb'' connectMode
data ActionGroupActionRemovedSignalInfo
instance SignalInfo ActionGroupActionRemovedSignalInfo where
type HaskellCallbackType ActionGroupActionRemovedSignalInfo = ActionGroupActionRemovedCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_ActionGroupActionRemovedCallback cb
cb'' <- mk_ActionGroupActionRemovedCallback cb'
connectSignalFunPtr obj "action-removed" cb'' connectMode
data ActionGroupActionStateChangedSignalInfo
instance SignalInfo ActionGroupActionStateChangedSignalInfo where
type HaskellCallbackType ActionGroupActionStateChangedSignalInfo = ActionGroupActionStateChangedCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_ActionGroupActionStateChangedCallback cb
cb'' <- mk_ActionGroupActionStateChangedCallback cb'
connectSignalFunPtr obj "action-state-changed" cb'' connectMode
type instance O.SignalList ActionGroup = ActionGroupSignalList
type ActionGroupSignalList = ('[ '("actionAdded", ActionGroupActionAddedSignalInfo), '("actionEnabledChanged", ActionGroupActionEnabledChangedSignalInfo), '("actionRemoved", ActionGroupActionRemovedSignalInfo), '("actionStateChanged", ActionGroupActionStateChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_action_group_get_type"
c_g_action_group_get_type :: IO GType
instance GObject ActionGroup where
gobjectType = c_g_action_group_get_type
-- | Type class for types which can be safely cast to `ActionGroup`, for instance with `toActionGroup`.
class (GObject o, O.IsDescendantOf ActionGroup o) => IsActionGroup o
instance (GObject o, O.IsDescendantOf ActionGroup o) => IsActionGroup o
instance O.HasParentTypes ActionGroup
type instance O.ParentTypes ActionGroup = '[GObject.Object.Object]
-- | Cast to `ActionGroup`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toActionGroup :: (MonadIO m, IsActionGroup o) => o -> m ActionGroup
toActionGroup = liftIO . unsafeCastTo ActionGroup
#if ENABLE_OVERLOADING
instance O.HasAttributeList ActionGroup
type instance O.AttributeList ActionGroup = ActionGroupAttributeList
type ActionGroupAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
type family ResolveActionGroupMethod (t :: Symbol) (o :: *) :: * where
ResolveActionGroupMethod "actionAdded" o = ActionGroupActionAddedMethodInfo
ResolveActionGroupMethod "actionEnabledChanged" o = ActionGroupActionEnabledChangedMethodInfo
ResolveActionGroupMethod "actionRemoved" o = ActionGroupActionRemovedMethodInfo
ResolveActionGroupMethod "actionStateChanged" o = ActionGroupActionStateChangedMethodInfo
ResolveActionGroupMethod "activateAction" o = ActionGroupActivateActionMethodInfo
ResolveActionGroupMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveActionGroupMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveActionGroupMethod "changeActionState" o = ActionGroupChangeActionStateMethodInfo
ResolveActionGroupMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveActionGroupMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveActionGroupMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveActionGroupMethod "hasAction" o = ActionGroupHasActionMethodInfo
ResolveActionGroupMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveActionGroupMethod "listActions" o = ActionGroupListActionsMethodInfo
ResolveActionGroupMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveActionGroupMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveActionGroupMethod "queryAction" o = ActionGroupQueryActionMethodInfo
ResolveActionGroupMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveActionGroupMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveActionGroupMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveActionGroupMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveActionGroupMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveActionGroupMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveActionGroupMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveActionGroupMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveActionGroupMethod "getActionEnabled" o = ActionGroupGetActionEnabledMethodInfo
ResolveActionGroupMethod "getActionParameterType" o = ActionGroupGetActionParameterTypeMethodInfo
ResolveActionGroupMethod "getActionState" o = ActionGroupGetActionStateMethodInfo
ResolveActionGroupMethod "getActionStateHint" o = ActionGroupGetActionStateHintMethodInfo
ResolveActionGroupMethod "getActionStateType" o = ActionGroupGetActionStateTypeMethodInfo
ResolveActionGroupMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveActionGroupMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveActionGroupMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveActionGroupMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveActionGroupMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveActionGroupMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveActionGroupMethod t ActionGroup, O.MethodInfo info ActionGroup p) => OL.IsLabel t (ActionGroup -> 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
-- method ActionGroup::action_added
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "action_group", argType = TInterface (Name {namespace = "Gio", name = "ActionGroup"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GActionGroup", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of an action in the group", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "g_action_group_action_added" g_action_group_action_added ::
Ptr ActionGroup -> -- action_group : TInterface (Name {namespace = "Gio", name = "ActionGroup"})
CString -> -- action_name : TBasicType TUTF8
IO ()
{- |
Emits the 'GI.Gio.Interfaces.ActionGroup.ActionGroup'::@/action-added/@ signal on /@actionGroup@/.
This function should only be called by 'GI.Gio.Interfaces.ActionGroup.ActionGroup' implementations.
/Since: 2.28/
-}
actionGroupActionAdded ::
(B.CallStack.HasCallStack, MonadIO m, IsActionGroup a) =>
a
{- ^ /@actionGroup@/: a 'GI.Gio.Interfaces.ActionGroup.ActionGroup' -}
-> T.Text
{- ^ /@actionName@/: the name of an action in the group -}
-> m ()
actionGroupActionAdded actionGroup actionName = liftIO $ do
actionGroup' <- unsafeManagedPtrCastPtr actionGroup
actionName' <- textToCString actionName
g_action_group_action_added actionGroup' actionName'
touchManagedPtr actionGroup
freeMem actionName'
return ()
#if ENABLE_OVERLOADING
data ActionGroupActionAddedMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsActionGroup a) => O.MethodInfo ActionGroupActionAddedMethodInfo a signature where
overloadedMethod _ = actionGroupActionAdded
#endif
-- method ActionGroup::action_enabled_changed
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "action_group", argType = TInterface (Name {namespace = "Gio", name = "ActionGroup"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GActionGroup", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of an action in the group", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "enabled", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether or not the action is now enabled", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "g_action_group_action_enabled_changed" g_action_group_action_enabled_changed ::
Ptr ActionGroup -> -- action_group : TInterface (Name {namespace = "Gio", name = "ActionGroup"})
CString -> -- action_name : TBasicType TUTF8
CInt -> -- enabled : TBasicType TBoolean
IO ()
{- |
Emits the 'GI.Gio.Interfaces.ActionGroup.ActionGroup'::@/action-enabled-changed/@ signal on /@actionGroup@/.
This function should only be called by 'GI.Gio.Interfaces.ActionGroup.ActionGroup' implementations.
/Since: 2.28/
-}
actionGroupActionEnabledChanged ::
(B.CallStack.HasCallStack, MonadIO m, IsActionGroup a) =>
a
{- ^ /@actionGroup@/: a 'GI.Gio.Interfaces.ActionGroup.ActionGroup' -}
-> T.Text
{- ^ /@actionName@/: the name of an action in the group -}
-> Bool
{- ^ /@enabled@/: whether or not the action is now enabled -}
-> m ()
actionGroupActionEnabledChanged actionGroup actionName enabled = liftIO $ do
actionGroup' <- unsafeManagedPtrCastPtr actionGroup
actionName' <- textToCString actionName
let enabled' = (fromIntegral . fromEnum) enabled
g_action_group_action_enabled_changed actionGroup' actionName' enabled'
touchManagedPtr actionGroup
freeMem actionName'
return ()
#if ENABLE_OVERLOADING
data ActionGroupActionEnabledChangedMethodInfo
instance (signature ~ (T.Text -> Bool -> m ()), MonadIO m, IsActionGroup a) => O.MethodInfo ActionGroupActionEnabledChangedMethodInfo a signature where
overloadedMethod _ = actionGroupActionEnabledChanged
#endif
-- method ActionGroup::action_removed
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "action_group", argType = TInterface (Name {namespace = "Gio", name = "ActionGroup"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GActionGroup", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of an action in the group", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "g_action_group_action_removed" g_action_group_action_removed ::
Ptr ActionGroup -> -- action_group : TInterface (Name {namespace = "Gio", name = "ActionGroup"})
CString -> -- action_name : TBasicType TUTF8
IO ()
{- |
Emits the 'GI.Gio.Interfaces.ActionGroup.ActionGroup'::@/action-removed/@ signal on /@actionGroup@/.
This function should only be called by 'GI.Gio.Interfaces.ActionGroup.ActionGroup' implementations.
/Since: 2.28/
-}
actionGroupActionRemoved ::
(B.CallStack.HasCallStack, MonadIO m, IsActionGroup a) =>
a
{- ^ /@actionGroup@/: a 'GI.Gio.Interfaces.ActionGroup.ActionGroup' -}
-> T.Text
{- ^ /@actionName@/: the name of an action in the group -}
-> m ()
actionGroupActionRemoved actionGroup actionName = liftIO $ do
actionGroup' <- unsafeManagedPtrCastPtr actionGroup
actionName' <- textToCString actionName
g_action_group_action_removed actionGroup' actionName'
touchManagedPtr actionGroup
freeMem actionName'
return ()
#if ENABLE_OVERLOADING
data ActionGroupActionRemovedMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsActionGroup a) => O.MethodInfo ActionGroupActionRemovedMethodInfo a signature where
overloadedMethod _ = actionGroupActionRemoved
#endif
-- method ActionGroup::action_state_changed
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "action_group", argType = TInterface (Name {namespace = "Gio", name = "ActionGroup"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GActionGroup", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of an action in the group", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "state", argType = TVariant, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new state of the named action", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "g_action_group_action_state_changed" g_action_group_action_state_changed ::
Ptr ActionGroup -> -- action_group : TInterface (Name {namespace = "Gio", name = "ActionGroup"})
CString -> -- action_name : TBasicType TUTF8
Ptr GVariant -> -- state : TVariant
IO ()
{- |
Emits the 'GI.Gio.Interfaces.ActionGroup.ActionGroup'::@/action-state-changed/@ signal on /@actionGroup@/.
This function should only be called by 'GI.Gio.Interfaces.ActionGroup.ActionGroup' implementations.
/Since: 2.28/
-}
actionGroupActionStateChanged ::
(B.CallStack.HasCallStack, MonadIO m, IsActionGroup a) =>
a
{- ^ /@actionGroup@/: a 'GI.Gio.Interfaces.ActionGroup.ActionGroup' -}
-> T.Text
{- ^ /@actionName@/: the name of an action in the group -}
-> GVariant
{- ^ /@state@/: the new state of the named action -}
-> m ()
actionGroupActionStateChanged actionGroup actionName state = liftIO $ do
actionGroup' <- unsafeManagedPtrCastPtr actionGroup
actionName' <- textToCString actionName
state' <- unsafeManagedPtrGetPtr state
g_action_group_action_state_changed actionGroup' actionName' state'
touchManagedPtr actionGroup
touchManagedPtr state
freeMem actionName'
return ()
#if ENABLE_OVERLOADING
data ActionGroupActionStateChangedMethodInfo
instance (signature ~ (T.Text -> GVariant -> m ()), MonadIO m, IsActionGroup a) => O.MethodInfo ActionGroupActionStateChangedMethodInfo a signature where
overloadedMethod _ = actionGroupActionStateChanged
#endif
-- method ActionGroup::activate_action
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "action_group", argType = TInterface (Name {namespace = "Gio", name = "ActionGroup"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GActionGroup", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the action to activate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parameter", argType = TVariant, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "parameters to the activation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "g_action_group_activate_action" g_action_group_activate_action ::
Ptr ActionGroup -> -- action_group : TInterface (Name {namespace = "Gio", name = "ActionGroup"})
CString -> -- action_name : TBasicType TUTF8
Ptr GVariant -> -- parameter : TVariant
IO ()
{- |
Activate the named action within /@actionGroup@/.
If the action is expecting a parameter, then the correct type of
parameter must be given as /@parameter@/. If the action is expecting no
parameters then /@parameter@/ must be 'Nothing'. See
'GI.Gio.Interfaces.ActionGroup.actionGroupGetActionParameterType'.
/Since: 2.28/
-}
actionGroupActivateAction ::
(B.CallStack.HasCallStack, MonadIO m, IsActionGroup a) =>
a
{- ^ /@actionGroup@/: a 'GI.Gio.Interfaces.ActionGroup.ActionGroup' -}
-> T.Text
{- ^ /@actionName@/: the name of the action to activate -}
-> Maybe (GVariant)
{- ^ /@parameter@/: parameters to the activation -}
-> m ()
actionGroupActivateAction actionGroup actionName parameter = liftIO $ do
actionGroup' <- unsafeManagedPtrCastPtr actionGroup
actionName' <- textToCString actionName
maybeParameter <- case parameter of
Nothing -> return nullPtr
Just jParameter -> do
jParameter' <- unsafeManagedPtrGetPtr jParameter
return jParameter'
g_action_group_activate_action actionGroup' actionName' maybeParameter
touchManagedPtr actionGroup
whenJust parameter touchManagedPtr
freeMem actionName'
return ()
#if ENABLE_OVERLOADING
data ActionGroupActivateActionMethodInfo
instance (signature ~ (T.Text -> Maybe (GVariant) -> m ()), MonadIO m, IsActionGroup a) => O.MethodInfo ActionGroupActivateActionMethodInfo a signature where
overloadedMethod _ = actionGroupActivateAction
#endif
-- method ActionGroup::change_action_state
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "action_group", argType = TInterface (Name {namespace = "Gio", name = "ActionGroup"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GActionGroup", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the action to request the change on", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TVariant, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new state", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "g_action_group_change_action_state" g_action_group_change_action_state ::
Ptr ActionGroup -> -- action_group : TInterface (Name {namespace = "Gio", name = "ActionGroup"})
CString -> -- action_name : TBasicType TUTF8
Ptr GVariant -> -- value : TVariant
IO ()
{- |
Request for the state of the named action within /@actionGroup@/ to be
changed to /@value@/.
The action must be stateful and /@value@/ must be of the correct type.
See 'GI.Gio.Interfaces.ActionGroup.actionGroupGetActionStateType'.
This call merely requests a change. The action may refuse to change
its state or may change its state to something other than /@value@/.
See 'GI.Gio.Interfaces.ActionGroup.actionGroupGetActionStateHint'.
If the /@value@/ GVariant is floating, it is consumed.
/Since: 2.28/
-}
actionGroupChangeActionState ::
(B.CallStack.HasCallStack, MonadIO m, IsActionGroup a) =>
a
{- ^ /@actionGroup@/: a 'GI.Gio.Interfaces.ActionGroup.ActionGroup' -}
-> T.Text
{- ^ /@actionName@/: the name of the action to request the change on -}
-> GVariant
{- ^ /@value@/: the new state -}
-> m ()
actionGroupChangeActionState actionGroup actionName value = liftIO $ do
actionGroup' <- unsafeManagedPtrCastPtr actionGroup
actionName' <- textToCString actionName
value' <- unsafeManagedPtrGetPtr value
g_action_group_change_action_state actionGroup' actionName' value'
touchManagedPtr actionGroup
touchManagedPtr value
freeMem actionName'
return ()
#if ENABLE_OVERLOADING
data ActionGroupChangeActionStateMethodInfo
instance (signature ~ (T.Text -> GVariant -> m ()), MonadIO m, IsActionGroup a) => O.MethodInfo ActionGroupChangeActionStateMethodInfo a signature where
overloadedMethod _ = actionGroupChangeActionState
#endif
-- method ActionGroup::get_action_enabled
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "action_group", argType = TInterface (Name {namespace = "Gio", name = "ActionGroup"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GActionGroup", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the action to query", 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_action_group_get_action_enabled" g_action_group_get_action_enabled ::
Ptr ActionGroup -> -- action_group : TInterface (Name {namespace = "Gio", name = "ActionGroup"})
CString -> -- action_name : TBasicType TUTF8
IO CInt
{- |
Checks if the named action within /@actionGroup@/ is currently enabled.
An action must be enabled in order to be activated or in order to
have its state changed from outside callers.
/Since: 2.28/
-}
actionGroupGetActionEnabled ::
(B.CallStack.HasCallStack, MonadIO m, IsActionGroup a) =>
a
{- ^ /@actionGroup@/: a 'GI.Gio.Interfaces.ActionGroup.ActionGroup' -}
-> T.Text
{- ^ /@actionName@/: the name of the action to query -}
-> m Bool
{- ^ __Returns:__ whether or not the action is currently enabled -}
actionGroupGetActionEnabled actionGroup actionName = liftIO $ do
actionGroup' <- unsafeManagedPtrCastPtr actionGroup
actionName' <- textToCString actionName
result <- g_action_group_get_action_enabled actionGroup' actionName'
let result' = (/= 0) result
touchManagedPtr actionGroup
freeMem actionName'
return result'
#if ENABLE_OVERLOADING
data ActionGroupGetActionEnabledMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m, IsActionGroup a) => O.MethodInfo ActionGroupGetActionEnabledMethodInfo a signature where
overloadedMethod _ = actionGroupGetActionEnabled
#endif
-- method ActionGroup::get_action_parameter_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "action_group", argType = TInterface (Name {namespace = "Gio", name = "ActionGroup"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GActionGroup", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the action to query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "VariantType"}))
-- throws : False
-- Skip return : False
foreign import ccall "g_action_group_get_action_parameter_type" g_action_group_get_action_parameter_type ::
Ptr ActionGroup -> -- action_group : TInterface (Name {namespace = "Gio", name = "ActionGroup"})
CString -> -- action_name : TBasicType TUTF8
IO (Ptr GLib.VariantType.VariantType)
{- |
Queries the type of the parameter that must be given when activating
the named action within /@actionGroup@/.
When activating the action using 'GI.Gio.Interfaces.ActionGroup.actionGroupActivateAction',
the 'GVariant' given to that function must be of the type returned
by this function.
In the case that this function returns 'Nothing', you must not give any
'GVariant', but 'Nothing' instead.
The parameter type of a particular action will never change but it is
possible for an action to be removed and for a new action to be added
with the same name but a different parameter type.
/Since: 2.28/
-}
actionGroupGetActionParameterType ::
(B.CallStack.HasCallStack, MonadIO m, IsActionGroup a) =>
a
{- ^ /@actionGroup@/: a 'GI.Gio.Interfaces.ActionGroup.ActionGroup' -}
-> T.Text
{- ^ /@actionName@/: the name of the action to query -}
-> m (Maybe GLib.VariantType.VariantType)
{- ^ __Returns:__ the parameter type -}
actionGroupGetActionParameterType actionGroup actionName = liftIO $ do
actionGroup' <- unsafeManagedPtrCastPtr actionGroup
actionName' <- textToCString actionName
result <- g_action_group_get_action_parameter_type actionGroup' actionName'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newBoxed GLib.VariantType.VariantType) result'
return result''
touchManagedPtr actionGroup
freeMem actionName'
return maybeResult
#if ENABLE_OVERLOADING
data ActionGroupGetActionParameterTypeMethodInfo
instance (signature ~ (T.Text -> m (Maybe GLib.VariantType.VariantType)), MonadIO m, IsActionGroup a) => O.MethodInfo ActionGroupGetActionParameterTypeMethodInfo a signature where
overloadedMethod _ = actionGroupGetActionParameterType
#endif
-- method ActionGroup::get_action_state
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "action_group", argType = TInterface (Name {namespace = "Gio", name = "ActionGroup"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GActionGroup", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the action to query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just TVariant
-- throws : False
-- Skip return : False
foreign import ccall "g_action_group_get_action_state" g_action_group_get_action_state ::
Ptr ActionGroup -> -- action_group : TInterface (Name {namespace = "Gio", name = "ActionGroup"})
CString -> -- action_name : TBasicType TUTF8
IO (Ptr GVariant)
{- |
Queries the current state of the named action within /@actionGroup@/.
If the action is not stateful then 'Nothing' will be returned. If the
action is stateful then the type of the return value is the type
given by 'GI.Gio.Interfaces.ActionGroup.actionGroupGetActionStateType'.
The return value (if non-'Nothing') should be freed with
'GI.GLib.Structs.Variant.variantUnref' when it is no longer required.
/Since: 2.28/
-}
actionGroupGetActionState ::
(B.CallStack.HasCallStack, MonadIO m, IsActionGroup a) =>
a
{- ^ /@actionGroup@/: a 'GI.Gio.Interfaces.ActionGroup.ActionGroup' -}
-> T.Text
{- ^ /@actionName@/: the name of the action to query -}
-> m (Maybe GVariant)
{- ^ __Returns:__ the current state of the action -}
actionGroupGetActionState actionGroup actionName = liftIO $ do
actionGroup' <- unsafeManagedPtrCastPtr actionGroup
actionName' <- textToCString actionName
result <- g_action_group_get_action_state actionGroup' actionName'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- B.GVariant.wrapGVariantPtr result'
return result''
touchManagedPtr actionGroup
freeMem actionName'
return maybeResult
#if ENABLE_OVERLOADING
data ActionGroupGetActionStateMethodInfo
instance (signature ~ (T.Text -> m (Maybe GVariant)), MonadIO m, IsActionGroup a) => O.MethodInfo ActionGroupGetActionStateMethodInfo a signature where
overloadedMethod _ = actionGroupGetActionState
#endif
-- method ActionGroup::get_action_state_hint
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "action_group", argType = TInterface (Name {namespace = "Gio", name = "ActionGroup"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GActionGroup", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the action to query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just TVariant
-- throws : False
-- Skip return : False
foreign import ccall "g_action_group_get_action_state_hint" g_action_group_get_action_state_hint ::
Ptr ActionGroup -> -- action_group : TInterface (Name {namespace = "Gio", name = "ActionGroup"})
CString -> -- action_name : TBasicType TUTF8
IO (Ptr GVariant)
{- |
Requests a hint about the valid range of values for the state of the
named action within /@actionGroup@/.
If 'Nothing' is returned it either means that the action is not stateful
or that there is no hint about the valid range of values for the
state of the action.
If a 'GVariant' array is returned then each item in the array is a
possible value for the state. If a 'GVariant' pair (ie: two-tuple) is
returned then the tuple specifies the inclusive lower and upper bound
of valid values for the state.
In any case, the information is merely a hint. It may be possible to
have a state value outside of the hinted range and setting a value
within the range may fail.
The return value (if non-'Nothing') should be freed with
'GI.GLib.Structs.Variant.variantUnref' when it is no longer required.
/Since: 2.28/
-}
actionGroupGetActionStateHint ::
(B.CallStack.HasCallStack, MonadIO m, IsActionGroup a) =>
a
{- ^ /@actionGroup@/: a 'GI.Gio.Interfaces.ActionGroup.ActionGroup' -}
-> T.Text
{- ^ /@actionName@/: the name of the action to query -}
-> m (Maybe GVariant)
{- ^ __Returns:__ the state range hint -}
actionGroupGetActionStateHint actionGroup actionName = liftIO $ do
actionGroup' <- unsafeManagedPtrCastPtr actionGroup
actionName' <- textToCString actionName
result <- g_action_group_get_action_state_hint actionGroup' actionName'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- B.GVariant.wrapGVariantPtr result'
return result''
touchManagedPtr actionGroup
freeMem actionName'
return maybeResult
#if ENABLE_OVERLOADING
data ActionGroupGetActionStateHintMethodInfo
instance (signature ~ (T.Text -> m (Maybe GVariant)), MonadIO m, IsActionGroup a) => O.MethodInfo ActionGroupGetActionStateHintMethodInfo a signature where
overloadedMethod _ = actionGroupGetActionStateHint
#endif
-- method ActionGroup::get_action_state_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "action_group", argType = TInterface (Name {namespace = "Gio", name = "ActionGroup"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GActionGroup", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the action to query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "VariantType"}))
-- throws : False
-- Skip return : False
foreign import ccall "g_action_group_get_action_state_type" g_action_group_get_action_state_type ::
Ptr ActionGroup -> -- action_group : TInterface (Name {namespace = "Gio", name = "ActionGroup"})
CString -> -- action_name : TBasicType TUTF8
IO (Ptr GLib.VariantType.VariantType)
{- |
Queries the type of the state of the named action within
/@actionGroup@/.
If the action is stateful then this function returns the
'GI.GLib.Structs.VariantType.VariantType' of the state. All calls to
'GI.Gio.Interfaces.ActionGroup.actionGroupChangeActionState' must give a 'GVariant' of this
type and 'GI.Gio.Interfaces.ActionGroup.actionGroupGetActionState' will return a 'GVariant'
of the same type.
If the action is not stateful then this function will return 'Nothing'.
In that case, 'GI.Gio.Interfaces.ActionGroup.actionGroupGetActionState' will return 'Nothing'
and you must not call 'GI.Gio.Interfaces.ActionGroup.actionGroupChangeActionState'.
The state type of a particular action will never change but it is
possible for an action to be removed and for a new action to be added
with the same name but a different state type.
/Since: 2.28/
-}
actionGroupGetActionStateType ::
(B.CallStack.HasCallStack, MonadIO m, IsActionGroup a) =>
a
{- ^ /@actionGroup@/: a 'GI.Gio.Interfaces.ActionGroup.ActionGroup' -}
-> T.Text
{- ^ /@actionName@/: the name of the action to query -}
-> m (Maybe GLib.VariantType.VariantType)
{- ^ __Returns:__ the state type, if the action is stateful -}
actionGroupGetActionStateType actionGroup actionName = liftIO $ do
actionGroup' <- unsafeManagedPtrCastPtr actionGroup
actionName' <- textToCString actionName
result <- g_action_group_get_action_state_type actionGroup' actionName'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newBoxed GLib.VariantType.VariantType) result'
return result''
touchManagedPtr actionGroup
freeMem actionName'
return maybeResult
#if ENABLE_OVERLOADING
data ActionGroupGetActionStateTypeMethodInfo
instance (signature ~ (T.Text -> m (Maybe GLib.VariantType.VariantType)), MonadIO m, IsActionGroup a) => O.MethodInfo ActionGroupGetActionStateTypeMethodInfo a signature where
overloadedMethod _ = actionGroupGetActionStateType
#endif
-- method ActionGroup::has_action
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "action_group", argType = TInterface (Name {namespace = "Gio", name = "ActionGroup"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GActionGroup", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the action to check for", 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_action_group_has_action" g_action_group_has_action ::
Ptr ActionGroup -> -- action_group : TInterface (Name {namespace = "Gio", name = "ActionGroup"})
CString -> -- action_name : TBasicType TUTF8
IO CInt
{- |
Checks if the named action exists within /@actionGroup@/.
/Since: 2.28/
-}
actionGroupHasAction ::
(B.CallStack.HasCallStack, MonadIO m, IsActionGroup a) =>
a
{- ^ /@actionGroup@/: a 'GI.Gio.Interfaces.ActionGroup.ActionGroup' -}
-> T.Text
{- ^ /@actionName@/: the name of the action to check for -}
-> m Bool
{- ^ __Returns:__ whether the named action exists -}
actionGroupHasAction actionGroup actionName = liftIO $ do
actionGroup' <- unsafeManagedPtrCastPtr actionGroup
actionName' <- textToCString actionName
result <- g_action_group_has_action actionGroup' actionName'
let result' = (/= 0) result
touchManagedPtr actionGroup
freeMem actionName'
return result'
#if ENABLE_OVERLOADING
data ActionGroupHasActionMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m, IsActionGroup a) => O.MethodInfo ActionGroupHasActionMethodInfo a signature where
overloadedMethod _ = actionGroupHasAction
#endif
-- method ActionGroup::list_actions
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "action_group", argType = TInterface (Name {namespace = "Gio", name = "ActionGroup"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GActionGroup", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False
foreign import ccall "g_action_group_list_actions" g_action_group_list_actions ::
Ptr ActionGroup -> -- action_group : TInterface (Name {namespace = "Gio", name = "ActionGroup"})
IO (Ptr CString)
{- |
Lists the actions contained within /@actionGroup@/.
The caller is responsible for freeing the list with 'GI.GLib.Functions.strfreev' when
it is no longer required.
/Since: 2.28/
-}
actionGroupListActions ::
(B.CallStack.HasCallStack, MonadIO m, IsActionGroup a) =>
a
{- ^ /@actionGroup@/: a 'GI.Gio.Interfaces.ActionGroup.ActionGroup' -}
-> m [T.Text]
{- ^ __Returns:__ a 'Nothing'-terminated array of the names of the
actions in the group -}
actionGroupListActions actionGroup = liftIO $ do
actionGroup' <- unsafeManagedPtrCastPtr actionGroup
result <- g_action_group_list_actions actionGroup'
checkUnexpectedReturnNULL "actionGroupListActions" result
result' <- unpackZeroTerminatedUTF8CArray result
mapZeroTerminatedCArray freeMem result
freeMem result
touchManagedPtr actionGroup
return result'
#if ENABLE_OVERLOADING
data ActionGroupListActionsMethodInfo
instance (signature ~ (m [T.Text]), MonadIO m, IsActionGroup a) => O.MethodInfo ActionGroupListActionsMethodInfo a signature where
overloadedMethod _ = actionGroupListActions
#endif
-- method ActionGroup::query_action
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "action_group", argType = TInterface (Name {namespace = "Gio", name = "ActionGroup"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GActionGroup", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of an action in the group", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "enabled", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if the action is presently enabled", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "parameter_type", argType = TInterface (Name {namespace = "GLib", name = "VariantType"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the parameter type, or %NULL if none needed", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "state_type", argType = TInterface (Name {namespace = "GLib", name = "VariantType"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the state type, or %NULL if stateless", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "state_hint", argType = TVariant, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the state hint, or %NULL if none", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "state", argType = TVariant, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the current state, or %NULL if stateless", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False
foreign import ccall "g_action_group_query_action" g_action_group_query_action ::
Ptr ActionGroup -> -- action_group : TInterface (Name {namespace = "Gio", name = "ActionGroup"})
CString -> -- action_name : TBasicType TUTF8
Ptr CInt -> -- enabled : TBasicType TBoolean
Ptr (Ptr GLib.VariantType.VariantType) -> -- parameter_type : TInterface (Name {namespace = "GLib", name = "VariantType"})
Ptr (Ptr GLib.VariantType.VariantType) -> -- state_type : TInterface (Name {namespace = "GLib", name = "VariantType"})
Ptr (Ptr GVariant) -> -- state_hint : TVariant
Ptr (Ptr GVariant) -> -- state : TVariant
IO CInt
{- |
Queries all aspects of the named action within an /@actionGroup@/.
This function acquires the information available from
'GI.Gio.Interfaces.ActionGroup.actionGroupHasAction', 'GI.Gio.Interfaces.ActionGroup.actionGroupGetActionEnabled',
'GI.Gio.Interfaces.ActionGroup.actionGroupGetActionParameterType',
'GI.Gio.Interfaces.ActionGroup.actionGroupGetActionStateType',
'GI.Gio.Interfaces.ActionGroup.actionGroupGetActionStateHint' and
'GI.Gio.Interfaces.ActionGroup.actionGroupGetActionState' with a single function call.
This provides two main benefits.
The first is the improvement in efficiency that comes with not having
to perform repeated lookups of the action in order to discover
different things about it. The second is that implementing
'GI.Gio.Interfaces.ActionGroup.ActionGroup' can now be done by only overriding this one virtual
function.
The interface provides a default implementation of this function that
calls the individual functions, as required, to fetch the
information. The interface also provides default implementations of
those functions that call this function. All implementations,
therefore, must override either this function or all of the others.
If the action exists, 'True' is returned and any of the requested
fields (as indicated by having a non-'Nothing' reference passed in) are
filled. If the action doesn\'t exist, 'False' is returned and the
fields may or may not have been modified.
/Since: 2.32/
-}
actionGroupQueryAction ::
(B.CallStack.HasCallStack, MonadIO m, IsActionGroup a) =>
a
{- ^ /@actionGroup@/: a 'GI.Gio.Interfaces.ActionGroup.ActionGroup' -}
-> T.Text
{- ^ /@actionName@/: the name of an action in the group -}
-> m ((Bool, Bool, GLib.VariantType.VariantType, GLib.VariantType.VariantType, GVariant, GVariant))
{- ^ __Returns:__ 'True' if the action exists, else 'False' -}
actionGroupQueryAction actionGroup actionName = liftIO $ do
actionGroup' <- unsafeManagedPtrCastPtr actionGroup
actionName' <- textToCString actionName
enabled <- allocMem :: IO (Ptr CInt)
parameterType <- allocMem :: IO (Ptr (Ptr GLib.VariantType.VariantType))
stateType <- allocMem :: IO (Ptr (Ptr GLib.VariantType.VariantType))
stateHint <- allocMem :: IO (Ptr (Ptr GVariant))
state <- allocMem :: IO (Ptr (Ptr GVariant))
result <- g_action_group_query_action actionGroup' actionName' enabled parameterType stateType stateHint state
let result' = (/= 0) result
enabled' <- peek enabled
let enabled'' = (/= 0) enabled'
parameterType' <- peek parameterType
parameterType'' <- (wrapBoxed GLib.VariantType.VariantType) parameterType'
stateType' <- peek stateType
stateType'' <- (wrapBoxed GLib.VariantType.VariantType) stateType'
stateHint' <- peek stateHint
stateHint'' <- B.GVariant.wrapGVariantPtr stateHint'
state' <- peek state
state'' <- B.GVariant.wrapGVariantPtr state'
touchManagedPtr actionGroup
freeMem actionName'
freeMem enabled
freeMem parameterType
freeMem stateType
freeMem stateHint
freeMem state
return (result', enabled'', parameterType'', stateType'', stateHint'', state'')
#if ENABLE_OVERLOADING
data ActionGroupQueryActionMethodInfo
instance (signature ~ (T.Text -> m ((Bool, Bool, GLib.VariantType.VariantType, GLib.VariantType.VariantType, GVariant, GVariant))), MonadIO m, IsActionGroup a) => O.MethodInfo ActionGroupQueryActionMethodInfo a signature where
overloadedMethod _ = actionGroupQueryAction
#endif