[][src]Trait gio::VolumeExt

pub trait VolumeExt: 'static {
    fn can_eject(&self) -> bool;
fn can_mount(&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_activation_root(&self) -> Option<File>;
fn get_drive(&self) -> Option<Drive>;
fn get_icon(&self) -> Option<Icon>;
fn get_identifier(&self, kind: &str) -> Option<GString>;
fn get_mount(&self) -> Option<Mount>;
fn get_name(&self) -> Option<GString>;
fn get_sort_key(&self) -> Option<GString>;
fn get_symbolic_icon(&self) -> Option<Icon>;
fn get_uuid(&self) -> Option<GString>;
fn mount<P: IsA<MountOperation>, Q: IsA<Cancellable>, R: FnOnce(Result<(), Error>) + Send + 'static>(
        &self,
        flags: MountMountFlags,
        mount_operation: Option<&P>,
        cancellable: Option<&Q>,
        callback: R
    );
fn mount_future<P: IsA<MountOperation> + Clone + 'static>(
        &self,
        flags: MountMountFlags,
        mount_operation: Option<&P>
    ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>;
fn should_automount(&self) -> bool;
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_removed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; }

Trait containing all Volume methods.

Implementors

Volume

Required methods

fn can_eject(&self) -> bool

Checks if a volume can be ejected.

Returns

true if the self can be ejected. false otherwise

fn can_mount(&self) -> bool

Checks if a volume can be mounted.

Returns

true if the self can be mounted. 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 volume. This is an asynchronous operation, and is finished by calling Volume::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][volume-identifier] that self has. Use Volume::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_activation_root(&self) -> Option<File>

Gets the activation root for a Volume if it is known ahead of mount time. Returns None otherwise. If not None and if self is mounted, then the result of Mount::get_root on the Mount object obtained from Volume::get_mount will always either be equal or a prefix of what this function returns. In other words, in code

  GMount *mount;
  GFile *mount_root
  GFile *volume_activation_root;

  mount = g_volume_get_mount (volume); // mounted, so never NULL
  mount_root = g_mount_get_root (mount);
  volume_activation_root = g_volume_get_activation_root (volume); // assume not NULL

then the expression

  (g_file_has_prefix (volume_activation_root, mount_root) ||
   g_file_equal (volume_activation_root, mount_root))

will always be true.

Activation roots are typically used in VolumeMonitor implementations to find the underlying mount to shadow, see Mount::is_shadowed for more details.

Returns

the activation root of self or None. Use gobject::ObjectExt::unref to free.

fn get_drive(&self) -> Option<Drive>

Gets the drive for the self.

Returns

a Drive or None if self is not associated with a drive. The returned object should be unreffed with gobject::ObjectExt::unref when no longer needed.

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

Gets the icon for self.

Returns

a Icon. The returned object should be unreffed with gobject::ObjectExt::unref when no longer needed.

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

Gets the identifier of the given kind for self. See the [introduction][volume-identifier] for more information about volume identifiers.

kind

the kind of identifier to return

Returns

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

fn get_mount(&self) -> Option<Mount>

Gets the mount for the self.

Returns

a Mount or None if self isn't mounted. The returned object should be unreffed with gobject::ObjectExt::unref when no longer needed.

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

Gets the name of self.

Returns

the name for the given self. The returned string should be freed with g_free 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_symbolic_icon(&self) -> Option<Icon>

Gets the symbolic icon for self.

Returns

a Icon. The returned object should be unreffed with gobject::ObjectExt::unref when no longer needed.

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

Gets the UUID for the self. The reference is typically based on the file system UUID for the volume in question and should be considered an opaque string. Returns None if there is no UUID available.

Returns

the UUID for self or None if no UUID can be computed. The returned string should be freed with g_free when no longer needed.

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

Mounts a volume. This is an asynchronous operation, and is finished by calling Volume::mount_finish with the self and AsyncResult returned in the callback.

flags

flags affecting the 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 that gets passed to callback

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

fn should_automount(&self) -> bool

Returns whether the volume should be automatically mounted.

Returns

true if the volume should be automatically mounted

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

Emitted when the volume has been changed.

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

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

Loading content...

Implementors

impl<O: IsA<Volume>> VolumeExt for O[src]

Loading content...