module GI.Gio.Interfaces.ActionGroup
(
ActionGroup(..) ,
noActionGroup ,
ActionGroupK ,
toActionGroup ,
actionGroupActionAdded ,
actionGroupActionEnabledChanged ,
actionGroupActionRemoved ,
actionGroupActionStateChanged ,
actionGroupActivateAction ,
actionGroupChangeActionState ,
actionGroupGetActionEnabled ,
actionGroupGetActionParameterType ,
actionGroupGetActionState ,
actionGroupGetActionStateHint ,
actionGroupGetActionStateType ,
actionGroupHasAction ,
actionGroupListActions ,
actionGroupQueryAction ,
ActionGroupActionAddedCallback ,
ActionGroupActionAddedCallbackC ,
ActionGroupActionAddedSignalInfo ,
actionGroupActionAddedCallbackWrapper ,
actionGroupActionAddedClosure ,
afterActionGroupActionAdded ,
mkActionGroupActionAddedCallback ,
noActionGroupActionAddedCallback ,
onActionGroupActionAdded ,
ActionGroupActionEnabledChangedCallback ,
ActionGroupActionEnabledChangedCallbackC,
ActionGroupActionEnabledChangedSignalInfo,
actionGroupActionEnabledChangedCallbackWrapper,
actionGroupActionEnabledChangedClosure ,
afterActionGroupActionEnabledChanged ,
mkActionGroupActionEnabledChangedCallback,
noActionGroupActionEnabledChangedCallback,
onActionGroupActionEnabledChanged ,
ActionGroupActionRemovedCallback ,
ActionGroupActionRemovedCallbackC ,
ActionGroupActionRemovedSignalInfo ,
actionGroupActionRemovedCallbackWrapper ,
actionGroupActionRemovedClosure ,
afterActionGroupActionRemoved ,
mkActionGroupActionRemovedCallback ,
noActionGroupActionRemovedCallback ,
onActionGroupActionRemoved ,
ActionGroupActionStateChangedCallback ,
ActionGroupActionStateChangedCallbackC ,
ActionGroupActionStateChangedSignalInfo ,
actionGroupActionStateChangedCallbackWrapper,
actionGroupActionStateChangedClosure ,
afterActionGroupActionStateChanged ,
mkActionGroupActionStateChangedCallback ,
noActionGroupActionStateChangedCallback ,
onActionGroupActionStateChanged ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.Gio.Types
import GI.Gio.Callbacks
import qualified GI.GLib as GLib
import qualified GI.GObject as GObject
newtype ActionGroup = ActionGroup (ForeignPtr ActionGroup)
noActionGroup :: Maybe ActionGroup
noActionGroup = Nothing
type ActionGroupActionAddedCallback =
T.Text ->
IO ()
noActionGroupActionAddedCallback :: Maybe ActionGroupActionAddedCallback
noActionGroupActionAddedCallback = Nothing
type ActionGroupActionAddedCallbackC =
Ptr () ->
CString ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mkActionGroupActionAddedCallback :: ActionGroupActionAddedCallbackC -> IO (FunPtr ActionGroupActionAddedCallbackC)
actionGroupActionAddedClosure :: ActionGroupActionAddedCallback -> IO Closure
actionGroupActionAddedClosure cb = newCClosure =<< mkActionGroupActionAddedCallback wrapped
where wrapped = actionGroupActionAddedCallbackWrapper cb
actionGroupActionAddedCallbackWrapper ::
ActionGroupActionAddedCallback ->
Ptr () ->
CString ->
Ptr () ->
IO ()
actionGroupActionAddedCallbackWrapper _cb _ action_name _ = do
action_name' <- cstringToText action_name
_cb action_name'
onActionGroupActionAdded :: (GObject a, MonadIO m) => a -> ActionGroupActionAddedCallback -> m SignalHandlerId
onActionGroupActionAdded obj cb = liftIO $ connectActionGroupActionAdded obj cb SignalConnectBefore
afterActionGroupActionAdded :: (GObject a, MonadIO m) => a -> ActionGroupActionAddedCallback -> m SignalHandlerId
afterActionGroupActionAdded obj cb = connectActionGroupActionAdded obj cb SignalConnectAfter
connectActionGroupActionAdded :: (GObject a, MonadIO m) =>
a -> ActionGroupActionAddedCallback -> SignalConnectMode -> m SignalHandlerId
connectActionGroupActionAdded obj cb after = liftIO $ do
cb' <- mkActionGroupActionAddedCallback (actionGroupActionAddedCallbackWrapper cb)
connectSignalFunPtr obj "action-added" cb' after
type ActionGroupActionEnabledChangedCallback =
T.Text ->
Bool ->
IO ()
noActionGroupActionEnabledChangedCallback :: Maybe ActionGroupActionEnabledChangedCallback
noActionGroupActionEnabledChangedCallback = Nothing
type ActionGroupActionEnabledChangedCallbackC =
Ptr () ->
CString ->
CInt ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mkActionGroupActionEnabledChangedCallback :: ActionGroupActionEnabledChangedCallbackC -> IO (FunPtr ActionGroupActionEnabledChangedCallbackC)
actionGroupActionEnabledChangedClosure :: ActionGroupActionEnabledChangedCallback -> IO Closure
actionGroupActionEnabledChangedClosure cb = newCClosure =<< mkActionGroupActionEnabledChangedCallback wrapped
where wrapped = actionGroupActionEnabledChangedCallbackWrapper cb
actionGroupActionEnabledChangedCallbackWrapper ::
ActionGroupActionEnabledChangedCallback ->
Ptr () ->
CString ->
CInt ->
Ptr () ->
IO ()
actionGroupActionEnabledChangedCallbackWrapper _cb _ action_name enabled _ = do
action_name' <- cstringToText action_name
let enabled' = (/= 0) enabled
_cb action_name' enabled'
onActionGroupActionEnabledChanged :: (GObject a, MonadIO m) => a -> ActionGroupActionEnabledChangedCallback -> m SignalHandlerId
onActionGroupActionEnabledChanged obj cb = liftIO $ connectActionGroupActionEnabledChanged obj cb SignalConnectBefore
afterActionGroupActionEnabledChanged :: (GObject a, MonadIO m) => a -> ActionGroupActionEnabledChangedCallback -> m SignalHandlerId
afterActionGroupActionEnabledChanged obj cb = connectActionGroupActionEnabledChanged obj cb SignalConnectAfter
connectActionGroupActionEnabledChanged :: (GObject a, MonadIO m) =>
a -> ActionGroupActionEnabledChangedCallback -> SignalConnectMode -> m SignalHandlerId
connectActionGroupActionEnabledChanged obj cb after = liftIO $ do
cb' <- mkActionGroupActionEnabledChangedCallback (actionGroupActionEnabledChangedCallbackWrapper cb)
connectSignalFunPtr obj "action-enabled-changed" cb' after
type ActionGroupActionRemovedCallback =
T.Text ->
IO ()
noActionGroupActionRemovedCallback :: Maybe ActionGroupActionRemovedCallback
noActionGroupActionRemovedCallback = Nothing
type ActionGroupActionRemovedCallbackC =
Ptr () ->
CString ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mkActionGroupActionRemovedCallback :: ActionGroupActionRemovedCallbackC -> IO (FunPtr ActionGroupActionRemovedCallbackC)
actionGroupActionRemovedClosure :: ActionGroupActionRemovedCallback -> IO Closure
actionGroupActionRemovedClosure cb = newCClosure =<< mkActionGroupActionRemovedCallback wrapped
where wrapped = actionGroupActionRemovedCallbackWrapper cb
actionGroupActionRemovedCallbackWrapper ::
ActionGroupActionRemovedCallback ->
Ptr () ->
CString ->
Ptr () ->
IO ()
actionGroupActionRemovedCallbackWrapper _cb _ action_name _ = do
action_name' <- cstringToText action_name
_cb action_name'
onActionGroupActionRemoved :: (GObject a, MonadIO m) => a -> ActionGroupActionRemovedCallback -> m SignalHandlerId
onActionGroupActionRemoved obj cb = liftIO $ connectActionGroupActionRemoved obj cb SignalConnectBefore
afterActionGroupActionRemoved :: (GObject a, MonadIO m) => a -> ActionGroupActionRemovedCallback -> m SignalHandlerId
afterActionGroupActionRemoved obj cb = connectActionGroupActionRemoved obj cb SignalConnectAfter
connectActionGroupActionRemoved :: (GObject a, MonadIO m) =>
a -> ActionGroupActionRemovedCallback -> SignalConnectMode -> m SignalHandlerId
connectActionGroupActionRemoved obj cb after = liftIO $ do
cb' <- mkActionGroupActionRemovedCallback (actionGroupActionRemovedCallbackWrapper cb)
connectSignalFunPtr obj "action-removed" cb' after
type ActionGroupActionStateChangedCallback =
T.Text ->
GVariant ->
IO ()
noActionGroupActionStateChangedCallback :: Maybe ActionGroupActionStateChangedCallback
noActionGroupActionStateChangedCallback = Nothing
type ActionGroupActionStateChangedCallbackC =
Ptr () ->
CString ->
Ptr GVariant ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mkActionGroupActionStateChangedCallback :: ActionGroupActionStateChangedCallbackC -> IO (FunPtr ActionGroupActionStateChangedCallbackC)
actionGroupActionStateChangedClosure :: ActionGroupActionStateChangedCallback -> IO Closure
actionGroupActionStateChangedClosure cb = newCClosure =<< mkActionGroupActionStateChangedCallback wrapped
where wrapped = actionGroupActionStateChangedCallbackWrapper cb
actionGroupActionStateChangedCallbackWrapper ::
ActionGroupActionStateChangedCallback ->
Ptr () ->
CString ->
Ptr GVariant ->
Ptr () ->
IO ()
actionGroupActionStateChangedCallbackWrapper _cb _ action_name value _ = do
action_name' <- cstringToText action_name
value' <- newGVariantFromPtr value
_cb action_name' value'
onActionGroupActionStateChanged :: (GObject a, MonadIO m) => a -> ActionGroupActionStateChangedCallback -> m SignalHandlerId
onActionGroupActionStateChanged obj cb = liftIO $ connectActionGroupActionStateChanged obj cb SignalConnectBefore
afterActionGroupActionStateChanged :: (GObject a, MonadIO m) => a -> ActionGroupActionStateChangedCallback -> m SignalHandlerId
afterActionGroupActionStateChanged obj cb = connectActionGroupActionStateChanged obj cb SignalConnectAfter
connectActionGroupActionStateChanged :: (GObject a, MonadIO m) =>
a -> ActionGroupActionStateChangedCallback -> SignalConnectMode -> m SignalHandlerId
connectActionGroupActionStateChanged obj cb after = liftIO $ do
cb' <- mkActionGroupActionStateChangedCallback (actionGroupActionStateChangedCallbackWrapper cb)
connectSignalFunPtr obj "action-state-changed" cb' after
type instance AttributeList ActionGroup = ActionGroupAttributeList
type ActionGroupAttributeList = ('[ ] :: [(Symbol, *)])
data ActionGroupActionAddedSignalInfo
instance SignalInfo ActionGroupActionAddedSignalInfo where
type HaskellCallbackType ActionGroupActionAddedSignalInfo = ActionGroupActionAddedCallback
connectSignal _ = connectActionGroupActionAdded
data ActionGroupActionEnabledChangedSignalInfo
instance SignalInfo ActionGroupActionEnabledChangedSignalInfo where
type HaskellCallbackType ActionGroupActionEnabledChangedSignalInfo = ActionGroupActionEnabledChangedCallback
connectSignal _ = connectActionGroupActionEnabledChanged
data ActionGroupActionRemovedSignalInfo
instance SignalInfo ActionGroupActionRemovedSignalInfo where
type HaskellCallbackType ActionGroupActionRemovedSignalInfo = ActionGroupActionRemovedCallback
connectSignal _ = connectActionGroupActionRemoved
data ActionGroupActionStateChangedSignalInfo
instance SignalInfo ActionGroupActionStateChangedSignalInfo where
type HaskellCallbackType ActionGroupActionStateChangedSignalInfo = ActionGroupActionStateChangedCallback
connectSignal _ = connectActionGroupActionStateChanged
type instance SignalList ActionGroup = ActionGroupSignalList
type ActionGroupSignalList = ('[ '("action-added", ActionGroupActionAddedSignalInfo), '("action-enabled-changed", ActionGroupActionEnabledChangedSignalInfo), '("action-removed", ActionGroupActionRemovedSignalInfo), '("action-state-changed", ActionGroupActionStateChangedSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
foreign import ccall "g_action_group_get_type"
c_g_action_group_get_type :: IO GType
type instance ParentTypes ActionGroup = ActionGroupParentTypes
type ActionGroupParentTypes = '[GObject.Object]
instance GObject ActionGroup where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_g_action_group_get_type
class GObject o => ActionGroupK o
instance (GObject o, IsDescendantOf ActionGroup o) => ActionGroupK o
toActionGroup :: ActionGroupK o => o -> IO ActionGroup
toActionGroup = unsafeCastTo ActionGroup
foreign import ccall "g_action_group_action_added" g_action_group_action_added ::
Ptr ActionGroup ->
CString ->
IO ()
actionGroupActionAdded ::
(MonadIO m, ActionGroupK a) =>
a ->
T.Text ->
m ()
actionGroupActionAdded _obj action_name = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
action_name' <- textToCString action_name
g_action_group_action_added _obj' action_name'
touchManagedPtr _obj
freeMem action_name'
return ()
foreign import ccall "g_action_group_action_enabled_changed" g_action_group_action_enabled_changed ::
Ptr ActionGroup ->
CString ->
CInt ->
IO ()
actionGroupActionEnabledChanged ::
(MonadIO m, ActionGroupK a) =>
a ->
T.Text ->
Bool ->
m ()
actionGroupActionEnabledChanged _obj action_name enabled = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
action_name' <- textToCString action_name
let enabled' = (fromIntegral . fromEnum) enabled
g_action_group_action_enabled_changed _obj' action_name' enabled'
touchManagedPtr _obj
freeMem action_name'
return ()
foreign import ccall "g_action_group_action_removed" g_action_group_action_removed ::
Ptr ActionGroup ->
CString ->
IO ()
actionGroupActionRemoved ::
(MonadIO m, ActionGroupK a) =>
a ->
T.Text ->
m ()
actionGroupActionRemoved _obj action_name = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
action_name' <- textToCString action_name
g_action_group_action_removed _obj' action_name'
touchManagedPtr _obj
freeMem action_name'
return ()
foreign import ccall "g_action_group_action_state_changed" g_action_group_action_state_changed ::
Ptr ActionGroup ->
CString ->
Ptr GVariant ->
IO ()
actionGroupActionStateChanged ::
(MonadIO m, ActionGroupK a) =>
a ->
T.Text ->
GVariant ->
m ()
actionGroupActionStateChanged _obj action_name state = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
action_name' <- textToCString action_name
let state' = unsafeManagedPtrGetPtr state
g_action_group_action_state_changed _obj' action_name' state'
touchManagedPtr _obj
freeMem action_name'
return ()
foreign import ccall "g_action_group_activate_action" g_action_group_activate_action ::
Ptr ActionGroup ->
CString ->
Ptr GVariant ->
IO ()
actionGroupActivateAction ::
(MonadIO m, ActionGroupK a) =>
a ->
T.Text ->
Maybe (GVariant) ->
m ()
actionGroupActivateAction _obj action_name parameter = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
action_name' <- textToCString action_name
maybeParameter <- case parameter of
Nothing -> return nullPtr
Just jParameter -> do
let jParameter' = unsafeManagedPtrGetPtr jParameter
return jParameter'
g_action_group_activate_action _obj' action_name' maybeParameter
touchManagedPtr _obj
freeMem action_name'
return ()
foreign import ccall "g_action_group_change_action_state" g_action_group_change_action_state ::
Ptr ActionGroup ->
CString ->
Ptr GVariant ->
IO ()
actionGroupChangeActionState ::
(MonadIO m, ActionGroupK a) =>
a ->
T.Text ->
GVariant ->
m ()
actionGroupChangeActionState _obj action_name value = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
action_name' <- textToCString action_name
let value' = unsafeManagedPtrGetPtr value
g_action_group_change_action_state _obj' action_name' value'
touchManagedPtr _obj
freeMem action_name'
return ()
foreign import ccall "g_action_group_get_action_enabled" g_action_group_get_action_enabled ::
Ptr ActionGroup ->
CString ->
IO CInt
actionGroupGetActionEnabled ::
(MonadIO m, ActionGroupK a) =>
a ->
T.Text ->
m Bool
actionGroupGetActionEnabled _obj action_name = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
action_name' <- textToCString action_name
result <- g_action_group_get_action_enabled _obj' action_name'
let result' = (/= 0) result
touchManagedPtr _obj
freeMem action_name'
return result'
foreign import ccall "g_action_group_get_action_parameter_type" g_action_group_get_action_parameter_type ::
Ptr ActionGroup ->
CString ->
IO (Ptr GLib.VariantType)
actionGroupGetActionParameterType ::
(MonadIO m, ActionGroupK a) =>
a ->
T.Text ->
m GLib.VariantType
actionGroupGetActionParameterType _obj action_name = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
action_name' <- textToCString action_name
result <- g_action_group_get_action_parameter_type _obj' action_name'
checkUnexpectedReturnNULL "g_action_group_get_action_parameter_type" result
result' <- (newBoxed GLib.VariantType) result
touchManagedPtr _obj
freeMem action_name'
return result'
foreign import ccall "g_action_group_get_action_state" g_action_group_get_action_state ::
Ptr ActionGroup ->
CString ->
IO (Ptr GVariant)
actionGroupGetActionState ::
(MonadIO m, ActionGroupK a) =>
a ->
T.Text ->
m GVariant
actionGroupGetActionState _obj action_name = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
action_name' <- textToCString action_name
result <- g_action_group_get_action_state _obj' action_name'
checkUnexpectedReturnNULL "g_action_group_get_action_state" result
result' <- wrapGVariantPtr result
touchManagedPtr _obj
freeMem action_name'
return result'
foreign import ccall "g_action_group_get_action_state_hint" g_action_group_get_action_state_hint ::
Ptr ActionGroup ->
CString ->
IO (Ptr GVariant)
actionGroupGetActionStateHint ::
(MonadIO m, ActionGroupK a) =>
a ->
T.Text ->
m GVariant
actionGroupGetActionStateHint _obj action_name = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
action_name' <- textToCString action_name
result <- g_action_group_get_action_state_hint _obj' action_name'
checkUnexpectedReturnNULL "g_action_group_get_action_state_hint" result
result' <- wrapGVariantPtr result
touchManagedPtr _obj
freeMem action_name'
return result'
foreign import ccall "g_action_group_get_action_state_type" g_action_group_get_action_state_type ::
Ptr ActionGroup ->
CString ->
IO (Ptr GLib.VariantType)
actionGroupGetActionStateType ::
(MonadIO m, ActionGroupK a) =>
a ->
T.Text ->
m GLib.VariantType
actionGroupGetActionStateType _obj action_name = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
action_name' <- textToCString action_name
result <- g_action_group_get_action_state_type _obj' action_name'
checkUnexpectedReturnNULL "g_action_group_get_action_state_type" result
result' <- (wrapBoxed GLib.VariantType) result
touchManagedPtr _obj
freeMem action_name'
return result'
foreign import ccall "g_action_group_has_action" g_action_group_has_action ::
Ptr ActionGroup ->
CString ->
IO CInt
actionGroupHasAction ::
(MonadIO m, ActionGroupK a) =>
a ->
T.Text ->
m Bool
actionGroupHasAction _obj action_name = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
action_name' <- textToCString action_name
result <- g_action_group_has_action _obj' action_name'
let result' = (/= 0) result
touchManagedPtr _obj
freeMem action_name'
return result'
foreign import ccall "g_action_group_list_actions" g_action_group_list_actions ::
Ptr ActionGroup ->
IO (Ptr CString)
actionGroupListActions ::
(MonadIO m, ActionGroupK a) =>
a ->
m [T.Text]
actionGroupListActions _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_action_group_list_actions _obj'
checkUnexpectedReturnNULL "g_action_group_list_actions" result
result' <- unpackZeroTerminatedUTF8CArray result
mapZeroTerminatedCArray freeMem result
freeMem result
touchManagedPtr _obj
return result'
foreign import ccall "g_action_group_query_action" g_action_group_query_action ::
Ptr ActionGroup ->
CString ->
Ptr CInt ->
Ptr (Ptr GLib.VariantType) ->
Ptr (Ptr GLib.VariantType) ->
Ptr (Ptr GVariant) ->
Ptr (Ptr GVariant) ->
IO CInt
actionGroupQueryAction ::
(MonadIO m, ActionGroupK a) =>
a ->
T.Text ->
m (Bool,Bool,GLib.VariantType,GLib.VariantType,GVariant,GVariant)
actionGroupQueryAction _obj action_name = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
action_name' <- textToCString action_name
enabled <- allocMem :: IO (Ptr CInt)
parameter_type <- allocMem :: IO (Ptr (Ptr GLib.VariantType))
state_type <- allocMem :: IO (Ptr (Ptr GLib.VariantType))
state_hint <- allocMem :: IO (Ptr (Ptr GVariant))
state <- allocMem :: IO (Ptr (Ptr GVariant))
result <- g_action_group_query_action _obj' action_name' enabled parameter_type state_type state_hint state
let result' = (/= 0) result
enabled' <- peek enabled
let enabled'' = (/= 0) enabled'
parameter_type' <- peek parameter_type
parameter_type'' <- (wrapBoxed GLib.VariantType) parameter_type'
state_type' <- peek state_type
state_type'' <- (wrapBoxed GLib.VariantType) state_type'
state_hint' <- peek state_hint
state_hint'' <- wrapGVariantPtr state_hint'
state' <- peek state
state'' <- wrapGVariantPtr state'
touchManagedPtr _obj
freeMem action_name'
freeMem enabled
freeMem parameter_type
freeMem state_type
freeMem state_hint
freeMem state
return (result', enabled'', parameter_type'', state_type'', state_hint'', state'')