gi-gio
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

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

Exported types

newtype Permission Source #

Memory-managed wrapper type.

Instances

Instances details
Eq Permission Source # 
Instance details

Defined in GI.Gio.Objects.Permission

GObject Permission Source # 
Instance details

Defined in GI.Gio.Objects.Permission

ManagedPtrNewtype Permission Source # 
Instance details

Defined in GI.Gio.Objects.Permission

TypedObject Permission Source # 
Instance details

Defined in GI.Gio.Objects.Permission

Methods

glibType :: IO GType #

HasParentTypes Permission Source # 
Instance details

Defined in GI.Gio.Objects.Permission

HasAttributeList Permission Source # 
Instance details

Defined in GI.Gio.Objects.Permission

(info ~ ResolvePermissionMethod t Permission, OverloadedMethod info Permission p, HasField t Permission p) => HasField (t :: Symbol) Permission (p :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.Permission

Methods

getField :: Permission -> p #

(info ~ ResolvePermissionMethod t Permission, OverloadedMethodInfo info Permission) => IsLabel t (MethodProxy info Permission) Source # 
Instance details

Defined in GI.Gio.Objects.Permission

(info ~ ResolvePermissionMethod t Permission, OverloadedMethod info Permission p) => IsLabel t (Permission -> p) Source # 
Instance details

Defined in GI.Gio.Objects.Permission

Methods

fromLabel :: Permission -> p #

IsGValue (Maybe Permission) Source #

Convert Permission to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gio.Objects.Permission

type AttributeList Permission Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type ParentTypes Permission Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type SignalList Permission Source # 
Instance details

Defined in GI.Gio.Objects.Permission

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

Instances details
(GObject o, IsDescendantOf Permission o) => IsPermission o Source # 
Instance details

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

type family ResolvePermissionMethod (t :: Symbol) o where ... Source #

Equations

ResolvePermissionMethod "acquire" o = PermissionAcquireMethodInfo 
ResolvePermissionMethod "acquireAsync" o = PermissionAcquireAsyncMethodInfo 
ResolvePermissionMethod "acquireFinish" o = PermissionAcquireFinishMethodInfo 
ResolvePermissionMethod "bindProperty" o = ObjectBindPropertyMethodInfo 
ResolvePermissionMethod "bindPropertyFull" o = ObjectBindPropertyFullMethodInfo 
ResolvePermissionMethod "forceFloating" o = ObjectForceFloatingMethodInfo 
ResolvePermissionMethod "freezeNotify" o = ObjectFreezeNotifyMethodInfo 
ResolvePermissionMethod "getv" o = ObjectGetvMethodInfo 
ResolvePermissionMethod "implUpdate" o = PermissionImplUpdateMethodInfo 
ResolvePermissionMethod "isFloating" o = ObjectIsFloatingMethodInfo 
ResolvePermissionMethod "notify" o = ObjectNotifyMethodInfo 
ResolvePermissionMethod "notifyByPspec" o = ObjectNotifyByPspecMethodInfo 
ResolvePermissionMethod "ref" o = ObjectRefMethodInfo 
ResolvePermissionMethod "refSink" o = ObjectRefSinkMethodInfo 
ResolvePermissionMethod "release" o = PermissionReleaseMethodInfo 
ResolvePermissionMethod "releaseAsync" o = PermissionReleaseAsyncMethodInfo 
ResolvePermissionMethod "releaseFinish" o = PermissionReleaseFinishMethodInfo 
ResolvePermissionMethod "runDispose" o = ObjectRunDisposeMethodInfo 
ResolvePermissionMethod "stealData" o = ObjectStealDataMethodInfo 
ResolvePermissionMethod "stealQdata" o = ObjectStealQdataMethodInfo 
ResolvePermissionMethod "thawNotify" o = ObjectThawNotifyMethodInfo 
ResolvePermissionMethod "unref" o = ObjectUnrefMethodInfo 
ResolvePermissionMethod "watchClosure" o = ObjectWatchClosureMethodInfo 
ResolvePermissionMethod "getAllowed" o = PermissionGetAllowedMethodInfo 
ResolvePermissionMethod "getCanAcquire" o = PermissionGetCanAcquireMethodInfo 
ResolvePermissionMethod "getCanRelease" o = PermissionGetCanReleaseMethodInfo 
ResolvePermissionMethod "getData" o = ObjectGetDataMethodInfo 
ResolvePermissionMethod "getProperty" o = ObjectGetPropertyMethodInfo 
ResolvePermissionMethod "getQdata" o = ObjectGetQdataMethodInfo 
ResolvePermissionMethod "setData" o = ObjectSetDataMethodInfo 
ResolvePermissionMethod "setDataFull" o = ObjectSetDataFullMethodInfo 
ResolvePermissionMethod "setProperty" o = ObjectSetPropertyMethodInfo 
ResolvePermissionMethod l o = MethodResolutionFailed l o :: Type 

acquire

data PermissionAcquireMethodInfo Source #

Instances

Instances details
(signature ~ (Maybe b -> m ()), MonadIO m, IsPermission a, IsCancellable b) => OverloadedMethod PermissionAcquireMethodInfo a signature Source # 
Instance details

Defined in GI.Gio.Objects.Permission

Methods

overloadedMethod :: a -> signature #

OverloadedMethodInfo PermissionAcquireMethodInfo (a :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.Permission

permissionAcquire Source #

Arguments

:: (HasCallStack, MonadIO m, IsPermission a, IsCancellable b) 
=> a

permission: a Permission instance

-> Maybe b

cancellable: a Cancellable, or Nothing

-> m ()

(Can throw GError)

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

permissionAcquireAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsPermission a, IsCancellable b) 
=> a

permission: a Permission instance

-> Maybe b

cancellable: a Cancellable, or Nothing

-> Maybe AsyncReadyCallback

callback: the AsyncReadyCallback to call when done

-> m () 

Attempts to acquire the permission represented by permission.

This is the first half of the asynchronous version of permissionAcquire.

Since: 2.26

acquireFinish

permissionAcquireFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsPermission a, IsAsyncResult b) 
=> a

permission: a Permission instance

-> b

result: the AsyncResult given to the AsyncReadyCallback

-> m ()

(Can throw GError)

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

permissionGetAllowed Source #

Arguments

:: (HasCallStack, MonadIO m, IsPermission a) 
=> a

permission: a Permission instance

-> 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

permissionGetCanAcquire Source #

Arguments

:: (HasCallStack, MonadIO m, IsPermission a) 
=> a

permission: a Permission instance

-> 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

permissionGetCanRelease Source #

Arguments

:: (HasCallStack, MonadIO m, IsPermission a) 
=> a

permission: a Permission instance

-> 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

Instances details
(signature ~ (Bool -> Bool -> Bool -> m ()), MonadIO m, IsPermission a) => OverloadedMethod PermissionImplUpdateMethodInfo a signature Source # 
Instance details

Defined in GI.Gio.Objects.Permission

Methods

overloadedMethod :: a -> signature #

OverloadedMethodInfo PermissionImplUpdateMethodInfo (a :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.Permission

permissionImplUpdate Source #

Arguments

:: (HasCallStack, MonadIO m, IsPermission a) 
=> a

permission: a Permission instance

-> Bool

allowed: the new value for the 'allowed' property

-> Bool

canAcquire: the new value for the 'can-acquire' property

-> Bool

canRelease: the new value for the 'can-release' property

-> 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

Instances details
(signature ~ (Maybe b -> m ()), MonadIO m, IsPermission a, IsCancellable b) => OverloadedMethod PermissionReleaseMethodInfo a signature Source # 
Instance details

Defined in GI.Gio.Objects.Permission

Methods

overloadedMethod :: a -> signature #

OverloadedMethodInfo PermissionReleaseMethodInfo (a :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.Permission

permissionRelease Source #

Arguments

:: (HasCallStack, MonadIO m, IsPermission a, IsCancellable b) 
=> a

permission: a Permission instance

-> Maybe b

cancellable: a Cancellable, or Nothing

-> m ()

(Can throw GError)

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

permissionReleaseAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsPermission a, IsCancellable b) 
=> a

permission: a Permission instance

-> Maybe b

cancellable: a Cancellable, or Nothing

-> Maybe AsyncReadyCallback

callback: the AsyncReadyCallback to call when done

-> m () 

Attempts to release the permission represented by permission.

This is the first half of the asynchronous version of permissionRelease.

Since: 2.26

releaseFinish

permissionReleaseFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsPermission a, IsAsyncResult b) 
=> a

permission: a Permission instance

-> b

result: the AsyncResult given to the AsyncReadyCallback

-> m ()

(Can throw GError)

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

Instances details
AttrInfo PermissionAllowedPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrAllowedOps PermissionAllowedPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrBaseTypeConstraint PermissionAllowedPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrGetType PermissionAllowedPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrLabel PermissionAllowedPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrOrigin PermissionAllowedPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrSetTypeConstraint PermissionAllowedPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrTransferType PermissionAllowedPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrTransferTypeConstraint PermissionAllowedPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

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

canAcquire

True if it is generally possible to acquire the permission by calling permissionAcquire.

data PermissionCanAcquirePropertyInfo Source #

Instances

Instances details
AttrInfo PermissionCanAcquirePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrAllowedOps PermissionCanAcquirePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrBaseTypeConstraint PermissionCanAcquirePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrGetType PermissionCanAcquirePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrLabel PermissionCanAcquirePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrOrigin PermissionCanAcquirePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrSetTypeConstraint PermissionCanAcquirePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrTransferType PermissionCanAcquirePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrTransferTypeConstraint PermissionCanAcquirePropertyInfo Source # 
Instance details

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

canRelease

True if it is generally possible to release the permission by calling permissionRelease.

data PermissionCanReleasePropertyInfo Source #

Instances

Instances details
AttrInfo PermissionCanReleasePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrAllowedOps PermissionCanReleasePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrBaseTypeConstraint PermissionCanReleasePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrGetType PermissionCanReleasePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrLabel PermissionCanReleasePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrOrigin PermissionCanReleasePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrSetTypeConstraint PermissionCanReleasePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrTransferType PermissionCanReleasePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type AttrTransferTypeConstraint PermissionCanReleasePropertyInfo Source # 
Instance details

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