{-# LANGUAGE ImplicitParams, RankNTypes, TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- t'GI.Gtk.Objects.RecentManager.RecentManager' provides a facility for adding, removing and
-- looking up recently used files. Each recently used file is
-- identified by its URI, and has meta-data associated to it, like
-- the names and command lines of the applications that have
-- registered it, the number of time each application has registered
-- the same file, the mime type of the file and whether the file
-- should be displayed only by the applications that have
-- registered it.
-- 
-- The recently used files list is per user.
-- 
-- The t'GI.Gtk.Objects.RecentManager.RecentManager' acts like a database of all the recently
-- used files. You can create new t'GI.Gtk.Objects.RecentManager.RecentManager' objects, but
-- it is more efficient to use the default manager created by GTK+.
-- 
-- Adding a new recently used file is as simple as:
-- 
-- 
-- === /C code/
-- >
-- >GtkRecentManager *manager;
-- >
-- >manager = gtk_recent_manager_get_default ();
-- >gtk_recent_manager_add_item (manager, file_uri);
-- 
-- 
-- The t'GI.Gtk.Objects.RecentManager.RecentManager' will try to gather all the needed information
-- from the file itself through GIO.
-- 
-- Looking up the meta-data associated with a recently used file
-- given its URI requires calling 'GI.Gtk.Objects.RecentManager.recentManagerLookupItem':
-- 
-- 
-- === /C code/
-- >
-- >GtkRecentManager *manager;
-- >GtkRecentInfo *info;
-- >GError *error = NULL;
-- >
-- >manager = gtk_recent_manager_get_default ();
-- >info = gtk_recent_manager_lookup_item (manager, file_uri, &error);
-- >if (error)
-- >  {
-- >    g_warning ("Could not find the file: %s", error->message);
-- >    g_error_free (error);
-- >  }
-- >else
-- > {
-- >   // Use the info object
-- >   gtk_recent_info_unref (info);
-- > }
-- 
-- 
-- In order to retrieve the list of recently used files, you can use
-- 'GI.Gtk.Objects.RecentManager.recentManagerGetItems', which returns a list of t'GI.Gtk.Structs.RecentInfo.RecentInfo'-structs.
-- 
-- A t'GI.Gtk.Objects.RecentManager.RecentManager' is the model used to populate the contents of
-- one, or more t'GI.Gtk.Interfaces.RecentChooser.RecentChooser' implementations.
-- 
-- Note that the maximum age of the recently used files list is
-- controllable through the [Settings:gtkRecentFilesMaxAge]("GI.Gtk.Objects.Settings#g:attr:gtkRecentFilesMaxAge")
-- property.
-- 
-- Recently used files are supported since GTK+ 2.10.
-- 
-- /Since: 2.10/

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Gtk.Objects.RecentManager
    ( 

-- * Exported types
    RecentManager(..)                       ,
    IsRecentManager                         ,
    toRecentManager                         ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [addFull]("GI.Gtk.Objects.RecentManager#g:method:addFull"), [addItem]("GI.Gtk.Objects.RecentManager#g:method:addItem"), [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [hasItem]("GI.Gtk.Objects.RecentManager#g:method:hasItem"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [lookupItem]("GI.Gtk.Objects.RecentManager#g:method:lookupItem"), [moveItem]("GI.Gtk.Objects.RecentManager#g:method:moveItem"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [purgeItems]("GI.Gtk.Objects.RecentManager#g:method:purgeItems"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [removeItem]("GI.Gtk.Objects.RecentManager#g:method:removeItem"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getData]("GI.GObject.Objects.Object#g:method:getData"), [getItems]("GI.Gtk.Objects.RecentManager#g:method:getItems"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveRecentManagerMethod              ,
#endif

-- ** addFull #method:addFull#

#if defined(ENABLE_OVERLOADING)
    RecentManagerAddFullMethodInfo          ,
#endif
    recentManagerAddFull                    ,


-- ** addItem #method:addItem#

#if defined(ENABLE_OVERLOADING)
    RecentManagerAddItemMethodInfo          ,
#endif
    recentManagerAddItem                    ,


-- ** getDefault #method:getDefault#

    recentManagerGetDefault                 ,


-- ** getItems #method:getItems#

#if defined(ENABLE_OVERLOADING)
    RecentManagerGetItemsMethodInfo         ,
#endif
    recentManagerGetItems                   ,


-- ** hasItem #method:hasItem#

#if defined(ENABLE_OVERLOADING)
    RecentManagerHasItemMethodInfo          ,
#endif
    recentManagerHasItem                    ,


-- ** lookupItem #method:lookupItem#

#if defined(ENABLE_OVERLOADING)
    RecentManagerLookupItemMethodInfo       ,
#endif
    recentManagerLookupItem                 ,


-- ** moveItem #method:moveItem#

#if defined(ENABLE_OVERLOADING)
    RecentManagerMoveItemMethodInfo         ,
#endif
    recentManagerMoveItem                   ,


-- ** new #method:new#

    recentManagerNew                        ,


-- ** purgeItems #method:purgeItems#

#if defined(ENABLE_OVERLOADING)
    RecentManagerPurgeItemsMethodInfo       ,
#endif
    recentManagerPurgeItems                 ,


-- ** removeItem #method:removeItem#

#if defined(ENABLE_OVERLOADING)
    RecentManagerRemoveItemMethodInfo       ,
#endif
    recentManagerRemoveItem                 ,




 -- * Properties


-- ** filename #attr:filename#
-- | The full path to the file to be used to store and read the
-- recently used resources list
-- 
-- /Since: 2.10/

#if defined(ENABLE_OVERLOADING)
    RecentManagerFilenamePropertyInfo       ,
#endif
    constructRecentManagerFilename          ,
    getRecentManagerFilename                ,
#if defined(ENABLE_OVERLOADING)
    recentManagerFilename                   ,
#endif


-- ** size #attr:size#
-- | The size of the recently used resources list.
-- 
-- /Since: 2.10/

#if defined(ENABLE_OVERLOADING)
    RecentManagerSizePropertyInfo           ,
#endif
    getRecentManagerSize                    ,
#if defined(ENABLE_OVERLOADING)
    recentManagerSize                       ,
#endif




 -- * Signals


-- ** changed #signal:changed#

    RecentManagerChangedCallback            ,
#if defined(ENABLE_OVERLOADING)
    RecentManagerChangedSignalInfo          ,
#endif
    afterRecentManagerChanged               ,
    onRecentManagerChanged                  ,




    ) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gtk.Structs.RecentData as Gtk.RecentData
import {-# SOURCE #-} qualified GI.Gtk.Structs.RecentInfo as Gtk.RecentInfo

-- | Memory-managed wrapper type.
newtype RecentManager = RecentManager (SP.ManagedPtr RecentManager)
    deriving (RecentManager -> RecentManager -> Bool
(RecentManager -> RecentManager -> Bool)
-> (RecentManager -> RecentManager -> Bool) -> Eq RecentManager
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RecentManager -> RecentManager -> Bool
== :: RecentManager -> RecentManager -> Bool
$c/= :: RecentManager -> RecentManager -> Bool
/= :: RecentManager -> RecentManager -> Bool
Eq)

instance SP.ManagedPtrNewtype RecentManager where
    toManagedPtr :: RecentManager -> ManagedPtr RecentManager
toManagedPtr (RecentManager ManagedPtr RecentManager
p) = ManagedPtr RecentManager
p

foreign import ccall "gtk_recent_manager_get_type"
    c_gtk_recent_manager_get_type :: IO B.Types.GType

instance B.Types.TypedObject RecentManager where
    glibType :: IO GType
glibType = IO GType
c_gtk_recent_manager_get_type

instance B.Types.GObject RecentManager

-- | Type class for types which can be safely cast to `RecentManager`, for instance with `toRecentManager`.
class (SP.GObject o, O.IsDescendantOf RecentManager o) => IsRecentManager o
instance (SP.GObject o, O.IsDescendantOf RecentManager o) => IsRecentManager o

instance O.HasParentTypes RecentManager
type instance O.ParentTypes RecentManager = '[GObject.Object.Object]

-- | Cast to `RecentManager`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toRecentManager :: (MIO.MonadIO m, IsRecentManager o) => o -> m RecentManager
toRecentManager :: forall (m :: * -> *) o.
(MonadIO m, IsRecentManager o) =>
o -> m RecentManager
toRecentManager = IO RecentManager -> m RecentManager
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO RecentManager -> m RecentManager)
-> (o -> IO RecentManager) -> o -> m RecentManager
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr RecentManager -> RecentManager)
-> o -> IO RecentManager
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr RecentManager -> RecentManager
RecentManager

-- | Convert 'RecentManager' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe RecentManager) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gtk_recent_manager_get_type
    gvalueSet_ :: Ptr GValue -> Maybe RecentManager -> IO ()
gvalueSet_ Ptr GValue
gv Maybe RecentManager
P.Nothing = Ptr GValue -> Ptr RecentManager -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr RecentManager
forall a. Ptr a
FP.nullPtr :: FP.Ptr RecentManager)
    gvalueSet_ Ptr GValue
gv (P.Just RecentManager
obj) = RecentManager -> (Ptr RecentManager -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr RecentManager
obj (Ptr GValue -> Ptr RecentManager -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe RecentManager)
gvalueGet_ Ptr GValue
gv = do
        Ptr RecentManager
ptr <- Ptr GValue -> IO (Ptr RecentManager)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr RecentManager)
        if Ptr RecentManager
ptr Ptr RecentManager -> Ptr RecentManager -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr RecentManager
forall a. Ptr a
FP.nullPtr
        then RecentManager -> Maybe RecentManager
forall a. a -> Maybe a
P.Just (RecentManager -> Maybe RecentManager)
-> IO RecentManager -> IO (Maybe RecentManager)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr RecentManager -> RecentManager)
-> Ptr RecentManager -> IO RecentManager
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr RecentManager -> RecentManager
RecentManager Ptr RecentManager
ptr
        else Maybe RecentManager -> IO (Maybe RecentManager)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe RecentManager
forall a. Maybe a
P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveRecentManagerMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveRecentManagerMethod "addFull" o = RecentManagerAddFullMethodInfo
    ResolveRecentManagerMethod "addItem" o = RecentManagerAddItemMethodInfo
    ResolveRecentManagerMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveRecentManagerMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveRecentManagerMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveRecentManagerMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveRecentManagerMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveRecentManagerMethod "hasItem" o = RecentManagerHasItemMethodInfo
    ResolveRecentManagerMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveRecentManagerMethod "lookupItem" o = RecentManagerLookupItemMethodInfo
    ResolveRecentManagerMethod "moveItem" o = RecentManagerMoveItemMethodInfo
    ResolveRecentManagerMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveRecentManagerMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveRecentManagerMethod "purgeItems" o = RecentManagerPurgeItemsMethodInfo
    ResolveRecentManagerMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveRecentManagerMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveRecentManagerMethod "removeItem" o = RecentManagerRemoveItemMethodInfo
    ResolveRecentManagerMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveRecentManagerMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveRecentManagerMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveRecentManagerMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveRecentManagerMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveRecentManagerMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveRecentManagerMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveRecentManagerMethod "getItems" o = RecentManagerGetItemsMethodInfo
    ResolveRecentManagerMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveRecentManagerMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveRecentManagerMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveRecentManagerMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveRecentManagerMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveRecentManagerMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveRecentManagerMethod t RecentManager, O.OverloadedMethod info RecentManager p) => OL.IsLabel t (RecentManager -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveRecentManagerMethod t RecentManager, O.OverloadedMethod info RecentManager p, R.HasField t RecentManager p) => R.HasField t RecentManager p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveRecentManagerMethod t RecentManager, O.OverloadedMethodInfo info RecentManager) => OL.IsLabel t (O.MethodProxy info RecentManager) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

-- signal RecentManager::changed
-- | Emitted when the current recently used resources manager changes
-- its contents, either by calling 'GI.Gtk.Objects.RecentManager.recentManagerAddItem' or
-- by another application.
-- 
-- /Since: 2.10/
type RecentManagerChangedCallback =
    IO ()

type C_RecentManagerChangedCallback =
    Ptr RecentManager ->                    -- object
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_RecentManagerChangedCallback`.
foreign import ccall "wrapper"
    mk_RecentManagerChangedCallback :: C_RecentManagerChangedCallback -> IO (FunPtr C_RecentManagerChangedCallback)

wrap_RecentManagerChangedCallback :: 
    GObject a => (a -> RecentManagerChangedCallback) ->
    C_RecentManagerChangedCallback
wrap_RecentManagerChangedCallback :: forall a.
GObject a =>
(a -> IO ()) -> C_RecentManagerChangedCallback
wrap_RecentManagerChangedCallback a -> IO ()
gi'cb Ptr RecentManager
gi'selfPtr Ptr ()
_ = do
    Ptr RecentManager -> (RecentManager -> IO ()) -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient Ptr RecentManager
gi'selfPtr ((RecentManager -> IO ()) -> IO ())
-> (RecentManager -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \RecentManager
gi'self -> a -> IO ()
gi'cb (RecentManager -> a
forall a b. Coercible a b => a -> b
Coerce.coerce RecentManager
gi'self) 


-- | Connect a signal handler for the [changed](#signal:changed) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' recentManager #changed callback
-- @
-- 
-- 
onRecentManagerChanged :: (IsRecentManager a, MonadIO m) => a -> ((?self :: a) => RecentManagerChangedCallback) -> m SignalHandlerId
onRecentManagerChanged :: forall a (m :: * -> *).
(IsRecentManager a, MonadIO m) =>
a -> ((?self::a) => IO ()) -> m SignalHandlerId
onRecentManagerChanged a
obj (?self::a) => IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let wrapped :: a -> IO ()
wrapped a
self = let ?self = a
?self::a
self in IO ()
(?self::a) => IO ()
cb
    let wrapped' :: C_RecentManagerChangedCallback
wrapped' = (a -> IO ()) -> C_RecentManagerChangedCallback
forall a.
GObject a =>
(a -> IO ()) -> C_RecentManagerChangedCallback
wrap_RecentManagerChangedCallback a -> IO ()
wrapped
    FunPtr C_RecentManagerChangedCallback
wrapped'' <- C_RecentManagerChangedCallback
-> IO (FunPtr C_RecentManagerChangedCallback)
mk_RecentManagerChangedCallback C_RecentManagerChangedCallback
wrapped'
    a
-> Text
-> FunPtr C_RecentManagerChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"changed" FunPtr C_RecentManagerChangedCallback
wrapped'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [changed](#signal:changed) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' recentManager #changed callback
-- @
-- 
-- 
-- 
-- By default the object invoking the signal is not passed to the callback.
-- If you need to access it, you can use the implit @?self@ parameter.
-- Note that this requires activating the @ImplicitParams@ GHC extension.
-- 
afterRecentManagerChanged :: (IsRecentManager a, MonadIO m) => a -> ((?self :: a) => RecentManagerChangedCallback) -> m SignalHandlerId
afterRecentManagerChanged :: forall a (m :: * -> *).
(IsRecentManager a, MonadIO m) =>
a -> ((?self::a) => IO ()) -> m SignalHandlerId
afterRecentManagerChanged a
obj (?self::a) => IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let wrapped :: a -> IO ()
wrapped a
self = let ?self = a
?self::a
self in IO ()
(?self::a) => IO ()
cb
    let wrapped' :: C_RecentManagerChangedCallback
wrapped' = (a -> IO ()) -> C_RecentManagerChangedCallback
forall a.
GObject a =>
(a -> IO ()) -> C_RecentManagerChangedCallback
wrap_RecentManagerChangedCallback a -> IO ()
wrapped
    FunPtr C_RecentManagerChangedCallback
wrapped'' <- C_RecentManagerChangedCallback
-> IO (FunPtr C_RecentManagerChangedCallback)
mk_RecentManagerChangedCallback C_RecentManagerChangedCallback
wrapped'
    a
-> Text
-> FunPtr C_RecentManagerChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"changed" FunPtr C_RecentManagerChangedCallback
wrapped'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data RecentManagerChangedSignalInfo
instance SignalInfo RecentManagerChangedSignalInfo where
    type HaskellCallbackType RecentManagerChangedSignalInfo = RecentManagerChangedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_RecentManagerChangedCallback cb
        cb'' <- mk_RecentManagerChangedCallback cb'
        connectSignalFunPtr obj "changed" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.RecentManager::changed"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Objects-RecentManager.html#g:signal:changed"})

#endif

-- VVV Prop "filename"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@filename@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' recentManager #filename
-- @
getRecentManagerFilename :: (MonadIO m, IsRecentManager o) => o -> m (Maybe T.Text)
getRecentManagerFilename :: forall (m :: * -> *) o.
(MonadIO m, IsRecentManager o) =>
o -> m (Maybe Text)
getRecentManagerFilename o
obj = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe Text)
forall a. GObject a => a -> String -> IO (Maybe Text)
B.Properties.getObjectPropertyString o
obj String
"filename"

-- | Construct a `GValueConstruct` with valid value for the “@filename@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructRecentManagerFilename :: (IsRecentManager o, MIO.MonadIO m) => T.Text -> m (GValueConstruct o)
constructRecentManagerFilename :: forall o (m :: * -> *).
(IsRecentManager o, MonadIO m) =>
Text -> m (GValueConstruct o)
constructRecentManagerFilename Text
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe Text -> IO (GValueConstruct o)
forall o. String -> Maybe Text -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyString String
"filename" (Text -> Maybe Text
forall a. a -> Maybe a
P.Just Text
val)

#if defined(ENABLE_OVERLOADING)
data RecentManagerFilenamePropertyInfo
instance AttrInfo RecentManagerFilenamePropertyInfo where
    type AttrAllowedOps RecentManagerFilenamePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint RecentManagerFilenamePropertyInfo = IsRecentManager
    type AttrSetTypeConstraint RecentManagerFilenamePropertyInfo = (~) T.Text
    type AttrTransferTypeConstraint RecentManagerFilenamePropertyInfo = (~) T.Text
    type AttrTransferType RecentManagerFilenamePropertyInfo = T.Text
    type AttrGetType RecentManagerFilenamePropertyInfo = (Maybe T.Text)
    type AttrLabel RecentManagerFilenamePropertyInfo = "filename"
    type AttrOrigin RecentManagerFilenamePropertyInfo = RecentManager
    attrGet = getRecentManagerFilename
    attrSet = undefined
    attrTransfer _ v = do
        return v
    attrConstruct = constructRecentManagerFilename
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.RecentManager.filename"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Objects-RecentManager.html#g:attr:filename"
        })
#endif

-- VVV Prop "size"
   -- Type: TBasicType TInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@size@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' recentManager #size
-- @
getRecentManagerSize :: (MonadIO m, IsRecentManager o) => o -> m Int32
getRecentManagerSize :: forall (m :: * -> *) o.
(MonadIO m, IsRecentManager o) =>
o -> m Int32
getRecentManagerSize o
obj = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Int32
forall a. GObject a => a -> String -> IO Int32
B.Properties.getObjectPropertyInt32 o
obj String
"size"

#if defined(ENABLE_OVERLOADING)
data RecentManagerSizePropertyInfo
instance AttrInfo RecentManagerSizePropertyInfo where
    type AttrAllowedOps RecentManagerSizePropertyInfo = '[ 'AttrGet]
    type AttrBaseTypeConstraint RecentManagerSizePropertyInfo = IsRecentManager
    type AttrSetTypeConstraint RecentManagerSizePropertyInfo = (~) ()
    type AttrTransferTypeConstraint RecentManagerSizePropertyInfo = (~) ()
    type AttrTransferType RecentManagerSizePropertyInfo = ()
    type AttrGetType RecentManagerSizePropertyInfo = Int32
    type AttrLabel RecentManagerSizePropertyInfo = "size"
    type AttrOrigin RecentManagerSizePropertyInfo = RecentManager
    attrGet = getRecentManagerSize
    attrSet = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.RecentManager.size"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Objects-RecentManager.html#g:attr:size"
        })
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList RecentManager
type instance O.AttributeList RecentManager = RecentManagerAttributeList
type RecentManagerAttributeList = ('[ '("filename", RecentManagerFilenamePropertyInfo), '("size", RecentManagerSizePropertyInfo)] :: [(Symbol, DK.Type)])
#endif

#if defined(ENABLE_OVERLOADING)
recentManagerFilename :: AttrLabelProxy "filename"
recentManagerFilename = AttrLabelProxy

recentManagerSize :: AttrLabelProxy "size"
recentManagerSize = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList RecentManager = RecentManagerSignalList
type RecentManagerSignalList = ('[ '("changed", RecentManagerChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])

#endif

-- method RecentManager::new
-- method type : Constructor
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gtk" , name = "RecentManager" })
-- throws : False
-- Skip return : False

foreign import ccall "gtk_recent_manager_new" gtk_recent_manager_new :: 
    IO (Ptr RecentManager)

-- | Creates a new recent manager object. Recent manager objects are used to
-- handle the list of recently used resources. A t'GI.Gtk.Objects.RecentManager.RecentManager' object
-- monitors the recently used resources list, and emits the “changed” signal
-- each time something inside the list changes.
-- 
-- t'GI.Gtk.Objects.RecentManager.RecentManager' objects are expensive: be sure to create them only when
-- needed. You should use 'GI.Gtk.Objects.RecentManager.recentManagerGetDefault' instead.
-- 
-- /Since: 2.10/
recentManagerNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m RecentManager
    -- ^ __Returns:__ A newly created t'GI.Gtk.Objects.RecentManager.RecentManager' object
recentManagerNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m RecentManager
recentManagerNew  = IO RecentManager -> m RecentManager
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO RecentManager -> m RecentManager)
-> IO RecentManager -> m RecentManager
forall a b. (a -> b) -> a -> b
$ do
    Ptr RecentManager
result <- IO (Ptr RecentManager)
gtk_recent_manager_new
    Text -> Ptr RecentManager -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"recentManagerNew" Ptr RecentManager
result
    RecentManager
result' <- ((ManagedPtr RecentManager -> RecentManager)
-> Ptr RecentManager -> IO RecentManager
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr RecentManager -> RecentManager
RecentManager) Ptr RecentManager
result
    RecentManager -> IO RecentManager
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return RecentManager
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method RecentManager::add_full
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "manager"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "RecentManager" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkRecentManager"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "uri"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a valid URI" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "recent_data"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "RecentData" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "metadata of the resource"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_recent_manager_add_full" gtk_recent_manager_add_full :: 
    Ptr RecentManager ->                    -- manager : TInterface (Name {namespace = "Gtk", name = "RecentManager"})
    CString ->                              -- uri : TBasicType TUTF8
    Ptr Gtk.RecentData.RecentData ->        -- recent_data : TInterface (Name {namespace = "Gtk", name = "RecentData"})
    IO CInt

-- | Adds a new resource, pointed by /@uri@/, into the recently used
-- resources list, using the metadata specified inside the
-- t'GI.Gtk.Structs.RecentData.RecentData'-struct passed in /@recentData@/.
-- 
-- The passed URI will be used to identify this resource inside the
-- list.
-- 
-- In order to register the new recently used resource, metadata about
-- the resource must be passed as well as the URI; the metadata is
-- stored in a t'GI.Gtk.Structs.RecentData.RecentData'-struct, which must contain the MIME
-- type of the resource pointed by the URI; the name of the application
-- that is registering the item, and a command line to be used when
-- launching the item.
-- 
-- Optionally, a t'GI.Gtk.Structs.RecentData.RecentData'-struct might contain a UTF-8 string
-- to be used when viewing the item instead of the last component of
-- the URI; a short description of the item; whether the item should
-- be considered private - that is, should be displayed only by the
-- applications that have registered it.
-- 
-- /Since: 2.10/
recentManagerAddFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsRecentManager a) =>
    a
    -- ^ /@manager@/: a t'GI.Gtk.Objects.RecentManager.RecentManager'
    -> T.Text
    -- ^ /@uri@/: a valid URI
    -> Gtk.RecentData.RecentData
    -- ^ /@recentData@/: metadata of the resource
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the new item was successfully added to the
    --     recently used resources list, 'P.False' otherwise
recentManagerAddFull :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsRecentManager a) =>
a -> Text -> RecentData -> m Bool
recentManagerAddFull a
manager Text
uri RecentData
recentData = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr RecentManager
manager' <- a -> IO (Ptr RecentManager)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
manager
    CString
uri' <- Text -> IO CString
textToCString Text
uri
    Ptr RecentData
recentData' <- RecentData -> IO (Ptr RecentData)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RecentData
recentData
    CInt
result <- Ptr RecentManager -> CString -> Ptr RecentData -> IO CInt
gtk_recent_manager_add_full Ptr RecentManager
manager' CString
uri' Ptr RecentData
recentData'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
manager
    RecentData -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RecentData
recentData
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uri'
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data RecentManagerAddFullMethodInfo
instance (signature ~ (T.Text -> Gtk.RecentData.RecentData -> m Bool), MonadIO m, IsRecentManager a) => O.OverloadedMethod RecentManagerAddFullMethodInfo a signature where
    overloadedMethod = recentManagerAddFull

instance O.OverloadedMethodInfo RecentManagerAddFullMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.RecentManager.recentManagerAddFull",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Objects-RecentManager.html#v:recentManagerAddFull"
        })


#endif

-- method RecentManager::add_item
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "manager"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "RecentManager" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkRecentManager"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "uri"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a valid URI" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_recent_manager_add_item" gtk_recent_manager_add_item :: 
    Ptr RecentManager ->                    -- manager : TInterface (Name {namespace = "Gtk", name = "RecentManager"})
    CString ->                              -- uri : TBasicType TUTF8
    IO CInt

-- | Adds a new resource, pointed by /@uri@/, into the recently used
-- resources list.
-- 
-- This function automatically retrieves some of the needed
-- metadata and setting other metadata to common default values;
-- it then feeds the data to 'GI.Gtk.Objects.RecentManager.recentManagerAddFull'.
-- 
-- See 'GI.Gtk.Objects.RecentManager.recentManagerAddFull' if you want to explicitly
-- define the metadata for the resource pointed by /@uri@/.
-- 
-- /Since: 2.10/
recentManagerAddItem ::
    (B.CallStack.HasCallStack, MonadIO m, IsRecentManager a) =>
    a
    -- ^ /@manager@/: a t'GI.Gtk.Objects.RecentManager.RecentManager'
    -> T.Text
    -- ^ /@uri@/: a valid URI
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the new item was successfully added
    --   to the recently used resources list
recentManagerAddItem :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsRecentManager a) =>
a -> Text -> m Bool
recentManagerAddItem a
manager Text
uri = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr RecentManager
manager' <- a -> IO (Ptr RecentManager)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
manager
    CString
uri' <- Text -> IO CString
textToCString Text
uri
    CInt
result <- Ptr RecentManager -> CString -> IO CInt
gtk_recent_manager_add_item Ptr RecentManager
manager' CString
uri'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
manager
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uri'
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data RecentManagerAddItemMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m, IsRecentManager a) => O.OverloadedMethod RecentManagerAddItemMethodInfo a signature where
    overloadedMethod = recentManagerAddItem

instance O.OverloadedMethodInfo RecentManagerAddItemMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.RecentManager.recentManagerAddItem",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Objects-RecentManager.html#v:recentManagerAddItem"
        })


#endif

-- method RecentManager::get_items
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "manager"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "RecentManager" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkRecentManager"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TGList
--                  (TInterface Name { namespace = "Gtk" , name = "RecentInfo" }))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_recent_manager_get_items" gtk_recent_manager_get_items :: 
    Ptr RecentManager ->                    -- manager : TInterface (Name {namespace = "Gtk", name = "RecentManager"})
    IO (Ptr (GList (Ptr Gtk.RecentInfo.RecentInfo)))

-- | Gets the list of recently used resources.
-- 
-- /Since: 2.10/
recentManagerGetItems ::
    (B.CallStack.HasCallStack, MonadIO m, IsRecentManager a) =>
    a
    -- ^ /@manager@/: a t'GI.Gtk.Objects.RecentManager.RecentManager'
    -> m [Gtk.RecentInfo.RecentInfo]
    -- ^ __Returns:__ a list of
    --   newly allocated t'GI.Gtk.Structs.RecentInfo.RecentInfo' objects. Use
    --   'GI.Gtk.Structs.RecentInfo.recentInfoUnref' on each item inside the list, and then
    --   free the list itself using @/g_list_free()/@.
recentManagerGetItems :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsRecentManager a) =>
a -> m [RecentInfo]
recentManagerGetItems a
manager = IO [RecentInfo] -> m [RecentInfo]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [RecentInfo] -> m [RecentInfo])
-> IO [RecentInfo] -> m [RecentInfo]
forall a b. (a -> b) -> a -> b
$ do
    Ptr RecentManager
manager' <- a -> IO (Ptr RecentManager)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
manager
    Ptr (GList (Ptr RecentInfo))
result <- Ptr RecentManager -> IO (Ptr (GList (Ptr RecentInfo)))
gtk_recent_manager_get_items Ptr RecentManager
manager'
    [Ptr RecentInfo]
result' <- Ptr (GList (Ptr RecentInfo)) -> IO [Ptr RecentInfo]
forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList (Ptr RecentInfo))
result
    [RecentInfo]
result'' <- (Ptr RecentInfo -> IO RecentInfo)
-> [Ptr RecentInfo] -> IO [RecentInfo]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM ((ManagedPtr RecentInfo -> RecentInfo)
-> Ptr RecentInfo -> IO RecentInfo
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr RecentInfo -> RecentInfo
Gtk.RecentInfo.RecentInfo) [Ptr RecentInfo]
result'
    Ptr (GList (Ptr RecentInfo)) -> IO ()
forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr RecentInfo))
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
manager
    [RecentInfo] -> IO [RecentInfo]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [RecentInfo]
result''

#if defined(ENABLE_OVERLOADING)
data RecentManagerGetItemsMethodInfo
instance (signature ~ (m [Gtk.RecentInfo.RecentInfo]), MonadIO m, IsRecentManager a) => O.OverloadedMethod RecentManagerGetItemsMethodInfo a signature where
    overloadedMethod = recentManagerGetItems

instance O.OverloadedMethodInfo RecentManagerGetItemsMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.RecentManager.recentManagerGetItems",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Objects-RecentManager.html#v:recentManagerGetItems"
        })


#endif

-- method RecentManager::has_item
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "manager"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "RecentManager" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkRecentManager"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "uri"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a URI" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_recent_manager_has_item" gtk_recent_manager_has_item :: 
    Ptr RecentManager ->                    -- manager : TInterface (Name {namespace = "Gtk", name = "RecentManager"})
    CString ->                              -- uri : TBasicType TUTF8
    IO CInt

-- | Checks whether there is a recently used resource registered
-- with /@uri@/ inside the recent manager.
-- 
-- /Since: 2.10/
recentManagerHasItem ::
    (B.CallStack.HasCallStack, MonadIO m, IsRecentManager a) =>
    a
    -- ^ /@manager@/: a t'GI.Gtk.Objects.RecentManager.RecentManager'
    -> T.Text
    -- ^ /@uri@/: a URI
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the resource was found, 'P.False' otherwise
recentManagerHasItem :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsRecentManager a) =>
a -> Text -> m Bool
recentManagerHasItem a
manager Text
uri = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr RecentManager
manager' <- a -> IO (Ptr RecentManager)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
manager
    CString
uri' <- Text -> IO CString
textToCString Text
uri
    CInt
result <- Ptr RecentManager -> CString -> IO CInt
gtk_recent_manager_has_item Ptr RecentManager
manager' CString
uri'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
manager
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uri'
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data RecentManagerHasItemMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m, IsRecentManager a) => O.OverloadedMethod RecentManagerHasItemMethodInfo a signature where
    overloadedMethod = recentManagerHasItem

instance O.OverloadedMethodInfo RecentManagerHasItemMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.RecentManager.recentManagerHasItem",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Objects-RecentManager.html#v:recentManagerHasItem"
        })


#endif

-- method RecentManager::lookup_item
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "manager"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "RecentManager" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkRecentManager"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "uri"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a URI" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gtk" , name = "RecentInfo" })
-- throws : True
-- Skip return : False

foreign import ccall "gtk_recent_manager_lookup_item" gtk_recent_manager_lookup_item :: 
    Ptr RecentManager ->                    -- manager : TInterface (Name {namespace = "Gtk", name = "RecentManager"})
    CString ->                              -- uri : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Gtk.RecentInfo.RecentInfo)

-- | Searches for a URI inside the recently used resources list, and
-- returns a t'GI.Gtk.Structs.RecentInfo.RecentInfo'-struct containing informations about the resource
-- like its MIME type, or its display name.
-- 
-- /Since: 2.10/
recentManagerLookupItem ::
    (B.CallStack.HasCallStack, MonadIO m, IsRecentManager a) =>
    a
    -- ^ /@manager@/: a t'GI.Gtk.Objects.RecentManager.RecentManager'
    -> T.Text
    -- ^ /@uri@/: a URI
    -> m (Maybe Gtk.RecentInfo.RecentInfo)
    -- ^ __Returns:__ a t'GI.Gtk.Structs.RecentInfo.RecentInfo'-struct containing information
    --   about the resource pointed by /@uri@/, or 'P.Nothing' if the URI was
    --   not registered in the recently used resources list. Free with
    --   'GI.Gtk.Structs.RecentInfo.recentInfoUnref'. /(Can throw 'Data.GI.Base.GError.GError')/
recentManagerLookupItem :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsRecentManager a) =>
a -> Text -> m (Maybe RecentInfo)
recentManagerLookupItem a
manager Text
uri = IO (Maybe RecentInfo) -> m (Maybe RecentInfo)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe RecentInfo) -> m (Maybe RecentInfo))
-> IO (Maybe RecentInfo) -> m (Maybe RecentInfo)
forall a b. (a -> b) -> a -> b
$ do
    Ptr RecentManager
manager' <- a -> IO (Ptr RecentManager)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
manager
    CString
uri' <- Text -> IO CString
textToCString Text
uri
    IO (Maybe RecentInfo) -> IO () -> IO (Maybe RecentInfo)
forall a b. IO a -> IO b -> IO a
onException (do
        Ptr RecentInfo
result <- (Ptr (Ptr GError) -> IO (Ptr RecentInfo)) -> IO (Ptr RecentInfo)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr RecentInfo)) -> IO (Ptr RecentInfo))
-> (Ptr (Ptr GError) -> IO (Ptr RecentInfo)) -> IO (Ptr RecentInfo)
forall a b. (a -> b) -> a -> b
$ Ptr RecentManager
-> CString -> Ptr (Ptr GError) -> IO (Ptr RecentInfo)
gtk_recent_manager_lookup_item Ptr RecentManager
manager' CString
uri'
        Maybe RecentInfo
maybeResult <- Ptr RecentInfo
-> (Ptr RecentInfo -> IO RecentInfo) -> IO (Maybe RecentInfo)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr RecentInfo
result ((Ptr RecentInfo -> IO RecentInfo) -> IO (Maybe RecentInfo))
-> (Ptr RecentInfo -> IO RecentInfo) -> IO (Maybe RecentInfo)
forall a b. (a -> b) -> a -> b
$ \Ptr RecentInfo
result' -> do
            RecentInfo
result'' <- ((ManagedPtr RecentInfo -> RecentInfo)
-> Ptr RecentInfo -> IO RecentInfo
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr RecentInfo -> RecentInfo
Gtk.RecentInfo.RecentInfo) Ptr RecentInfo
result'
            RecentInfo -> IO RecentInfo
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return RecentInfo
result''
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
manager
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uri'
        Maybe RecentInfo -> IO (Maybe RecentInfo)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe RecentInfo
maybeResult
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uri'
     )

#if defined(ENABLE_OVERLOADING)
data RecentManagerLookupItemMethodInfo
instance (signature ~ (T.Text -> m (Maybe Gtk.RecentInfo.RecentInfo)), MonadIO m, IsRecentManager a) => O.OverloadedMethod RecentManagerLookupItemMethodInfo a signature where
    overloadedMethod = recentManagerLookupItem

instance O.OverloadedMethodInfo RecentManagerLookupItemMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.RecentManager.recentManagerLookupItem",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Objects-RecentManager.html#v:recentManagerLookupItem"
        })


#endif

-- method RecentManager::move_item
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "manager"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "RecentManager" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkRecentManager"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "uri"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the URI of a recently used resource"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "new_uri"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the new URI of the recently used resource, or\n   %NULL to remove the item pointed by @uri in the list"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_recent_manager_move_item" gtk_recent_manager_move_item :: 
    Ptr RecentManager ->                    -- manager : TInterface (Name {namespace = "Gtk", name = "RecentManager"})
    CString ->                              -- uri : TBasicType TUTF8
    CString ->                              -- new_uri : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Changes the location of a recently used resource from /@uri@/ to /@newUri@/.
-- 
-- Please note that this function will not affect the resource pointed
-- by the URIs, but only the URI used in the recently used resources list.
-- 
-- /Since: 2.10/
recentManagerMoveItem ::
    (B.CallStack.HasCallStack, MonadIO m, IsRecentManager a) =>
    a
    -- ^ /@manager@/: a t'GI.Gtk.Objects.RecentManager.RecentManager'
    -> T.Text
    -- ^ /@uri@/: the URI of a recently used resource
    -> Maybe (T.Text)
    -- ^ /@newUri@/: the new URI of the recently used resource, or
    --    'P.Nothing' to remove the item pointed by /@uri@/ in the list
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
recentManagerMoveItem :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsRecentManager a) =>
a -> Text -> Maybe Text -> m ()
recentManagerMoveItem a
manager Text
uri Maybe Text
newUri = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr RecentManager
manager' <- a -> IO (Ptr RecentManager)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
manager
    CString
uri' <- Text -> IO CString
textToCString Text
uri
    CString
maybeNewUri <- case Maybe Text
newUri of
        Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jNewUri -> do
            CString
jNewUri' <- Text -> IO CString
textToCString Text
jNewUri
            CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jNewUri'
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr RecentManager
-> CString -> CString -> Ptr (Ptr GError) -> IO CInt
gtk_recent_manager_move_item Ptr RecentManager
manager' CString
uri' CString
maybeNewUri
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
manager
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uri'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeNewUri
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uri'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeNewUri
     )

#if defined(ENABLE_OVERLOADING)
data RecentManagerMoveItemMethodInfo
instance (signature ~ (T.Text -> Maybe (T.Text) -> m ()), MonadIO m, IsRecentManager a) => O.OverloadedMethod RecentManagerMoveItemMethodInfo a signature where
    overloadedMethod = recentManagerMoveItem

instance O.OverloadedMethodInfo RecentManagerMoveItemMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.RecentManager.recentManagerMoveItem",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Objects-RecentManager.html#v:recentManagerMoveItem"
        })


#endif

-- method RecentManager::purge_items
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "manager"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "RecentManager" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkRecentManager"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_recent_manager_purge_items" gtk_recent_manager_purge_items :: 
    Ptr RecentManager ->                    -- manager : TInterface (Name {namespace = "Gtk", name = "RecentManager"})
    Ptr (Ptr GError) ->                     -- error
    IO Int32

-- | Purges every item from the recently used resources list.
-- 
-- /Since: 2.10/
recentManagerPurgeItems ::
    (B.CallStack.HasCallStack, MonadIO m, IsRecentManager a) =>
    a
    -- ^ /@manager@/: a t'GI.Gtk.Objects.RecentManager.RecentManager'
    -> m Int32
    -- ^ __Returns:__ the number of items that have been removed from the
    --   recently used resources list /(Can throw 'Data.GI.Base.GError.GError')/
recentManagerPurgeItems :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsRecentManager a) =>
a -> m Int32
recentManagerPurgeItems a
manager = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr RecentManager
manager' <- a -> IO (Ptr RecentManager)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
manager
    IO Int32 -> IO () -> IO Int32
forall a b. IO a -> IO b -> IO a
onException (do
        Int32
result <- (Ptr (Ptr GError) -> IO Int32) -> IO Int32
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO Int32) -> IO Int32)
-> (Ptr (Ptr GError) -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ Ptr RecentManager -> Ptr (Ptr GError) -> IO Int32
gtk_recent_manager_purge_items Ptr RecentManager
manager'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
manager
        Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result
     ) (do
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data RecentManagerPurgeItemsMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsRecentManager a) => O.OverloadedMethod RecentManagerPurgeItemsMethodInfo a signature where
    overloadedMethod = recentManagerPurgeItems

instance O.OverloadedMethodInfo RecentManagerPurgeItemsMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.RecentManager.recentManagerPurgeItems",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Objects-RecentManager.html#v:recentManagerPurgeItems"
        })


#endif

-- method RecentManager::remove_item
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "manager"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "RecentManager" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkRecentManager"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "uri"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the URI of the item you wish to remove"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_recent_manager_remove_item" gtk_recent_manager_remove_item :: 
    Ptr RecentManager ->                    -- manager : TInterface (Name {namespace = "Gtk", name = "RecentManager"})
    CString ->                              -- uri : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Removes a resource pointed by /@uri@/ from the recently used resources
-- list handled by a recent manager.
-- 
-- /Since: 2.10/
recentManagerRemoveItem ::
    (B.CallStack.HasCallStack, MonadIO m, IsRecentManager a) =>
    a
    -- ^ /@manager@/: a t'GI.Gtk.Objects.RecentManager.RecentManager'
    -> T.Text
    -- ^ /@uri@/: the URI of the item you wish to remove
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
recentManagerRemoveItem :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsRecentManager a) =>
a -> Text -> m ()
recentManagerRemoveItem a
manager Text
uri = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr RecentManager
manager' <- a -> IO (Ptr RecentManager)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
manager
    CString
uri' <- Text -> IO CString
textToCString Text
uri
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr RecentManager -> CString -> Ptr (Ptr GError) -> IO CInt
gtk_recent_manager_remove_item Ptr RecentManager
manager' CString
uri'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
manager
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uri'
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uri'
     )

#if defined(ENABLE_OVERLOADING)
data RecentManagerRemoveItemMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsRecentManager a) => O.OverloadedMethod RecentManagerRemoveItemMethodInfo a signature where
    overloadedMethod = recentManagerRemoveItem

instance O.OverloadedMethodInfo RecentManagerRemoveItemMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.RecentManager.recentManagerRemoveItem",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Objects-RecentManager.html#v:recentManagerRemoveItem"
        })


#endif

-- method RecentManager::get_default
-- method type : MemberFunction
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gtk" , name = "RecentManager" })
-- throws : False
-- Skip return : False

foreign import ccall "gtk_recent_manager_get_default" gtk_recent_manager_get_default :: 
    IO (Ptr RecentManager)

-- | Gets a unique instance of t'GI.Gtk.Objects.RecentManager.RecentManager', that you can share
-- in your application without caring about memory management.
-- 
-- /Since: 2.10/
recentManagerGetDefault ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m RecentManager
    -- ^ __Returns:__ A unique t'GI.Gtk.Objects.RecentManager.RecentManager'. Do not ref or
    --   unref it.
recentManagerGetDefault :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m RecentManager
recentManagerGetDefault  = IO RecentManager -> m RecentManager
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO RecentManager -> m RecentManager)
-> IO RecentManager -> m RecentManager
forall a b. (a -> b) -> a -> b
$ do
    Ptr RecentManager
result <- IO (Ptr RecentManager)
gtk_recent_manager_get_default
    Text -> Ptr RecentManager -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"recentManagerGetDefault" Ptr RecentManager
result
    RecentManager
result' <- ((ManagedPtr RecentManager -> RecentManager)
-> Ptr RecentManager -> IO RecentManager
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr RecentManager -> RecentManager
RecentManager) Ptr RecentManager
result
    RecentManager -> IO RecentManager
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return RecentManager
result'

#if defined(ENABLE_OVERLOADING)
#endif