1.64 <GPermission>

Class: <GPermission>

It derives from <GObject>.

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

Fields

parent-instance

Properties

Property: permission:allowed self

#t if the caller currently has permission to perform the action that permission represents the permission to perform.

Its value is a boolean.

It is read only.

Property: permission:can-acquire self

#t if it is generally possible to acquire the permission by calling permission:acquire?.

Its value is a boolean.

It is read only.

Property: permission:can-release self

#t if it is generally possible to release the permission by calling permission:release?.

Its value is a boolean.

It is read only.

Procedures

Method: permission:acquire-async self [cancellable] [callback]
Method: acquire-async self [cancellable] [callback]

Attempts to acquire the permission represented by self.

This is the first half of the asynchronous version of permission:acquire?.

self

Passed: a <GPermission>.

a <GPermission> instance

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

callback

Passed, or left out: a procedure, or #f.

the GAsyncReadyCallback to call when done

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the user data to pass to callback

Method: permission:acquire-finish? self result ⇒ %return
Method: acquire-finish? self result ⇒ %return

Collects the result of attempting to acquire the permission represented by self.

This is the second half of the asynchronous version of permission:acquire?.

self

Passed: a <GPermission>.

a <GPermission> instance

result

Passed: a <GAsyncResult>.

the <GAsyncResult> given to the GAsyncReadyCallback

%return

Returned: a boolean.

#t if the permission was successfully acquired

Method: permission:acquire? self [cancellable] ⇒ %return
Method: acquire? self [cancellable] ⇒ %return

Attempts to acquire the permission represented by self.

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 permission:get-can-acquire? before calling this function.

If the permission is acquired then #t is returned. Otherwise, #f 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 permission:acquire-async for the non-blocking version.

self

Passed: a <GPermission>.

a <GPermission> instance

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

%return

Returned: a boolean.

#t if the permission was successfully acquired

Method: permission:get-allowed? self ⇒ %return
Method: get-allowed? self ⇒ %return

Gets the value of the ’allowed’ property. This property is #t if the caller currently has permission to perform the action that self represents the permission to perform.

self

Passed: a <GPermission>.

a <GPermission> instance

%return

Returned: a boolean.

the value of the ’allowed’ property

Method: permission:get-can-acquire? self ⇒ %return
Method: get-can-acquire? self ⇒ %return

Gets the value of the ’can-acquire’ property. This property is #t if it is generally possible to acquire the permission by calling permission:acquire?.

self

Passed: a <GPermission>.

a <GPermission> instance

%return

Returned: a boolean.

the value of the ’can-acquire’ property

Method: permission:get-can-release? self ⇒ %return
Method: get-can-release? self ⇒ %return

Gets the value of the ’can-release’ property. This property is #t if it is generally possible to release the permission by calling permission:release?.

self

Passed: a <GPermission>.

a <GPermission> instance

%return

Returned: a boolean.

the value of the ’can-release’ property

Method: permission:impl-update self allowed can-acquire can-release
Method: impl-update self allowed can-acquire can-release

This function is called by the <GPermission> implementation to update the properties of the permission. You should never call this function except from a <GPermission> implementation.

GObject notify signals are generated, as appropriate.

self

Passed: a <GPermission>.

a <GPermission> instance

allowed

Passed: a boolean.

the new value for the ’allowed’ property

can-acquire

Passed: a boolean.

the new value for the ’can-acquire’ property

can-release

Passed: a boolean.

the new value for the ’can-release’ property

Method: permission:release-async self [cancellable] [callback]
Method: release-async self [cancellable] [callback]

Attempts to release the permission represented by self.

This is the first half of the asynchronous version of permission:release?.

self

Passed: a <GPermission>.

a <GPermission> instance

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

callback

Passed, or left out: a procedure, or #f.

the GAsyncReadyCallback to call when done

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the user data to pass to callback

Method: permission:release-finish? self result ⇒ %return
Method: release-finish? self result ⇒ %return

Collects the result of attempting to release the permission represented by self.

This is the second half of the asynchronous version of permission:release?.

self

Passed: a <GPermission>.

a <GPermission> instance

result

Passed: a <GAsyncResult>.

the <GAsyncResult> given to the GAsyncReadyCallback

%return

Returned: a boolean.

#t if the permission was successfully released

Method: permission:release? self [cancellable] ⇒ %return
Method: release? self [cancellable] ⇒ %return

Attempts to release the permission represented by self.

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 permission:get-can-release? before calling this function.

If the permission is released then #t is returned. Otherwise, #f 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 permission:release-async for the non-blocking version.

self

Passed: a <GPermission>.

a <GPermission> instance

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

%return

Returned: a boolean.

#t if the permission was successfully released

Virtual methods

Virtual method: permission:do-acquire implementor self [cancellable] ⇒ %return

Attempts to acquire the permission represented by self.

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 permission:get-can-acquire? before calling this function.

If the permission is acquired then #t is returned. Otherwise, #f 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 permission:acquire-async for the non-blocking version.

To override it in a new class, give register-type #:vfuncs `((acquire . ,procedure)). The procedure is called as (procedure self cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GPermission>, or a class that derives from it, or its GType number.

self

Passed: a <GPermission>.

a <GPermission> instance

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

%return

Returned: a boolean.

#t if the permission was successfully acquired

Virtual method: permission:do-acquire-async implementor self [cancellable] [callback]

Attempts to acquire the permission represented by self.

This is the first half of the asynchronous version of permission:acquire?.

To override it in a new class, give register-type #:vfuncs `((acquire-async . ,procedure)). The procedure is called as (procedure self cancellable callback user-data).

implementor

Passed: the class whose implementation to call: <GPermission>, or a class that derives from it, or its GType number.

self

Passed: a <GPermission>.

a <GPermission> instance

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

callback

Passed, or left out: a procedure, or #f.

the GAsyncReadyCallback to call when done

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the user data to pass to callback

Virtual method: permission:do-acquire-finish implementor self result ⇒ %return

Collects the result of attempting to acquire the permission represented by self.

This is the second half of the asynchronous version of permission:acquire?.

To override it in a new class, give register-type #:vfuncs `((acquire-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GPermission>, or a class that derives from it, or its GType number.

self

Passed: a <GPermission>.

a <GPermission> instance

result

Passed: a <GAsyncResult>.

the <GAsyncResult> given to the GAsyncReadyCallback

%return

Returned: a boolean.

#t if the permission was successfully acquired

Virtual method: permission:do-release implementor self [cancellable] ⇒ %return

Attempts to release the permission represented by self.

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 permission:get-can-release? before calling this function.

If the permission is released then #t is returned. Otherwise, #f 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 permission:release-async for the non-blocking version.

To override it in a new class, give register-type #:vfuncs `((release . ,procedure)). The procedure is called as (procedure self cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GPermission>, or a class that derives from it, or its GType number.

self

Passed: a <GPermission>.

a <GPermission> instance

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

%return

Returned: a boolean.

#t if the permission was successfully released

Virtual method: permission:do-release-async implementor self [cancellable] [callback]

Attempts to release the permission represented by self.

This is the first half of the asynchronous version of permission:release?.

To override it in a new class, give register-type #:vfuncs `((release-async . ,procedure)). The procedure is called as (procedure self cancellable callback user-data).

implementor

Passed: the class whose implementation to call: <GPermission>, or a class that derives from it, or its GType number.

self

Passed: a <GPermission>.

a <GPermission> instance

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

callback

Passed, or left out: a procedure, or #f.

the GAsyncReadyCallback to call when done

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the user data to pass to callback

Virtual method: permission:do-release-finish implementor self result ⇒ %return

Collects the result of attempting to release the permission represented by self.

This is the second half of the asynchronous version of permission:release?.

To override it in a new class, give register-type #:vfuncs `((release-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GPermission>, or a class that derives from it, or its GType number.

self

Passed: a <GPermission>.

a <GPermission> instance

result

Passed: a <GAsyncResult>.

the <GAsyncResult> given to the GAsyncReadyCallback

%return

Returned: a boolean.

#t if the permission was successfully released