{- |
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.RecentFilter
    ( 

-- * Exported types
    RecentFilter(..)                        ,
    RecentFilterK                           ,
    toRecentFilter                          ,
    noRecentFilter                          ,


 -- * Methods
-- ** recentFilterAddAge
    recentFilterAddAge                      ,


-- ** recentFilterAddApplication
    recentFilterAddApplication              ,


-- ** recentFilterAddCustom
    recentFilterAddCustom                   ,


-- ** recentFilterAddGroup
    recentFilterAddGroup                    ,


-- ** recentFilterAddMimeType
    recentFilterAddMimeType                 ,


-- ** recentFilterAddPattern
    recentFilterAddPattern                  ,


-- ** recentFilterAddPixbufFormats
    recentFilterAddPixbufFormats            ,


-- ** recentFilterFilter
    recentFilterFilter                      ,


-- ** recentFilterGetName
    recentFilterGetName                     ,


-- ** recentFilterGetNeeded
    recentFilterGetNeeded                   ,


-- ** recentFilterNew
    recentFilterNew                         ,


-- ** recentFilterSetName
    recentFilterSetName                     ,




    ) 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.GLib as GLib
import qualified GI.GObject as GObject

newtype RecentFilter = RecentFilter (ForeignPtr RecentFilter)
foreign import ccall "gtk_recent_filter_get_type"
    c_gtk_recent_filter_get_type :: IO GType

type instance ParentTypes RecentFilter = RecentFilterParentTypes
type RecentFilterParentTypes = '[GObject.Object, Buildable]

instance GObject RecentFilter where
    gobjectIsInitiallyUnowned _ = True
    gobjectType _ = c_gtk_recent_filter_get_type
    

class GObject o => RecentFilterK o
instance (GObject o, IsDescendantOf RecentFilter o) => RecentFilterK o

toRecentFilter :: RecentFilterK o => o -> IO RecentFilter
toRecentFilter = unsafeCastTo RecentFilter

noRecentFilter :: Maybe RecentFilter
noRecentFilter = Nothing

type instance AttributeList RecentFilter = RecentFilterAttributeList
type RecentFilterAttributeList = ('[ ] :: [(Symbol, *)])

type instance SignalList RecentFilter = RecentFilterSignalList
type RecentFilterSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method RecentFilter::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Gtk" "RecentFilter"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_recent_filter_new" gtk_recent_filter_new :: 
    IO (Ptr RecentFilter)


recentFilterNew ::
    (MonadIO m) =>
    m RecentFilter
recentFilterNew  = liftIO $ do
    result <- gtk_recent_filter_new
    checkUnexpectedReturnNULL "gtk_recent_filter_new" result
    result' <- (newObject RecentFilter) result
    return result'

-- method RecentFilter::add_age
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentFilter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "days", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentFilter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "days", argType = TBasicType TInt32, 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_filter_add_age" gtk_recent_filter_add_age :: 
    Ptr RecentFilter ->                     -- _obj : TInterface "Gtk" "RecentFilter"
    Int32 ->                                -- days : TBasicType TInt32
    IO ()


recentFilterAddAge ::
    (MonadIO m, RecentFilterK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- days
    m ()
recentFilterAddAge _obj days = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gtk_recent_filter_add_age _obj' days
    touchManagedPtr _obj
    return ()

-- method RecentFilter::add_application
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentFilter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "application", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentFilter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "application", argType = TBasicType TUTF8, 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_filter_add_application" gtk_recent_filter_add_application :: 
    Ptr RecentFilter ->                     -- _obj : TInterface "Gtk" "RecentFilter"
    CString ->                              -- application : TBasicType TUTF8
    IO ()


recentFilterAddApplication ::
    (MonadIO m, RecentFilterK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- application
    m ()
recentFilterAddApplication _obj application = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    application' <- textToCString application
    gtk_recent_filter_add_application _obj' application'
    touchManagedPtr _obj
    freeMem application'
    return ()

-- method RecentFilter::add_custom
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentFilter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "needed", argType = TInterface "Gtk" "RecentFilterFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "func", argType = TInterface "Gtk" "RecentFilterFunc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeNotified, argClosure = 3, argDestroy = 4, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data_destroy", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentFilter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "needed", argType = TInterface "Gtk" "RecentFilterFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "func", argType = TInterface "Gtk" "RecentFilterFunc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeNotified, argClosure = 3, argDestroy = 4, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_recent_filter_add_custom" gtk_recent_filter_add_custom :: 
    Ptr RecentFilter ->                     -- _obj : TInterface "Gtk" "RecentFilter"
    CUInt ->                                -- needed : TInterface "Gtk" "RecentFilterFlags"
    FunPtr RecentFilterFuncC ->             -- func : TInterface "Gtk" "RecentFilterFunc"
    Ptr () ->                               -- data : TBasicType TVoid
    FunPtr GLib.DestroyNotifyC ->           -- data_destroy : TInterface "GLib" "DestroyNotify"
    IO ()


recentFilterAddCustom ::
    (MonadIO m, RecentFilterK a) =>
    a ->                                    -- _obj
    [RecentFilterFlags] ->                  -- needed
    RecentFilterFunc ->                     -- func
    m ()
recentFilterAddCustom _obj needed func = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let needed' = gflagsToWord needed
    func' <- mkRecentFilterFunc (recentFilterFuncWrapper Nothing func)
    let data_ = castFunPtrToPtr func'
    let data_destroy = safeFreeFunPtrPtr
    gtk_recent_filter_add_custom _obj' needed' func' data_ data_destroy
    touchManagedPtr _obj
    return ()

-- method RecentFilter::add_group
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentFilter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "group", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentFilter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "group", argType = TBasicType TUTF8, 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_filter_add_group" gtk_recent_filter_add_group :: 
    Ptr RecentFilter ->                     -- _obj : TInterface "Gtk" "RecentFilter"
    CString ->                              -- group : TBasicType TUTF8
    IO ()


recentFilterAddGroup ::
    (MonadIO m, RecentFilterK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- group
    m ()
recentFilterAddGroup _obj group = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    group' <- textToCString group
    gtk_recent_filter_add_group _obj' group'
    touchManagedPtr _obj
    freeMem group'
    return ()

-- method RecentFilter::add_mime_type
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentFilter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "mime_type", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentFilter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "mime_type", argType = TBasicType TUTF8, 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_filter_add_mime_type" gtk_recent_filter_add_mime_type :: 
    Ptr RecentFilter ->                     -- _obj : TInterface "Gtk" "RecentFilter"
    CString ->                              -- mime_type : TBasicType TUTF8
    IO ()


recentFilterAddMimeType ::
    (MonadIO m, RecentFilterK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- mime_type
    m ()
recentFilterAddMimeType _obj mime_type = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    mime_type' <- textToCString mime_type
    gtk_recent_filter_add_mime_type _obj' mime_type'
    touchManagedPtr _obj
    freeMem mime_type'
    return ()

-- method RecentFilter::add_pattern
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentFilter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "pattern", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentFilter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "pattern", argType = TBasicType TUTF8, 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_filter_add_pattern" gtk_recent_filter_add_pattern :: 
    Ptr RecentFilter ->                     -- _obj : TInterface "Gtk" "RecentFilter"
    CString ->                              -- pattern : TBasicType TUTF8
    IO ()


recentFilterAddPattern ::
    (MonadIO m, RecentFilterK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- pattern
    m ()
recentFilterAddPattern _obj pattern = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    pattern' <- textToCString pattern
    gtk_recent_filter_add_pattern _obj' pattern'
    touchManagedPtr _obj
    freeMem pattern'
    return ()

-- method RecentFilter::add_pixbuf_formats
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentFilter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentFilter", 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_filter_add_pixbuf_formats" gtk_recent_filter_add_pixbuf_formats :: 
    Ptr RecentFilter ->                     -- _obj : TInterface "Gtk" "RecentFilter"
    IO ()


recentFilterAddPixbufFormats ::
    (MonadIO m, RecentFilterK a) =>
    a ->                                    -- _obj
    m ()
recentFilterAddPixbufFormats _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gtk_recent_filter_add_pixbuf_formats _obj'
    touchManagedPtr _obj
    return ()

-- method RecentFilter::filter
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentFilter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "filter_info", argType = TInterface "Gtk" "RecentFilterInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentFilter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "filter_info", argType = TInterface "Gtk" "RecentFilterInfo", 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_filter_filter" gtk_recent_filter_filter :: 
    Ptr RecentFilter ->                     -- _obj : TInterface "Gtk" "RecentFilter"
    Ptr RecentFilterInfo ->                 -- filter_info : TInterface "Gtk" "RecentFilterInfo"
    IO CInt


recentFilterFilter ::
    (MonadIO m, RecentFilterK a) =>
    a ->                                    -- _obj
    RecentFilterInfo ->                     -- filter_info
    m Bool
recentFilterFilter _obj filter_info = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let filter_info' = unsafeManagedPtrGetPtr filter_info
    result <- gtk_recent_filter_filter _obj' filter_info'
    let result' = (/= 0) result
    touchManagedPtr _obj
    touchManagedPtr filter_info
    return result'

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

foreign import ccall "gtk_recent_filter_get_name" gtk_recent_filter_get_name :: 
    Ptr RecentFilter ->                     -- _obj : TInterface "Gtk" "RecentFilter"
    IO CString


recentFilterGetName ::
    (MonadIO m, RecentFilterK a) =>
    a ->                                    -- _obj
    m T.Text
recentFilterGetName _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_recent_filter_get_name _obj'
    checkUnexpectedReturnNULL "gtk_recent_filter_get_name" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "gtk_recent_filter_get_needed" gtk_recent_filter_get_needed :: 
    Ptr RecentFilter ->                     -- _obj : TInterface "Gtk" "RecentFilter"
    IO CUInt


recentFilterGetNeeded ::
    (MonadIO m, RecentFilterK a) =>
    a ->                                    -- _obj
    m [RecentFilterFlags]
recentFilterGetNeeded _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_recent_filter_get_needed _obj'
    let result' = wordToGFlags result
    touchManagedPtr _obj
    return result'

-- method RecentFilter::set_name
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentFilter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "RecentFilter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, 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_filter_set_name" gtk_recent_filter_set_name :: 
    Ptr RecentFilter ->                     -- _obj : TInterface "Gtk" "RecentFilter"
    CString ->                              -- name : TBasicType TUTF8
    IO ()


recentFilterSetName ::
    (MonadIO m, RecentFilterK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- name
    m ()
recentFilterSetName _obj name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    name' <- textToCString name
    gtk_recent_filter_set_name _obj' name'
    touchManagedPtr _obj
    freeMem name'
    return ()