{- |
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.Gtk.Objects.RecentAction
    ( 

-- * Exported types
    RecentAction(..)                        ,
    RecentActionK                           ,
    toRecentAction                          ,
    noRecentAction                          ,


 -- * Methods
-- ** recentActionGetShowNumbers
    recentActionGetShowNumbers              ,


-- ** recentActionNew
    recentActionNew                         ,


-- ** recentActionNewForManager
    recentActionNewForManager               ,


-- ** recentActionSetShowNumbers
    recentActionSetShowNumbers              ,




 -- * Properties
-- ** ShowNumbers
    RecentActionShowNumbersPropertyInfo     ,
    constructRecentActionShowNumbers        ,
    getRecentActionShowNumbers              ,
    setRecentActionShowNumbers              ,




    ) 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.Gtk.Types
import GI.Gtk.Callbacks
import qualified GI.GObject as GObject

newtype RecentAction = RecentAction (ForeignPtr RecentAction)
foreign import ccall "gtk_recent_action_get_type"
    c_gtk_recent_action_get_type :: IO GType

type instance ParentTypes RecentAction = RecentActionParentTypes
type RecentActionParentTypes = '[Action, GObject.Object, Buildable, RecentChooser]

instance GObject RecentAction where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_gtk_recent_action_get_type
    

class GObject o => RecentActionK o
instance (GObject o, IsDescendantOf RecentAction o) => RecentActionK o

toRecentAction :: RecentActionK o => o -> IO RecentAction
toRecentAction = unsafeCastTo RecentAction

noRecentAction :: Maybe RecentAction
noRecentAction = Nothing

-- VVV Prop "show-numbers"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]

getRecentActionShowNumbers :: (MonadIO m, RecentActionK o) => o -> m Bool
getRecentActionShowNumbers obj = liftIO $ getObjectPropertyBool obj "show-numbers"

setRecentActionShowNumbers :: (MonadIO m, RecentActionK o) => o -> Bool -> m ()
setRecentActionShowNumbers obj val = liftIO $ setObjectPropertyBool obj "show-numbers" val

constructRecentActionShowNumbers :: Bool -> IO ([Char], GValue)
constructRecentActionShowNumbers val = constructObjectPropertyBool "show-numbers" val

data RecentActionShowNumbersPropertyInfo
instance AttrInfo RecentActionShowNumbersPropertyInfo where
    type AttrAllowedOps RecentActionShowNumbersPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint RecentActionShowNumbersPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint RecentActionShowNumbersPropertyInfo = RecentActionK
    type AttrGetType RecentActionShowNumbersPropertyInfo = Bool
    type AttrLabel RecentActionShowNumbersPropertyInfo = "RecentAction::show-numbers"
    attrGet _ = getRecentActionShowNumbers
    attrSet _ = setRecentActionShowNumbers
    attrConstruct _ = constructRecentActionShowNumbers

type instance AttributeList RecentAction = RecentActionAttributeList
type RecentActionAttributeList = ('[ '("action-group", ActionActionGroupPropertyInfo), '("always-show-image", ActionAlwaysShowImagePropertyInfo), '("filter", RecentChooserFilterPropertyInfo), '("gicon", ActionGiconPropertyInfo), '("hide-if-empty", ActionHideIfEmptyPropertyInfo), '("icon-name", ActionIconNamePropertyInfo), '("is-important", ActionIsImportantPropertyInfo), '("label", ActionLabelPropertyInfo), '("limit", RecentChooserLimitPropertyInfo), '("local-only", RecentChooserLocalOnlyPropertyInfo), '("name", ActionNamePropertyInfo), '("recent-manager", RecentChooserRecentManagerPropertyInfo), '("select-multiple", RecentChooserSelectMultiplePropertyInfo), '("sensitive", ActionSensitivePropertyInfo), '("short-label", ActionShortLabelPropertyInfo), '("show-icons", RecentChooserShowIconsPropertyInfo), '("show-not-found", RecentChooserShowNotFoundPropertyInfo), '("show-numbers", RecentActionShowNumbersPropertyInfo), '("show-private", RecentChooserShowPrivatePropertyInfo), '("show-tips", RecentChooserShowTipsPropertyInfo), '("sort-type", RecentChooserSortTypePropertyInfo), '("stock-id", ActionStockIdPropertyInfo), '("tooltip", ActionTooltipPropertyInfo), '("visible", ActionVisiblePropertyInfo), '("visible-horizontal", ActionVisibleHorizontalPropertyInfo), '("visible-overflown", ActionVisibleOverflownPropertyInfo), '("visible-vertical", ActionVisibleVerticalPropertyInfo)] :: [(Symbol, *)])

type instance SignalList RecentAction = RecentActionSignalList
type RecentActionSignalList = ('[ '("activate", ActionActivateSignalInfo), '("item-activated", RecentChooserItemActivatedSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("selection-changed", RecentChooserSelectionChangedSignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method RecentAction::new
-- method type : Constructor
-- Args : [Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "tooltip", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "stock_id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "tooltip", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "stock_id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "RecentAction"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_recent_action_new" gtk_recent_action_new :: 
    CString ->                              -- name : TBasicType TUTF8
    CString ->                              -- label : TBasicType TUTF8
    CString ->                              -- tooltip : TBasicType TUTF8
    CString ->                              -- stock_id : TBasicType TUTF8
    IO (Ptr RecentAction)

{-# DEPRECATED recentActionNew ["(Since version 3.10)"]#-}
recentActionNew ::
    (MonadIO m) =>
    T.Text ->                               -- name
    Maybe (T.Text) ->                       -- label
    Maybe (T.Text) ->                       -- tooltip
    Maybe (T.Text) ->                       -- stock_id
    m RecentAction
recentActionNew name label tooltip stock_id = liftIO $ do
    name' <- textToCString name
    maybeLabel <- case label of
        Nothing -> return nullPtr
        Just jLabel -> do
            jLabel' <- textToCString jLabel
            return jLabel'
    maybeTooltip <- case tooltip of
        Nothing -> return nullPtr
        Just jTooltip -> do
            jTooltip' <- textToCString jTooltip
            return jTooltip'
    maybeStock_id <- case stock_id of
        Nothing -> return nullPtr
        Just jStock_id -> do
            jStock_id' <- textToCString jStock_id
            return jStock_id'
    result <- gtk_recent_action_new name' maybeLabel maybeTooltip maybeStock_id
    checkUnexpectedReturnNULL "gtk_recent_action_new" result
    result' <- (wrapObject RecentAction) result
    freeMem name'
    freeMem maybeLabel
    freeMem maybeTooltip
    freeMem maybeStock_id
    return result'

-- method RecentAction::new_for_manager
-- method type : Constructor
-- Args : [Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "tooltip", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "stock_id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "manager", argType = TInterface "Gtk" "RecentManager", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "tooltip", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "stock_id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "manager", argType = TInterface "Gtk" "RecentManager", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "RecentAction"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_recent_action_new_for_manager" gtk_recent_action_new_for_manager :: 
    CString ->                              -- name : TBasicType TUTF8
    CString ->                              -- label : TBasicType TUTF8
    CString ->                              -- tooltip : TBasicType TUTF8
    CString ->                              -- stock_id : TBasicType TUTF8
    Ptr RecentManager ->                    -- manager : TInterface "Gtk" "RecentManager"
    IO (Ptr RecentAction)

{-# DEPRECATED recentActionNewForManager ["(Since version 3.10)"]#-}
recentActionNewForManager ::
    (MonadIO m, RecentManagerK a) =>
    T.Text ->                               -- name
    Maybe (T.Text) ->                       -- label
    Maybe (T.Text) ->                       -- tooltip
    Maybe (T.Text) ->                       -- stock_id
    Maybe (a) ->                            -- manager
    m RecentAction
recentActionNewForManager name label tooltip stock_id manager = liftIO $ do
    name' <- textToCString name
    maybeLabel <- case label of
        Nothing -> return nullPtr
        Just jLabel -> do
            jLabel' <- textToCString jLabel
            return jLabel'
    maybeTooltip <- case tooltip of
        Nothing -> return nullPtr
        Just jTooltip -> do
            jTooltip' <- textToCString jTooltip
            return jTooltip'
    maybeStock_id <- case stock_id of
        Nothing -> return nullPtr
        Just jStock_id -> do
            jStock_id' <- textToCString jStock_id
            return jStock_id'
    maybeManager <- case manager of
        Nothing -> return nullPtr
        Just jManager -> do
            let jManager' = unsafeManagedPtrCastPtr jManager
            return jManager'
    result <- gtk_recent_action_new_for_manager name' maybeLabel maybeTooltip maybeStock_id maybeManager
    checkUnexpectedReturnNULL "gtk_recent_action_new_for_manager" result
    result' <- (wrapObject RecentAction) result
    whenJust manager touchManagedPtr
    freeMem name'
    freeMem maybeLabel
    freeMem maybeTooltip
    freeMem maybeStock_id
    return result'

-- method RecentAction::get_show_numbers
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentAction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentAction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gtk_recent_action_get_show_numbers" gtk_recent_action_get_show_numbers :: 
    Ptr RecentAction ->                     -- _obj : TInterface "Gtk" "RecentAction"
    IO CInt

{-# DEPRECATED recentActionGetShowNumbers ["(Since version 3.10)"]#-}
recentActionGetShowNumbers ::
    (MonadIO m, RecentActionK a) =>
    a ->                                    -- _obj
    m Bool
recentActionGetShowNumbers _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_recent_action_get_show_numbers _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method RecentAction::set_show_numbers
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentAction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "show_numbers", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentAction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "show_numbers", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_recent_action_set_show_numbers" gtk_recent_action_set_show_numbers :: 
    Ptr RecentAction ->                     -- _obj : TInterface "Gtk" "RecentAction"
    CInt ->                                 -- show_numbers : TBasicType TBoolean
    IO ()

{-# DEPRECATED recentActionSetShowNumbers ["(Since version 3.10)"]#-}
recentActionSetShowNumbers ::
    (MonadIO m, RecentActionK a) =>
    a ->                                    -- _obj
    Bool ->                                 -- show_numbers
    m ()
recentActionSetShowNumbers _obj show_numbers = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let show_numbers' = (fromIntegral . fromEnum) show_numbers
    gtk_recent_action_set_show_numbers _obj' show_numbers'
    touchManagedPtr _obj
    return ()