module GI.Gio.Interfaces.Action
(
Action(..) ,
noAction ,
ActionK ,
toAction ,
actionActivate ,
actionChangeState ,
actionGetEnabled ,
actionGetName ,
actionGetParameterType ,
actionGetState ,
actionGetStateHint ,
actionGetStateType ,
ActionEnabledPropertyInfo ,
getActionEnabled ,
ActionNamePropertyInfo ,
getActionName ,
ActionParameterTypePropertyInfo ,
getActionParameterType ,
ActionStatePropertyInfo ,
getActionState ,
ActionStateTypePropertyInfo ,
getActionStateType ,
) 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 Action = Action (ForeignPtr Action)
noAction :: Maybe Action
noAction = Nothing
getActionEnabled :: (MonadIO m, ActionK o) => o -> m Bool
getActionEnabled obj = liftIO $ getObjectPropertyBool obj "enabled"
data ActionEnabledPropertyInfo
instance AttrInfo ActionEnabledPropertyInfo where
type AttrAllowedOps ActionEnabledPropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint ActionEnabledPropertyInfo = (~) ()
type AttrBaseTypeConstraint ActionEnabledPropertyInfo = ActionK
type AttrGetType ActionEnabledPropertyInfo = Bool
type AttrLabel ActionEnabledPropertyInfo = "Action::enabled"
attrGet _ = getActionEnabled
attrSet _ = undefined
attrConstruct _ = undefined
getActionName :: (MonadIO m, ActionK o) => o -> m T.Text
getActionName obj = liftIO $ getObjectPropertyString obj "name"
data ActionNamePropertyInfo
instance AttrInfo ActionNamePropertyInfo where
type AttrAllowedOps ActionNamePropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint ActionNamePropertyInfo = (~) ()
type AttrBaseTypeConstraint ActionNamePropertyInfo = ActionK
type AttrGetType ActionNamePropertyInfo = T.Text
type AttrLabel ActionNamePropertyInfo = "Action::name"
attrGet _ = getActionName
attrSet _ = undefined
attrConstruct _ = undefined
getActionParameterType :: (MonadIO m, ActionK o) => o -> m GLib.VariantType
getActionParameterType obj = liftIO $ getObjectPropertyBoxed obj "parameter-type" GLib.VariantType
data ActionParameterTypePropertyInfo
instance AttrInfo ActionParameterTypePropertyInfo where
type AttrAllowedOps ActionParameterTypePropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint ActionParameterTypePropertyInfo = (~) ()
type AttrBaseTypeConstraint ActionParameterTypePropertyInfo = ActionK
type AttrGetType ActionParameterTypePropertyInfo = GLib.VariantType
type AttrLabel ActionParameterTypePropertyInfo = "Action::parameter-type"
attrGet _ = getActionParameterType
attrSet _ = undefined
attrConstruct _ = undefined
getActionState :: (MonadIO m, ActionK o) => o -> m GVariant
getActionState obj = liftIO $ getObjectPropertyVariant obj "state"
data ActionStatePropertyInfo
instance AttrInfo ActionStatePropertyInfo where
type AttrAllowedOps ActionStatePropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint ActionStatePropertyInfo = (~) ()
type AttrBaseTypeConstraint ActionStatePropertyInfo = ActionK
type AttrGetType ActionStatePropertyInfo = GVariant
type AttrLabel ActionStatePropertyInfo = "Action::state"
attrGet _ = getActionState
attrSet _ = undefined
attrConstruct _ = undefined
getActionStateType :: (MonadIO m, ActionK o) => o -> m GLib.VariantType
getActionStateType obj = liftIO $ getObjectPropertyBoxed obj "state-type" GLib.VariantType
data ActionStateTypePropertyInfo
instance AttrInfo ActionStateTypePropertyInfo where
type AttrAllowedOps ActionStateTypePropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint ActionStateTypePropertyInfo = (~) ()
type AttrBaseTypeConstraint ActionStateTypePropertyInfo = ActionK
type AttrGetType ActionStateTypePropertyInfo = GLib.VariantType
type AttrLabel ActionStateTypePropertyInfo = "Action::state-type"
attrGet _ = getActionStateType
attrSet _ = undefined
attrConstruct _ = undefined
type instance AttributeList Action = ActionAttributeList
type ActionAttributeList = ('[ '("enabled", ActionEnabledPropertyInfo), '("name", ActionNamePropertyInfo), '("parameter-type", ActionParameterTypePropertyInfo), '("state", ActionStatePropertyInfo), '("state-type", ActionStateTypePropertyInfo)] :: [(Symbol, *)])
type instance SignalList Action = ActionSignalList
type ActionSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
foreign import ccall "g_action_get_type"
c_g_action_get_type :: IO GType
type instance ParentTypes Action = ActionParentTypes
type ActionParentTypes = '[GObject.Object]
instance GObject Action where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_g_action_get_type
class GObject o => ActionK o
instance (GObject o, IsDescendantOf Action o) => ActionK o
toAction :: ActionK o => o -> IO Action
toAction = unsafeCastTo Action
foreign import ccall "g_action_activate" g_action_activate ::
Ptr Action ->
Ptr GVariant ->
IO ()
actionActivate ::
(MonadIO m, ActionK a) =>
a ->
Maybe (GVariant) ->
m ()
actionActivate _obj parameter = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
maybeParameter <- case parameter of
Nothing -> return nullPtr
Just jParameter -> do
let jParameter' = unsafeManagedPtrGetPtr jParameter
return jParameter'
g_action_activate _obj' maybeParameter
touchManagedPtr _obj
return ()
foreign import ccall "g_action_change_state" g_action_change_state ::
Ptr Action ->
Ptr GVariant ->
IO ()
actionChangeState ::
(MonadIO m, ActionK a) =>
a ->
GVariant ->
m ()
actionChangeState _obj value = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let value' = unsafeManagedPtrGetPtr value
g_action_change_state _obj' value'
touchManagedPtr _obj
return ()
foreign import ccall "g_action_get_enabled" g_action_get_enabled ::
Ptr Action ->
IO CInt
actionGetEnabled ::
(MonadIO m, ActionK a) =>
a ->
m Bool
actionGetEnabled _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_action_get_enabled _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
foreign import ccall "g_action_get_name" g_action_get_name ::
Ptr Action ->
IO CString
actionGetName ::
(MonadIO m, ActionK a) =>
a ->
m T.Text
actionGetName _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_action_get_name _obj'
checkUnexpectedReturnNULL "g_action_get_name" result
result' <- cstringToText result
touchManagedPtr _obj
return result'
foreign import ccall "g_action_get_parameter_type" g_action_get_parameter_type ::
Ptr Action ->
IO (Ptr GLib.VariantType)
actionGetParameterType ::
(MonadIO m, ActionK a) =>
a ->
m GLib.VariantType
actionGetParameterType _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_action_get_parameter_type _obj'
checkUnexpectedReturnNULL "g_action_get_parameter_type" result
result' <- (newBoxed GLib.VariantType) result
touchManagedPtr _obj
return result'
foreign import ccall "g_action_get_state" g_action_get_state ::
Ptr Action ->
IO (Ptr GVariant)
actionGetState ::
(MonadIO m, ActionK a) =>
a ->
m GVariant
actionGetState _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_action_get_state _obj'
checkUnexpectedReturnNULL "g_action_get_state" result
result' <- wrapGVariantPtr result
touchManagedPtr _obj
return result'
foreign import ccall "g_action_get_state_hint" g_action_get_state_hint ::
Ptr Action ->
IO (Ptr GVariant)
actionGetStateHint ::
(MonadIO m, ActionK a) =>
a ->
m GVariant
actionGetStateHint _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_action_get_state_hint _obj'
checkUnexpectedReturnNULL "g_action_get_state_hint" result
result' <- wrapGVariantPtr result
touchManagedPtr _obj
return result'
foreign import ccall "g_action_get_state_type" g_action_get_state_type ::
Ptr Action ->
IO (Ptr GLib.VariantType)
actionGetStateType ::
(MonadIO m, ActionK a) =>
a ->
m GLib.VariantType
actionGetStateType _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_action_get_state_type _obj'
checkUnexpectedReturnNULL "g_action_get_state_type" result
result' <- (newBoxed GLib.VariantType) result
touchManagedPtr _obj
return result'