module GI.Gtk.Objects.RecentAction
(
RecentAction(..) ,
RecentActionK ,
toRecentAction ,
noRecentAction ,
recentActionGetShowNumbers ,
recentActionNew ,
recentActionNewForManager ,
recentActionSetShowNumbers ,
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
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, *)])
foreign import ccall "gtk_recent_action_new" gtk_recent_action_new ::
CString ->
CString ->
CString ->
CString ->
IO (Ptr RecentAction)
recentActionNew ::
(MonadIO m) =>
T.Text ->
Maybe (T.Text) ->
Maybe (T.Text) ->
Maybe (T.Text) ->
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'
foreign import ccall "gtk_recent_action_new_for_manager" gtk_recent_action_new_for_manager ::
CString ->
CString ->
CString ->
CString ->
Ptr RecentManager ->
IO (Ptr RecentAction)
recentActionNewForManager ::
(MonadIO m, RecentManagerK a) =>
T.Text ->
Maybe (T.Text) ->
Maybe (T.Text) ->
Maybe (T.Text) ->
Maybe (a) ->
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'
foreign import ccall "gtk_recent_action_get_show_numbers" gtk_recent_action_get_show_numbers ::
Ptr RecentAction ->
IO CInt
recentActionGetShowNumbers ::
(MonadIO m, RecentActionK a) =>
a ->
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'
foreign import ccall "gtk_recent_action_set_show_numbers" gtk_recent_action_set_show_numbers ::
Ptr RecentAction ->
CInt ->
IO ()
recentActionSetShowNumbers ::
(MonadIO m, RecentActionK a) =>
a ->
Bool ->
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 ()