{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) -} module GI.Gio.Objects.Task ( -- * Exported types Task(..) , TaskK , toTask , noTask , -- * Methods -- ** taskGetCancellable taskGetCancellable , -- ** taskGetCheckCancellable taskGetCheckCancellable , -- ** taskGetCompleted taskGetCompleted , -- ** taskGetContext taskGetContext , -- ** taskGetPriority taskGetPriority , -- ** taskGetReturnOnCancel taskGetReturnOnCancel , -- ** taskGetSourceObject taskGetSourceObject , -- ** taskGetSourceTag taskGetSourceTag , -- ** taskGetTaskData taskGetTaskData , -- ** taskHadError taskHadError , -- ** taskIsValid taskIsValid , -- ** taskNew taskNew , -- ** taskPropagateBoolean taskPropagateBoolean , -- ** taskPropagateInt taskPropagateInt , -- ** taskPropagatePointer taskPropagatePointer , -- ** taskReportError taskReportError , -- ** taskReturnBoolean taskReturnBoolean , -- ** taskReturnError taskReturnError , -- ** taskReturnErrorIfCancelled taskReturnErrorIfCancelled , -- ** taskReturnInt taskReturnInt , -- ** taskReturnPointer taskReturnPointer , -- ** taskSetCheckCancellable taskSetCheckCancellable , -- ** taskSetPriority taskSetPriority , -- ** taskSetReturnOnCancel taskSetReturnOnCancel , -- ** taskSetSourceTag taskSetSourceTag , -- ** taskSetTaskData taskSetTaskData , -- * Properties -- ** Completed TaskCompletedPropertyInfo , getTaskCompleted , ) 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.GLib as GLib import qualified GI.GObject as GObject newtype Task = Task (ForeignPtr Task) foreign import ccall "g_task_get_type" c_g_task_get_type :: IO GType type instance ParentTypes Task = TaskParentTypes type TaskParentTypes = '[GObject.Object, AsyncResult] instance GObject Task where gobjectIsInitiallyUnowned _ = False gobjectType _ = c_g_task_get_type class GObject o => TaskK o instance (GObject o, IsDescendantOf Task o) => TaskK o toTask :: TaskK o => o -> IO Task toTask = unsafeCastTo Task noTask :: Maybe Task noTask = Nothing -- VVV Prop "completed" -- Type: TBasicType TBoolean -- Flags: [PropertyReadable] getTaskCompleted :: (MonadIO m, TaskK o) => o -> m Bool getTaskCompleted obj = liftIO $ getObjectPropertyBool obj "completed" data TaskCompletedPropertyInfo instance AttrInfo TaskCompletedPropertyInfo where type AttrAllowedOps TaskCompletedPropertyInfo = '[ 'AttrGet] type AttrSetTypeConstraint TaskCompletedPropertyInfo = (~) () type AttrBaseTypeConstraint TaskCompletedPropertyInfo = TaskK type AttrGetType TaskCompletedPropertyInfo = Bool type AttrLabel TaskCompletedPropertyInfo = "Task::completed" attrGet _ = getTaskCompleted attrSet _ = undefined attrConstruct _ = undefined type instance AttributeList Task = TaskAttributeList type TaskAttributeList = ('[ '("completed", TaskCompletedPropertyInfo)] :: [(Symbol, *)]) type instance SignalList Task = TaskSignalList type TaskSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)]) -- method Task::new -- method type : Constructor -- Args : [Arg {argName = "source_object", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 3, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "source_object", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 3, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gio" "Task" -- throws : False -- Skip return : False foreign import ccall "g_task_new" g_task_new :: Ptr GObject.Object -> -- source_object : TInterface "GObject" "Object" Ptr Cancellable -> -- cancellable : TInterface "Gio" "Cancellable" FunPtr AsyncReadyCallbackC -> -- callback : TInterface "Gio" "AsyncReadyCallback" Ptr () -> -- callback_data : TBasicType TVoid IO (Ptr Task) taskNew :: (MonadIO m, GObject.ObjectK a, CancellableK b) => Maybe (a) -> -- source_object Maybe (b) -> -- cancellable Maybe (AsyncReadyCallback) -> -- callback m Task taskNew source_object cancellable callback = liftIO $ do maybeSource_object <- case source_object of Nothing -> return nullPtr Just jSource_object -> do let jSource_object' = unsafeManagedPtrCastPtr jSource_object return jSource_object' maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do let jCancellable' = unsafeManagedPtrCastPtr jCancellable return jCancellable' ptrcallback <- callocMem :: IO (Ptr (FunPtr AsyncReadyCallbackC)) maybeCallback <- case callback of Nothing -> return (castPtrToFunPtr nullPtr) Just jCallback -> do jCallback' <- mkAsyncReadyCallback (asyncReadyCallbackWrapper (Just ptrcallback) jCallback) poke ptrcallback jCallback' return jCallback' let callback_data = nullPtr result <- g_task_new maybeSource_object maybeCancellable maybeCallback callback_data checkUnexpectedReturnNULL "g_task_new" result result' <- (wrapObject Task) result whenJust source_object touchManagedPtr whenJust cancellable touchManagedPtr return result' -- method Task::get_cancellable -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gio" "Cancellable" -- throws : False -- Skip return : False foreign import ccall "g_task_get_cancellable" g_task_get_cancellable :: Ptr Task -> -- _obj : TInterface "Gio" "Task" IO (Ptr Cancellable) taskGetCancellable :: (MonadIO m, TaskK a) => a -> -- _obj m Cancellable taskGetCancellable _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_task_get_cancellable _obj' checkUnexpectedReturnNULL "g_task_get_cancellable" result result' <- (newObject Cancellable) result touchManagedPtr _obj return result' -- method Task::get_check_cancellable -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "g_task_get_check_cancellable" g_task_get_check_cancellable :: Ptr Task -> -- _obj : TInterface "Gio" "Task" IO CInt taskGetCheckCancellable :: (MonadIO m, TaskK a) => a -> -- _obj m Bool taskGetCheckCancellable _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_task_get_check_cancellable _obj' let result' = (/= 0) result touchManagedPtr _obj return result' -- method Task::get_completed -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "g_task_get_completed" g_task_get_completed :: Ptr Task -> -- _obj : TInterface "Gio" "Task" IO CInt taskGetCompleted :: (MonadIO m, TaskK a) => a -> -- _obj m Bool taskGetCompleted _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_task_get_completed _obj' let result' = (/= 0) result touchManagedPtr _obj return result' -- method Task::get_context -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "GLib" "MainContext" -- throws : False -- Skip return : False foreign import ccall "g_task_get_context" g_task_get_context :: Ptr Task -> -- _obj : TInterface "Gio" "Task" IO (Ptr GLib.MainContext) taskGetContext :: (MonadIO m, TaskK a) => a -> -- _obj m GLib.MainContext taskGetContext _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_task_get_context _obj' checkUnexpectedReturnNULL "g_task_get_context" result result' <- (newBoxed GLib.MainContext) result touchManagedPtr _obj return result' -- method Task::get_priority -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "g_task_get_priority" g_task_get_priority :: Ptr Task -> -- _obj : TInterface "Gio" "Task" IO Int32 taskGetPriority :: (MonadIO m, TaskK a) => a -> -- _obj m Int32 taskGetPriority _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_task_get_priority _obj' touchManagedPtr _obj return result -- method Task::get_return_on_cancel -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "g_task_get_return_on_cancel" g_task_get_return_on_cancel :: Ptr Task -> -- _obj : TInterface "Gio" "Task" IO CInt taskGetReturnOnCancel :: (MonadIO m, TaskK a) => a -> -- _obj m Bool taskGetReturnOnCancel _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_task_get_return_on_cancel _obj' let result' = (/= 0) result touchManagedPtr _obj return result' -- method Task::get_source_object -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "GObject" "Object" -- throws : False -- Skip return : False foreign import ccall "g_task_get_source_object" g_task_get_source_object :: Ptr Task -> -- _obj : TInterface "Gio" "Task" IO (Ptr GObject.Object) taskGetSourceObject :: (MonadIO m, TaskK a) => a -> -- _obj m GObject.Object taskGetSourceObject _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_task_get_source_object _obj' checkUnexpectedReturnNULL "g_task_get_source_object" result result' <- (newObject GObject.Object) result touchManagedPtr _obj return result' -- method Task::get_source_tag -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_task_get_source_tag" g_task_get_source_tag :: Ptr Task -> -- _obj : TInterface "Gio" "Task" IO () taskGetSourceTag :: (MonadIO m, TaskK a) => a -> -- _obj m () taskGetSourceTag _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj g_task_get_source_tag _obj' touchManagedPtr _obj return () -- method Task::get_task_data -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_task_get_task_data" g_task_get_task_data :: Ptr Task -> -- _obj : TInterface "Gio" "Task" IO () taskGetTaskData :: (MonadIO m, TaskK a) => a -> -- _obj m () taskGetTaskData _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj g_task_get_task_data _obj' touchManagedPtr _obj return () -- method Task::had_error -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "g_task_had_error" g_task_had_error :: Ptr Task -> -- _obj : TInterface "Gio" "Task" IO CInt taskHadError :: (MonadIO m, TaskK a) => a -> -- _obj m Bool taskHadError _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_task_had_error _obj' let result' = (/= 0) result touchManagedPtr _obj return result' -- method Task::propagate_boolean -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : True -- Skip return : False foreign import ccall "g_task_propagate_boolean" g_task_propagate_boolean :: Ptr Task -> -- _obj : TInterface "Gio" "Task" Ptr (Ptr GError) -> -- error IO CInt taskPropagateBoolean :: (MonadIO m, TaskK a) => a -> -- _obj m () taskPropagateBoolean _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj onException (do _ <- propagateGError $ g_task_propagate_boolean _obj' touchManagedPtr _obj return () ) (do return () ) -- method Task::propagate_int -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt64 -- throws : True -- Skip return : False foreign import ccall "g_task_propagate_int" g_task_propagate_int :: Ptr Task -> -- _obj : TInterface "Gio" "Task" Ptr (Ptr GError) -> -- error IO Int64 taskPropagateInt :: (MonadIO m, TaskK a) => a -> -- _obj m Int64 taskPropagateInt _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj onException (do result <- propagateGError $ g_task_propagate_int _obj' touchManagedPtr _obj return result ) (do return () ) -- method Task::propagate_pointer -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : True -- Skip return : False foreign import ccall "g_task_propagate_pointer" g_task_propagate_pointer :: Ptr Task -> -- _obj : TInterface "Gio" "Task" Ptr (Ptr GError) -> -- error IO () taskPropagatePointer :: (MonadIO m, TaskK a) => a -> -- _obj m () taskPropagatePointer _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj onException (do propagateGError $ g_task_propagate_pointer _obj' touchManagedPtr _obj return () ) (do return () ) -- method Task::return_boolean -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_task_return_boolean" g_task_return_boolean :: Ptr Task -> -- _obj : TInterface "Gio" "Task" CInt -> -- result : TBasicType TBoolean IO () taskReturnBoolean :: (MonadIO m, TaskK a) => a -> -- _obj Bool -> -- result m () taskReturnBoolean _obj result_ = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let result_' = (fromIntegral . fromEnum) result_ g_task_return_boolean _obj' result_' touchManagedPtr _obj return () -- method Task::return_error -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "error", argType = TError, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "error", argType = TError, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_task_return_error" g_task_return_error :: Ptr Task -> -- _obj : TInterface "Gio" "Task" Ptr GError -> -- error : TError IO () taskReturnError :: (MonadIO m, TaskK a) => a -> -- _obj GError -> -- error m () taskReturnError _obj error_ = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj error_' <- copyBoxed error_ g_task_return_error _obj' error_' touchManagedPtr _obj touchManagedPtr error_ return () -- method Task::return_error_if_cancelled -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "g_task_return_error_if_cancelled" g_task_return_error_if_cancelled :: Ptr Task -> -- _obj : TInterface "Gio" "Task" IO CInt taskReturnErrorIfCancelled :: (MonadIO m, TaskK a) => a -> -- _obj m Bool taskReturnErrorIfCancelled _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_task_return_error_if_cancelled _obj' let result' = (/= 0) result touchManagedPtr _obj return result' -- method Task::return_int -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_task_return_int" g_task_return_int :: Ptr Task -> -- _obj : TInterface "Gio" "Task" Int64 -> -- result : TBasicType TInt64 IO () taskReturnInt :: (MonadIO m, TaskK a) => a -> -- _obj Int64 -> -- result m () taskReturnInt _obj result_ = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj g_task_return_int _obj' result_ touchManagedPtr _obj return () -- method Task::return_pointer -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "result_destroy", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "result_destroy", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_task_return_pointer" g_task_return_pointer :: Ptr Task -> -- _obj : TInterface "Gio" "Task" Ptr () -> -- result : TBasicType TVoid FunPtr GLib.DestroyNotifyC -> -- result_destroy : TInterface "GLib" "DestroyNotify" IO () taskReturnPointer :: (MonadIO m, TaskK a) => a -> -- _obj Maybe (Ptr ()) -> -- result Maybe (GLib.DestroyNotify) -> -- result_destroy m () taskReturnPointer _obj result_ result_destroy = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybeResult_ <- case result_ of Nothing -> return nullPtr Just jResult_ -> do return jResult_ ptrresult_destroy <- callocMem :: IO (Ptr (FunPtr GLib.DestroyNotifyC)) maybeResult_destroy <- case result_destroy of Nothing -> return (castPtrToFunPtr nullPtr) Just jResult_destroy -> do jResult_destroy' <- GLib.mkDestroyNotify (GLib.destroyNotifyWrapper (Just ptrresult_destroy) jResult_destroy) poke ptrresult_destroy jResult_destroy' return jResult_destroy' g_task_return_pointer _obj' maybeResult_ maybeResult_destroy touchManagedPtr _obj return () -- method Task::set_check_cancellable -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "check_cancellable", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "check_cancellable", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_task_set_check_cancellable" g_task_set_check_cancellable :: Ptr Task -> -- _obj : TInterface "Gio" "Task" CInt -> -- check_cancellable : TBasicType TBoolean IO () taskSetCheckCancellable :: (MonadIO m, TaskK a) => a -> -- _obj Bool -> -- check_cancellable m () taskSetCheckCancellable _obj check_cancellable = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let check_cancellable' = (fromIntegral . fromEnum) check_cancellable g_task_set_check_cancellable _obj' check_cancellable' touchManagedPtr _obj return () -- method Task::set_priority -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_task_set_priority" g_task_set_priority :: Ptr Task -> -- _obj : TInterface "Gio" "Task" Int32 -> -- priority : TBasicType TInt32 IO () taskSetPriority :: (MonadIO m, TaskK a) => a -> -- _obj Int32 -> -- priority m () taskSetPriority _obj priority = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj g_task_set_priority _obj' priority touchManagedPtr _obj return () -- method Task::set_return_on_cancel -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "return_on_cancel", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "return_on_cancel", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "g_task_set_return_on_cancel" g_task_set_return_on_cancel :: Ptr Task -> -- _obj : TInterface "Gio" "Task" CInt -> -- return_on_cancel : TBasicType TBoolean IO CInt taskSetReturnOnCancel :: (MonadIO m, TaskK a) => a -> -- _obj Bool -> -- return_on_cancel m Bool taskSetReturnOnCancel _obj return_on_cancel = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let return_on_cancel' = (fromIntegral . fromEnum) return_on_cancel result <- g_task_set_return_on_cancel _obj' return_on_cancel' let result' = (/= 0) result touchManagedPtr _obj return result' -- method Task::set_source_tag -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "source_tag", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "source_tag", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_task_set_source_tag" g_task_set_source_tag :: Ptr Task -> -- _obj : TInterface "Gio" "Task" Ptr () -> -- source_tag : TBasicType TVoid IO () taskSetSourceTag :: (MonadIO m, TaskK a) => a -> -- _obj Ptr () -> -- source_tag m () taskSetSourceTag _obj source_tag = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj g_task_set_source_tag _obj' source_tag touchManagedPtr _obj return () -- method Task::set_task_data -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "task_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "task_data_destroy", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Task", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "task_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "task_data_destroy", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_task_set_task_data" g_task_set_task_data :: Ptr Task -> -- _obj : TInterface "Gio" "Task" Ptr () -> -- task_data : TBasicType TVoid FunPtr GLib.DestroyNotifyC -> -- task_data_destroy : TInterface "GLib" "DestroyNotify" IO () taskSetTaskData :: (MonadIO m, TaskK a) => a -> -- _obj Maybe (Ptr ()) -> -- task_data Maybe (GLib.DestroyNotify) -> -- task_data_destroy m () taskSetTaskData _obj task_data task_data_destroy = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybeTask_data <- case task_data of Nothing -> return nullPtr Just jTask_data -> do return jTask_data ptrtask_data_destroy <- callocMem :: IO (Ptr (FunPtr GLib.DestroyNotifyC)) maybeTask_data_destroy <- case task_data_destroy of Nothing -> return (castPtrToFunPtr nullPtr) Just jTask_data_destroy -> do jTask_data_destroy' <- GLib.mkDestroyNotify (GLib.destroyNotifyWrapper (Just ptrtask_data_destroy) jTask_data_destroy) poke ptrtask_data_destroy jTask_data_destroy' return jTask_data_destroy' g_task_set_task_data _obj' maybeTask_data maybeTask_data_destroy touchManagedPtr _obj return () -- method Task::is_valid -- method type : MemberFunction -- Args : [Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "source_object", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "source_object", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "g_task_is_valid" g_task_is_valid :: Ptr AsyncResult -> -- result : TInterface "Gio" "AsyncResult" Ptr GObject.Object -> -- source_object : TInterface "GObject" "Object" IO CInt taskIsValid :: (MonadIO m, AsyncResultK a, GObject.ObjectK b) => a -> -- result Maybe (b) -> -- source_object m Bool taskIsValid result_ source_object = liftIO $ do let result_' = unsafeManagedPtrCastPtr result_ maybeSource_object <- case source_object of Nothing -> return nullPtr Just jSource_object -> do let jSource_object' = unsafeManagedPtrCastPtr jSource_object return jSource_object' result <- g_task_is_valid result_' maybeSource_object let result' = (/= 0) result touchManagedPtr result_ whenJust source_object touchManagedPtr return result' -- method Task::report_error -- method type : MemberFunction -- Args : [Arg {argName = "source_object", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 2, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "source_tag", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "error", argType = TError, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}] -- Lengths : [] -- hInArgs : [Arg {argName = "source_object", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 2, argDestroy = -1, transfer = TransferNothing},Arg {argName = "source_tag", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "error", argType = TError, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_task_report_error" g_task_report_error :: Ptr GObject.Object -> -- source_object : TInterface "GObject" "Object" FunPtr AsyncReadyCallbackC -> -- callback : TInterface "Gio" "AsyncReadyCallback" Ptr () -> -- callback_data : TBasicType TVoid Ptr () -> -- source_tag : TBasicType TVoid Ptr GError -> -- error : TError IO () taskReportError :: (MonadIO m, GObject.ObjectK a) => Maybe (a) -> -- source_object Maybe (AsyncReadyCallback) -> -- callback Ptr () -> -- source_tag GError -> -- error m () taskReportError source_object callback source_tag error_ = liftIO $ do maybeSource_object <- case source_object of Nothing -> return nullPtr Just jSource_object -> do let jSource_object' = unsafeManagedPtrCastPtr jSource_object return jSource_object' ptrcallback <- callocMem :: IO (Ptr (FunPtr AsyncReadyCallbackC)) maybeCallback <- case callback of Nothing -> return (castPtrToFunPtr nullPtr) Just jCallback -> do jCallback' <- mkAsyncReadyCallback (asyncReadyCallbackWrapper (Just ptrcallback) jCallback) poke ptrcallback jCallback' return jCallback' error_' <- copyBoxed error_ let callback_data = nullPtr g_task_report_error maybeSource_object maybeCallback callback_data source_tag error_' whenJust source_object touchManagedPtr touchManagedPtr error_ return ()