#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gio.Interfaces.LoadableIcon
(
LoadableIcon(..) ,
noLoadableIcon ,
IsLoadableIcon ,
toLoadableIcon ,
#if ENABLE_OVERLOADING
LoadableIconLoadMethodInfo ,
#endif
loadableIconLoad ,
#if ENABLE_OVERLOADING
LoadableIconLoadAsyncMethodInfo ,
#endif
loadableIconLoadAsync ,
#if ENABLE_OVERLOADING
LoadableIconLoadFinishMethodInfo ,
#endif
loadableIconLoadFinish ,
) 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.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.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
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Icon as Gio.Icon
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.InputStream as Gio.InputStream
newtype LoadableIcon = LoadableIcon (ManagedPtr LoadableIcon)
noLoadableIcon :: Maybe LoadableIcon
noLoadableIcon = Nothing
#if ENABLE_OVERLOADING
type instance O.SignalList LoadableIcon = LoadableIconSignalList
type LoadableIconSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_loadable_icon_get_type"
c_g_loadable_icon_get_type :: IO GType
instance GObject LoadableIcon where
gobjectType = c_g_loadable_icon_get_type
class (GObject o, O.IsDescendantOf LoadableIcon o) => IsLoadableIcon o
instance (GObject o, O.IsDescendantOf LoadableIcon o) => IsLoadableIcon o
instance O.HasParentTypes LoadableIcon
type instance O.ParentTypes LoadableIcon = '[Gio.Icon.Icon, GObject.Object.Object]
toLoadableIcon :: (MonadIO m, IsLoadableIcon o) => o -> m LoadableIcon
toLoadableIcon = liftIO . unsafeCastTo LoadableIcon
#if ENABLE_OVERLOADING
instance O.HasAttributeList LoadableIcon
type instance O.AttributeList LoadableIcon = LoadableIconAttributeList
type LoadableIconAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
type family ResolveLoadableIconMethod (t :: Symbol) (o :: *) :: * where
ResolveLoadableIconMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveLoadableIconMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveLoadableIconMethod "equal" o = Gio.Icon.IconEqualMethodInfo
ResolveLoadableIconMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveLoadableIconMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveLoadableIconMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveLoadableIconMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveLoadableIconMethod "load" o = LoadableIconLoadMethodInfo
ResolveLoadableIconMethod "loadAsync" o = LoadableIconLoadAsyncMethodInfo
ResolveLoadableIconMethod "loadFinish" o = LoadableIconLoadFinishMethodInfo
ResolveLoadableIconMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveLoadableIconMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveLoadableIconMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveLoadableIconMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveLoadableIconMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveLoadableIconMethod "serialize" o = Gio.Icon.IconSerializeMethodInfo
ResolveLoadableIconMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveLoadableIconMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveLoadableIconMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveLoadableIconMethod "toString" o = Gio.Icon.IconToStringMethodInfo
ResolveLoadableIconMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveLoadableIconMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveLoadableIconMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveLoadableIconMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveLoadableIconMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveLoadableIconMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveLoadableIconMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveLoadableIconMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveLoadableIconMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveLoadableIconMethod t LoadableIcon, O.MethodInfo info LoadableIcon p) => OL.IsLabel t (LoadableIcon -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
foreign import ccall "g_loadable_icon_load" g_loadable_icon_load ::
Ptr LoadableIcon ->
Int32 ->
Ptr CString ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.InputStream.InputStream)
loadableIconLoad ::
(B.CallStack.HasCallStack, MonadIO m, IsLoadableIcon a, Gio.Cancellable.IsCancellable b) =>
a
-> Int32
-> Maybe (b)
-> m ((Gio.InputStream.InputStream, T.Text))
loadableIconLoad icon size cancellable = liftIO $ do
icon' <- unsafeManagedPtrCastPtr icon
type_ <- allocMem :: IO (Ptr CString)
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
onException (do
result <- propagateGError $ g_loadable_icon_load icon' size type_ maybeCancellable
checkUnexpectedReturnNULL "loadableIconLoad" result
result' <- (wrapObject Gio.InputStream.InputStream) result
type_' <- peek type_
type_'' <- cstringToText type_'
freeMem type_'
touchManagedPtr icon
whenJust cancellable touchManagedPtr
freeMem type_
return (result', type_'')
) (do
freeMem type_
)
#if ENABLE_OVERLOADING
data LoadableIconLoadMethodInfo
instance (signature ~ (Int32 -> Maybe (b) -> m ((Gio.InputStream.InputStream, T.Text))), MonadIO m, IsLoadableIcon a, Gio.Cancellable.IsCancellable b) => O.MethodInfo LoadableIconLoadMethodInfo a signature where
overloadedMethod _ = loadableIconLoad
#endif
foreign import ccall "g_loadable_icon_load_async" g_loadable_icon_load_async ::
Ptr LoadableIcon ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
loadableIconLoadAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsLoadableIcon a, Gio.Cancellable.IsCancellable b) =>
a
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
loadableIconLoadAsync icon size cancellable callback = liftIO $ do
icon' <- unsafeManagedPtrCastPtr icon
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
maybeCallback <- case callback of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jCallback -> do
ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = nullPtr
g_loadable_icon_load_async icon' size maybeCancellable maybeCallback userData
touchManagedPtr icon
whenJust cancellable touchManagedPtr
return ()
#if ENABLE_OVERLOADING
data LoadableIconLoadAsyncMethodInfo
instance (signature ~ (Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsLoadableIcon a, Gio.Cancellable.IsCancellable b) => O.MethodInfo LoadableIconLoadAsyncMethodInfo a signature where
overloadedMethod _ = loadableIconLoadAsync
#endif
foreign import ccall "g_loadable_icon_load_finish" g_loadable_icon_load_finish ::
Ptr LoadableIcon ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr CString ->
Ptr (Ptr GError) ->
IO (Ptr Gio.InputStream.InputStream)
loadableIconLoadFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsLoadableIcon a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ((Gio.InputStream.InputStream, T.Text))
loadableIconLoadFinish icon res = liftIO $ do
icon' <- unsafeManagedPtrCastPtr icon
res' <- unsafeManagedPtrCastPtr res
type_ <- allocMem :: IO (Ptr CString)
onException (do
result <- propagateGError $ g_loadable_icon_load_finish icon' res' type_
checkUnexpectedReturnNULL "loadableIconLoadFinish" result
result' <- (wrapObject Gio.InputStream.InputStream) result
type_' <- peek type_
type_'' <- cstringToText type_'
freeMem type_'
touchManagedPtr icon
touchManagedPtr res
freeMem type_
return (result', type_'')
) (do
freeMem type_
)
#if ENABLE_OVERLOADING
data LoadableIconLoadFinishMethodInfo
instance (signature ~ (b -> m ((Gio.InputStream.InputStream, T.Text))), MonadIO m, IsLoadableIcon a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo LoadableIconLoadFinishMethodInfo a signature where
overloadedMethod _ = loadableIconLoadFinish
#endif