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


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- A @GdkContentProvider@ is used to provide content for the clipboard or
-- for drag-and-drop operations in a number of formats.
-- 
-- To create a @GdkContentProvider@, use 'GI.Gdk.Objects.ContentProvider.contentProviderNewForValue'
-- or 'GI.Gdk.Objects.ContentProvider.contentProviderNewForBytes'.
-- 
-- GDK knows how to handle common text and image formats out-of-the-box. See
-- t'GI.Gdk.Objects.ContentSerializer.ContentSerializer' and t'GI.Gdk.Objects.ContentDeserializer.ContentDeserializer' if you want
-- to add support for application-specific data formats.

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

module GI.Gdk.Objects.ContentProvider
    ( 

-- * Exported types
    ContentProvider(..)                     ,
    IsContentProvider                       ,
    toContentProvider                       ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [contentChanged]("GI.Gdk.Objects.ContentProvider#g:method:contentChanged"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refFormats]("GI.Gdk.Objects.ContentProvider#g:method:refFormats"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [refStorableFormats]("GI.Gdk.Objects.ContentProvider#g:method:refStorableFormats"), [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"), [writeMimeTypeAsync]("GI.Gdk.Objects.ContentProvider#g:method:writeMimeTypeAsync"), [writeMimeTypeFinish]("GI.Gdk.Objects.ContentProvider#g:method:writeMimeTypeFinish").
-- 
-- ==== Getters
-- [getData]("GI.GObject.Objects.Object#g:method:getData"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getValue]("GI.Gdk.Objects.ContentProvider#g:method:getValue").
-- 
-- ==== 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)
    ResolveContentProviderMethod            ,
#endif

-- ** contentChanged #method:contentChanged#

#if defined(ENABLE_OVERLOADING)
    ContentProviderContentChangedMethodInfo ,
#endif
    contentProviderContentChanged           ,


-- ** getValue #method:getValue#

#if defined(ENABLE_OVERLOADING)
    ContentProviderGetValueMethodInfo       ,
#endif
    contentProviderGetValue                 ,


-- ** newForBytes #method:newForBytes#

    contentProviderNewForBytes              ,


-- ** newForValue #method:newForValue#

    contentProviderNewForValue              ,


-- ** newUnion #method:newUnion#

    contentProviderNewUnion                 ,


-- ** refFormats #method:refFormats#

#if defined(ENABLE_OVERLOADING)
    ContentProviderRefFormatsMethodInfo     ,
#endif
    contentProviderRefFormats               ,


-- ** refStorableFormats #method:refStorableFormats#

#if defined(ENABLE_OVERLOADING)
    ContentProviderRefStorableFormatsMethodInfo,
#endif
    contentProviderRefStorableFormats       ,


-- ** writeMimeTypeAsync #method:writeMimeTypeAsync#

#if defined(ENABLE_OVERLOADING)
    ContentProviderWriteMimeTypeAsyncMethodInfo,
#endif
    contentProviderWriteMimeTypeAsync       ,


-- ** writeMimeTypeFinish #method:writeMimeTypeFinish#

#if defined(ENABLE_OVERLOADING)
    ContentProviderWriteMimeTypeFinishMethodInfo,
#endif
    contentProviderWriteMimeTypeFinish      ,




 -- * Properties


-- ** formats #attr:formats#
-- | The possible formats that the provider can provide its data in.

#if defined(ENABLE_OVERLOADING)
    ContentProviderFormatsPropertyInfo      ,
#endif
#if defined(ENABLE_OVERLOADING)
    contentProviderFormats                  ,
#endif
    getContentProviderFormats               ,


-- ** storableFormats #attr:storableFormats#
-- | The subset of formats that clipboard managers should store this provider\'s data in.

#if defined(ENABLE_OVERLOADING)
    ContentProviderStorableFormatsPropertyInfo,
#endif
#if defined(ENABLE_OVERLOADING)
    contentProviderStorableFormats          ,
#endif
    getContentProviderStorableFormats       ,




 -- * Signals


-- ** contentChanged #signal:contentChanged#

    ContentProviderContentChangedCallback   ,
#if defined(ENABLE_OVERLOADING)
    ContentProviderContentChangedSignalInfo ,
#endif
    afterContentProviderContentChanged      ,
    onContentProviderContentChanged         ,




    ) 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.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.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gdk.Structs.ContentFormats as Gdk.ContentFormats
import qualified GI.Gio.Callbacks as Gio.Callbacks
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import qualified GI.Gio.Objects.OutputStream as Gio.OutputStream

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

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

foreign import ccall "gdk_content_provider_get_type"
    c_gdk_content_provider_get_type :: IO B.Types.GType

instance B.Types.TypedObject ContentProvider where
    glibType :: IO GType
glibType = IO GType
c_gdk_content_provider_get_type

instance B.Types.GObject ContentProvider

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

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

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

-- | Convert 'ContentProvider' 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 ContentProvider) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gdk_content_provider_get_type
    gvalueSet_ :: Ptr GValue -> Maybe ContentProvider -> IO ()
gvalueSet_ Ptr GValue
gv Maybe ContentProvider
P.Nothing = Ptr GValue -> Ptr ContentProvider -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr ContentProvider
forall a. Ptr a
FP.nullPtr :: FP.Ptr ContentProvider)
    gvalueSet_ Ptr GValue
gv (P.Just ContentProvider
obj) = ContentProvider -> (Ptr ContentProvider -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr ContentProvider
obj (Ptr GValue -> Ptr ContentProvider -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe ContentProvider)
gvalueGet_ Ptr GValue
gv = do
        Ptr ContentProvider
ptr <- Ptr GValue -> IO (Ptr ContentProvider)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr ContentProvider)
        if Ptr ContentProvider
ptr Ptr ContentProvider -> Ptr ContentProvider -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr ContentProvider
forall a. Ptr a
FP.nullPtr
        then ContentProvider -> Maybe ContentProvider
forall a. a -> Maybe a
P.Just (ContentProvider -> Maybe ContentProvider)
-> IO ContentProvider -> IO (Maybe ContentProvider)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr ContentProvider -> ContentProvider)
-> Ptr ContentProvider -> IO ContentProvider
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr ContentProvider -> ContentProvider
ContentProvider Ptr ContentProvider
ptr
        else Maybe ContentProvider -> IO (Maybe ContentProvider)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe ContentProvider
forall a. Maybe a
P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveContentProviderMethod (t :: Symbol) (o :: *) :: * where
    ResolveContentProviderMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveContentProviderMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveContentProviderMethod "contentChanged" o = ContentProviderContentChangedMethodInfo
    ResolveContentProviderMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveContentProviderMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveContentProviderMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveContentProviderMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveContentProviderMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveContentProviderMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveContentProviderMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveContentProviderMethod "refFormats" o = ContentProviderRefFormatsMethodInfo
    ResolveContentProviderMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveContentProviderMethod "refStorableFormats" o = ContentProviderRefStorableFormatsMethodInfo
    ResolveContentProviderMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveContentProviderMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveContentProviderMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveContentProviderMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveContentProviderMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveContentProviderMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveContentProviderMethod "writeMimeTypeAsync" o = ContentProviderWriteMimeTypeAsyncMethodInfo
    ResolveContentProviderMethod "writeMimeTypeFinish" o = ContentProviderWriteMimeTypeFinishMethodInfo
    ResolveContentProviderMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveContentProviderMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveContentProviderMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveContentProviderMethod "getValue" o = ContentProviderGetValueMethodInfo
    ResolveContentProviderMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveContentProviderMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveContentProviderMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveContentProviderMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveContentProviderMethod t ContentProvider, O.OverloadedMethod info ContentProvider p) => OL.IsLabel t (ContentProvider -> 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 ~ ResolveContentProviderMethod t ContentProvider, O.OverloadedMethod info ContentProvider p, R.HasField t ContentProvider p) => R.HasField t ContentProvider p where
    getField = O.overloadedMethod @info

#endif

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

#endif

-- signal ContentProvider::content-changed
-- | Emitted whenever the content provided by this provider has changed.
type ContentProviderContentChangedCallback =
    IO ()

type C_ContentProviderContentChangedCallback =
    Ptr ContentProvider ->                  -- object
    Ptr () ->                               -- user_data
    IO ()

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

wrap_ContentProviderContentChangedCallback :: 
    GObject a => (a -> ContentProviderContentChangedCallback) ->
    C_ContentProviderContentChangedCallback
wrap_ContentProviderContentChangedCallback :: forall a.
GObject a =>
(a -> IO ()) -> C_ContentProviderContentChangedCallback
wrap_ContentProviderContentChangedCallback a -> IO ()
gi'cb Ptr ContentProvider
gi'selfPtr Ptr ()
_ = do
    Ptr ContentProvider -> (ContentProvider -> IO ()) -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient Ptr ContentProvider
gi'selfPtr ((ContentProvider -> IO ()) -> IO ())
-> (ContentProvider -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ContentProvider
gi'self -> a -> IO ()
gi'cb (ContentProvider -> a
forall a b. Coercible a b => a -> b
Coerce.coerce ContentProvider
gi'self) 


-- | Connect a signal handler for the [contentChanged](#signal:contentChanged) 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' contentProvider #contentChanged callback
-- @
-- 
-- 
onContentProviderContentChanged :: (IsContentProvider a, MonadIO m) => a -> ((?self :: a) => ContentProviderContentChangedCallback) -> m SignalHandlerId
onContentProviderContentChanged :: forall a (m :: * -> *).
(IsContentProvider a, MonadIO m) =>
a -> ((?self::a) => IO ()) -> m SignalHandlerId
onContentProviderContentChanged 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_ContentProviderContentChangedCallback
wrapped' = (a -> IO ()) -> C_ContentProviderContentChangedCallback
forall a.
GObject a =>
(a -> IO ()) -> C_ContentProviderContentChangedCallback
wrap_ContentProviderContentChangedCallback a -> IO ()
wrapped
    FunPtr C_ContentProviderContentChangedCallback
wrapped'' <- C_ContentProviderContentChangedCallback
-> IO (FunPtr C_ContentProviderContentChangedCallback)
mk_ContentProviderContentChangedCallback C_ContentProviderContentChangedCallback
wrapped'
    a
-> Text
-> FunPtr C_ContentProviderContentChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"content-changed" FunPtr C_ContentProviderContentChangedCallback
wrapped'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [contentChanged](#signal:contentChanged) 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' contentProvider #contentChanged 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.
-- 
afterContentProviderContentChanged :: (IsContentProvider a, MonadIO m) => a -> ((?self :: a) => ContentProviderContentChangedCallback) -> m SignalHandlerId
afterContentProviderContentChanged :: forall a (m :: * -> *).
(IsContentProvider a, MonadIO m) =>
a -> ((?self::a) => IO ()) -> m SignalHandlerId
afterContentProviderContentChanged 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_ContentProviderContentChangedCallback
wrapped' = (a -> IO ()) -> C_ContentProviderContentChangedCallback
forall a.
GObject a =>
(a -> IO ()) -> C_ContentProviderContentChangedCallback
wrap_ContentProviderContentChangedCallback a -> IO ()
wrapped
    FunPtr C_ContentProviderContentChangedCallback
wrapped'' <- C_ContentProviderContentChangedCallback
-> IO (FunPtr C_ContentProviderContentChangedCallback)
mk_ContentProviderContentChangedCallback C_ContentProviderContentChangedCallback
wrapped'
    a
-> Text
-> FunPtr C_ContentProviderContentChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"content-changed" FunPtr C_ContentProviderContentChangedCallback
wrapped'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data ContentProviderContentChangedSignalInfo
instance SignalInfo ContentProviderContentChangedSignalInfo where
    type HaskellCallbackType ContentProviderContentChangedSignalInfo = ContentProviderContentChangedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_ContentProviderContentChangedCallback cb
        cb'' <- mk_ContentProviderContentChangedCallback cb'
        connectSignalFunPtr obj "content-changed" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gdk.Objects.ContentProvider::content-changed"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.5/docs/GI-Gdk-Objects-ContentProvider.html#g:signal:contentChanged"})

#endif

-- VVV Prop "formats"
   -- Type: TInterface (Name {namespace = "Gdk", name = "ContentFormats"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@formats@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' contentProvider #formats
-- @
getContentProviderFormats :: (MonadIO m, IsContentProvider o) => o -> m (Maybe Gdk.ContentFormats.ContentFormats)
getContentProviderFormats :: forall (m :: * -> *) o.
(MonadIO m, IsContentProvider o) =>
o -> m (Maybe ContentFormats)
getContentProviderFormats o
obj = IO (Maybe ContentFormats) -> m (Maybe ContentFormats)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe ContentFormats) -> m (Maybe ContentFormats))
-> IO (Maybe ContentFormats) -> m (Maybe ContentFormats)
forall a b. (a -> b) -> a -> b
$ o
-> String
-> (ManagedPtr ContentFormats -> ContentFormats)
-> IO (Maybe ContentFormats)
forall a b.
(GObject a, GBoxed b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyBoxed o
obj String
"formats" ManagedPtr ContentFormats -> ContentFormats
Gdk.ContentFormats.ContentFormats

#if defined(ENABLE_OVERLOADING)
data ContentProviderFormatsPropertyInfo
instance AttrInfo ContentProviderFormatsPropertyInfo where
    type AttrAllowedOps ContentProviderFormatsPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint ContentProviderFormatsPropertyInfo = IsContentProvider
    type AttrSetTypeConstraint ContentProviderFormatsPropertyInfo = (~) ()
    type AttrTransferTypeConstraint ContentProviderFormatsPropertyInfo = (~) ()
    type AttrTransferType ContentProviderFormatsPropertyInfo = ()
    type AttrGetType ContentProviderFormatsPropertyInfo = (Maybe Gdk.ContentFormats.ContentFormats)
    type AttrLabel ContentProviderFormatsPropertyInfo = "formats"
    type AttrOrigin ContentProviderFormatsPropertyInfo = ContentProvider
    attrGet = getContentProviderFormats
    attrSet = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gdk.Objects.ContentProvider.formats"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.5/docs/GI-Gdk-Objects-ContentProvider.html#g:attr:formats"
        })
#endif

-- VVV Prop "storable-formats"
   -- Type: TInterface (Name {namespace = "Gdk", name = "ContentFormats"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@storable-formats@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' contentProvider #storableFormats
-- @
getContentProviderStorableFormats :: (MonadIO m, IsContentProvider o) => o -> m (Maybe Gdk.ContentFormats.ContentFormats)
getContentProviderStorableFormats :: forall (m :: * -> *) o.
(MonadIO m, IsContentProvider o) =>
o -> m (Maybe ContentFormats)
getContentProviderStorableFormats o
obj = IO (Maybe ContentFormats) -> m (Maybe ContentFormats)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe ContentFormats) -> m (Maybe ContentFormats))
-> IO (Maybe ContentFormats) -> m (Maybe ContentFormats)
forall a b. (a -> b) -> a -> b
$ o
-> String
-> (ManagedPtr ContentFormats -> ContentFormats)
-> IO (Maybe ContentFormats)
forall a b.
(GObject a, GBoxed b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyBoxed o
obj String
"storable-formats" ManagedPtr ContentFormats -> ContentFormats
Gdk.ContentFormats.ContentFormats

#if defined(ENABLE_OVERLOADING)
data ContentProviderStorableFormatsPropertyInfo
instance AttrInfo ContentProviderStorableFormatsPropertyInfo where
    type AttrAllowedOps ContentProviderStorableFormatsPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint ContentProviderStorableFormatsPropertyInfo = IsContentProvider
    type AttrSetTypeConstraint ContentProviderStorableFormatsPropertyInfo = (~) ()
    type AttrTransferTypeConstraint ContentProviderStorableFormatsPropertyInfo = (~) ()
    type AttrTransferType ContentProviderStorableFormatsPropertyInfo = ()
    type AttrGetType ContentProviderStorableFormatsPropertyInfo = (Maybe Gdk.ContentFormats.ContentFormats)
    type AttrLabel ContentProviderStorableFormatsPropertyInfo = "storable-formats"
    type AttrOrigin ContentProviderStorableFormatsPropertyInfo = ContentProvider
    attrGet = getContentProviderStorableFormats
    attrSet = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gdk.Objects.ContentProvider.storableFormats"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.5/docs/GI-Gdk-Objects-ContentProvider.html#g:attr:storableFormats"
        })
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList ContentProvider
type instance O.AttributeList ContentProvider = ContentProviderAttributeList
type ContentProviderAttributeList = ('[ '("formats", ContentProviderFormatsPropertyInfo), '("storableFormats", ContentProviderStorableFormatsPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
contentProviderFormats :: AttrLabelProxy "formats"
contentProviderFormats = AttrLabelProxy

contentProviderStorableFormats :: AttrLabelProxy "storableFormats"
contentProviderStorableFormats = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList ContentProvider = ContentProviderSignalList
type ContentProviderSignalList = ('[ '("contentChanged", ContentProviderContentChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method ContentProvider::new_for_bytes
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "mime_type"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the mime type" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "bytes"
--           , argType = TInterface Name { namespace = "GLib" , name = "Bytes" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a `GBytes` with the data for @mime_type"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gdk" , name = "ContentProvider" })
-- throws : False
-- Skip return : False

foreign import ccall "gdk_content_provider_new_for_bytes" gdk_content_provider_new_for_bytes :: 
    CString ->                              -- mime_type : TBasicType TUTF8
    Ptr GLib.Bytes.Bytes ->                 -- bytes : TInterface (Name {namespace = "GLib", name = "Bytes"})
    IO (Ptr ContentProvider)

-- | Create a content provider that provides the given /@bytes@/ as data for
-- the given /@mimeType@/.
contentProviderNewForBytes ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@mimeType@/: the mime type
    -> GLib.Bytes.Bytes
    -- ^ /@bytes@/: a @GBytes@ with the data for /@mimeType@/
    -> m ContentProvider
    -- ^ __Returns:__ a new @GdkContentProvider@
contentProviderNewForBytes :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Bytes -> m ContentProvider
contentProviderNewForBytes Text
mimeType Bytes
bytes = IO ContentProvider -> m ContentProvider
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ContentProvider -> m ContentProvider)
-> IO ContentProvider -> m ContentProvider
forall a b. (a -> b) -> a -> b
$ do
    CString
mimeType' <- Text -> IO CString
textToCString Text
mimeType
    Ptr Bytes
bytes' <- Bytes -> IO (Ptr Bytes)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Bytes
bytes
    Ptr ContentProvider
result <- CString -> Ptr Bytes -> IO (Ptr ContentProvider)
gdk_content_provider_new_for_bytes CString
mimeType' Ptr Bytes
bytes'
    Text -> Ptr ContentProvider -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"contentProviderNewForBytes" Ptr ContentProvider
result
    ContentProvider
result' <- ((ManagedPtr ContentProvider -> ContentProvider)
-> Ptr ContentProvider -> IO ContentProvider
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr ContentProvider -> ContentProvider
ContentProvider) Ptr ContentProvider
result
    Bytes -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Bytes
bytes
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
mimeType'
    ContentProvider -> IO ContentProvider
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ContentProvider
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method ContentProvider::new_for_value
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a `GValue`" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gdk" , name = "ContentProvider" })
-- throws : False
-- Skip return : False

foreign import ccall "gdk_content_provider_new_for_value" gdk_content_provider_new_for_value :: 
    Ptr GValue ->                           -- value : TGValue
    IO (Ptr ContentProvider)

-- | Create a content provider that provides the given /@value@/.
contentProviderNewForValue ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    -- ^ /@value@/: a @GValue@
    -> m ContentProvider
    -- ^ __Returns:__ a new @GdkContentProvider@
contentProviderNewForValue :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GValue -> m ContentProvider
contentProviderNewForValue GValue
value = IO ContentProvider -> m ContentProvider
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ContentProvider -> m ContentProvider)
-> IO ContentProvider -> m ContentProvider
forall a b. (a -> b) -> a -> b
$ do
    Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
    Ptr ContentProvider
result <- Ptr GValue -> IO (Ptr ContentProvider)
gdk_content_provider_new_for_value Ptr GValue
value'
    Text -> Ptr ContentProvider -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"contentProviderNewForValue" Ptr ContentProvider
result
    ContentProvider
result' <- ((ManagedPtr ContentProvider -> ContentProvider)
-> Ptr ContentProvider -> IO ContentProvider
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr ContentProvider -> ContentProvider
ContentProvider) Ptr ContentProvider
result
    GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
    ContentProvider -> IO ContentProvider
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ContentProvider
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method ContentProvider::new_union
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "providers"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 1
--                 (TInterface Name { namespace = "Gdk" , name = "ContentProvider" })
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "\n  The `GdkContentProvider`s to present the union of"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "n_providers"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of providers"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "n_providers"
--              , argType = TBasicType TUInt64
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "the number of providers"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just
--               (TInterface Name { namespace = "Gdk" , name = "ContentProvider" })
-- throws : False
-- Skip return : False

foreign import ccall "gdk_content_provider_new_union" gdk_content_provider_new_union :: 
    Ptr (Ptr ContentProvider) ->            -- providers : TCArray False (-1) 1 (TInterface (Name {namespace = "Gdk", name = "ContentProvider"}))
    Word64 ->                               -- n_providers : TBasicType TUInt64
    IO (Ptr ContentProvider)

-- | Creates a content provider that represents all the given /@providers@/.
-- 
-- Whenever data needs to be written, the union provider will try the given
-- /@providers@/ in the given order and the first one supporting a format will
-- be chosen to provide it.
-- 
-- This allows an easy way to support providing data in different formats.
-- For example, an image may be provided by its file and by the image
-- contents with a call such as
-- 
-- === /c code/
-- >gdk_content_provider_new_union ((GdkContentProvider *[2]) {
-- >                                  gdk_content_provider_new_typed (G_TYPE_FILE, file),
-- >                                  gdk_content_provider_new_typed (G_TYPE_TEXTURE, texture)
-- >                                }, 2);
contentProviderNewUnion ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe ([ContentProvider])
    -- ^ /@providers@/: 
    --   The @GdkContentProvider@s to present the union of
    -> m ContentProvider
    -- ^ __Returns:__ a new @GdkContentProvider@
contentProviderNewUnion :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Maybe [ContentProvider] -> m ContentProvider
contentProviderNewUnion Maybe [ContentProvider]
providers = IO ContentProvider -> m ContentProvider
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ContentProvider -> m ContentProvider)
-> IO ContentProvider -> m ContentProvider
forall a b. (a -> b) -> a -> b
$ do
    let nProviders :: Word64
nProviders = case Maybe [ContentProvider]
providers of
            Maybe [ContentProvider]
Nothing -> Word64
0
            Just [ContentProvider]
jProviders -> Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word64) -> Int -> Word64
forall a b. (a -> b) -> a -> b
$ [ContentProvider] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [ContentProvider]
jProviders
    Ptr (Ptr ContentProvider)
maybeProviders <- case Maybe [ContentProvider]
providers of
        Maybe [ContentProvider]
Nothing -> Ptr (Ptr ContentProvider) -> IO (Ptr (Ptr ContentProvider))
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (Ptr ContentProvider)
forall a. Ptr a
nullPtr
        Just [ContentProvider]
jProviders -> do
            [Ptr ContentProvider]
jProviders' <- (ContentProvider -> IO (Ptr ContentProvider))
-> [ContentProvider] -> IO [Ptr ContentProvider]
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 ContentProvider -> IO (Ptr ContentProvider)
forall a b. (HasCallStack, GObject a) => a -> IO (Ptr b)
B.ManagedPtr.disownObject [ContentProvider]
jProviders
            Ptr (Ptr ContentProvider)
jProviders'' <- [Ptr ContentProvider] -> IO (Ptr (Ptr ContentProvider))
forall a. [Ptr a] -> IO (Ptr (Ptr a))
packPtrArray [Ptr ContentProvider]
jProviders'
            Ptr (Ptr ContentProvider) -> IO (Ptr (Ptr ContentProvider))
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (Ptr ContentProvider)
jProviders''
    Ptr ContentProvider
result <- Ptr (Ptr ContentProvider) -> Word64 -> IO (Ptr ContentProvider)
gdk_content_provider_new_union Ptr (Ptr ContentProvider)
maybeProviders Word64
nProviders
    Text -> Ptr ContentProvider -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"contentProviderNewUnion" Ptr ContentProvider
result
    ContentProvider
result' <- ((ManagedPtr ContentProvider -> ContentProvider)
-> Ptr ContentProvider -> IO ContentProvider
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr ContentProvider -> ContentProvider
ContentProvider) Ptr ContentProvider
result
    Maybe [ContentProvider] -> ([ContentProvider] -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe [ContentProvider]
providers ((ContentProvider -> IO ()) -> [ContentProvider] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ ContentProvider -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr)
    ContentProvider -> IO ContentProvider
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ContentProvider
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method ContentProvider::content_changed
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "provider"
--           , argType =
--               TInterface Name { namespace = "Gdk" , name = "ContentProvider" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a `GdkContentProvider`"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gdk_content_provider_content_changed" gdk_content_provider_content_changed :: 
    Ptr ContentProvider ->                  -- provider : TInterface (Name {namespace = "Gdk", name = "ContentProvider"})
    IO ()

-- | Emits the [contentChanged](#g:signal:contentChanged) signal.
contentProviderContentChanged ::
    (B.CallStack.HasCallStack, MonadIO m, IsContentProvider a) =>
    a
    -- ^ /@provider@/: a @GdkContentProvider@
    -> m ()
contentProviderContentChanged :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsContentProvider a) =>
a -> m ()
contentProviderContentChanged a
provider = 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 ContentProvider
provider' <- a -> IO (Ptr ContentProvider)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
provider
    Ptr ContentProvider -> IO ()
gdk_content_provider_content_changed Ptr ContentProvider
provider'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
provider
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ContentProviderContentChangedMethodInfo
instance (signature ~ (m ()), MonadIO m, IsContentProvider a) => O.OverloadedMethod ContentProviderContentChangedMethodInfo a signature where
    overloadedMethod = contentProviderContentChanged

instance O.OverloadedMethodInfo ContentProviderContentChangedMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gdk.Objects.ContentProvider.contentProviderContentChanged",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.5/docs/GI-Gdk-Objects-ContentProvider.html#v:contentProviderContentChanged"
        })


#endif

-- method ContentProvider::get_value
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "provider"
--           , argType =
--               TInterface Name { namespace = "Gdk" , name = "ContentProvider" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a `GdkContentProvider`"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the `GValue` to fill"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "gdk_content_provider_get_value" gdk_content_provider_get_value :: 
    Ptr ContentProvider ->                  -- provider : TInterface (Name {namespace = "Gdk", name = "ContentProvider"})
    Ptr GValue ->                           -- value : TGValue
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Gets the contents of /@provider@/ stored in /@value@/.
-- 
-- The /@value@/ will have been initialized to the @GType@ the value should be
-- provided in. This given @GType@ does not need to be listed in the formats
-- returned by 'GI.Gdk.Objects.ContentProvider.contentProviderRefFormats'. However, if the
-- given @GType@ is not supported, this operation can fail and
-- @G_IO_ERROR_NOT_SUPPORTED@ will be reported.
contentProviderGetValue ::
    (B.CallStack.HasCallStack, MonadIO m, IsContentProvider a) =>
    a
    -- ^ /@provider@/: a @GdkContentProvider@
    -> m (GValue)
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
contentProviderGetValue :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsContentProvider a) =>
a -> m GValue
contentProviderGetValue a
provider = IO GValue -> m GValue
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GValue -> m GValue) -> IO GValue -> m GValue
forall a b. (a -> b) -> a -> b
$ do
    Ptr ContentProvider
provider' <- a -> IO (Ptr ContentProvider)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
provider
    Ptr GValue
value <- Int -> IO (Ptr GValue)
forall a. Int -> IO (Ptr a)
SP.callocBytes Int
24 :: IO (Ptr GValue)
    IO GValue -> IO () -> IO GValue
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 ContentProvider -> Ptr GValue -> Ptr (Ptr GError) -> IO CInt
gdk_content_provider_get_value Ptr ContentProvider
provider' Ptr GValue
value
        GValue
value' <- Ptr GValue -> IO GValue
B.GValue.wrapGValuePtr Ptr GValue
value
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
provider
        GValue -> IO GValue
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return GValue
value'
     ) (do
        Ptr GValue -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr GValue
value
     )

#if defined(ENABLE_OVERLOADING)
data ContentProviderGetValueMethodInfo
instance (signature ~ (m (GValue)), MonadIO m, IsContentProvider a) => O.OverloadedMethod ContentProviderGetValueMethodInfo a signature where
    overloadedMethod = contentProviderGetValue

instance O.OverloadedMethodInfo ContentProviderGetValueMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gdk.Objects.ContentProvider.contentProviderGetValue",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.5/docs/GI-Gdk-Objects-ContentProvider.html#v:contentProviderGetValue"
        })


#endif

-- method ContentProvider::ref_formats
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "provider"
--           , argType =
--               TInterface Name { namespace = "Gdk" , name = "ContentProvider" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a `GdkContentProvider`"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gdk" , name = "ContentFormats" })
-- throws : False
-- Skip return : False

foreign import ccall "gdk_content_provider_ref_formats" gdk_content_provider_ref_formats :: 
    Ptr ContentProvider ->                  -- provider : TInterface (Name {namespace = "Gdk", name = "ContentProvider"})
    IO (Ptr Gdk.ContentFormats.ContentFormats)

-- | Gets the formats that the provider can provide its current contents in.
contentProviderRefFormats ::
    (B.CallStack.HasCallStack, MonadIO m, IsContentProvider a) =>
    a
    -- ^ /@provider@/: a @GdkContentProvider@
    -> m Gdk.ContentFormats.ContentFormats
    -- ^ __Returns:__ The formats of the provider
contentProviderRefFormats :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsContentProvider a) =>
a -> m ContentFormats
contentProviderRefFormats a
provider = IO ContentFormats -> m ContentFormats
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ContentFormats -> m ContentFormats)
-> IO ContentFormats -> m ContentFormats
forall a b. (a -> b) -> a -> b
$ do
    Ptr ContentProvider
provider' <- a -> IO (Ptr ContentProvider)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
provider
    Ptr ContentFormats
result <- Ptr ContentProvider -> IO (Ptr ContentFormats)
gdk_content_provider_ref_formats Ptr ContentProvider
provider'
    Text -> Ptr ContentFormats -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"contentProviderRefFormats" Ptr ContentFormats
result
    ContentFormats
result' <- ((ManagedPtr ContentFormats -> ContentFormats)
-> Ptr ContentFormats -> IO ContentFormats
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr ContentFormats -> ContentFormats
Gdk.ContentFormats.ContentFormats) Ptr ContentFormats
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
provider
    ContentFormats -> IO ContentFormats
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ContentFormats
result'

#if defined(ENABLE_OVERLOADING)
data ContentProviderRefFormatsMethodInfo
instance (signature ~ (m Gdk.ContentFormats.ContentFormats), MonadIO m, IsContentProvider a) => O.OverloadedMethod ContentProviderRefFormatsMethodInfo a signature where
    overloadedMethod = contentProviderRefFormats

instance O.OverloadedMethodInfo ContentProviderRefFormatsMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gdk.Objects.ContentProvider.contentProviderRefFormats",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.5/docs/GI-Gdk-Objects-ContentProvider.html#v:contentProviderRefFormats"
        })


#endif

-- method ContentProvider::ref_storable_formats
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "provider"
--           , argType =
--               TInterface Name { namespace = "Gdk" , name = "ContentProvider" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a `GdkContentProvider`"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gdk" , name = "ContentFormats" })
-- throws : False
-- Skip return : False

foreign import ccall "gdk_content_provider_ref_storable_formats" gdk_content_provider_ref_storable_formats :: 
    Ptr ContentProvider ->                  -- provider : TInterface (Name {namespace = "Gdk", name = "ContentProvider"})
    IO (Ptr Gdk.ContentFormats.ContentFormats)

-- | Gets the formats that the provider suggests other applications to store
-- the data in.
-- 
-- An example of such an application would be a clipboard manager.
-- 
-- This can be assumed to be a subset of 'GI.Gdk.Objects.ContentProvider.contentProviderRefFormats'.
contentProviderRefStorableFormats ::
    (B.CallStack.HasCallStack, MonadIO m, IsContentProvider a) =>
    a
    -- ^ /@provider@/: a @GdkContentProvider@
    -> m Gdk.ContentFormats.ContentFormats
    -- ^ __Returns:__ The storable formats of the provider
contentProviderRefStorableFormats :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsContentProvider a) =>
a -> m ContentFormats
contentProviderRefStorableFormats a
provider = IO ContentFormats -> m ContentFormats
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ContentFormats -> m ContentFormats)
-> IO ContentFormats -> m ContentFormats
forall a b. (a -> b) -> a -> b
$ do
    Ptr ContentProvider
provider' <- a -> IO (Ptr ContentProvider)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
provider
    Ptr ContentFormats
result <- Ptr ContentProvider -> IO (Ptr ContentFormats)
gdk_content_provider_ref_storable_formats Ptr ContentProvider
provider'
    Text -> Ptr ContentFormats -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"contentProviderRefStorableFormats" Ptr ContentFormats
result
    ContentFormats
result' <- ((ManagedPtr ContentFormats -> ContentFormats)
-> Ptr ContentFormats -> IO ContentFormats
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr ContentFormats -> ContentFormats
Gdk.ContentFormats.ContentFormats) Ptr ContentFormats
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
provider
    ContentFormats -> IO ContentFormats
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ContentFormats
result'

#if defined(ENABLE_OVERLOADING)
data ContentProviderRefStorableFormatsMethodInfo
instance (signature ~ (m Gdk.ContentFormats.ContentFormats), MonadIO m, IsContentProvider a) => O.OverloadedMethod ContentProviderRefStorableFormatsMethodInfo a signature where
    overloadedMethod = contentProviderRefStorableFormats

instance O.OverloadedMethodInfo ContentProviderRefStorableFormatsMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gdk.Objects.ContentProvider.contentProviderRefStorableFormats",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.5/docs/GI-Gdk-Objects-ContentProvider.html#v:contentProviderRefStorableFormats"
        })


#endif

-- method ContentProvider::write_mime_type_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "provider"
--           , argType =
--               TInterface Name { namespace = "Gdk" , name = "ContentProvider" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a `GdkContentProvider`"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "mime_type"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the mime type to provide the data in"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "OutputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the `GOutputStream` to write to"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "io_priority"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "I/O priority of the request."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "optional `GCancellable` object, %NULL to ignore."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "callback to call when the request is satisfied"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 6
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the data to pass to callback function"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gdk_content_provider_write_mime_type_async" gdk_content_provider_write_mime_type_async :: 
    Ptr ContentProvider ->                  -- provider : TInterface (Name {namespace = "Gdk", name = "ContentProvider"})
    CString ->                              -- mime_type : TBasicType TUTF8
    Ptr Gio.OutputStream.OutputStream ->    -- stream : TInterface (Name {namespace = "Gio", name = "OutputStream"})
    Int32 ->                                -- io_priority : TBasicType TInt
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Asynchronously writes the contents of /@provider@/ to /@stream@/ in the given
-- /@mimeType@/.
-- 
-- When the operation is finished /@callback@/ will be called. You must then call
-- 'GI.Gdk.Objects.ContentProvider.contentProviderWriteMimeTypeFinish' to get the result
-- of the operation.
-- 
-- The given mime type does not need to be listed in the formats returned by
-- 'GI.Gdk.Objects.ContentProvider.contentProviderRefFormats'. However, if the given @GType@ is
-- not supported, @G_IO_ERROR_NOT_SUPPORTED@ will be reported.
-- 
-- The given /@stream@/ will not be closed.
contentProviderWriteMimeTypeAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsContentProvider a, Gio.OutputStream.IsOutputStream b, Gio.Cancellable.IsCancellable c) =>
    a
    -- ^ /@provider@/: a @GdkContentProvider@
    -> T.Text
    -- ^ /@mimeType@/: the mime type to provide the data in
    -> b
    -- ^ /@stream@/: the @GOutputStream@ to write to
    -> Int32
    -- ^ /@ioPriority@/: I\/O priority of the request.
    -> Maybe (c)
    -- ^ /@cancellable@/: optional @GCancellable@ object, 'P.Nothing' to ignore.
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: callback to call when the request is satisfied
    -> m ()
contentProviderWriteMimeTypeAsync :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsContentProvider a, IsOutputStream b,
 IsCancellable c) =>
a
-> Text
-> b
-> Int32
-> Maybe c
-> Maybe AsyncReadyCallback
-> m ()
contentProviderWriteMimeTypeAsync a
provider Text
mimeType b
stream Int32
ioPriority Maybe c
cancellable Maybe AsyncReadyCallback
callback = 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 ContentProvider
provider' <- a -> IO (Ptr ContentProvider)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
provider
    CString
mimeType' <- Text -> IO CString
textToCString Text
mimeType
    Ptr OutputStream
stream' <- b -> IO (Ptr OutputStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
stream
    Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
        Maybe c
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just c
jCancellable -> do
            Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
            Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
    Ptr ContentProvider
-> CString
-> Ptr OutputStream
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
gdk_content_provider_write_mime_type_async Ptr ContentProvider
provider' CString
mimeType' Ptr OutputStream
stream' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
provider
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
stream
    Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
mimeType'
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ContentProviderWriteMimeTypeAsyncMethodInfo
instance (signature ~ (T.Text -> b -> Int32 -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsContentProvider a, Gio.OutputStream.IsOutputStream b, Gio.Cancellable.IsCancellable c) => O.OverloadedMethod ContentProviderWriteMimeTypeAsyncMethodInfo a signature where
    overloadedMethod = contentProviderWriteMimeTypeAsync

instance O.OverloadedMethodInfo ContentProviderWriteMimeTypeAsyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gdk.Objects.ContentProvider.contentProviderWriteMimeTypeAsync",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.5/docs/GI-Gdk-Objects-ContentProvider.html#v:contentProviderWriteMimeTypeAsync"
        })


#endif

-- method ContentProvider::write_mime_type_finish
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "provider"
--           , argType =
--               TInterface Name { namespace = "Gdk" , name = "ContentProvider" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a `GdkContentProvider`"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a `GAsyncResult`" , 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 "gdk_content_provider_write_mime_type_finish" gdk_content_provider_write_mime_type_finish :: 
    Ptr ContentProvider ->                  -- provider : TInterface (Name {namespace = "Gdk", name = "ContentProvider"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Finishes an asynchronous write operation.
-- 
-- See 'GI.Gdk.Objects.ContentProvider.contentProviderWriteMimeTypeAsync'.
contentProviderWriteMimeTypeFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsContentProvider a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@provider@/: a @GdkContentProvider@
    -> b
    -- ^ /@result@/: a @GAsyncResult@
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
contentProviderWriteMimeTypeFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsContentProvider a, IsAsyncResult b) =>
a -> b -> m ()
contentProviderWriteMimeTypeFinish a
provider b
result_ = 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 ContentProvider
provider' <- a -> IO (Ptr ContentProvider)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
provider
    Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
    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 ContentProvider
-> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
gdk_content_provider_write_mime_type_finish Ptr ContentProvider
provider' Ptr AsyncResult
result_'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
provider
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data ContentProviderWriteMimeTypeFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsContentProvider a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod ContentProviderWriteMimeTypeFinishMethodInfo a signature where
    overloadedMethod = contentProviderWriteMimeTypeFinish

instance O.OverloadedMethodInfo ContentProviderWriteMimeTypeFinishMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gdk.Objects.ContentProvider.contentProviderWriteMimeTypeFinish",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.5/docs/GI-Gdk-Objects-ContentProvider.html#v:contentProviderWriteMimeTypeFinish"
        })


#endif