Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
GI.Gio.Objects.Permission
Description
A GPermission
represents the status of the caller’s permission to
perform a certain action.
You can query if the action is currently allowed and if it is possible to acquire the permission so that the action will be allowed in the future.
There is also an API to actually acquire the permission and one to release it.
As an example, a GPermission
might represent the ability for the
user to write to a Settings
object. This GPermission
object
could then be used to decide if it is appropriate to show a “Click here to
unlock” button in a dialog and to provide the mechanism to invoke
when that button is clicked.
Synopsis
- newtype Permission = Permission (ManagedPtr Permission)
- class (GObject o, IsDescendantOf Permission o) => IsPermission o
- toPermission :: (MonadIO m, IsPermission o) => o -> m Permission
- type family ResolvePermissionMethod (t :: Symbol) o where ...
- data PermissionAcquireMethodInfo
- permissionAcquire :: (HasCallStack, MonadIO m, IsPermission a, IsCancellable b) => a -> Maybe b -> m ()
- data PermissionAcquireAsyncMethodInfo
- permissionAcquireAsync :: (HasCallStack, MonadIO m, IsPermission a, IsCancellable b) => a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- data PermissionAcquireFinishMethodInfo
- permissionAcquireFinish :: (HasCallStack, MonadIO m, IsPermission a, IsAsyncResult b) => a -> b -> m ()
- data PermissionGetAllowedMethodInfo
- permissionGetAllowed :: (HasCallStack, MonadIO m, IsPermission a) => a -> m Bool
- data PermissionGetCanAcquireMethodInfo
- permissionGetCanAcquire :: (HasCallStack, MonadIO m, IsPermission a) => a -> m Bool
- data PermissionGetCanReleaseMethodInfo
- permissionGetCanRelease :: (HasCallStack, MonadIO m, IsPermission a) => a -> m Bool
- data PermissionImplUpdateMethodInfo
- permissionImplUpdate :: (HasCallStack, MonadIO m, IsPermission a) => a -> Bool -> Bool -> Bool -> m ()
- data PermissionReleaseMethodInfo
- permissionRelease :: (HasCallStack, MonadIO m, IsPermission a, IsCancellable b) => a -> Maybe b -> m ()
- data PermissionReleaseAsyncMethodInfo
- permissionReleaseAsync :: (HasCallStack, MonadIO m, IsPermission a, IsCancellable b) => a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- data PermissionReleaseFinishMethodInfo
- permissionReleaseFinish :: (HasCallStack, MonadIO m, IsPermission a, IsAsyncResult b) => a -> b -> m ()
- data PermissionAllowedPropertyInfo
- getPermissionAllowed :: (MonadIO m, IsPermission o) => o -> m Bool
- permissionAllowed :: AttrLabelProxy "allowed"
- data PermissionCanAcquirePropertyInfo
- getPermissionCanAcquire :: (MonadIO m, IsPermission o) => o -> m Bool
- permissionCanAcquire :: AttrLabelProxy "canAcquire"
- data PermissionCanReleasePropertyInfo
- getPermissionCanRelease :: (MonadIO m, IsPermission o) => o -> m Bool
- permissionCanRelease :: AttrLabelProxy "canRelease"
Exported types
newtype Permission Source #
Memory-managed wrapper type.
Constructors
Permission (ManagedPtr Permission) |
Instances
class (GObject o, IsDescendantOf Permission o) => IsPermission o Source #
Type class for types which can be safely cast to Permission
, for instance with toPermission
.
Instances
(GObject o, IsDescendantOf Permission o) => IsPermission o Source # | |
Defined in GI.Gio.Objects.Permission |
toPermission :: (MonadIO m, IsPermission o) => o -> m Permission Source #
Cast to Permission
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
acquire, acquireAsync, acquireFinish, bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, implUpdate, isFloating, notify, notifyByPspec, ref, refSink, release, releaseAsync, releaseFinish, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getAllowed, getCanAcquire, getCanRelease, getData, getProperty, getQdata.
Setters
type family ResolvePermissionMethod (t :: Symbol) o where ... Source #
Equations
acquire
data PermissionAcquireMethodInfo Source #
Instances
(signature ~ (Maybe b -> m ()), MonadIO m, IsPermission a, IsCancellable b) => OverloadedMethod PermissionAcquireMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Permission Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo PermissionAcquireMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Permission Methods |
Arguments
:: (HasCallStack, MonadIO m, IsPermission a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> m () | (Can throw |
Attempts to acquire the permission represented by permission
.
The precise method by which this happens depends on the permission and the underlying authentication mechanism. A simple example is that a dialog may appear asking the user to enter their password.
You should check with permissionGetCanAcquire
before calling
this function.
If the permission is acquired then True
is returned. Otherwise,
False
is returned and error
is set appropriately.
This call is blocking, likely for a very long time (in the case that
user interaction is required). See permissionAcquireAsync
for
the non-blocking version.
Since: 2.26
acquireAsync
data PermissionAcquireAsyncMethodInfo Source #
Instances
(signature ~ (Maybe b -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsPermission a, IsCancellable b) => OverloadedMethod PermissionAcquireAsyncMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Permission Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo PermissionAcquireAsyncMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Permission Methods |
permissionAcquireAsync Source #
Arguments
:: (HasCallStack, MonadIO m, IsPermission a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Attempts to acquire the permission represented by permission
.
This is the first half of the asynchronous version of
permissionAcquire
.
Since: 2.26
acquireFinish
data PermissionAcquireFinishMethodInfo Source #
Instances
(signature ~ (b -> m ()), MonadIO m, IsPermission a, IsAsyncResult b) => OverloadedMethod PermissionAcquireFinishMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Permission Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo PermissionAcquireFinishMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Permission Methods |
permissionAcquireFinish Source #
Arguments
:: (HasCallStack, MonadIO m, IsPermission a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
Collects the result of attempting to acquire the permission
represented by permission
.
This is the second half of the asynchronous version of
permissionAcquire
.
Since: 2.26
getAllowed
data PermissionGetAllowedMethodInfo Source #
Instances
(signature ~ m Bool, MonadIO m, IsPermission a) => OverloadedMethod PermissionGetAllowedMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Permission Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo PermissionGetAllowedMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Permission Methods |
Arguments
:: (HasCallStack, MonadIO m, IsPermission a) | |
=> a |
|
-> m Bool | Returns: the value of the 'allowed' property |
Gets the value of the 'allowed' property. This property is True
if
the caller currently has permission to perform the action that
permission
represents the permission to perform.
Since: 2.26
getCanAcquire
data PermissionGetCanAcquireMethodInfo Source #
Instances
(signature ~ m Bool, MonadIO m, IsPermission a) => OverloadedMethod PermissionGetCanAcquireMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Permission Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo PermissionGetCanAcquireMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Permission Methods |
permissionGetCanAcquire Source #
Arguments
:: (HasCallStack, MonadIO m, IsPermission a) | |
=> a |
|
-> m Bool | Returns: the value of the 'can-acquire' property |
Gets the value of the 'can-acquire' property. This property is True
if it is generally possible to acquire the permission by calling
permissionAcquire
.
Since: 2.26
getCanRelease
data PermissionGetCanReleaseMethodInfo Source #
Instances
(signature ~ m Bool, MonadIO m, IsPermission a) => OverloadedMethod PermissionGetCanReleaseMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Permission Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo PermissionGetCanReleaseMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Permission Methods |
permissionGetCanRelease Source #
Arguments
:: (HasCallStack, MonadIO m, IsPermission a) | |
=> a |
|
-> m Bool | Returns: the value of the 'can-release' property |
Gets the value of the 'can-release' property. This property is True
if it is generally possible to release the permission by calling
permissionRelease
.
Since: 2.26
implUpdate
data PermissionImplUpdateMethodInfo Source #
Instances
(signature ~ (Bool -> Bool -> Bool -> m ()), MonadIO m, IsPermission a) => OverloadedMethod PermissionImplUpdateMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Permission Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo PermissionImplUpdateMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Permission Methods |
Arguments
:: (HasCallStack, MonadIO m, IsPermission a) | |
=> a |
|
-> Bool |
|
-> Bool |
|
-> Bool |
|
-> m () |
This function is called by the Permission
implementation to update
the properties of the permission. You should never call this
function except from a Permission
implementation.
GObject notify signals are generated, as appropriate.
Since: 2.26
release
data PermissionReleaseMethodInfo Source #
Instances
(signature ~ (Maybe b -> m ()), MonadIO m, IsPermission a, IsCancellable b) => OverloadedMethod PermissionReleaseMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Permission Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo PermissionReleaseMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Permission Methods |
Arguments
:: (HasCallStack, MonadIO m, IsPermission a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> m () | (Can throw |
Attempts to release the permission represented by permission
.
The precise method by which this happens depends on the permission and the underlying authentication mechanism. In most cases the permission will be dropped immediately without further action.
You should check with permissionGetCanRelease
before calling
this function.
If the permission is released then True
is returned. Otherwise,
False
is returned and error
is set appropriately.
This call is blocking, likely for a very long time (in the case that
user interaction is required). See permissionReleaseAsync
for
the non-blocking version.
Since: 2.26
releaseAsync
data PermissionReleaseAsyncMethodInfo Source #
Instances
(signature ~ (Maybe b -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsPermission a, IsCancellable b) => OverloadedMethod PermissionReleaseAsyncMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Permission Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo PermissionReleaseAsyncMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Permission Methods |
permissionReleaseAsync Source #
Arguments
:: (HasCallStack, MonadIO m, IsPermission a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Attempts to release the permission represented by permission
.
This is the first half of the asynchronous version of
permissionRelease
.
Since: 2.26
releaseFinish
data PermissionReleaseFinishMethodInfo Source #
Instances
(signature ~ (b -> m ()), MonadIO m, IsPermission a, IsAsyncResult b) => OverloadedMethod PermissionReleaseFinishMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Permission Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo PermissionReleaseFinishMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Permission Methods |
permissionReleaseFinish Source #
Arguments
:: (HasCallStack, MonadIO m, IsPermission a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
Collects the result of attempting to release the permission
represented by permission
.
This is the second half of the asynchronous version of
permissionRelease
.
Since: 2.26
Properties
allowed
True
if the caller currently has permission to perform the action that
permission
represents the permission to perform.
data PermissionAllowedPropertyInfo Source #
Instances
getPermissionAllowed :: (MonadIO m, IsPermission o) => o -> m Bool Source #
Get the value of the “allowed
” property.
When overloading is enabled, this is equivalent to
get
permission #allowed
permissionAllowed :: AttrLabelProxy "allowed" Source #
canAcquire
True
if it is generally possible to acquire the permission by calling
permissionAcquire
.
data PermissionCanAcquirePropertyInfo Source #
Instances
AttrInfo PermissionCanAcquirePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Permission Associated Types
Methods attrGet :: AttrBaseTypeConstraint PermissionCanAcquirePropertyInfo o => o -> IO (AttrGetType PermissionCanAcquirePropertyInfo) # attrSet :: (AttrBaseTypeConstraint PermissionCanAcquirePropertyInfo o, AttrSetTypeConstraint PermissionCanAcquirePropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint PermissionCanAcquirePropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint PermissionCanAcquirePropertyInfo o, AttrSetTypeConstraint PermissionCanAcquirePropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint PermissionCanAcquirePropertyInfo o, AttrTransferTypeConstraint PermissionCanAcquirePropertyInfo b) => Proxy o -> b -> IO (AttrTransferType PermissionCanAcquirePropertyInfo) # | |||||||||||||||||||||||||||||||||
type AttrAllowedOps PermissionCanAcquirePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Permission | |||||||||||||||||||||||||||||||||
type AttrBaseTypeConstraint PermissionCanAcquirePropertyInfo Source # | |||||||||||||||||||||||||||||||||
type AttrGetType PermissionCanAcquirePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Permission | |||||||||||||||||||||||||||||||||
type AttrLabel PermissionCanAcquirePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Permission | |||||||||||||||||||||||||||||||||
type AttrOrigin PermissionCanAcquirePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Permission | |||||||||||||||||||||||||||||||||
type AttrSetTypeConstraint PermissionCanAcquirePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Permission | |||||||||||||||||||||||||||||||||
type AttrTransferType PermissionCanAcquirePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Permission | |||||||||||||||||||||||||||||||||
type AttrTransferTypeConstraint PermissionCanAcquirePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Permission |
getPermissionCanAcquire :: (MonadIO m, IsPermission o) => o -> m Bool Source #
Get the value of the “can-acquire
” property.
When overloading is enabled, this is equivalent to
get
permission #canAcquire
permissionCanAcquire :: AttrLabelProxy "canAcquire" Source #
canRelease
True
if it is generally possible to release the permission by calling
permissionRelease
.
data PermissionCanReleasePropertyInfo Source #
Instances
AttrInfo PermissionCanReleasePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Permission Associated Types
Methods attrGet :: AttrBaseTypeConstraint PermissionCanReleasePropertyInfo o => o -> IO (AttrGetType PermissionCanReleasePropertyInfo) # attrSet :: (AttrBaseTypeConstraint PermissionCanReleasePropertyInfo o, AttrSetTypeConstraint PermissionCanReleasePropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint PermissionCanReleasePropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint PermissionCanReleasePropertyInfo o, AttrSetTypeConstraint PermissionCanReleasePropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint PermissionCanReleasePropertyInfo o, AttrTransferTypeConstraint PermissionCanReleasePropertyInfo b) => Proxy o -> b -> IO (AttrTransferType PermissionCanReleasePropertyInfo) # | |||||||||||||||||||||||||||||||||
type AttrAllowedOps PermissionCanReleasePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Permission | |||||||||||||||||||||||||||||||||
type AttrBaseTypeConstraint PermissionCanReleasePropertyInfo Source # | |||||||||||||||||||||||||||||||||
type AttrGetType PermissionCanReleasePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Permission | |||||||||||||||||||||||||||||||||
type AttrLabel PermissionCanReleasePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Permission | |||||||||||||||||||||||||||||||||
type AttrOrigin PermissionCanReleasePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Permission | |||||||||||||||||||||||||||||||||
type AttrSetTypeConstraint PermissionCanReleasePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Permission | |||||||||||||||||||||||||||||||||
type AttrTransferType PermissionCanReleasePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Permission | |||||||||||||||||||||||||||||||||
type AttrTransferTypeConstraint PermissionCanReleasePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Permission |
getPermissionCanRelease :: (MonadIO m, IsPermission o) => o -> m Bool Source #
Get the value of the “can-release
” property.
When overloading is enabled, this is equivalent to
get
permission #canRelease
permissionCanRelease :: AttrLabelProxy "canRelease" Source #