{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.SimplePermission
(
SimplePermission(..) ,
IsSimplePermission ,
toSimplePermission ,
#if defined(ENABLE_OVERLOADING)
ResolveSimplePermissionMethod ,
#endif
simplePermissionNew ,
) 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.BasicTypes as B.Types
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.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
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.Permission as Gio.Permission
newtype SimplePermission = SimplePermission (SP.ManagedPtr SimplePermission)
deriving (SimplePermission -> SimplePermission -> Bool
(SimplePermission -> SimplePermission -> Bool)
-> (SimplePermission -> SimplePermission -> Bool)
-> Eq SimplePermission
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SimplePermission -> SimplePermission -> Bool
$c/= :: SimplePermission -> SimplePermission -> Bool
== :: SimplePermission -> SimplePermission -> Bool
$c== :: SimplePermission -> SimplePermission -> Bool
Eq)
instance SP.ManagedPtrNewtype SimplePermission where
toManagedPtr :: SimplePermission -> ManagedPtr SimplePermission
toManagedPtr (SimplePermission ManagedPtr SimplePermission
p) = ManagedPtr SimplePermission
p
foreign import ccall "g_simple_permission_get_type"
c_g_simple_permission_get_type :: IO B.Types.GType
instance B.Types.TypedObject SimplePermission where
glibType :: IO GType
glibType = IO GType
c_g_simple_permission_get_type
instance B.Types.GObject SimplePermission
instance B.GValue.IsGValue SimplePermission where
toGValue :: SimplePermission -> IO GValue
toGValue SimplePermission
o = do
GType
gtype <- IO GType
c_g_simple_permission_get_type
SimplePermission
-> (Ptr SimplePermission -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr SimplePermission
o (GType
-> (GValue -> Ptr SimplePermission -> IO ())
-> Ptr SimplePermission
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr SimplePermission -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO SimplePermission
fromGValue GValue
gv = do
Ptr SimplePermission
ptr <- GValue -> IO (Ptr SimplePermission)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr SimplePermission)
(ManagedPtr SimplePermission -> SimplePermission)
-> Ptr SimplePermission -> IO SimplePermission
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr SimplePermission -> SimplePermission
SimplePermission Ptr SimplePermission
ptr
class (SP.GObject o, O.IsDescendantOf SimplePermission o) => IsSimplePermission o
instance (SP.GObject o, O.IsDescendantOf SimplePermission o) => IsSimplePermission o
instance O.HasParentTypes SimplePermission
type instance O.ParentTypes SimplePermission = '[Gio.Permission.Permission, GObject.Object.Object]
toSimplePermission :: (MonadIO m, IsSimplePermission o) => o -> m SimplePermission
toSimplePermission :: o -> m SimplePermission
toSimplePermission = IO SimplePermission -> m SimplePermission
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SimplePermission -> m SimplePermission)
-> (o -> IO SimplePermission) -> o -> m SimplePermission
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr SimplePermission -> SimplePermission)
-> o -> IO SimplePermission
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr SimplePermission -> SimplePermission
SimplePermission
#if defined(ENABLE_OVERLOADING)
type family ResolveSimplePermissionMethod (t :: Symbol) (o :: *) :: * where
ResolveSimplePermissionMethod "acquire" o = Gio.Permission.PermissionAcquireMethodInfo
ResolveSimplePermissionMethod "acquireAsync" o = Gio.Permission.PermissionAcquireAsyncMethodInfo
ResolveSimplePermissionMethod "acquireFinish" o = Gio.Permission.PermissionAcquireFinishMethodInfo
ResolveSimplePermissionMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveSimplePermissionMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveSimplePermissionMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveSimplePermissionMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveSimplePermissionMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveSimplePermissionMethod "implUpdate" o = Gio.Permission.PermissionImplUpdateMethodInfo
ResolveSimplePermissionMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveSimplePermissionMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveSimplePermissionMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveSimplePermissionMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveSimplePermissionMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveSimplePermissionMethod "release" o = Gio.Permission.PermissionReleaseMethodInfo
ResolveSimplePermissionMethod "releaseAsync" o = Gio.Permission.PermissionReleaseAsyncMethodInfo
ResolveSimplePermissionMethod "releaseFinish" o = Gio.Permission.PermissionReleaseFinishMethodInfo
ResolveSimplePermissionMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveSimplePermissionMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveSimplePermissionMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveSimplePermissionMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveSimplePermissionMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveSimplePermissionMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveSimplePermissionMethod "getAllowed" o = Gio.Permission.PermissionGetAllowedMethodInfo
ResolveSimplePermissionMethod "getCanAcquire" o = Gio.Permission.PermissionGetCanAcquireMethodInfo
ResolveSimplePermissionMethod "getCanRelease" o = Gio.Permission.PermissionGetCanReleaseMethodInfo
ResolveSimplePermissionMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveSimplePermissionMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveSimplePermissionMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveSimplePermissionMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveSimplePermissionMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveSimplePermissionMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveSimplePermissionMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveSimplePermissionMethod t SimplePermission, O.MethodInfo info SimplePermission p) => OL.IsLabel t (SimplePermission -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList SimplePermission
type instance O.AttributeList SimplePermission = SimplePermissionAttributeList
type SimplePermissionAttributeList = ('[ '("allowed", Gio.Permission.PermissionAllowedPropertyInfo), '("canAcquire", Gio.Permission.PermissionCanAcquirePropertyInfo), '("canRelease", Gio.Permission.PermissionCanReleasePropertyInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList SimplePermission = SimplePermissionSignalList
type SimplePermissionSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_simple_permission_new" g_simple_permission_new ::
CInt ->
IO (Ptr SimplePermission)
simplePermissionNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
Bool
-> m SimplePermission
simplePermissionNew :: Bool -> m SimplePermission
simplePermissionNew Bool
allowed = IO SimplePermission -> m SimplePermission
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SimplePermission -> m SimplePermission)
-> IO SimplePermission -> m SimplePermission
forall a b. (a -> b) -> a -> b
$ do
let allowed' :: CInt
allowed' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
allowed
Ptr SimplePermission
result <- CInt -> IO (Ptr SimplePermission)
g_simple_permission_new CInt
allowed'
Text -> Ptr SimplePermission -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"simplePermissionNew" Ptr SimplePermission
result
SimplePermission
result' <- ((ManagedPtr SimplePermission -> SimplePermission)
-> Ptr SimplePermission -> IO SimplePermission
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr SimplePermission -> SimplePermission
SimplePermission) Ptr SimplePermission
result
SimplePermission -> IO SimplePermission
forall (m :: * -> *) a. Monad m => a -> m a
return SimplePermission
result'
#if defined(ENABLE_OVERLOADING)
#endif