[][src]Trait gio::DriveExt

pub trait DriveExt: 'static {
    fn can_eject(&self) -> bool;
fn can_poll_for_media(&self) -> bool;
fn can_start(&self) -> bool;
fn can_start_degraded(&self) -> bool;
fn can_stop(&self) -> bool;
fn eject_with_operation<P: IsA<MountOperation>, Q: IsA<Cancellable>, R: FnOnce(Result<(), Error>) + Send + 'static>(
        &self,
        flags: MountUnmountFlags,
        mount_operation: Option<&P>,
        cancellable: Option<&Q>,
        callback: R
    );
fn eject_with_operation_future<P: IsA<MountOperation> + Clone + 'static>(
        &self,
        flags: MountUnmountFlags,
        mount_operation: Option<&P>
    ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>;
fn enumerate_identifiers(&self) -> Vec<GString>;
fn get_icon(&self) -> Option<Icon>;
fn get_identifier(&self, kind: &str) -> Option<GString>;
fn get_name(&self) -> Option<GString>;
fn get_sort_key(&self) -> Option<GString>;
fn get_start_stop_type(&self) -> DriveStartStopType;
fn get_symbolic_icon(&self) -> Option<Icon>;
fn get_volumes(&self) -> Vec<Volume>;
fn has_media(&self) -> bool;
fn has_volumes(&self) -> bool;
fn is_media_check_automatic(&self) -> bool;
fn is_media_removable(&self) -> bool;
fn poll_for_media<P: IsA<Cancellable>, Q: FnOnce(Result<(), Error>) + Send + 'static>(
        &self,
        cancellable: Option<&P>,
        callback: Q
    );
fn poll_for_media_future(
        &self
    ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>;
fn start<P: IsA<MountOperation>, Q: IsA<Cancellable>, R: FnOnce(Result<(), Error>) + Send + 'static>(
        &self,
        flags: DriveStartFlags,
        mount_operation: Option<&P>,
        cancellable: Option<&Q>,
        callback: R
    );
fn start_future<P: IsA<MountOperation> + Clone + 'static>(
        &self,
        flags: DriveStartFlags,
        mount_operation: Option<&P>
    ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>;
fn stop<P: IsA<MountOperation>, Q: IsA<Cancellable>, R: FnOnce(Result<(), Error>) + Send + 'static>(
        &self,
        flags: MountUnmountFlags,
        mount_operation: Option<&P>,
        cancellable: Option<&Q>,
        callback: R
    );
fn stop_future<P: IsA<MountOperation> + Clone + 'static>(
        &self,
        flags: MountUnmountFlags,
        mount_operation: Option<&P>
    ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>;
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_disconnected<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_eject_button<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_stop_button<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; }

Trait containing all Drive methods.

Implementors

Drive

Required methods

fn can_eject(&self) -> bool

Checks if a drive can be ejected.

Returns

true if the self can be ejected, false otherwise.

fn can_poll_for_media(&self) -> bool

Checks if a drive can be polled for media changes.

Returns

true if the self can be polled for media changes, false otherwise.

fn can_start(&self) -> bool

Checks if a drive can be started.

Returns

true if the self can be started, false otherwise.

fn can_start_degraded(&self) -> bool

Checks if a drive can be started degraded.

Returns

true if the self can be started degraded, false otherwise.

fn can_stop(&self) -> bool

Checks if a drive can be stopped.

Returns

true if the self can be stopped, false otherwise.

fn eject_with_operation<P: IsA<MountOperation>, Q: IsA<Cancellable>, R: FnOnce(Result<(), Error>) + Send + 'static>(
    &self,
    flags: MountUnmountFlags,
    mount_operation: Option<&P>,
    cancellable: Option<&Q>,
    callback: R
)

Ejects a drive. This is an asynchronous operation, and is finished by calling Drive::eject_with_operation_finish with the self and AsyncResult data returned in the callback.

flags

flags affecting the unmount if required for eject

mount_operation

a MountOperation or None to avoid user interaction.

cancellable

optional Cancellable object, None to ignore.

callback

a GAsyncReadyCallback, or None.

user_data

user data passed to callback.

fn eject_with_operation_future<P: IsA<MountOperation> + Clone + 'static>(
    &self,
    flags: MountUnmountFlags,
    mount_operation: Option<&P>
) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>

fn enumerate_identifiers(&self) -> Vec<GString>

Gets the kinds of identifiers that self has. Use Drive::get_identifier to obtain the identifiers themselves.

Returns

a None-terminated array of strings containing kinds of identifiers. Use g_strfreev to free.

fn get_icon(&self) -> Option<Icon>

Gets the icon for self.

Returns

Icon for the self. Free the returned object with gobject::ObjectExt::unref.

fn get_identifier(&self, kind: &str) -> Option<GString>

Gets the identifier of the given kind for self. The only identifier currently available is G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE.

kind

the kind of identifier to return

Returns

a newly allocated string containing the requested identifier, or None if the Drive doesn't have this kind of identifier.

fn get_name(&self) -> Option<GString>

Gets the name of self.

Returns

a string containing self's name. The returned string should be freed when no longer needed.

fn get_sort_key(&self) -> Option<GString>

Gets the sort key for self, if any.

Returns

Sorting key for self or None if no such key is available.

fn get_start_stop_type(&self) -> DriveStartStopType

Gets a hint about how a drive can be started/stopped.

Returns

A value from the DriveStartStopType enumeration.

fn get_symbolic_icon(&self) -> Option<Icon>

Gets the icon for self.

Returns

symbolic Icon for the self. Free the returned object with gobject::ObjectExt::unref.

fn get_volumes(&self) -> Vec<Volume>

Get a list of mountable volumes for self.

The returned list should be freed with glib::List::free, after its elements have been unreffed with gobject::ObjectExt::unref.

Returns

glib::List containing any Volume objects on the given self.

fn has_media(&self) -> bool

Checks if the self has media. Note that the OS may not be polling the drive for media changes; see Drive::is_media_check_automatic for more details.

Returns

true if self has media, false otherwise.

fn has_volumes(&self) -> bool

Check if self has any mountable volumes.

Returns

true if the self contains volumes, false otherwise.

fn is_media_check_automatic(&self) -> bool

Checks if self is capabable of automatically detecting media changes.

Returns

true if the self is capabable of automatically detecting media changes, false otherwise.

fn is_media_removable(&self) -> bool

Checks if the self supports removable media.

Returns

true if self supports removable media, false otherwise.

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

Asynchronously polls self to see if media has been inserted or removed.

When the operation is finished, callback will be called. You can then call Drive::poll_for_media_finish to obtain the result of the operation.

cancellable

optional Cancellable object, None to ignore.

callback

a GAsyncReadyCallback, or None.

user_data

user data to pass to callback

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

fn start<P: IsA<MountOperation>, Q: IsA<Cancellable>, R: FnOnce(Result<(), Error>) + Send + 'static>(
    &self,
    flags: DriveStartFlags,
    mount_operation: Option<&P>,
    cancellable: Option<&Q>,
    callback: R
)

Asynchronously starts a drive.

When the operation is finished, callback will be called. You can then call Drive::start_finish to obtain the result of the operation.

flags

flags affecting the start operation.

mount_operation

a MountOperation or None to avoid user interaction.

cancellable

optional Cancellable object, None to ignore.

callback

a GAsyncReadyCallback, or None.

user_data

user data to pass to callback

fn start_future<P: IsA<MountOperation> + Clone + 'static>(
    &self,
    flags: DriveStartFlags,
    mount_operation: Option<&P>
) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>

fn stop<P: IsA<MountOperation>, Q: IsA<Cancellable>, R: FnOnce(Result<(), Error>) + Send + 'static>(
    &self,
    flags: MountUnmountFlags,
    mount_operation: Option<&P>,
    cancellable: Option<&Q>,
    callback: R
)

Asynchronously stops a drive.

When the operation is finished, callback will be called. You can then call Drive::stop_finish to obtain the result of the operation.

flags

flags affecting the unmount if required for stopping.

mount_operation

a MountOperation or None to avoid user interaction.

cancellable

optional Cancellable object, None to ignore.

callback

a GAsyncReadyCallback, or None.

user_data

user data to pass to callback

fn stop_future<P: IsA<MountOperation> + Clone + 'static>(
    &self,
    flags: MountUnmountFlags,
    mount_operation: Option<&P>
) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>

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

Emitted when the drive's state has changed.

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

This signal is emitted when the Drive have been disconnected. If the recipient is holding references to the object they should release them so the object can be finalized.

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

Emitted when the physical eject button (if any) of a drive has been pressed.

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

Emitted when the physical stop button (if any) of a drive has been pressed.

Loading content...

Implementors

impl<O: IsA<Drive>> DriveExt for O[src]

Loading content...