{- |
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.WebKit2.Objects.Plugin
    ( 

-- * Exported types
    Plugin(..)                              ,
    PluginK                                 ,
    toPlugin                                ,
    noPlugin                                ,


 -- * Methods
-- ** pluginGetDescription
    pluginGetDescription                    ,


-- ** pluginGetMimeInfoList
    pluginGetMimeInfoList                   ,


-- ** pluginGetName
    pluginGetName                           ,


-- ** pluginGetPath
    pluginGetPath                           ,




    ) 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.WebKit2.Types
import GI.WebKit2.Callbacks
import qualified GI.GObject as GObject

newtype Plugin = Plugin (ForeignPtr Plugin)
foreign import ccall "webkit_plugin_get_type"
    c_webkit_plugin_get_type :: IO GType

type instance ParentTypes Plugin = PluginParentTypes
type PluginParentTypes = '[GObject.Object]

instance GObject Plugin where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_webkit_plugin_get_type
    

class GObject o => PluginK o
instance (GObject o, IsDescendantOf Plugin o) => PluginK o

toPlugin :: PluginK o => o -> IO Plugin
toPlugin = unsafeCastTo Plugin

noPlugin :: Maybe Plugin
noPlugin = Nothing

type instance AttributeList Plugin = PluginAttributeList
type PluginAttributeList = ('[ ] :: [(Symbol, *)])

type instance SignalList Plugin = PluginSignalList
type PluginSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method Plugin::get_description
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Plugin", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Plugin", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "webkit_plugin_get_description" webkit_plugin_get_description :: 
    Ptr Plugin ->                           -- _obj : TInterface "WebKit2" "Plugin"
    IO CString


pluginGetDescription ::
    (MonadIO m, PluginK a) =>
    a ->                                    -- _obj
    m T.Text
pluginGetDescription _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_plugin_get_description _obj'
    checkUnexpectedReturnNULL "webkit_plugin_get_description" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

-- method Plugin::get_mime_info_list
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Plugin", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Plugin", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGList (TInterface "WebKit2" "MimeInfo")
-- throws : False
-- Skip return : False

foreign import ccall "webkit_plugin_get_mime_info_list" webkit_plugin_get_mime_info_list :: 
    Ptr Plugin ->                           -- _obj : TInterface "WebKit2" "Plugin"
    IO (Ptr (GList (Ptr MimeInfo)))


pluginGetMimeInfoList ::
    (MonadIO m, PluginK a) =>
    a ->                                    -- _obj
    m [MimeInfo]
pluginGetMimeInfoList _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_plugin_get_mime_info_list _obj'
    checkUnexpectedReturnNULL "webkit_plugin_get_mime_info_list" result
    result' <- unpackGList result
    result'' <- mapM (newBoxed MimeInfo) result'
    touchManagedPtr _obj
    return result''

-- method Plugin::get_name
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Plugin", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Plugin", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "webkit_plugin_get_name" webkit_plugin_get_name :: 
    Ptr Plugin ->                           -- _obj : TInterface "WebKit2" "Plugin"
    IO CString


pluginGetName ::
    (MonadIO m, PluginK a) =>
    a ->                                    -- _obj
    m T.Text
pluginGetName _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_plugin_get_name _obj'
    checkUnexpectedReturnNULL "webkit_plugin_get_name" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

-- method Plugin::get_path
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Plugin", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Plugin", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "webkit_plugin_get_path" webkit_plugin_get_path :: 
    Ptr Plugin ->                           -- _obj : TInterface "WebKit2" "Plugin"
    IO CString


pluginGetPath ::
    (MonadIO m, PluginK a) =>
    a ->                                    -- _obj
    m T.Text
pluginGetPath _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_plugin_get_path _obj'
    checkUnexpectedReturnNULL "webkit_plugin_get_path" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'