#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gio.Objects.DBusAuthObserver
(
DBusAuthObserver(..) ,
IsDBusAuthObserver ,
toDBusAuthObserver ,
noDBusAuthObserver ,
#if ENABLE_OVERLOADING
DBusAuthObserverAllowMechanismMethodInfo,
#endif
dBusAuthObserverAllowMechanism ,
#if ENABLE_OVERLOADING
DBusAuthObserverAuthorizeAuthenticatedPeerMethodInfo,
#endif
dBusAuthObserverAuthorizeAuthenticatedPeer,
dBusAuthObserverNew ,
C_DBusAuthObserverAllowMechanismCallback,
DBusAuthObserverAllowMechanismCallback ,
#if ENABLE_OVERLOADING
DBusAuthObserverAllowMechanismSignalInfo,
#endif
afterDBusAuthObserverAllowMechanism ,
genClosure_DBusAuthObserverAllowMechanism,
mk_DBusAuthObserverAllowMechanismCallback,
noDBusAuthObserverAllowMechanismCallback,
onDBusAuthObserverAllowMechanism ,
wrap_DBusAuthObserverAllowMechanismCallback,
C_DBusAuthObserverAuthorizeAuthenticatedPeerCallback,
DBusAuthObserverAuthorizeAuthenticatedPeerCallback,
#if ENABLE_OVERLOADING
DBusAuthObserverAuthorizeAuthenticatedPeerSignalInfo,
#endif
afterDBusAuthObserverAuthorizeAuthenticatedPeer,
genClosure_DBusAuthObserverAuthorizeAuthenticatedPeer,
mk_DBusAuthObserverAuthorizeAuthenticatedPeerCallback,
noDBusAuthObserverAuthorizeAuthenticatedPeerCallback,
onDBusAuthObserverAuthorizeAuthenticatedPeer,
wrap_DBusAuthObserverAuthorizeAuthenticatedPeerCallback,
) 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
import {-# SOURCE #-} qualified GI.Gio.Objects.Credentials as Gio.Credentials
import {-# SOURCE #-} qualified GI.Gio.Objects.IOStream as Gio.IOStream
newtype DBusAuthObserver = DBusAuthObserver (ManagedPtr DBusAuthObserver)
foreign import ccall "g_dbus_auth_observer_get_type"
c_g_dbus_auth_observer_get_type :: IO GType
instance GObject DBusAuthObserver where
gobjectType = c_g_dbus_auth_observer_get_type
class (GObject o, O.IsDescendantOf DBusAuthObserver o) => IsDBusAuthObserver o
instance (GObject o, O.IsDescendantOf DBusAuthObserver o) => IsDBusAuthObserver o
instance O.HasParentTypes DBusAuthObserver
type instance O.ParentTypes DBusAuthObserver = '[GObject.Object.Object]
toDBusAuthObserver :: (MonadIO m, IsDBusAuthObserver o) => o -> m DBusAuthObserver
toDBusAuthObserver = liftIO . unsafeCastTo DBusAuthObserver
noDBusAuthObserver :: Maybe DBusAuthObserver
noDBusAuthObserver = Nothing
#if ENABLE_OVERLOADING
type family ResolveDBusAuthObserverMethod (t :: Symbol) (o :: *) :: * where
ResolveDBusAuthObserverMethod "allowMechanism" o = DBusAuthObserverAllowMechanismMethodInfo
ResolveDBusAuthObserverMethod "authorizeAuthenticatedPeer" o = DBusAuthObserverAuthorizeAuthenticatedPeerMethodInfo
ResolveDBusAuthObserverMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveDBusAuthObserverMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveDBusAuthObserverMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveDBusAuthObserverMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveDBusAuthObserverMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveDBusAuthObserverMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveDBusAuthObserverMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveDBusAuthObserverMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveDBusAuthObserverMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveDBusAuthObserverMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveDBusAuthObserverMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveDBusAuthObserverMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveDBusAuthObserverMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveDBusAuthObserverMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveDBusAuthObserverMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveDBusAuthObserverMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveDBusAuthObserverMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveDBusAuthObserverMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveDBusAuthObserverMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveDBusAuthObserverMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveDBusAuthObserverMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveDBusAuthObserverMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveDBusAuthObserverMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveDBusAuthObserverMethod t DBusAuthObserver, O.MethodInfo info DBusAuthObserver p) => OL.IsLabel t (DBusAuthObserver -> 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 DBusAuthObserverAllowMechanismCallback =
T.Text
-> IO Bool
noDBusAuthObserverAllowMechanismCallback :: Maybe DBusAuthObserverAllowMechanismCallback
noDBusAuthObserverAllowMechanismCallback = Nothing
type C_DBusAuthObserverAllowMechanismCallback =
Ptr () ->
CString ->
Ptr () ->
IO CInt
foreign import ccall "wrapper"
mk_DBusAuthObserverAllowMechanismCallback :: C_DBusAuthObserverAllowMechanismCallback -> IO (FunPtr C_DBusAuthObserverAllowMechanismCallback)
genClosure_DBusAuthObserverAllowMechanism :: MonadIO m => DBusAuthObserverAllowMechanismCallback -> m (GClosure C_DBusAuthObserverAllowMechanismCallback)
genClosure_DBusAuthObserverAllowMechanism cb = liftIO $ do
let cb' = wrap_DBusAuthObserverAllowMechanismCallback cb
mk_DBusAuthObserverAllowMechanismCallback cb' >>= B.GClosure.newGClosure
wrap_DBusAuthObserverAllowMechanismCallback ::
DBusAuthObserverAllowMechanismCallback ->
C_DBusAuthObserverAllowMechanismCallback
wrap_DBusAuthObserverAllowMechanismCallback _cb _ mechanism _ = do
mechanism' <- cstringToText mechanism
result <- _cb mechanism'
let result' = (fromIntegral . fromEnum) result
return result'
onDBusAuthObserverAllowMechanism :: (IsDBusAuthObserver a, MonadIO m) => a -> DBusAuthObserverAllowMechanismCallback -> m SignalHandlerId
onDBusAuthObserverAllowMechanism obj cb = liftIO $ do
let cb' = wrap_DBusAuthObserverAllowMechanismCallback cb
cb'' <- mk_DBusAuthObserverAllowMechanismCallback cb'
connectSignalFunPtr obj "allow-mechanism" cb'' SignalConnectBefore
afterDBusAuthObserverAllowMechanism :: (IsDBusAuthObserver a, MonadIO m) => a -> DBusAuthObserverAllowMechanismCallback -> m SignalHandlerId
afterDBusAuthObserverAllowMechanism obj cb = liftIO $ do
let cb' = wrap_DBusAuthObserverAllowMechanismCallback cb
cb'' <- mk_DBusAuthObserverAllowMechanismCallback cb'
connectSignalFunPtr obj "allow-mechanism" cb'' SignalConnectAfter
type DBusAuthObserverAuthorizeAuthenticatedPeerCallback =
Gio.IOStream.IOStream
-> Maybe Gio.Credentials.Credentials
-> IO Bool
noDBusAuthObserverAuthorizeAuthenticatedPeerCallback :: Maybe DBusAuthObserverAuthorizeAuthenticatedPeerCallback
noDBusAuthObserverAuthorizeAuthenticatedPeerCallback = Nothing
type C_DBusAuthObserverAuthorizeAuthenticatedPeerCallback =
Ptr () ->
Ptr Gio.IOStream.IOStream ->
Ptr Gio.Credentials.Credentials ->
Ptr () ->
IO CInt
foreign import ccall "wrapper"
mk_DBusAuthObserverAuthorizeAuthenticatedPeerCallback :: C_DBusAuthObserverAuthorizeAuthenticatedPeerCallback -> IO (FunPtr C_DBusAuthObserverAuthorizeAuthenticatedPeerCallback)
genClosure_DBusAuthObserverAuthorizeAuthenticatedPeer :: MonadIO m => DBusAuthObserverAuthorizeAuthenticatedPeerCallback -> m (GClosure C_DBusAuthObserverAuthorizeAuthenticatedPeerCallback)
genClosure_DBusAuthObserverAuthorizeAuthenticatedPeer cb = liftIO $ do
let cb' = wrap_DBusAuthObserverAuthorizeAuthenticatedPeerCallback cb
mk_DBusAuthObserverAuthorizeAuthenticatedPeerCallback cb' >>= B.GClosure.newGClosure
wrap_DBusAuthObserverAuthorizeAuthenticatedPeerCallback ::
DBusAuthObserverAuthorizeAuthenticatedPeerCallback ->
C_DBusAuthObserverAuthorizeAuthenticatedPeerCallback
wrap_DBusAuthObserverAuthorizeAuthenticatedPeerCallback _cb _ stream credentials _ = do
stream' <- (newObject Gio.IOStream.IOStream) stream
maybeCredentials <-
if credentials == nullPtr
then return Nothing
else do
credentials' <- (newObject Gio.Credentials.Credentials) credentials
return $ Just credentials'
result <- _cb stream' maybeCredentials
let result' = (fromIntegral . fromEnum) result
return result'
onDBusAuthObserverAuthorizeAuthenticatedPeer :: (IsDBusAuthObserver a, MonadIO m) => a -> DBusAuthObserverAuthorizeAuthenticatedPeerCallback -> m SignalHandlerId
onDBusAuthObserverAuthorizeAuthenticatedPeer obj cb = liftIO $ do
let cb' = wrap_DBusAuthObserverAuthorizeAuthenticatedPeerCallback cb
cb'' <- mk_DBusAuthObserverAuthorizeAuthenticatedPeerCallback cb'
connectSignalFunPtr obj "authorize-authenticated-peer" cb'' SignalConnectBefore
afterDBusAuthObserverAuthorizeAuthenticatedPeer :: (IsDBusAuthObserver a, MonadIO m) => a -> DBusAuthObserverAuthorizeAuthenticatedPeerCallback -> m SignalHandlerId
afterDBusAuthObserverAuthorizeAuthenticatedPeer obj cb = liftIO $ do
let cb' = wrap_DBusAuthObserverAuthorizeAuthenticatedPeerCallback cb
cb'' <- mk_DBusAuthObserverAuthorizeAuthenticatedPeerCallback cb'
connectSignalFunPtr obj "authorize-authenticated-peer" cb'' SignalConnectAfter
#if ENABLE_OVERLOADING
instance O.HasAttributeList DBusAuthObserver
type instance O.AttributeList DBusAuthObserver = DBusAuthObserverAttributeList
type DBusAuthObserverAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
data DBusAuthObserverAllowMechanismSignalInfo
instance SignalInfo DBusAuthObserverAllowMechanismSignalInfo where
type HaskellCallbackType DBusAuthObserverAllowMechanismSignalInfo = DBusAuthObserverAllowMechanismCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_DBusAuthObserverAllowMechanismCallback cb
cb'' <- mk_DBusAuthObserverAllowMechanismCallback cb'
connectSignalFunPtr obj "allow-mechanism" cb'' connectMode
data DBusAuthObserverAuthorizeAuthenticatedPeerSignalInfo
instance SignalInfo DBusAuthObserverAuthorizeAuthenticatedPeerSignalInfo where
type HaskellCallbackType DBusAuthObserverAuthorizeAuthenticatedPeerSignalInfo = DBusAuthObserverAuthorizeAuthenticatedPeerCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_DBusAuthObserverAuthorizeAuthenticatedPeerCallback cb
cb'' <- mk_DBusAuthObserverAuthorizeAuthenticatedPeerCallback cb'
connectSignalFunPtr obj "authorize-authenticated-peer" cb'' connectMode
type instance O.SignalList DBusAuthObserver = DBusAuthObserverSignalList
type DBusAuthObserverSignalList = ('[ '("allowMechanism", DBusAuthObserverAllowMechanismSignalInfo), '("authorizeAuthenticatedPeer", DBusAuthObserverAuthorizeAuthenticatedPeerSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_dbus_auth_observer_new" g_dbus_auth_observer_new ::
IO (Ptr DBusAuthObserver)
dBusAuthObserverNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m DBusAuthObserver
dBusAuthObserverNew = liftIO $ do
result <- g_dbus_auth_observer_new
checkUnexpectedReturnNULL "dBusAuthObserverNew" result
result' <- (wrapObject DBusAuthObserver) result
return result'
#if ENABLE_OVERLOADING
#endif
foreign import ccall "g_dbus_auth_observer_allow_mechanism" g_dbus_auth_observer_allow_mechanism ::
Ptr DBusAuthObserver ->
CString ->
IO CInt
dBusAuthObserverAllowMechanism ::
(B.CallStack.HasCallStack, MonadIO m, IsDBusAuthObserver a) =>
a
-> T.Text
-> m Bool
dBusAuthObserverAllowMechanism observer mechanism = liftIO $ do
observer' <- unsafeManagedPtrCastPtr observer
mechanism' <- textToCString mechanism
result <- g_dbus_auth_observer_allow_mechanism observer' mechanism'
let result' = (/= 0) result
touchManagedPtr observer
freeMem mechanism'
return result'
#if ENABLE_OVERLOADING
data DBusAuthObserverAllowMechanismMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m, IsDBusAuthObserver a) => O.MethodInfo DBusAuthObserverAllowMechanismMethodInfo a signature where
overloadedMethod _ = dBusAuthObserverAllowMechanism
#endif
foreign import ccall "g_dbus_auth_observer_authorize_authenticated_peer" g_dbus_auth_observer_authorize_authenticated_peer ::
Ptr DBusAuthObserver ->
Ptr Gio.IOStream.IOStream ->
Ptr Gio.Credentials.Credentials ->
IO CInt
dBusAuthObserverAuthorizeAuthenticatedPeer ::
(B.CallStack.HasCallStack, MonadIO m, IsDBusAuthObserver a, Gio.IOStream.IsIOStream b, Gio.Credentials.IsCredentials c) =>
a
-> b
-> Maybe (c)
-> m Bool
dBusAuthObserverAuthorizeAuthenticatedPeer observer stream credentials = liftIO $ do
observer' <- unsafeManagedPtrCastPtr observer
stream' <- unsafeManagedPtrCastPtr stream
maybeCredentials <- case credentials of
Nothing -> return nullPtr
Just jCredentials -> do
jCredentials' <- unsafeManagedPtrCastPtr jCredentials
return jCredentials'
result <- g_dbus_auth_observer_authorize_authenticated_peer observer' stream' maybeCredentials
let result' = (/= 0) result
touchManagedPtr observer
touchManagedPtr stream
whenJust credentials touchManagedPtr
return result'
#if ENABLE_OVERLOADING
data DBusAuthObserverAuthorizeAuthenticatedPeerMethodInfo
instance (signature ~ (b -> Maybe (c) -> m Bool), MonadIO m, IsDBusAuthObserver a, Gio.IOStream.IsIOStream b, Gio.Credentials.IsCredentials c) => O.MethodInfo DBusAuthObserverAuthorizeAuthenticatedPeerMethodInfo a signature where
overloadedMethod _ = dBusAuthObserverAuthorizeAuthenticatedPeer
#endif