[][src]Trait gio::PermissionExt

pub trait PermissionExt: 'static {
    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 get_allowed(&self) -> bool;
fn get_can_acquire(&self) -> bool;
fn get_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_property_allowed_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_can_acquire_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_can_release_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; }

Trait containing all Permission methods.

Implementors

Permission, SimplePermission

Required methods

fn acquire<P: IsA<Cancellable>>(
    &self,
    cancellable: Option<&P>
) -> 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 PermissionExt::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 PermissionExt::acquire_async for the non-blocking version.

cancellable

a Cancellable, or None

Returns

true if the permission was successfully acquired

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

Attempts to acquire the permission represented by self.

This is the first half of the asynchronous version of PermissionExt::acquire.

cancellable

a Cancellable, or None

callback

the GAsyncReadyCallback to call when done

user_data

the user data to pass to callback

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

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

fn get_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 PermissionExt::acquire.

Returns

the value of the 'can-acquire' property

fn get_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 PermissionExt::release.

Returns

the value of the 'can-release' property

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

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

fn release<P: IsA<Cancellable>>(
    &self,
    cancellable: Option<&P>
) -> 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 PermissionExt::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 PermissionExt::release_async for the non-blocking version.

cancellable

a Cancellable, or None

Returns

true if the permission was successfully released

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

Attempts to release the permission represented by self.

This is the first half of the asynchronous version of PermissionExt::release.

cancellable

a Cancellable, or None

callback

the GAsyncReadyCallback to call when done

user_data

the user data to pass to callback

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

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

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

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

Loading content...

Implementors

impl<O: IsA<Permission>> PermissionExt for O[src]

Loading content...