gi-gio-2.0.27: Gio bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gio.Objects.Permission

Description

A Permission 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 Permission might represent the ability for the user to write to a Settings object. This Permission 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

IsGValue Permission Source #

Convert Permission to and from GValue with toGValue and fromGValue.

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 #

GObject Permission Source # 
Instance details

Defined in GI.Gio.Objects.Permission

HasParentTypes Permission Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type ParentTypes Permission Source # 
Instance details

Defined in GI.Gio.Objects.Permission

type ParentTypes Permission = '[Object]

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

Overloaded methods

acquire

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

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

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.

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.

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.

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