module GI.WebKit.Objects.WebPlugin
(
WebPlugin(..) ,
WebPluginK ,
toWebPlugin ,
noWebPlugin ,
webPluginGetDescription ,
webPluginGetEnabled ,
webPluginGetName ,
webPluginGetPath ,
webPluginSetEnabled ,
WebPluginEnabledPropertyInfo ,
constructWebPluginEnabled ,
getWebPluginEnabled ,
setWebPluginEnabled ,
) 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 WebPlugin = WebPlugin (ForeignPtr WebPlugin)
foreign import ccall "webkit_web_plugin_get_type"
c_webkit_web_plugin_get_type :: IO GType
type instance ParentTypes WebPlugin = WebPluginParentTypes
type WebPluginParentTypes = '[GObject.Object]
instance GObject WebPlugin where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_webkit_web_plugin_get_type
class GObject o => WebPluginK o
instance (GObject o, IsDescendantOf WebPlugin o) => WebPluginK o
toWebPlugin :: WebPluginK o => o -> IO WebPlugin
toWebPlugin = unsafeCastTo WebPlugin
noWebPlugin :: Maybe WebPlugin
noWebPlugin = Nothing
getWebPluginEnabled :: (MonadIO m, WebPluginK o) => o -> m Bool
getWebPluginEnabled obj = liftIO $ getObjectPropertyBool obj "enabled"
setWebPluginEnabled :: (MonadIO m, WebPluginK o) => o -> Bool -> m ()
setWebPluginEnabled obj val = liftIO $ setObjectPropertyBool obj "enabled" val
constructWebPluginEnabled :: Bool -> IO ([Char], GValue)
constructWebPluginEnabled val = constructObjectPropertyBool "enabled" val
data WebPluginEnabledPropertyInfo
instance AttrInfo WebPluginEnabledPropertyInfo where
type AttrAllowedOps WebPluginEnabledPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint WebPluginEnabledPropertyInfo = (~) Bool
type AttrBaseTypeConstraint WebPluginEnabledPropertyInfo = WebPluginK
type AttrGetType WebPluginEnabledPropertyInfo = Bool
type AttrLabel WebPluginEnabledPropertyInfo = "WebPlugin::enabled"
attrGet _ = getWebPluginEnabled
attrSet _ = setWebPluginEnabled
attrConstruct _ = constructWebPluginEnabled
type instance AttributeList WebPlugin = WebPluginAttributeList
type WebPluginAttributeList = ('[ '("enabled", WebPluginEnabledPropertyInfo)] :: [(Symbol, *)])
type instance SignalList WebPlugin = WebPluginSignalList
type WebPluginSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
foreign import ccall "webkit_web_plugin_get_description" webkit_web_plugin_get_description ::
Ptr WebPlugin ->
IO CString
webPluginGetDescription ::
(MonadIO m, WebPluginK a) =>
a ->
m T.Text
webPluginGetDescription _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_web_plugin_get_description _obj'
checkUnexpectedReturnNULL "webkit_web_plugin_get_description" result
result' <- cstringToText result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_web_plugin_get_enabled" webkit_web_plugin_get_enabled ::
Ptr WebPlugin ->
IO CInt
webPluginGetEnabled ::
(MonadIO m, WebPluginK a) =>
a ->
m Bool
webPluginGetEnabled _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_web_plugin_get_enabled _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_web_plugin_get_name" webkit_web_plugin_get_name ::
Ptr WebPlugin ->
IO CString
webPluginGetName ::
(MonadIO m, WebPluginK a) =>
a ->
m T.Text
webPluginGetName _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_web_plugin_get_name _obj'
checkUnexpectedReturnNULL "webkit_web_plugin_get_name" result
result' <- cstringToText result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_web_plugin_get_path" webkit_web_plugin_get_path ::
Ptr WebPlugin ->
IO CString
webPluginGetPath ::
(MonadIO m, WebPluginK a) =>
a ->
m T.Text
webPluginGetPath _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_web_plugin_get_path _obj'
checkUnexpectedReturnNULL "webkit_web_plugin_get_path" result
result' <- cstringToText result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_web_plugin_set_enabled" webkit_web_plugin_set_enabled ::
Ptr WebPlugin ->
CInt ->
IO ()
webPluginSetEnabled ::
(MonadIO m, WebPluginK a) =>
a ->
Bool ->
m ()
webPluginSetEnabled _obj enabled = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let enabled' = (fromIntegral . fromEnum) enabled
webkit_web_plugin_set_enabled _obj' enabled'
touchManagedPtr _obj
return ()