Trait gio::prelude::VolumeExt

source ·
pub trait VolumeExt: IsA<Volume> + Sealed + 'static {
Show 19 methods // Provided methods fn can_eject(&self) -> bool { ... } fn can_mount(&self) -> bool { ... } fn eject_with_operation<P: FnOnce(Result<(), Error>) + 'static>( &self, flags: MountUnmountFlags, mount_operation: Option<&impl IsA<MountOperation>>, cancellable: Option<&impl IsA<Cancellable>>, callback: P ) { ... } fn eject_with_operation_future( &self, flags: MountUnmountFlags, mount_operation: Option<&(impl IsA<MountOperation> + Clone + 'static)> ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>> { ... } fn enumerate_identifiers(&self) -> Vec<GString> { ... } fn activation_root(&self) -> Option<File> { ... } fn drive(&self) -> Option<Drive> { ... } fn icon(&self) -> Icon { ... } fn identifier(&self, kind: &str) -> Option<GString> { ... } fn get_mount(&self) -> Option<Mount> { ... } fn name(&self) -> GString { ... } fn sort_key(&self) -> Option<GString> { ... } fn symbolic_icon(&self) -> Icon { ... } fn uuid(&self) -> Option<GString> { ... } fn mount<P: FnOnce(Result<(), Error>) + 'static>( &self, flags: MountMountFlags, mount_operation: Option<&impl IsA<MountOperation>>, cancellable: Option<&impl IsA<Cancellable>>, callback: P ) { ... } fn mount_future( &self, flags: MountMountFlags, mount_operation: Option<&(impl IsA<MountOperation> + Clone + 'static)> ) -> 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 { ... }
}
Expand description

Trait containing all Volume methods.

Implementors

Volume

Provided Methods§

source

fn can_eject(&self) -> bool

Checks if a volume can be ejected.

Returns

true if the self can be ejected. false otherwise

source

fn can_mount(&self) -> bool

Checks if a volume can be mounted.

Returns

true if the self can be mounted. false otherwise

source

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

Ejects a volume. This is an asynchronous operation, and is finished by calling g_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

source

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

source

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

Gets the kinds of [identifiers][volume-identifier] that self has. Use identifier() to obtain the identifiers themselves.

Returns

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

source

fn 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 MountExt::root() on the Mount object obtained from get_mount() will always either be equal or a prefix of what this function returns. In other words, in code

⚠️ The following code is in C ⚠️

  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

⚠️ The following code is in C ⚠️

  (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 MountExt::is_shadowed() for more details.

Returns

the activation root of self or None. Use g_object_unref() to free.

source

fn 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 g_object_unref() when no longer needed.

source

fn icon(&self) -> Icon

Gets the icon for self.

Returns

a Icon. The returned object should be unreffed with g_object_unref() when no longer needed.

source

fn 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

source

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 g_object_unref() when no longer needed.

source

fn name(&self) -> 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.

source

fn 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

source

fn symbolic_icon(&self) -> Icon

Gets the symbolic icon for self.

Returns

a Icon. The returned object should be unreffed with g_object_unref() when no longer needed.

source

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

source

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

Mounts a volume. This is an asynchronous operation, and is finished by calling g_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

source

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

source

fn should_automount(&self) -> bool

Returns whether the volume should be automatically mounted.

Returns

true if the volume should be automatically mounted

source

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

Emitted when the volume has been changed.

source

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.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<O: IsA<Volume>> VolumeExt for O