Trait gio::prelude::PermissionExt[][src]

pub trait PermissionExt: 'static {
Show methods fn acquire<P: IsA<Cancellable>>(
        &self,
        cancellable: Option<&P>
    ) -> Result<(), Error>;
fn acquire_async<P: IsA<Cancellable>, Q: FnOnce(Result<(), Error>) + Send + 'static>(
        &self,
        cancellable: Option<&P>,
        callback: Q
    );
fn acquire_async_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<P: IsA<Cancellable>>(
        &self,
        cancellable: Option<&P>
    ) -> Result<(), Error>;
fn release_async<P: IsA<Cancellable>, Q: FnOnce(Result<(), Error>) + Send + 'static>(
        &self,
        cancellable: Option<&P>,
        callback: Q
    );
fn release_async_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

Required methods

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

cancellable

a Cancellable, or None

Returns

true if the permission was successfully acquired

Attempts to acquire the permission represented by self.

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

cancellable

a Cancellable, or None

callback

the GAsyncReadyCallback to call when done

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

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

Returns

the value of the ‘can-acquire’ property

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

Returns

the value of the ‘can-release’ property

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.

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

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

cancellable

a Cancellable, or None

Returns

true if the permission was successfully released

Attempts to release the permission represented by self.

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

cancellable

a Cancellable, or None

callback

the GAsyncReadyCallback to call when done

Implementors