module GI.WebKit2.Objects.Notification
(
Notification(..) ,
NotificationK ,
toNotification ,
noNotification ,
notificationClose ,
notificationGetBody ,
notificationGetId ,
notificationGetTitle ,
NotificationBodyPropertyInfo ,
getNotificationBody ,
NotificationIdPropertyInfo ,
getNotificationId ,
NotificationTitlePropertyInfo ,
getNotificationTitle ,
NotificationClosedCallback ,
NotificationClosedCallbackC ,
NotificationClosedSignalInfo ,
afterNotificationClosed ,
mkNotificationClosedCallback ,
noNotificationClosedCallback ,
notificationClosedCallbackWrapper ,
notificationClosedClosure ,
onNotificationClosed ,
) 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 Notification = Notification (ForeignPtr Notification)
foreign import ccall "webkit_notification_get_type"
c_webkit_notification_get_type :: IO GType
type instance ParentTypes Notification = NotificationParentTypes
type NotificationParentTypes = '[GObject.Object]
instance GObject Notification where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_webkit_notification_get_type
class GObject o => NotificationK o
instance (GObject o, IsDescendantOf Notification o) => NotificationK o
toNotification :: NotificationK o => o -> IO Notification
toNotification = unsafeCastTo Notification
noNotification :: Maybe Notification
noNotification = Nothing
type NotificationClosedCallback =
IO ()
noNotificationClosedCallback :: Maybe NotificationClosedCallback
noNotificationClosedCallback = Nothing
type NotificationClosedCallbackC =
Ptr () ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mkNotificationClosedCallback :: NotificationClosedCallbackC -> IO (FunPtr NotificationClosedCallbackC)
notificationClosedClosure :: NotificationClosedCallback -> IO Closure
notificationClosedClosure cb = newCClosure =<< mkNotificationClosedCallback wrapped
where wrapped = notificationClosedCallbackWrapper cb
notificationClosedCallbackWrapper ::
NotificationClosedCallback ->
Ptr () ->
Ptr () ->
IO ()
notificationClosedCallbackWrapper _cb _ _ = do
_cb
onNotificationClosed :: (GObject a, MonadIO m) => a -> NotificationClosedCallback -> m SignalHandlerId
onNotificationClosed obj cb = liftIO $ connectNotificationClosed obj cb SignalConnectBefore
afterNotificationClosed :: (GObject a, MonadIO m) => a -> NotificationClosedCallback -> m SignalHandlerId
afterNotificationClosed obj cb = connectNotificationClosed obj cb SignalConnectAfter
connectNotificationClosed :: (GObject a, MonadIO m) =>
a -> NotificationClosedCallback -> SignalConnectMode -> m SignalHandlerId
connectNotificationClosed obj cb after = liftIO $ do
cb' <- mkNotificationClosedCallback (notificationClosedCallbackWrapper cb)
connectSignalFunPtr obj "closed" cb' after
getNotificationBody :: (MonadIO m, NotificationK o) => o -> m T.Text
getNotificationBody obj = liftIO $ getObjectPropertyString obj "body"
data NotificationBodyPropertyInfo
instance AttrInfo NotificationBodyPropertyInfo where
type AttrAllowedOps NotificationBodyPropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint NotificationBodyPropertyInfo = (~) ()
type AttrBaseTypeConstraint NotificationBodyPropertyInfo = NotificationK
type AttrGetType NotificationBodyPropertyInfo = T.Text
type AttrLabel NotificationBodyPropertyInfo = "Notification::body"
attrGet _ = getNotificationBody
attrSet _ = undefined
attrConstruct _ = undefined
getNotificationId :: (MonadIO m, NotificationK o) => o -> m Word64
getNotificationId obj = liftIO $ getObjectPropertyUInt64 obj "id"
data NotificationIdPropertyInfo
instance AttrInfo NotificationIdPropertyInfo where
type AttrAllowedOps NotificationIdPropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint NotificationIdPropertyInfo = (~) ()
type AttrBaseTypeConstraint NotificationIdPropertyInfo = NotificationK
type AttrGetType NotificationIdPropertyInfo = Word64
type AttrLabel NotificationIdPropertyInfo = "Notification::id"
attrGet _ = getNotificationId
attrSet _ = undefined
attrConstruct _ = undefined
getNotificationTitle :: (MonadIO m, NotificationK o) => o -> m T.Text
getNotificationTitle obj = liftIO $ getObjectPropertyString obj "title"
data NotificationTitlePropertyInfo
instance AttrInfo NotificationTitlePropertyInfo where
type AttrAllowedOps NotificationTitlePropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint NotificationTitlePropertyInfo = (~) ()
type AttrBaseTypeConstraint NotificationTitlePropertyInfo = NotificationK
type AttrGetType NotificationTitlePropertyInfo = T.Text
type AttrLabel NotificationTitlePropertyInfo = "Notification::title"
attrGet _ = getNotificationTitle
attrSet _ = undefined
attrConstruct _ = undefined
type instance AttributeList Notification = NotificationAttributeList
type NotificationAttributeList = ('[ '("body", NotificationBodyPropertyInfo), '("id", NotificationIdPropertyInfo), '("title", NotificationTitlePropertyInfo)] :: [(Symbol, *)])
data NotificationClosedSignalInfo
instance SignalInfo NotificationClosedSignalInfo where
type HaskellCallbackType NotificationClosedSignalInfo = NotificationClosedCallback
connectSignal _ = connectNotificationClosed
type instance SignalList Notification = NotificationSignalList
type NotificationSignalList = ('[ '("closed", NotificationClosedSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
foreign import ccall "webkit_notification_close" webkit_notification_close ::
Ptr Notification ->
IO ()
notificationClose ::
(MonadIO m, NotificationK a) =>
a ->
m ()
notificationClose _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
webkit_notification_close _obj'
touchManagedPtr _obj
return ()
foreign import ccall "webkit_notification_get_body" webkit_notification_get_body ::
Ptr Notification ->
IO CString
notificationGetBody ::
(MonadIO m, NotificationK a) =>
a ->
m T.Text
notificationGetBody _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_notification_get_body _obj'
checkUnexpectedReturnNULL "webkit_notification_get_body" result
result' <- cstringToText result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_notification_get_id" webkit_notification_get_id ::
Ptr Notification ->
IO Word64
notificationGetId ::
(MonadIO m, NotificationK a) =>
a ->
m Word64
notificationGetId _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_notification_get_id _obj'
touchManagedPtr _obj
return result
foreign import ccall "webkit_notification_get_title" webkit_notification_get_title ::
Ptr Notification ->
IO CString
notificationGetTitle ::
(MonadIO m, NotificationK a) =>
a ->
m T.Text
notificationGetTitle _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_notification_get_title _obj'
checkUnexpectedReturnNULL "webkit_notification_get_title" result
result' <- cstringToText result
touchManagedPtr _obj
return result'