{- | 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.Notification ( -- * Exported types Notification(..) , NotificationK , toNotification , noNotification , -- * Methods -- ** notificationClose notificationClose , -- ** notificationGetBody notificationGetBody , -- ** notificationGetId notificationGetId , -- ** notificationGetTitle notificationGetTitle , -- * Properties -- ** Body NotificationBodyPropertyInfo , getNotificationBody , -- ** Id NotificationIdPropertyInfo , getNotificationId , -- ** Title NotificationTitlePropertyInfo , getNotificationTitle , -- * Signals -- ** Closed 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 -- signal Notification::closed type NotificationClosedCallback = IO () noNotificationClosedCallback :: Maybe NotificationClosedCallback noNotificationClosedCallback = Nothing type NotificationClosedCallbackC = Ptr () -> -- object Ptr () -> -- user_data 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 -- VVV Prop "body" -- Type: TBasicType TUTF8 -- Flags: [PropertyReadable] 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 -- VVV Prop "id" -- Type: TBasicType TUInt64 -- Flags: [PropertyReadable] 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 -- VVV Prop "title" -- Type: TBasicType TUTF8 -- Flags: [PropertyReadable] 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, *)]) -- method Notification::close -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Notification", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Notification", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "webkit_notification_close" webkit_notification_close :: Ptr Notification -> -- _obj : TInterface "WebKit2" "Notification" IO () notificationClose :: (MonadIO m, NotificationK a) => a -> -- _obj m () notificationClose _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj webkit_notification_close _obj' touchManagedPtr _obj return () -- method Notification::get_body -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Notification", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Notification", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUTF8 -- throws : False -- Skip return : False foreign import ccall "webkit_notification_get_body" webkit_notification_get_body :: Ptr Notification -> -- _obj : TInterface "WebKit2" "Notification" IO CString notificationGetBody :: (MonadIO m, NotificationK a) => a -> -- _obj 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' -- method Notification::get_id -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Notification", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Notification", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUInt64 -- throws : False -- Skip return : False foreign import ccall "webkit_notification_get_id" webkit_notification_get_id :: Ptr Notification -> -- _obj : TInterface "WebKit2" "Notification" IO Word64 notificationGetId :: (MonadIO m, NotificationK a) => a -> -- _obj m Word64 notificationGetId _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- webkit_notification_get_id _obj' touchManagedPtr _obj return result -- method Notification::get_title -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Notification", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Notification", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUTF8 -- throws : False -- Skip return : False foreign import ccall "webkit_notification_get_title" webkit_notification_get_title :: Ptr Notification -> -- _obj : TInterface "WebKit2" "Notification" IO CString notificationGetTitle :: (MonadIO m, NotificationK a) => a -> -- _obj 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'