#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.WebKit2.Objects.Notification
(
Notification(..) ,
IsNotification ,
toNotification ,
noNotification ,
#if ENABLE_OVERLOADING
NotificationClickedMethodInfo ,
#endif
notificationClicked ,
#if ENABLE_OVERLOADING
NotificationCloseMethodInfo ,
#endif
notificationClose ,
#if ENABLE_OVERLOADING
NotificationGetBodyMethodInfo ,
#endif
notificationGetBody ,
#if ENABLE_OVERLOADING
NotificationGetIdMethodInfo ,
#endif
notificationGetId ,
#if ENABLE_OVERLOADING
NotificationGetTagMethodInfo ,
#endif
notificationGetTag ,
#if ENABLE_OVERLOADING
NotificationGetTitleMethodInfo ,
#endif
notificationGetTitle ,
#if ENABLE_OVERLOADING
NotificationBodyPropertyInfo ,
#endif
getNotificationBody ,
#if ENABLE_OVERLOADING
notificationBody ,
#endif
#if ENABLE_OVERLOADING
NotificationIdPropertyInfo ,
#endif
getNotificationId ,
#if ENABLE_OVERLOADING
notificationId ,
#endif
#if ENABLE_OVERLOADING
NotificationTagPropertyInfo ,
#endif
getNotificationTag ,
#if ENABLE_OVERLOADING
notificationTag ,
#endif
#if ENABLE_OVERLOADING
NotificationTitlePropertyInfo ,
#endif
getNotificationTitle ,
#if ENABLE_OVERLOADING
notificationTitle ,
#endif
C_NotificationClickedCallback ,
NotificationClickedCallback ,
#if ENABLE_OVERLOADING
NotificationClickedSignalInfo ,
#endif
afterNotificationClicked ,
genClosure_NotificationClicked ,
mk_NotificationClickedCallback ,
noNotificationClickedCallback ,
onNotificationClicked ,
wrap_NotificationClickedCallback ,
C_NotificationClosedCallback ,
NotificationClosedCallback ,
#if ENABLE_OVERLOADING
NotificationClosedSignalInfo ,
#endif
afterNotificationClosed ,
genClosure_NotificationClosed ,
mk_NotificationClosedCallback ,
noNotificationClosedCallback ,
onNotificationClosed ,
wrap_NotificationClosedCallback ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GI.GObject.Objects.Object as GObject.Object
newtype Notification = Notification (ManagedPtr Notification)
foreign import ccall "webkit_notification_get_type"
c_webkit_notification_get_type :: IO GType
instance GObject Notification where
gobjectType = c_webkit_notification_get_type
class (GObject o, O.IsDescendantOf Notification o) => IsNotification o
instance (GObject o, O.IsDescendantOf Notification o) => IsNotification o
instance O.HasParentTypes Notification
type instance O.ParentTypes Notification = '[GObject.Object.Object]
toNotification :: (MonadIO m, IsNotification o) => o -> m Notification
toNotification = liftIO . unsafeCastTo Notification
noNotification :: Maybe Notification
noNotification = Nothing
#if ENABLE_OVERLOADING
type family ResolveNotificationMethod (t :: Symbol) (o :: *) :: * where
ResolveNotificationMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveNotificationMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveNotificationMethod "clicked" o = NotificationClickedMethodInfo
ResolveNotificationMethod "close" o = NotificationCloseMethodInfo
ResolveNotificationMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveNotificationMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveNotificationMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveNotificationMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveNotificationMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveNotificationMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveNotificationMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveNotificationMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveNotificationMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveNotificationMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveNotificationMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveNotificationMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveNotificationMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveNotificationMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveNotificationMethod "getBody" o = NotificationGetBodyMethodInfo
ResolveNotificationMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveNotificationMethod "getId" o = NotificationGetIdMethodInfo
ResolveNotificationMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveNotificationMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveNotificationMethod "getTag" o = NotificationGetTagMethodInfo
ResolveNotificationMethod "getTitle" o = NotificationGetTitleMethodInfo
ResolveNotificationMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveNotificationMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveNotificationMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveNotificationMethod t Notification, O.MethodInfo info Notification p) => OL.IsLabel t (Notification -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
type NotificationClickedCallback =
IO ()
noNotificationClickedCallback :: Maybe NotificationClickedCallback
noNotificationClickedCallback = Nothing
type C_NotificationClickedCallback =
Ptr () ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_NotificationClickedCallback :: C_NotificationClickedCallback -> IO (FunPtr C_NotificationClickedCallback)
genClosure_NotificationClicked :: MonadIO m => NotificationClickedCallback -> m (GClosure C_NotificationClickedCallback)
genClosure_NotificationClicked cb = liftIO $ do
let cb' = wrap_NotificationClickedCallback cb
mk_NotificationClickedCallback cb' >>= B.GClosure.newGClosure
wrap_NotificationClickedCallback ::
NotificationClickedCallback ->
C_NotificationClickedCallback
wrap_NotificationClickedCallback _cb _ _ = do
_cb
onNotificationClicked :: (IsNotification a, MonadIO m) => a -> NotificationClickedCallback -> m SignalHandlerId
onNotificationClicked obj cb = liftIO $ do
let cb' = wrap_NotificationClickedCallback cb
cb'' <- mk_NotificationClickedCallback cb'
connectSignalFunPtr obj "clicked" cb'' SignalConnectBefore
afterNotificationClicked :: (IsNotification a, MonadIO m) => a -> NotificationClickedCallback -> m SignalHandlerId
afterNotificationClicked obj cb = liftIO $ do
let cb' = wrap_NotificationClickedCallback cb
cb'' <- mk_NotificationClickedCallback cb'
connectSignalFunPtr obj "clicked" cb'' SignalConnectAfter
type NotificationClosedCallback =
IO ()
noNotificationClosedCallback :: Maybe NotificationClosedCallback
noNotificationClosedCallback = Nothing
type C_NotificationClosedCallback =
Ptr () ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_NotificationClosedCallback :: C_NotificationClosedCallback -> IO (FunPtr C_NotificationClosedCallback)
genClosure_NotificationClosed :: MonadIO m => NotificationClosedCallback -> m (GClosure C_NotificationClosedCallback)
genClosure_NotificationClosed cb = liftIO $ do
let cb' = wrap_NotificationClosedCallback cb
mk_NotificationClosedCallback cb' >>= B.GClosure.newGClosure
wrap_NotificationClosedCallback ::
NotificationClosedCallback ->
C_NotificationClosedCallback
wrap_NotificationClosedCallback _cb _ _ = do
_cb
onNotificationClosed :: (IsNotification a, MonadIO m) => a -> NotificationClosedCallback -> m SignalHandlerId
onNotificationClosed obj cb = liftIO $ do
let cb' = wrap_NotificationClosedCallback cb
cb'' <- mk_NotificationClosedCallback cb'
connectSignalFunPtr obj "closed" cb'' SignalConnectBefore
afterNotificationClosed :: (IsNotification a, MonadIO m) => a -> NotificationClosedCallback -> m SignalHandlerId
afterNotificationClosed obj cb = liftIO $ do
let cb' = wrap_NotificationClosedCallback cb
cb'' <- mk_NotificationClosedCallback cb'
connectSignalFunPtr obj "closed" cb'' SignalConnectAfter
getNotificationBody :: (MonadIO m, IsNotification o) => o -> m T.Text
getNotificationBody obj = liftIO $ checkUnexpectedNothing "getNotificationBody" $ B.Properties.getObjectPropertyString obj "body"
#if ENABLE_OVERLOADING
data NotificationBodyPropertyInfo
instance AttrInfo NotificationBodyPropertyInfo where
type AttrAllowedOps NotificationBodyPropertyInfo = '[ 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint NotificationBodyPropertyInfo = (~) ()
type AttrBaseTypeConstraint NotificationBodyPropertyInfo = IsNotification
type AttrGetType NotificationBodyPropertyInfo = T.Text
type AttrLabel NotificationBodyPropertyInfo = "body"
type AttrOrigin NotificationBodyPropertyInfo = Notification
attrGet _ = getNotificationBody
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
getNotificationId :: (MonadIO m, IsNotification o) => o -> m Word64
getNotificationId obj = liftIO $ B.Properties.getObjectPropertyUInt64 obj "id"
#if ENABLE_OVERLOADING
data NotificationIdPropertyInfo
instance AttrInfo NotificationIdPropertyInfo where
type AttrAllowedOps NotificationIdPropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint NotificationIdPropertyInfo = (~) ()
type AttrBaseTypeConstraint NotificationIdPropertyInfo = IsNotification
type AttrGetType NotificationIdPropertyInfo = Word64
type AttrLabel NotificationIdPropertyInfo = "id"
type AttrOrigin NotificationIdPropertyInfo = Notification
attrGet _ = getNotificationId
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
getNotificationTag :: (MonadIO m, IsNotification o) => o -> m (Maybe T.Text)
getNotificationTag obj = liftIO $ B.Properties.getObjectPropertyString obj "tag"
#if ENABLE_OVERLOADING
data NotificationTagPropertyInfo
instance AttrInfo NotificationTagPropertyInfo where
type AttrAllowedOps NotificationTagPropertyInfo = '[ 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint NotificationTagPropertyInfo = (~) ()
type AttrBaseTypeConstraint NotificationTagPropertyInfo = IsNotification
type AttrGetType NotificationTagPropertyInfo = (Maybe T.Text)
type AttrLabel NotificationTagPropertyInfo = "tag"
type AttrOrigin NotificationTagPropertyInfo = Notification
attrGet _ = getNotificationTag
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
getNotificationTitle :: (MonadIO m, IsNotification o) => o -> m T.Text
getNotificationTitle obj = liftIO $ checkUnexpectedNothing "getNotificationTitle" $ B.Properties.getObjectPropertyString obj "title"
#if ENABLE_OVERLOADING
data NotificationTitlePropertyInfo
instance AttrInfo NotificationTitlePropertyInfo where
type AttrAllowedOps NotificationTitlePropertyInfo = '[ 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint NotificationTitlePropertyInfo = (~) ()
type AttrBaseTypeConstraint NotificationTitlePropertyInfo = IsNotification
type AttrGetType NotificationTitlePropertyInfo = T.Text
type AttrLabel NotificationTitlePropertyInfo = "title"
type AttrOrigin NotificationTitlePropertyInfo = Notification
attrGet _ = getNotificationTitle
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList Notification
type instance O.AttributeList Notification = NotificationAttributeList
type NotificationAttributeList = ('[ '("body", NotificationBodyPropertyInfo), '("id", NotificationIdPropertyInfo), '("tag", NotificationTagPropertyInfo), '("title", NotificationTitlePropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
notificationBody :: AttrLabelProxy "body"
notificationBody = AttrLabelProxy
notificationId :: AttrLabelProxy "id"
notificationId = AttrLabelProxy
notificationTag :: AttrLabelProxy "tag"
notificationTag = AttrLabelProxy
notificationTitle :: AttrLabelProxy "title"
notificationTitle = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
data NotificationClickedSignalInfo
instance SignalInfo NotificationClickedSignalInfo where
type HaskellCallbackType NotificationClickedSignalInfo = NotificationClickedCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_NotificationClickedCallback cb
cb'' <- mk_NotificationClickedCallback cb'
connectSignalFunPtr obj "clicked" cb'' connectMode
data NotificationClosedSignalInfo
instance SignalInfo NotificationClosedSignalInfo where
type HaskellCallbackType NotificationClosedSignalInfo = NotificationClosedCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_NotificationClosedCallback cb
cb'' <- mk_NotificationClosedCallback cb'
connectSignalFunPtr obj "closed" cb'' connectMode
type instance O.SignalList Notification = NotificationSignalList
type NotificationSignalList = ('[ '("clicked", NotificationClickedSignalInfo), '("closed", NotificationClosedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "webkit_notification_clicked" webkit_notification_clicked ::
Ptr Notification ->
IO ()
notificationClicked ::
(B.CallStack.HasCallStack, MonadIO m, IsNotification a) =>
a
-> m ()
notificationClicked notification = liftIO $ do
notification' <- unsafeManagedPtrCastPtr notification
webkit_notification_clicked notification'
touchManagedPtr notification
return ()
#if ENABLE_OVERLOADING
data NotificationClickedMethodInfo
instance (signature ~ (m ()), MonadIO m, IsNotification a) => O.MethodInfo NotificationClickedMethodInfo a signature where
overloadedMethod _ = notificationClicked
#endif
foreign import ccall "webkit_notification_close" webkit_notification_close ::
Ptr Notification ->
IO ()
notificationClose ::
(B.CallStack.HasCallStack, MonadIO m, IsNotification a) =>
a
-> m ()
notificationClose notification = liftIO $ do
notification' <- unsafeManagedPtrCastPtr notification
webkit_notification_close notification'
touchManagedPtr notification
return ()
#if ENABLE_OVERLOADING
data NotificationCloseMethodInfo
instance (signature ~ (m ()), MonadIO m, IsNotification a) => O.MethodInfo NotificationCloseMethodInfo a signature where
overloadedMethod _ = notificationClose
#endif
foreign import ccall "webkit_notification_get_body" webkit_notification_get_body ::
Ptr Notification ->
IO CString
notificationGetBody ::
(B.CallStack.HasCallStack, MonadIO m, IsNotification a) =>
a
-> m T.Text
notificationGetBody notification = liftIO $ do
notification' <- unsafeManagedPtrCastPtr notification
result <- webkit_notification_get_body notification'
checkUnexpectedReturnNULL "notificationGetBody" result
result' <- cstringToText result
touchManagedPtr notification
return result'
#if ENABLE_OVERLOADING
data NotificationGetBodyMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsNotification a) => O.MethodInfo NotificationGetBodyMethodInfo a signature where
overloadedMethod _ = notificationGetBody
#endif
foreign import ccall "webkit_notification_get_id" webkit_notification_get_id ::
Ptr Notification ->
IO Word64
notificationGetId ::
(B.CallStack.HasCallStack, MonadIO m, IsNotification a) =>
a
-> m Word64
notificationGetId notification = liftIO $ do
notification' <- unsafeManagedPtrCastPtr notification
result <- webkit_notification_get_id notification'
touchManagedPtr notification
return result
#if ENABLE_OVERLOADING
data NotificationGetIdMethodInfo
instance (signature ~ (m Word64), MonadIO m, IsNotification a) => O.MethodInfo NotificationGetIdMethodInfo a signature where
overloadedMethod _ = notificationGetId
#endif
foreign import ccall "webkit_notification_get_tag" webkit_notification_get_tag ::
Ptr Notification ->
IO CString
notificationGetTag ::
(B.CallStack.HasCallStack, MonadIO m, IsNotification a) =>
a
-> m (Maybe T.Text)
notificationGetTag notification = liftIO $ do
notification' <- unsafeManagedPtrCastPtr notification
result <- webkit_notification_get_tag notification'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- cstringToText result'
return result''
touchManagedPtr notification
return maybeResult
#if ENABLE_OVERLOADING
data NotificationGetTagMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsNotification a) => O.MethodInfo NotificationGetTagMethodInfo a signature where
overloadedMethod _ = notificationGetTag
#endif
foreign import ccall "webkit_notification_get_title" webkit_notification_get_title ::
Ptr Notification ->
IO CString
notificationGetTitle ::
(B.CallStack.HasCallStack, MonadIO m, IsNotification a) =>
a
-> m T.Text
notificationGetTitle notification = liftIO $ do
notification' <- unsafeManagedPtrCastPtr notification
result <- webkit_notification_get_title notification'
checkUnexpectedReturnNULL "notificationGetTitle" result
result' <- cstringToText result
touchManagedPtr notification
return result'
#if ENABLE_OVERLOADING
data NotificationGetTitleMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsNotification a) => O.MethodInfo NotificationGetTitleMethodInfo a signature where
overloadedMethod _ = notificationGetTitle
#endif