{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- Completes partial file and directory names given a partial string by
-- looking in the file system for clues. Can return a list of possible
-- completion strings for widget implementations.

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

module GI.Gio.Objects.FilenameCompleter
    ( 

-- * Exported types
    FilenameCompleter(..)                   ,
    IsFilenameCompleter                     ,
    toFilenameCompleter                     ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveFilenameCompleterMethod          ,
#endif


-- ** getCompletionSuffix #method:getCompletionSuffix#

#if defined(ENABLE_OVERLOADING)
    FilenameCompleterGetCompletionSuffixMethodInfo,
#endif
    filenameCompleterGetCompletionSuffix    ,


-- ** getCompletions #method:getCompletions#

#if defined(ENABLE_OVERLOADING)
    FilenameCompleterGetCompletionsMethodInfo,
#endif
    filenameCompleterGetCompletions         ,


-- ** new #method:new#

    filenameCompleterNew                    ,


-- ** setDirsOnly #method:setDirsOnly#

#if defined(ENABLE_OVERLOADING)
    FilenameCompleterSetDirsOnlyMethodInfo  ,
#endif
    filenameCompleterSetDirsOnly            ,




 -- * Signals
-- ** gotCompletionData #signal:gotCompletionData#

    C_FilenameCompleterGotCompletionDataCallback,
    FilenameCompleterGotCompletionDataCallback,
#if defined(ENABLE_OVERLOADING)
    FilenameCompleterGotCompletionDataSignalInfo,
#endif
    afterFilenameCompleterGotCompletionData ,
    genClosure_FilenameCompleterGotCompletionData,
    mk_FilenameCompleterGotCompletionDataCallback,
    noFilenameCompleterGotCompletionDataCallback,
    onFilenameCompleterGotCompletionData    ,
    wrap_FilenameCompleterGotCompletionDataCallback,




    ) 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.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
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.Text as T
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 GI.GObject.Objects.Object as GObject.Object

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

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

foreign import ccall "g_filename_completer_get_type"
    c_g_filename_completer_get_type :: IO B.Types.GType

instance B.Types.TypedObject FilenameCompleter where
    glibType :: IO GType
glibType = IO GType
c_g_filename_completer_get_type

instance B.Types.GObject FilenameCompleter

-- | Convert 'FilenameCompleter' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue FilenameCompleter where
    toGValue :: FilenameCompleter -> IO GValue
toGValue FilenameCompleter
o = do
        GType
gtype <- IO GType
c_g_filename_completer_get_type
        FilenameCompleter
-> (Ptr FilenameCompleter -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr FilenameCompleter
o (GType
-> (GValue -> Ptr FilenameCompleter -> IO ())
-> Ptr FilenameCompleter
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr FilenameCompleter -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
        
    fromGValue :: GValue -> IO FilenameCompleter
fromGValue GValue
gv = do
        Ptr FilenameCompleter
ptr <- GValue -> IO (Ptr FilenameCompleter)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr FilenameCompleter)
        (ManagedPtr FilenameCompleter -> FilenameCompleter)
-> Ptr FilenameCompleter -> IO FilenameCompleter
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr FilenameCompleter -> FilenameCompleter
FilenameCompleter Ptr FilenameCompleter
ptr
        
    

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

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

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

#if defined(ENABLE_OVERLOADING)
type family ResolveFilenameCompleterMethod (t :: Symbol) (o :: *) :: * where
    ResolveFilenameCompleterMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveFilenameCompleterMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveFilenameCompleterMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveFilenameCompleterMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveFilenameCompleterMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveFilenameCompleterMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveFilenameCompleterMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveFilenameCompleterMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveFilenameCompleterMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveFilenameCompleterMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveFilenameCompleterMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveFilenameCompleterMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveFilenameCompleterMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveFilenameCompleterMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveFilenameCompleterMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveFilenameCompleterMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveFilenameCompleterMethod "getCompletionSuffix" o = FilenameCompleterGetCompletionSuffixMethodInfo
    ResolveFilenameCompleterMethod "getCompletions" o = FilenameCompleterGetCompletionsMethodInfo
    ResolveFilenameCompleterMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveFilenameCompleterMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveFilenameCompleterMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveFilenameCompleterMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveFilenameCompleterMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveFilenameCompleterMethod "setDirsOnly" o = FilenameCompleterSetDirsOnlyMethodInfo
    ResolveFilenameCompleterMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveFilenameCompleterMethod l o = O.MethodResolutionFailed l o

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

#endif

-- signal FilenameCompleter::got-completion-data
-- | Emitted when the file name completion information comes available.
type FilenameCompleterGotCompletionDataCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `FilenameCompleterGotCompletionDataCallback`@.
noFilenameCompleterGotCompletionDataCallback :: Maybe FilenameCompleterGotCompletionDataCallback
noFilenameCompleterGotCompletionDataCallback :: Maybe (IO ())
noFilenameCompleterGotCompletionDataCallback = Maybe (IO ())
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_FilenameCompleterGotCompletionDataCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

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

-- | Wrap the callback into a `GClosure`.
genClosure_FilenameCompleterGotCompletionData :: MonadIO m => FilenameCompleterGotCompletionDataCallback -> m (GClosure C_FilenameCompleterGotCompletionDataCallback)
genClosure_FilenameCompleterGotCompletionData :: IO () -> m (GClosure C_FilenameCompleterGotCompletionDataCallback)
genClosure_FilenameCompleterGotCompletionData IO ()
cb = IO (GClosure C_FilenameCompleterGotCompletionDataCallback)
-> m (GClosure C_FilenameCompleterGotCompletionDataCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_FilenameCompleterGotCompletionDataCallback)
 -> m (GClosure C_FilenameCompleterGotCompletionDataCallback))
-> IO (GClosure C_FilenameCompleterGotCompletionDataCallback)
-> m (GClosure C_FilenameCompleterGotCompletionDataCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_FilenameCompleterGotCompletionDataCallback
cb' = IO () -> C_FilenameCompleterGotCompletionDataCallback
wrap_FilenameCompleterGotCompletionDataCallback IO ()
cb
    C_FilenameCompleterGotCompletionDataCallback
-> IO (FunPtr C_FilenameCompleterGotCompletionDataCallback)
mk_FilenameCompleterGotCompletionDataCallback C_FilenameCompleterGotCompletionDataCallback
cb' IO (FunPtr C_FilenameCompleterGotCompletionDataCallback)
-> (FunPtr C_FilenameCompleterGotCompletionDataCallback
    -> IO (GClosure C_FilenameCompleterGotCompletionDataCallback))
-> IO (GClosure C_FilenameCompleterGotCompletionDataCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_FilenameCompleterGotCompletionDataCallback
-> IO (GClosure C_FilenameCompleterGotCompletionDataCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `FilenameCompleterGotCompletionDataCallback` into a `C_FilenameCompleterGotCompletionDataCallback`.
wrap_FilenameCompleterGotCompletionDataCallback ::
    FilenameCompleterGotCompletionDataCallback ->
    C_FilenameCompleterGotCompletionDataCallback
wrap_FilenameCompleterGotCompletionDataCallback :: IO () -> C_FilenameCompleterGotCompletionDataCallback
wrap_FilenameCompleterGotCompletionDataCallback IO ()
_cb Ptr ()
_ Ptr ()
_ = do
    IO ()
_cb 


-- | Connect a signal handler for the [gotCompletionData](#signal:gotCompletionData) 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' filenameCompleter #gotCompletionData callback
-- @
-- 
-- 
onFilenameCompleterGotCompletionData :: (IsFilenameCompleter a, MonadIO m) => a -> FilenameCompleterGotCompletionDataCallback -> m SignalHandlerId
onFilenameCompleterGotCompletionData :: a -> IO () -> m SignalHandlerId
onFilenameCompleterGotCompletionData a
obj IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
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 cb' :: C_FilenameCompleterGotCompletionDataCallback
cb' = IO () -> C_FilenameCompleterGotCompletionDataCallback
wrap_FilenameCompleterGotCompletionDataCallback IO ()
cb
    FunPtr C_FilenameCompleterGotCompletionDataCallback
cb'' <- C_FilenameCompleterGotCompletionDataCallback
-> IO (FunPtr C_FilenameCompleterGotCompletionDataCallback)
mk_FilenameCompleterGotCompletionDataCallback C_FilenameCompleterGotCompletionDataCallback
cb'
    a
-> Text
-> FunPtr C_FilenameCompleterGotCompletionDataCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"got-completion-data" FunPtr C_FilenameCompleterGotCompletionDataCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [gotCompletionData](#signal:gotCompletionData) 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' filenameCompleter #gotCompletionData callback
-- @
-- 
-- 
afterFilenameCompleterGotCompletionData :: (IsFilenameCompleter a, MonadIO m) => a -> FilenameCompleterGotCompletionDataCallback -> m SignalHandlerId
afterFilenameCompleterGotCompletionData :: a -> IO () -> m SignalHandlerId
afterFilenameCompleterGotCompletionData a
obj IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
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 cb' :: C_FilenameCompleterGotCompletionDataCallback
cb' = IO () -> C_FilenameCompleterGotCompletionDataCallback
wrap_FilenameCompleterGotCompletionDataCallback IO ()
cb
    FunPtr C_FilenameCompleterGotCompletionDataCallback
cb'' <- C_FilenameCompleterGotCompletionDataCallback
-> IO (FunPtr C_FilenameCompleterGotCompletionDataCallback)
mk_FilenameCompleterGotCompletionDataCallback C_FilenameCompleterGotCompletionDataCallback
cb'
    a
-> Text
-> FunPtr C_FilenameCompleterGotCompletionDataCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"got-completion-data" FunPtr C_FilenameCompleterGotCompletionDataCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data FilenameCompleterGotCompletionDataSignalInfo
instance SignalInfo FilenameCompleterGotCompletionDataSignalInfo where
    type HaskellCallbackType FilenameCompleterGotCompletionDataSignalInfo = FilenameCompleterGotCompletionDataCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_FilenameCompleterGotCompletionDataCallback cb
        cb'' <- mk_FilenameCompleterGotCompletionDataCallback cb'
        connectSignalFunPtr obj "got-completion-data" cb'' connectMode detail

#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList FilenameCompleter
type instance O.AttributeList FilenameCompleter = FilenameCompleterAttributeList
type FilenameCompleterAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList FilenameCompleter = FilenameCompleterSignalList
type FilenameCompleterSignalList = ('[ '("gotCompletionData", FilenameCompleterGotCompletionDataSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

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

foreign import ccall "g_filename_completer_new" g_filename_completer_new :: 
    IO (Ptr FilenameCompleter)

-- | Creates a new filename completer.
filenameCompleterNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m FilenameCompleter
    -- ^ __Returns:__ a t'GI.Gio.Objects.FilenameCompleter.FilenameCompleter'.
filenameCompleterNew :: m FilenameCompleter
filenameCompleterNew  = IO FilenameCompleter -> m FilenameCompleter
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FilenameCompleter -> m FilenameCompleter)
-> IO FilenameCompleter -> m FilenameCompleter
forall a b. (a -> b) -> a -> b
$ do
    Ptr FilenameCompleter
result <- IO (Ptr FilenameCompleter)
g_filename_completer_new
    Text -> Ptr FilenameCompleter -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"filenameCompleterNew" Ptr FilenameCompleter
result
    FilenameCompleter
result' <- ((ManagedPtr FilenameCompleter -> FilenameCompleter)
-> Ptr FilenameCompleter -> IO FilenameCompleter
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FilenameCompleter -> FilenameCompleter
FilenameCompleter) Ptr FilenameCompleter
result
    FilenameCompleter -> IO FilenameCompleter
forall (m :: * -> *) a. Monad m => a -> m a
return FilenameCompleter
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method FilenameCompleter::get_completion_suffix
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "completer"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "FilenameCompleter" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the filename completer."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "initial_text"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "text to be completed."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_filename_completer_get_completion_suffix" g_filename_completer_get_completion_suffix :: 
    Ptr FilenameCompleter ->                -- completer : TInterface (Name {namespace = "Gio", name = "FilenameCompleter"})
    CString ->                              -- initial_text : TBasicType TUTF8
    IO CString

-- | Obtains a completion for /@initialText@/ from /@completer@/.
filenameCompleterGetCompletionSuffix ::
    (B.CallStack.HasCallStack, MonadIO m, IsFilenameCompleter a) =>
    a
    -- ^ /@completer@/: the filename completer.
    -> T.Text
    -- ^ /@initialText@/: text to be completed.
    -> m T.Text
    -- ^ __Returns:__ a completed string, or 'P.Nothing' if no completion exists.
    --     This string is not owned by GIO, so remember to 'GI.GLib.Functions.free' it
    --     when finished.
filenameCompleterGetCompletionSuffix :: a -> Text -> m Text
filenameCompleterGetCompletionSuffix a
completer Text
initialText = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr FilenameCompleter
completer' <- a -> IO (Ptr FilenameCompleter)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
completer
    CString
initialText' <- Text -> IO CString
textToCString Text
initialText
    CString
result <- Ptr FilenameCompleter -> CString -> IO CString
g_filename_completer_get_completion_suffix Ptr FilenameCompleter
completer' CString
initialText'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"filenameCompleterGetCompletionSuffix" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
completer
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
initialText'
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if defined(ENABLE_OVERLOADING)
data FilenameCompleterGetCompletionSuffixMethodInfo
instance (signature ~ (T.Text -> m T.Text), MonadIO m, IsFilenameCompleter a) => O.MethodInfo FilenameCompleterGetCompletionSuffixMethodInfo a signature where
    overloadedMethod = filenameCompleterGetCompletionSuffix

#endif

-- method FilenameCompleter::get_completions
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "completer"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "FilenameCompleter" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the filename completer."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "initial_text"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "text to be completed."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "g_filename_completer_get_completions" g_filename_completer_get_completions :: 
    Ptr FilenameCompleter ->                -- completer : TInterface (Name {namespace = "Gio", name = "FilenameCompleter"})
    CString ->                              -- initial_text : TBasicType TUTF8
    IO (Ptr CString)

-- | Gets an array of completion strings for a given initial text.
filenameCompleterGetCompletions ::
    (B.CallStack.HasCallStack, MonadIO m, IsFilenameCompleter a) =>
    a
    -- ^ /@completer@/: the filename completer.
    -> T.Text
    -- ^ /@initialText@/: text to be completed.
    -> m [T.Text]
    -- ^ __Returns:__ array of strings with possible completions for /@initialText@/.
    -- This array must be freed by 'GI.GLib.Functions.strfreev' when finished.
filenameCompleterGetCompletions :: a -> Text -> m [Text]
filenameCompleterGetCompletions a
completer Text
initialText = IO [Text] -> m [Text]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Text] -> m [Text]) -> IO [Text] -> m [Text]
forall a b. (a -> b) -> a -> b
$ do
    Ptr FilenameCompleter
completer' <- a -> IO (Ptr FilenameCompleter)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
completer
    CString
initialText' <- Text -> IO CString
textToCString Text
initialText
    Ptr CString
result <- Ptr FilenameCompleter -> CString -> IO (Ptr CString)
g_filename_completer_get_completions Ptr FilenameCompleter
completer' CString
initialText'
    Text -> Ptr CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"filenameCompleterGetCompletions" Ptr CString
result
    [Text]
result' <- HasCallStack => Ptr CString -> IO [Text]
Ptr CString -> IO [Text]
unpackZeroTerminatedUTF8CArray Ptr CString
result
    (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
completer
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
initialText'
    [Text] -> IO [Text]
forall (m :: * -> *) a. Monad m => a -> m a
return [Text]
result'

#if defined(ENABLE_OVERLOADING)
data FilenameCompleterGetCompletionsMethodInfo
instance (signature ~ (T.Text -> m [T.Text]), MonadIO m, IsFilenameCompleter a) => O.MethodInfo FilenameCompleterGetCompletionsMethodInfo a signature where
    overloadedMethod = filenameCompleterGetCompletions

#endif

-- method FilenameCompleter::set_dirs_only
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "completer"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "FilenameCompleter" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the filename completer."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "dirs_only"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #gboolean." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_filename_completer_set_dirs_only" g_filename_completer_set_dirs_only :: 
    Ptr FilenameCompleter ->                -- completer : TInterface (Name {namespace = "Gio", name = "FilenameCompleter"})
    CInt ->                                 -- dirs_only : TBasicType TBoolean
    IO ()

-- | If /@dirsOnly@/ is 'P.True', /@completer@/ will only
-- complete directory names, and not file names.
filenameCompleterSetDirsOnly ::
    (B.CallStack.HasCallStack, MonadIO m, IsFilenameCompleter a) =>
    a
    -- ^ /@completer@/: the filename completer.
    -> Bool
    -- ^ /@dirsOnly@/: a t'P.Bool'.
    -> m ()
filenameCompleterSetDirsOnly :: a -> Bool -> m ()
filenameCompleterSetDirsOnly a
completer Bool
dirsOnly = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr FilenameCompleter
completer' <- a -> IO (Ptr FilenameCompleter)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
completer
    let dirsOnly' :: CInt
dirsOnly' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
dirsOnly
    Ptr FilenameCompleter -> CInt -> IO ()
g_filename_completer_set_dirs_only Ptr FilenameCompleter
completer' CInt
dirsOnly'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
completer
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data FilenameCompleterSetDirsOnlyMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsFilenameCompleter a) => O.MethodInfo FilenameCompleterSetDirsOnlyMethodInfo a signature where
    overloadedMethod = filenameCompleterSetDirsOnly

#endif