Trait gio::prelude::PermissionExt

source ·
pub trait PermissionExt: IsA<Permission> + Sealed + 'static {
Show 13 methods // Provided methods fn acquire( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(), Error> { ... } fn acquire_async<P: FnOnce(Result<(), Error>) + 'static>( &self, cancellable: Option<&impl IsA<Cancellable>>, callback: P, ) { ... } fn acquire_future( &self, ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>> { ... } fn is_allowed(&self) -> bool { ... } fn can_acquire(&self) -> bool { ... } fn can_release(&self) -> bool { ... } fn impl_update(&self, allowed: bool, can_acquire: bool, can_release: bool) { ... } fn release( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(), Error> { ... } fn release_async<P: FnOnce(Result<(), Error>) + 'static>( &self, cancellable: Option<&impl IsA<Cancellable>>, callback: P, ) { ... } fn release_future( &self, ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>> { ... } fn connect_allowed_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_can_acquire_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_can_release_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all Permission methods.

§Implementors

Permission, SimplePermission

Provided Methods§

source

fn acquire( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(), Error>

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 g_permission_get_can_acquire() 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 g_permission_acquire_async() for the non-blocking version.

§cancellable

a #GCancellable, or None

§Returns

true if the permission was successfully acquired

source

fn acquire_async<P: FnOnce(Result<(), Error>) + 'static>( &self, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Attempts to acquire the permission represented by @self.

This is the first half of the asynchronous version of g_permission_acquire().

§cancellable

a #GCancellable, or None

§callback

the #GAsyncReadyCallback to call when done

source

fn acquire_future( &self, ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>

source

fn is_allowed(&self) -> bool

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

§Returns

the value of the ‘allowed’ property

source

fn can_acquire(&self) -> bool

Gets the value of the ‘can-acquire’ property. This property is true if it is generally possible to acquire the permission by calling g_permission_acquire().

§Returns

the value of the ‘can-acquire’ property

source

fn can_release(&self) -> bool

Gets the value of the ‘can-release’ property. This property is true if it is generally possible to release the permission by calling g_permission_release().

§Returns

the value of the ‘can-release’ property

source

fn impl_update(&self, allowed: bool, can_acquire: bool, can_release: bool)

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.

§allowed

the new value for the ‘allowed’ property

§can_acquire

the new value for the ‘can-acquire’ property

§can_release

the new value for the ‘can-release’ property

source

fn release( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(), Error>

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 g_permission_get_can_release() 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 g_permission_release_async() for the non-blocking version.

§cancellable

a #GCancellable, or None

§Returns

true if the permission was successfully released

source

fn release_async<P: FnOnce(Result<(), Error>) + 'static>( &self, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Attempts to release the permission represented by @self.

This is the first half of the asynchronous version of g_permission_release().

§cancellable

a #GCancellable, or None

§callback

the #GAsyncReadyCallback to call when done

source

fn release_future( &self, ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>

source

fn connect_allowed_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

source

fn connect_can_acquire_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

source

fn connect_can_release_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Object Safety§

This trait is not object safe.

Implementors§