Trait gio::prelude::VolumeExt[][src]

pub trait VolumeExt: 'static {
Show methods 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 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: 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;
}
Expand description

Trait containing all Volume methods.

Implementors

Volume

Required methods

Checks if a volume can be ejected.

Returns

true if the self can be ejected. false otherwise

Checks if a volume can be mounted.

Returns

true if the self can be mounted. false otherwise

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

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.

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.

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.

Gets the icon for self.

Returns

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

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

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.

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.

Gets the sort key for self, if any.

Returns

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

Gets the symbolic icon for self.

Returns

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

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.

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

Returns whether the volume should be automatically mounted.

Returns

true if the volume should be automatically mounted

Emitted when the volume has been changed.

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.

Implementors