gi-webkit-0.2.4.12: GI/WebKit/Objects/WebPluginDatabase.hs
{- |
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.WebPluginDatabase
(
-- * Exported types
WebPluginDatabase(..) ,
WebPluginDatabaseK ,
toWebPluginDatabase ,
noWebPluginDatabase ,
-- * Methods
-- ** webPluginDatabaseGetPluginForMimetype
webPluginDatabaseGetPluginForMimetype ,
-- ** webPluginDatabaseGetPlugins
webPluginDatabaseGetPlugins ,
-- ** webPluginDatabasePluginsListFree
webPluginDatabasePluginsListFree ,
-- ** webPluginDatabaseRefresh
webPluginDatabaseRefresh ,
) 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
newtype WebPluginDatabase = WebPluginDatabase (ForeignPtr WebPluginDatabase)
foreign import ccall "webkit_web_plugin_database_get_type"
c_webkit_web_plugin_database_get_type :: IO GType
type instance ParentTypes WebPluginDatabase = WebPluginDatabaseParentTypes
type WebPluginDatabaseParentTypes = '[GObject.Object]
instance GObject WebPluginDatabase where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_webkit_web_plugin_database_get_type
class GObject o => WebPluginDatabaseK o
instance (GObject o, IsDescendantOf WebPluginDatabase o) => WebPluginDatabaseK o
toWebPluginDatabase :: WebPluginDatabaseK o => o -> IO WebPluginDatabase
toWebPluginDatabase = unsafeCastTo WebPluginDatabase
noWebPluginDatabase :: Maybe WebPluginDatabase
noWebPluginDatabase = Nothing
type instance AttributeList WebPluginDatabase = WebPluginDatabaseAttributeList
type WebPluginDatabaseAttributeList = ('[ ] :: [(Symbol, *)])
type instance SignalList WebPluginDatabase = WebPluginDatabaseSignalList
type WebPluginDatabaseSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
-- method WebPluginDatabase::get_plugin_for_mimetype
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "WebPluginDatabase", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "mime_type", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit" "WebPluginDatabase", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "mime_type", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "WebKit" "WebPlugin"
-- throws : False
-- Skip return : False
foreign import ccall "webkit_web_plugin_database_get_plugin_for_mimetype" webkit_web_plugin_database_get_plugin_for_mimetype ::
Ptr WebPluginDatabase -> -- _obj : TInterface "WebKit" "WebPluginDatabase"
CString -> -- mime_type : TBasicType TUTF8
IO (Ptr WebPlugin)
webPluginDatabaseGetPluginForMimetype ::
(MonadIO m, WebPluginDatabaseK a) =>
a -> -- _obj
T.Text -> -- mime_type
m WebPlugin
webPluginDatabaseGetPluginForMimetype _obj mime_type = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
mime_type' <- textToCString mime_type
result <- webkit_web_plugin_database_get_plugin_for_mimetype _obj' mime_type'
checkUnexpectedReturnNULL "webkit_web_plugin_database_get_plugin_for_mimetype" result
result' <- (wrapObject WebPlugin) result
touchManagedPtr _obj
freeMem mime_type'
return result'
-- method WebPluginDatabase::get_plugins
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "WebPluginDatabase", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit" "WebPluginDatabase", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGSList (TInterface "WebKit" "WebPlugin")
-- throws : False
-- Skip return : False
foreign import ccall "webkit_web_plugin_database_get_plugins" webkit_web_plugin_database_get_plugins ::
Ptr WebPluginDatabase -> -- _obj : TInterface "WebKit" "WebPluginDatabase"
IO (Ptr (GSList (Ptr WebPlugin)))
webPluginDatabaseGetPlugins ::
(MonadIO m, WebPluginDatabaseK a) =>
a -> -- _obj
m [WebPlugin]
webPluginDatabaseGetPlugins _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_web_plugin_database_get_plugins _obj'
checkUnexpectedReturnNULL "webkit_web_plugin_database_get_plugins" result
result' <- unpackGSList result
result'' <- mapM (wrapObject WebPlugin) result'
g_slist_free result
touchManagedPtr _obj
return result''
-- method WebPluginDatabase::refresh
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "WebPluginDatabase", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit" "WebPluginDatabase", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "webkit_web_plugin_database_refresh" webkit_web_plugin_database_refresh ::
Ptr WebPluginDatabase -> -- _obj : TInterface "WebKit" "WebPluginDatabase"
IO ()
webPluginDatabaseRefresh ::
(MonadIO m, WebPluginDatabaseK a) =>
a -> -- _obj
m ()
webPluginDatabaseRefresh _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
webkit_web_plugin_database_refresh _obj'
touchManagedPtr _obj
return ()
-- method WebPluginDatabase::plugins_list_free
-- method type : MemberFunction
-- Args : [Arg {argName = "list", argType = TGSList (TInterface "WebKit" "WebPlugin"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "list", argType = TGSList (TInterface "WebKit" "WebPlugin"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "webkit_web_plugin_database_plugins_list_free" webkit_web_plugin_database_plugins_list_free ::
Ptr (GSList (Ptr WebPlugin)) -> -- list : TGSList (TInterface "WebKit" "WebPlugin")
IO ()
webPluginDatabasePluginsListFree ::
(MonadIO m, WebPluginK a) =>
[a] -> -- list
m ()
webPluginDatabasePluginsListFree list = liftIO $ do
let list' = map unsafeManagedPtrCastPtr list
list'' <- packGSList list'
webkit_web_plugin_database_plugins_list_free list''
mapM_ touchManagedPtr list
g_slist_free list''
return ()