module GI.Gio.Interfaces.Action
(
Action(..) ,
noAction ,
IsAction ,
toAction ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
ActionActivateMethodInfo ,
#endif
actionActivate ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
ActionChangeStateMethodInfo ,
#endif
actionChangeState ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
ActionGetEnabledMethodInfo ,
#endif
actionGetEnabled ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
ActionGetNameMethodInfo ,
#endif
actionGetName ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
ActionGetParameterTypeMethodInfo ,
#endif
actionGetParameterType ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
ActionGetStateMethodInfo ,
#endif
actionGetState ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
ActionGetStateHintMethodInfo ,
#endif
actionGetStateHint ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
ActionGetStateTypeMethodInfo ,
#endif
actionGetStateType ,
actionNameIsValid ,
actionParseDetailedName ,
actionPrintDetailedName ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
ActionEnabledPropertyInfo ,
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
actionEnabled ,
#endif
getActionEnabled ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
ActionNamePropertyInfo ,
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
actionName ,
#endif
getActionName ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
ActionParameterTypePropertyInfo ,
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
actionParameterType ,
#endif
getActionParameterType ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
ActionStatePropertyInfo ,
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
actionState ,
#endif
getActionState ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
ActionStateTypePropertyInfo ,
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
actionStateType ,
#endif
getActionStateType ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GI.GLib.Structs.VariantType as GLib.VariantType
import qualified GI.GObject.Objects.Object as GObject.Object
newtype Action = Action (ManagedPtr Action)
noAction :: Maybe Action
noAction = Nothing
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type instance O.SignalList Action = ActionSignalList
type ActionSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_action_get_type"
c_g_action_get_type :: IO GType
instance GObject Action where
gobjectType _ = c_g_action_get_type
class GObject o => IsAction o
#if MIN_VERSION_base(4,9,0)
instance (GObject a, O.UnknownAncestorError Action a) =>
IsAction a
#endif
instance IsAction Action
instance GObject.Object.IsObject Action
toAction :: (MonadIO m, IsAction o) => o -> m Action
toAction = liftIO . unsafeCastTo Action
getActionEnabled :: (MonadIO m, IsAction o) => o -> m Bool
getActionEnabled obj = liftIO $ getObjectPropertyBool obj "enabled"
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ActionEnabledPropertyInfo
instance AttrInfo ActionEnabledPropertyInfo where
type AttrAllowedOps ActionEnabledPropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint ActionEnabledPropertyInfo = (~) ()
type AttrBaseTypeConstraint ActionEnabledPropertyInfo = IsAction
type AttrGetType ActionEnabledPropertyInfo = Bool
type AttrLabel ActionEnabledPropertyInfo = "enabled"
type AttrOrigin ActionEnabledPropertyInfo = Action
attrGet _ = getActionEnabled
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
getActionName :: (MonadIO m, IsAction o) => o -> m T.Text
getActionName obj = liftIO $ checkUnexpectedNothing "getActionName" $ getObjectPropertyString obj "name"
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ActionNamePropertyInfo
instance AttrInfo ActionNamePropertyInfo where
type AttrAllowedOps ActionNamePropertyInfo = '[ 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint ActionNamePropertyInfo = (~) ()
type AttrBaseTypeConstraint ActionNamePropertyInfo = IsAction
type AttrGetType ActionNamePropertyInfo = T.Text
type AttrLabel ActionNamePropertyInfo = "name"
type AttrOrigin ActionNamePropertyInfo = Action
attrGet _ = getActionName
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
getActionParameterType :: (MonadIO m, IsAction o) => o -> m (Maybe GLib.VariantType.VariantType)
getActionParameterType obj = liftIO $ getObjectPropertyBoxed obj "parameter-type" GLib.VariantType.VariantType
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ActionParameterTypePropertyInfo
instance AttrInfo ActionParameterTypePropertyInfo where
type AttrAllowedOps ActionParameterTypePropertyInfo = '[ 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint ActionParameterTypePropertyInfo = (~) ()
type AttrBaseTypeConstraint ActionParameterTypePropertyInfo = IsAction
type AttrGetType ActionParameterTypePropertyInfo = (Maybe GLib.VariantType.VariantType)
type AttrLabel ActionParameterTypePropertyInfo = "parameter-type"
type AttrOrigin ActionParameterTypePropertyInfo = Action
attrGet _ = getActionParameterType
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
getActionState :: (MonadIO m, IsAction o) => o -> m (Maybe GVariant)
getActionState obj = liftIO $ getObjectPropertyVariant obj "state"
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ActionStatePropertyInfo
instance AttrInfo ActionStatePropertyInfo where
type AttrAllowedOps ActionStatePropertyInfo = '[ 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint ActionStatePropertyInfo = (~) ()
type AttrBaseTypeConstraint ActionStatePropertyInfo = IsAction
type AttrGetType ActionStatePropertyInfo = (Maybe GVariant)
type AttrLabel ActionStatePropertyInfo = "state"
type AttrOrigin ActionStatePropertyInfo = Action
attrGet _ = getActionState
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
getActionStateType :: (MonadIO m, IsAction o) => o -> m (Maybe GLib.VariantType.VariantType)
getActionStateType obj = liftIO $ getObjectPropertyBoxed obj "state-type" GLib.VariantType.VariantType
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ActionStateTypePropertyInfo
instance AttrInfo ActionStateTypePropertyInfo where
type AttrAllowedOps ActionStateTypePropertyInfo = '[ 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint ActionStateTypePropertyInfo = (~) ()
type AttrBaseTypeConstraint ActionStateTypePropertyInfo = IsAction
type AttrGetType ActionStateTypePropertyInfo = (Maybe GLib.VariantType.VariantType)
type AttrLabel ActionStateTypePropertyInfo = "state-type"
type AttrOrigin ActionStateTypePropertyInfo = Action
attrGet _ = getActionStateType
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
instance O.HasAttributeList Action
type instance O.AttributeList Action = ActionAttributeList
type ActionAttributeList = ('[ '("enabled", ActionEnabledPropertyInfo), '("name", ActionNamePropertyInfo), '("parameterType", ActionParameterTypePropertyInfo), '("state", ActionStatePropertyInfo), '("stateType", ActionStateTypePropertyInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
actionEnabled :: AttrLabelProxy "enabled"
actionEnabled = AttrLabelProxy
actionName :: AttrLabelProxy "name"
actionName = AttrLabelProxy
actionParameterType :: AttrLabelProxy "parameterType"
actionParameterType = AttrLabelProxy
actionState :: AttrLabelProxy "state"
actionState = AttrLabelProxy
actionStateType :: AttrLabelProxy "stateType"
actionStateType = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type family ResolveActionMethod (t :: Symbol) (o :: *) :: * where
ResolveActionMethod "activate" o = ActionActivateMethodInfo
ResolveActionMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveActionMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveActionMethod "changeState" o = ActionChangeStateMethodInfo
ResolveActionMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveActionMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveActionMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveActionMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveActionMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveActionMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveActionMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveActionMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
ResolveActionMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
ResolveActionMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveActionMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveActionMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveActionMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveActionMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveActionMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveActionMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveActionMethod "getEnabled" o = ActionGetEnabledMethodInfo
ResolveActionMethod "getName" o = ActionGetNameMethodInfo
ResolveActionMethod "getParameterType" o = ActionGetParameterTypeMethodInfo
ResolveActionMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveActionMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveActionMethod "getState" o = ActionGetStateMethodInfo
ResolveActionMethod "getStateHint" o = ActionGetStateHintMethodInfo
ResolveActionMethod "getStateType" o = ActionGetStateTypeMethodInfo
ResolveActionMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveActionMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveActionMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveActionMethod t Action, O.MethodInfo info Action p) => O.IsLabelProxy t (Action -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveActionMethod t Action, O.MethodInfo info Action p) => O.IsLabel t (Action -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
#endif
foreign import ccall "g_action_activate" g_action_activate ::
Ptr Action ->
Ptr GVariant ->
IO ()
actionActivate ::
(B.CallStack.HasCallStack, MonadIO m, IsAction a) =>
a
-> Maybe (GVariant)
-> m ()
actionActivate action parameter = liftIO $ do
action' <- unsafeManagedPtrCastPtr action
maybeParameter <- case parameter of
Nothing -> return nullPtr
Just jParameter -> do
jParameter' <- unsafeManagedPtrGetPtr jParameter
return jParameter'
g_action_activate action' maybeParameter
touchManagedPtr action
whenJust parameter touchManagedPtr
return ()
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ActionActivateMethodInfo
instance (signature ~ (Maybe (GVariant) -> m ()), MonadIO m, IsAction a) => O.MethodInfo ActionActivateMethodInfo a signature where
overloadedMethod _ = actionActivate
#endif
foreign import ccall "g_action_change_state" g_action_change_state ::
Ptr Action ->
Ptr GVariant ->
IO ()
actionChangeState ::
(B.CallStack.HasCallStack, MonadIO m, IsAction a) =>
a
-> GVariant
-> m ()
actionChangeState action value = liftIO $ do
action' <- unsafeManagedPtrCastPtr action
value' <- unsafeManagedPtrGetPtr value
g_action_change_state action' value'
touchManagedPtr action
touchManagedPtr value
return ()
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ActionChangeStateMethodInfo
instance (signature ~ (GVariant -> m ()), MonadIO m, IsAction a) => O.MethodInfo ActionChangeStateMethodInfo a signature where
overloadedMethod _ = actionChangeState
#endif
foreign import ccall "g_action_get_enabled" g_action_get_enabled ::
Ptr Action ->
IO CInt
actionGetEnabled ::
(B.CallStack.HasCallStack, MonadIO m, IsAction a) =>
a
-> m Bool
actionGetEnabled action = liftIO $ do
action' <- unsafeManagedPtrCastPtr action
result <- g_action_get_enabled action'
let result' = (/= 0) result
touchManagedPtr action
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ActionGetEnabledMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsAction a) => O.MethodInfo ActionGetEnabledMethodInfo a signature where
overloadedMethod _ = actionGetEnabled
#endif
foreign import ccall "g_action_get_name" g_action_get_name ::
Ptr Action ->
IO CString
actionGetName ::
(B.CallStack.HasCallStack, MonadIO m, IsAction a) =>
a
-> m T.Text
actionGetName action = liftIO $ do
action' <- unsafeManagedPtrCastPtr action
result <- g_action_get_name action'
checkUnexpectedReturnNULL "actionGetName" result
result' <- cstringToText result
touchManagedPtr action
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ActionGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsAction a) => O.MethodInfo ActionGetNameMethodInfo a signature where
overloadedMethod _ = actionGetName
#endif
foreign import ccall "g_action_get_parameter_type" g_action_get_parameter_type ::
Ptr Action ->
IO (Ptr GLib.VariantType.VariantType)
actionGetParameterType ::
(B.CallStack.HasCallStack, MonadIO m, IsAction a) =>
a
-> m (Maybe GLib.VariantType.VariantType)
actionGetParameterType action = liftIO $ do
action' <- unsafeManagedPtrCastPtr action
result <- g_action_get_parameter_type action'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newBoxed GLib.VariantType.VariantType) result'
return result''
touchManagedPtr action
return maybeResult
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ActionGetParameterTypeMethodInfo
instance (signature ~ (m (Maybe GLib.VariantType.VariantType)), MonadIO m, IsAction a) => O.MethodInfo ActionGetParameterTypeMethodInfo a signature where
overloadedMethod _ = actionGetParameterType
#endif
foreign import ccall "g_action_get_state" g_action_get_state ::
Ptr Action ->
IO (Ptr GVariant)
actionGetState ::
(B.CallStack.HasCallStack, MonadIO m, IsAction a) =>
a
-> m GVariant
actionGetState action = liftIO $ do
action' <- unsafeManagedPtrCastPtr action
result <- g_action_get_state action'
checkUnexpectedReturnNULL "actionGetState" result
result' <- wrapGVariantPtr result
touchManagedPtr action
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ActionGetStateMethodInfo
instance (signature ~ (m GVariant), MonadIO m, IsAction a) => O.MethodInfo ActionGetStateMethodInfo a signature where
overloadedMethod _ = actionGetState
#endif
foreign import ccall "g_action_get_state_hint" g_action_get_state_hint ::
Ptr Action ->
IO (Ptr GVariant)
actionGetStateHint ::
(B.CallStack.HasCallStack, MonadIO m, IsAction a) =>
a
-> m (Maybe GVariant)
actionGetStateHint action = liftIO $ do
action' <- unsafeManagedPtrCastPtr action
result <- g_action_get_state_hint action'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- wrapGVariantPtr result'
return result''
touchManagedPtr action
return maybeResult
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ActionGetStateHintMethodInfo
instance (signature ~ (m (Maybe GVariant)), MonadIO m, IsAction a) => O.MethodInfo ActionGetStateHintMethodInfo a signature where
overloadedMethod _ = actionGetStateHint
#endif
foreign import ccall "g_action_get_state_type" g_action_get_state_type ::
Ptr Action ->
IO (Ptr GLib.VariantType.VariantType)
actionGetStateType ::
(B.CallStack.HasCallStack, MonadIO m, IsAction a) =>
a
-> m (Maybe GLib.VariantType.VariantType)
actionGetStateType action = liftIO $ do
action' <- unsafeManagedPtrCastPtr action
result <- g_action_get_state_type action'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newBoxed GLib.VariantType.VariantType) result'
return result''
touchManagedPtr action
return maybeResult
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ActionGetStateTypeMethodInfo
instance (signature ~ (m (Maybe GLib.VariantType.VariantType)), MonadIO m, IsAction a) => O.MethodInfo ActionGetStateTypeMethodInfo a signature where
overloadedMethod _ = actionGetStateType
#endif
foreign import ccall "g_action_name_is_valid" g_action_name_is_valid ::
CString ->
IO CInt
actionNameIsValid ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m Bool
actionNameIsValid actionName = liftIO $ do
actionName' <- textToCString actionName
result <- g_action_name_is_valid actionName'
let result' = (/= 0) result
freeMem actionName'
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif
foreign import ccall "g_action_parse_detailed_name" g_action_parse_detailed_name ::
CString ->
Ptr CString ->
Ptr (Ptr GVariant) ->
Ptr (Ptr GError) ->
IO CInt
actionParseDetailedName ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m ((T.Text, GVariant))
actionParseDetailedName detailedName = liftIO $ do
detailedName' <- textToCString detailedName
actionName <- allocMem :: IO (Ptr CString)
targetValue <- allocMem :: IO (Ptr (Ptr GVariant))
onException (do
_ <- propagateGError $ g_action_parse_detailed_name detailedName' actionName targetValue
actionName' <- peek actionName
actionName'' <- cstringToText actionName'
freeMem actionName'
targetValue' <- peek targetValue
targetValue'' <- wrapGVariantPtr targetValue'
freeMem detailedName'
freeMem actionName
freeMem targetValue
return (actionName'', targetValue'')
) (do
freeMem detailedName'
freeMem actionName
freeMem targetValue
)
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif
foreign import ccall "g_action_print_detailed_name" g_action_print_detailed_name ::
CString ->
Ptr GVariant ->
IO CString
actionPrintDetailedName ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> Maybe (GVariant)
-> m T.Text
actionPrintDetailedName actionName targetValue = liftIO $ do
actionName' <- textToCString actionName
maybeTargetValue <- case targetValue of
Nothing -> return nullPtr
Just jTargetValue -> do
jTargetValue' <- unsafeManagedPtrGetPtr jTargetValue
return jTargetValue'
result <- g_action_print_detailed_name actionName' maybeTargetValue
checkUnexpectedReturnNULL "actionPrintDetailedName" result
result' <- cstringToText result
freeMem result
whenJust targetValue touchManagedPtr
freeMem actionName'
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif