module GI.Gio.Interfaces.Initable
(
Initable(..) ,
noInitable ,
InitableK ,
toInitable ,
initableInit ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.Gio.Types
import GI.Gio.Callbacks
import qualified GI.GObject as GObject
newtype Initable = Initable (ForeignPtr Initable)
noInitable :: Maybe Initable
noInitable = Nothing
type instance AttributeList Initable = InitableAttributeList
type InitableAttributeList = ('[ ] :: [(Symbol, *)])
type instance SignalList Initable = InitableSignalList
type InitableSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
foreign import ccall "g_initable_get_type"
c_g_initable_get_type :: IO GType
type instance ParentTypes Initable = InitableParentTypes
type InitableParentTypes = '[GObject.Object]
instance GObject Initable where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_g_initable_get_type
class GObject o => InitableK o
instance (GObject o, IsDescendantOf Initable o) => InitableK o
toInitable :: InitableK o => o -> IO Initable
toInitable = unsafeCastTo Initable
foreign import ccall "g_initable_init" g_initable_init ::
Ptr Initable ->
Ptr Cancellable ->
Ptr (Ptr GError) ->
IO CInt
initableInit ::
(MonadIO m, InitableK a, CancellableK b) =>
a ->
Maybe (b) ->
m ()
initableInit _obj cancellable = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
let jCancellable' = unsafeManagedPtrCastPtr jCancellable
return jCancellable'
onException (do
_ <- propagateGError $ g_initable_init _obj' maybeCancellable
touchManagedPtr _obj
whenJust cancellable touchManagedPtr
return ()
) (do
return ()
)