{- | 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.WebKit.Objects.FaviconDatabase ( -- * Exported types FaviconDatabase(..) , FaviconDatabaseK , toFaviconDatabase , noFaviconDatabase , -- * Methods -- ** faviconDatabaseClear faviconDatabaseClear , -- ** faviconDatabaseGetFaviconPixbuf faviconDatabaseGetFaviconPixbuf , -- ** faviconDatabaseGetFaviconPixbufFinish faviconDatabaseGetFaviconPixbufFinish , -- ** faviconDatabaseGetFaviconUri faviconDatabaseGetFaviconUri , -- ** faviconDatabaseGetPath faviconDatabaseGetPath , -- ** faviconDatabaseSetPath faviconDatabaseSetPath , -- ** faviconDatabaseTryGetFaviconPixbuf faviconDatabaseTryGetFaviconPixbuf , -- * Properties -- ** Path FaviconDatabasePathPropertyInfo , constructFaviconDatabasePath , getFaviconDatabasePath , setFaviconDatabasePath , -- * Signals -- ** IconLoaded FaviconDatabaseIconLoadedCallback , FaviconDatabaseIconLoadedCallbackC , FaviconDatabaseIconLoadedSignalInfo , afterFaviconDatabaseIconLoaded , faviconDatabaseIconLoadedCallbackWrapper, faviconDatabaseIconLoadedClosure , mkFaviconDatabaseIconLoadedCallback , noFaviconDatabaseIconLoadedCallback , onFaviconDatabaseIconLoaded , ) 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.WebKit.Types import GI.WebKit.Callbacks import qualified GI.GObject as GObject import qualified GI.GdkPixbuf as GdkPixbuf import qualified GI.Gio as Gio newtype FaviconDatabase = FaviconDatabase (ForeignPtr FaviconDatabase) foreign import ccall "webkit_favicon_database_get_type" c_webkit_favicon_database_get_type :: IO GType type instance ParentTypes FaviconDatabase = FaviconDatabaseParentTypes type FaviconDatabaseParentTypes = '[GObject.Object] instance GObject FaviconDatabase where gobjectIsInitiallyUnowned _ = False gobjectType _ = c_webkit_favicon_database_get_type class GObject o => FaviconDatabaseK o instance (GObject o, IsDescendantOf FaviconDatabase o) => FaviconDatabaseK o toFaviconDatabase :: FaviconDatabaseK o => o -> IO FaviconDatabase toFaviconDatabase = unsafeCastTo FaviconDatabase noFaviconDatabase :: Maybe FaviconDatabase noFaviconDatabase = Nothing -- signal FaviconDatabase::icon-loaded type FaviconDatabaseIconLoadedCallback = T.Text -> IO () noFaviconDatabaseIconLoadedCallback :: Maybe FaviconDatabaseIconLoadedCallback noFaviconDatabaseIconLoadedCallback = Nothing type FaviconDatabaseIconLoadedCallbackC = Ptr () -> -- object CString -> Ptr () -> -- user_data IO () foreign import ccall "wrapper" mkFaviconDatabaseIconLoadedCallback :: FaviconDatabaseIconLoadedCallbackC -> IO (FunPtr FaviconDatabaseIconLoadedCallbackC) faviconDatabaseIconLoadedClosure :: FaviconDatabaseIconLoadedCallback -> IO Closure faviconDatabaseIconLoadedClosure cb = newCClosure =<< mkFaviconDatabaseIconLoadedCallback wrapped where wrapped = faviconDatabaseIconLoadedCallbackWrapper cb faviconDatabaseIconLoadedCallbackWrapper :: FaviconDatabaseIconLoadedCallback -> Ptr () -> CString -> Ptr () -> IO () faviconDatabaseIconLoadedCallbackWrapper _cb _ frame_uri _ = do frame_uri' <- cstringToText frame_uri _cb frame_uri' onFaviconDatabaseIconLoaded :: (GObject a, MonadIO m) => a -> FaviconDatabaseIconLoadedCallback -> m SignalHandlerId onFaviconDatabaseIconLoaded obj cb = liftIO $ connectFaviconDatabaseIconLoaded obj cb SignalConnectBefore afterFaviconDatabaseIconLoaded :: (GObject a, MonadIO m) => a -> FaviconDatabaseIconLoadedCallback -> m SignalHandlerId afterFaviconDatabaseIconLoaded obj cb = connectFaviconDatabaseIconLoaded obj cb SignalConnectAfter connectFaviconDatabaseIconLoaded :: (GObject a, MonadIO m) => a -> FaviconDatabaseIconLoadedCallback -> SignalConnectMode -> m SignalHandlerId connectFaviconDatabaseIconLoaded obj cb after = liftIO $ do cb' <- mkFaviconDatabaseIconLoadedCallback (faviconDatabaseIconLoadedCallbackWrapper cb) connectSignalFunPtr obj "icon-loaded" cb' after -- VVV Prop "path" -- Type: TBasicType TUTF8 -- Flags: [PropertyReadable,PropertyWritable] getFaviconDatabasePath :: (MonadIO m, FaviconDatabaseK o) => o -> m T.Text getFaviconDatabasePath obj = liftIO $ getObjectPropertyString obj "path" setFaviconDatabasePath :: (MonadIO m, FaviconDatabaseK o) => o -> T.Text -> m () setFaviconDatabasePath obj val = liftIO $ setObjectPropertyString obj "path" val constructFaviconDatabasePath :: T.Text -> IO ([Char], GValue) constructFaviconDatabasePath val = constructObjectPropertyString "path" val data FaviconDatabasePathPropertyInfo instance AttrInfo FaviconDatabasePathPropertyInfo where type AttrAllowedOps FaviconDatabasePathPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint FaviconDatabasePathPropertyInfo = (~) T.Text type AttrBaseTypeConstraint FaviconDatabasePathPropertyInfo = FaviconDatabaseK type AttrGetType FaviconDatabasePathPropertyInfo = T.Text type AttrLabel FaviconDatabasePathPropertyInfo = "FaviconDatabase::path" attrGet _ = getFaviconDatabasePath attrSet _ = setFaviconDatabasePath attrConstruct _ = constructFaviconDatabasePath type instance AttributeList FaviconDatabase = FaviconDatabaseAttributeList type FaviconDatabaseAttributeList = ('[ '("path", FaviconDatabasePathPropertyInfo)] :: [(Symbol, *)]) data FaviconDatabaseIconLoadedSignalInfo instance SignalInfo FaviconDatabaseIconLoadedSignalInfo where type HaskellCallbackType FaviconDatabaseIconLoadedSignalInfo = FaviconDatabaseIconLoadedCallback connectSignal _ = connectFaviconDatabaseIconLoaded type instance SignalList FaviconDatabase = FaviconDatabaseSignalList type FaviconDatabaseSignalList = ('[ '("icon-loaded", FaviconDatabaseIconLoadedSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)]) -- method FaviconDatabase::clear -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "FaviconDatabase", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit" "FaviconDatabase", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "webkit_favicon_database_clear" webkit_favicon_database_clear :: Ptr FaviconDatabase -> -- _obj : TInterface "WebKit" "FaviconDatabase" IO () faviconDatabaseClear :: (MonadIO m, FaviconDatabaseK a) => a -> -- _obj m () faviconDatabaseClear _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj webkit_favicon_database_clear _obj' touchManagedPtr _obj return () -- method FaviconDatabase::get_favicon_pixbuf -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "FaviconDatabase", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "page_uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "width", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "height", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, 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 = 6, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit" "FaviconDatabase", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "page_uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "width", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "height", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, 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 = 6, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "webkit_favicon_database_get_favicon_pixbuf" webkit_favicon_database_get_favicon_pixbuf :: Ptr FaviconDatabase -> -- _obj : TInterface "WebKit" "FaviconDatabase" CString -> -- page_uri : TBasicType TUTF8 Word32 -> -- width : TBasicType TUInt32 Word32 -> -- height : TBasicType TUInt32 Ptr Gio.Cancellable -> -- cancellable : TInterface "Gio" "Cancellable" FunPtr Gio.AsyncReadyCallbackC -> -- callback : TInterface "Gio" "AsyncReadyCallback" Ptr () -> -- user_data : TBasicType TVoid IO () faviconDatabaseGetFaviconPixbuf :: (MonadIO m, FaviconDatabaseK a, Gio.CancellableK b) => a -> -- _obj T.Text -> -- page_uri Word32 -> -- width Word32 -> -- height Maybe (b) -> -- cancellable Maybe (Gio.AsyncReadyCallback) -> -- callback m () faviconDatabaseGetFaviconPixbuf _obj page_uri width height cancellable callback = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj page_uri' <- textToCString page_uri maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do let jCancellable' = unsafeManagedPtrCastPtr jCancellable return jCancellable' ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.AsyncReadyCallbackC)) maybeCallback <- case callback of Nothing -> return (castPtrToFunPtr nullPtr) Just jCallback -> do jCallback' <- Gio.mkAsyncReadyCallback (Gio.asyncReadyCallbackWrapper (Just ptrcallback) jCallback) poke ptrcallback jCallback' return jCallback' let user_data = nullPtr webkit_favicon_database_get_favicon_pixbuf _obj' page_uri' width height maybeCancellable maybeCallback user_data touchManagedPtr _obj whenJust cancellable touchManagedPtr freeMem page_uri' return () -- method FaviconDatabase::get_favicon_pixbuf_finish -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "FaviconDatabase", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit" "FaviconDatabase", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "GdkPixbuf" "Pixbuf" -- throws : True -- Skip return : False foreign import ccall "webkit_favicon_database_get_favicon_pixbuf_finish" webkit_favicon_database_get_favicon_pixbuf_finish :: Ptr FaviconDatabase -> -- _obj : TInterface "WebKit" "FaviconDatabase" Ptr Gio.AsyncResult -> -- result : TInterface "Gio" "AsyncResult" Ptr (Ptr GError) -> -- error IO (Ptr GdkPixbuf.Pixbuf) faviconDatabaseGetFaviconPixbufFinish :: (MonadIO m, FaviconDatabaseK a, Gio.AsyncResultK b) => a -> -- _obj b -> -- result m GdkPixbuf.Pixbuf faviconDatabaseGetFaviconPixbufFinish _obj result_ = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let result_' = unsafeManagedPtrCastPtr result_ onException (do result <- propagateGError $ webkit_favicon_database_get_favicon_pixbuf_finish _obj' result_' checkUnexpectedReturnNULL "webkit_favicon_database_get_favicon_pixbuf_finish" result result' <- (wrapObject GdkPixbuf.Pixbuf) result touchManagedPtr _obj touchManagedPtr result_ return result' ) (do return () ) -- method FaviconDatabase::get_favicon_uri -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "FaviconDatabase", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "page_uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit" "FaviconDatabase", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "page_uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUTF8 -- throws : False -- Skip return : False foreign import ccall "webkit_favicon_database_get_favicon_uri" webkit_favicon_database_get_favicon_uri :: Ptr FaviconDatabase -> -- _obj : TInterface "WebKit" "FaviconDatabase" CString -> -- page_uri : TBasicType TUTF8 IO CString faviconDatabaseGetFaviconUri :: (MonadIO m, FaviconDatabaseK a) => a -> -- _obj T.Text -> -- page_uri m T.Text faviconDatabaseGetFaviconUri _obj page_uri = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj page_uri' <- textToCString page_uri result <- webkit_favicon_database_get_favicon_uri _obj' page_uri' checkUnexpectedReturnNULL "webkit_favicon_database_get_favicon_uri" result result' <- cstringToText result freeMem result touchManagedPtr _obj freeMem page_uri' return result' -- method FaviconDatabase::get_path -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "FaviconDatabase", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit" "FaviconDatabase", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUTF8 -- throws : False -- Skip return : False foreign import ccall "webkit_favicon_database_get_path" webkit_favicon_database_get_path :: Ptr FaviconDatabase -> -- _obj : TInterface "WebKit" "FaviconDatabase" IO CString faviconDatabaseGetPath :: (MonadIO m, FaviconDatabaseK a) => a -> -- _obj m T.Text faviconDatabaseGetPath _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- webkit_favicon_database_get_path _obj' checkUnexpectedReturnNULL "webkit_favicon_database_get_path" result result' <- cstringToText result touchManagedPtr _obj return result' -- method FaviconDatabase::set_path -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "FaviconDatabase", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit" "FaviconDatabase", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "webkit_favicon_database_set_path" webkit_favicon_database_set_path :: Ptr FaviconDatabase -> -- _obj : TInterface "WebKit" "FaviconDatabase" CString -> -- path : TBasicType TUTF8 IO () faviconDatabaseSetPath :: (MonadIO m, FaviconDatabaseK a) => a -> -- _obj Maybe (T.Text) -> -- path m () faviconDatabaseSetPath _obj path = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybePath <- case path of Nothing -> return nullPtr Just jPath -> do jPath' <- textToCString jPath return jPath' webkit_favicon_database_set_path _obj' maybePath touchManagedPtr _obj freeMem maybePath return () -- method FaviconDatabase::try_get_favicon_pixbuf -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "FaviconDatabase", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "page_uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "width", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "height", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit" "FaviconDatabase", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "page_uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "width", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "height", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "GdkPixbuf" "Pixbuf" -- throws : False -- Skip return : False foreign import ccall "webkit_favicon_database_try_get_favicon_pixbuf" webkit_favicon_database_try_get_favicon_pixbuf :: Ptr FaviconDatabase -> -- _obj : TInterface "WebKit" "FaviconDatabase" CString -> -- page_uri : TBasicType TUTF8 Word32 -> -- width : TBasicType TUInt32 Word32 -> -- height : TBasicType TUInt32 IO (Ptr GdkPixbuf.Pixbuf) faviconDatabaseTryGetFaviconPixbuf :: (MonadIO m, FaviconDatabaseK a) => a -> -- _obj T.Text -> -- page_uri Word32 -> -- width Word32 -> -- height m GdkPixbuf.Pixbuf faviconDatabaseTryGetFaviconPixbuf _obj page_uri width height = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj page_uri' <- textToCString page_uri result <- webkit_favicon_database_try_get_favicon_pixbuf _obj' page_uri' width height checkUnexpectedReturnNULL "webkit_favicon_database_try_get_favicon_pixbuf" result result' <- (wrapObject GdkPixbuf.Pixbuf) result touchManagedPtr _obj freeMem page_uri' return result'