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 { ... }
}
Provided Methods§
sourcefn 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<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 #GAsyncResult data returned in the @callback.
§flags
flags affecting the unmount if required for eject
§mount_operation
a #GMountOperation or None
to
avoid user interaction
§cancellable
optional #GCancellable object, None
to ignore
§callback
a #GAsyncReadyCallback, or None
fn eject_with_operation_future( &self, flags: MountUnmountFlags, mount_operation: Option<&(impl IsA<MountOperation> + Clone + 'static)>, ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>
sourcefn enumerate_identifiers(&self) -> Vec<GString>
fn enumerate_identifiers(&self) -> Vec<GString>
Gets the kinds of identifiers that @self has. Use g_volume_get_identifier() to obtain the identifiers themselves.
§Returns
a None
-terminated array
of strings containing kinds of identifiers. Use g_strfreev() to free.
sourcefn activation_root(&self) -> Option<File>
fn activation_root(&self) -> Option<File>
Gets the activation root for a #GVolume if it is known ahead of
mount time. Returns None
otherwise. If not None
and if @self
is mounted, then the result of g_mount_get_root() on the
#GMount object obtained from g_volume_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 #GVolumeMonitor implementations to find the underlying mount to shadow, see g_mount_is_shadowed() for more details.
§Returns
the activation root of @self
or None
. Use g_object_unref() to free.
sourcefn icon(&self) -> Icon
fn icon(&self) -> Icon
Gets the icon for @self.
§Returns
a #GIcon. The returned object should be unreffed with g_object_unref() when no longer needed.
sourcefn identifier(&self, kind: &str) -> Option<GString>
fn identifier(&self, kind: &str) -> Option<GString>
Gets the identifier of the given kind for @self. See the introduction 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 #GVolume
doesn’t have this kind of identifier
sourcefn name(&self) -> GString
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.
sourcefn symbolic_icon(&self) -> Icon
fn symbolic_icon(&self) -> Icon
Gets the symbolic icon for @self.
§Returns
a #GIcon. The returned object should be unreffed with g_object_unref() when no longer needed.
sourcefn uuid(&self) -> Option<GString>
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.
sourcefn mount<P: FnOnce(Result<(), Error>) + 'static>(
&self,
flags: MountMountFlags,
mount_operation: Option<&impl IsA<MountOperation>>,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
)
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 #GAsyncResult returned in the @callback.
§flags
flags affecting the operation
§mount_operation
a #GMountOperation or None
to avoid user interaction
§cancellable
optional #GCancellable object, None
to ignore
§callback
a #GAsyncReadyCallback, or None
fn mount_future( &self, flags: MountMountFlags, mount_operation: Option<&(impl IsA<MountOperation> + Clone + 'static)>, ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>
sourcefn should_automount(&self) -> bool
fn should_automount(&self) -> bool
sourcefn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Emitted when the volume has been changed.
sourcefn connect_removed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_removed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
This signal is emitted when the #GVolume have been removed. If the recipient is holding references to the object they should release them so the object can be finalized.