{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.Gio.Interfaces.RemoteActionGroup
    ( 

-- * Exported types
    RemoteActionGroup(..)                   ,
    noRemoteActionGroup                     ,
    RemoteActionGroupK                      ,
    toRemoteActionGroup                     ,


 -- * Methods
-- ** remoteActionGroupActivateActionFull
    remoteActionGroupActivateActionFull     ,


-- ** remoteActionGroupChangeActionStateFull
    remoteActionGroupChangeActionStateFull  ,




    ) 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.GObject as GObject

-- interface RemoteActionGroup 

newtype RemoteActionGroup = RemoteActionGroup (ForeignPtr RemoteActionGroup)
noRemoteActionGroup :: Maybe RemoteActionGroup
noRemoteActionGroup = Nothing

type instance AttributeList RemoteActionGroup = RemoteActionGroupAttributeList
type RemoteActionGroupAttributeList = ('[ ] :: [(Symbol, *)])

type instance SignalList RemoteActionGroup = RemoteActionGroupSignalList
type RemoteActionGroupSignalList = ('[ '("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_remote_action_group_get_type"
    c_g_remote_action_group_get_type :: IO GType

type instance ParentTypes RemoteActionGroup = RemoteActionGroupParentTypes
type RemoteActionGroupParentTypes = '[ActionGroup, GObject.Object]

instance GObject RemoteActionGroup where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_remote_action_group_get_type
    

class GObject o => RemoteActionGroupK o
instance (GObject o, IsDescendantOf RemoteActionGroup o) => RemoteActionGroupK o

toRemoteActionGroup :: RemoteActionGroupK o => o -> IO RemoteActionGroup
toRemoteActionGroup = unsafeCastTo RemoteActionGroup

-- method RemoteActionGroup::activate_action_full
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "RemoteActionGroup", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "parameter", argType = TVariant, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "platform_data", argType = TVariant, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "RemoteActionGroup", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "parameter", argType = TVariant, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "platform_data", argType = TVariant, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_remote_action_group_activate_action_full" g_remote_action_group_activate_action_full :: 
    Ptr RemoteActionGroup ->                -- _obj : TInterface "Gio" "RemoteActionGroup"
    CString ->                              -- action_name : TBasicType TUTF8
    Ptr GVariant ->                         -- parameter : TVariant
    Ptr GVariant ->                         -- platform_data : TVariant
    IO ()


remoteActionGroupActivateActionFull ::
    (MonadIO m, RemoteActionGroupK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- action_name
    Maybe (GVariant) ->                     -- parameter
    GVariant ->                             -- platform_data
    m ()
remoteActionGroupActivateActionFull _obj action_name parameter platform_data = 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'
    let platform_data' = unsafeManagedPtrGetPtr platform_data
    g_remote_action_group_activate_action_full _obj' action_name' maybeParameter platform_data'
    touchManagedPtr _obj
    freeMem action_name'
    return ()

-- method RemoteActionGroup::change_action_state_full
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "RemoteActionGroup", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TVariant, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "platform_data", argType = TVariant, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "RemoteActionGroup", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TVariant, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "platform_data", argType = TVariant, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_remote_action_group_change_action_state_full" g_remote_action_group_change_action_state_full :: 
    Ptr RemoteActionGroup ->                -- _obj : TInterface "Gio" "RemoteActionGroup"
    CString ->                              -- action_name : TBasicType TUTF8
    Ptr GVariant ->                         -- value : TVariant
    Ptr GVariant ->                         -- platform_data : TVariant
    IO ()


remoteActionGroupChangeActionStateFull ::
    (MonadIO m, RemoteActionGroupK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- action_name
    GVariant ->                             -- value
    GVariant ->                             -- platform_data
    m ()
remoteActionGroupChangeActionStateFull _obj action_name value platform_data = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    action_name' <- textToCString action_name
    let value' = unsafeManagedPtrGetPtr value
    let platform_data' = unsafeManagedPtrGetPtr platform_data
    g_remote_action_group_change_action_state_full _obj' action_name' value' platform_data'
    touchManagedPtr _obj
    freeMem action_name'
    return ()