pub trait MountExt: 'static {
Show 26 methods
// Required methods
fn can_eject(&self) -> bool;
fn can_unmount(&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 default_location(&self) -> File;
fn drive(&self) -> Option<Drive>;
fn icon(&self) -> Icon;
fn name(&self) -> GString;
fn root(&self) -> File;
fn sort_key(&self) -> Option<GString>;
fn symbolic_icon(&self) -> Icon;
fn uuid(&self) -> Option<GString>;
fn volume(&self) -> Option<Volume>;
fn guess_content_type<P: FnOnce(Result<Vec<GString>, Error>) + 'static>(
&self,
force_rescan: bool,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P
);
fn guess_content_type_future(
&self,
force_rescan: bool
) -> Pin<Box_<dyn Future<Output = Result<Vec<GString>, Error>> + 'static>>;
fn guess_content_type_sync(
&self,
force_rescan: bool,
cancellable: Option<&impl IsA<Cancellable>>
) -> Result<Vec<GString>, Error>;
fn is_shadowed(&self) -> bool;
fn remount<P: FnOnce(Result<(), Error>) + 'static>(
&self,
flags: MountMountFlags,
mount_operation: Option<&impl IsA<MountOperation>>,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P
);
fn remount_future(
&self,
flags: MountMountFlags,
mount_operation: Option<&impl IsA<MountOperation> + Clone + 'static>
) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>;
fn shadow(&self);
fn unmount_with_operation<P: FnOnce(Result<(), Error>) + 'static>(
&self,
flags: MountUnmountFlags,
mount_operation: Option<&impl IsA<MountOperation>>,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P
);
fn unmount_with_operation_future(
&self,
flags: MountUnmountFlags,
mount_operation: Option<&impl IsA<MountOperation> + Clone + 'static>
) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>;
fn unshadow(&self);
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_pre_unmount<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_unmounted<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
Expand description
Required Methods§
sourcefn can_unmount(&self) -> bool
fn can_unmount(&self) -> bool
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 mount. This is an asynchronous operation, and is
finished by calling g_mount_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
.
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 default_location(&self) -> File
fn default_location(&self) -> File
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
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 mount 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 guess_content_type<P: FnOnce(Result<Vec<GString>, Error>) + 'static>(
&self,
force_rescan: bool,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P
)
fn guess_content_type<P: FnOnce(Result<Vec<GString>, Error>) + 'static>( &self, force_rescan: bool, cancellable: Option<&impl IsA<Cancellable>>, callback: P )
Tries to guess the type of content stored on self
. Returns one or
more textual identifiers of well-known content types (typically
prefixed with “x-content/”), e.g. x-content/image-dcf for camera
memory cards. See the
shared-mime-info
specification for more on x-content types.
This is an asynchronous operation (see
guess_content_type_sync()
for the synchronous version), and
is finished by calling g_mount_guess_content_type_finish()
with the
self
and AsyncResult
data returned in the callback
.
force_rescan
Whether to force a rescan of the content. Otherwise a cached result will be used if available
cancellable
optional Cancellable
object, None
to ignore
callback
a GAsyncReadyCallback
fn guess_content_type_future( &self, force_rescan: bool ) -> Pin<Box_<dyn Future<Output = Result<Vec<GString>, Error>> + 'static>>
sourcefn guess_content_type_sync(
&self,
force_rescan: bool,
cancellable: Option<&impl IsA<Cancellable>>
) -> Result<Vec<GString>, Error>
fn guess_content_type_sync( &self, force_rescan: bool, cancellable: Option<&impl IsA<Cancellable>> ) -> Result<Vec<GString>, Error>
Tries to guess the type of content stored on self
. Returns one or
more textual identifiers of well-known content types (typically
prefixed with “x-content/”), e.g. x-content/image-dcf for camera
memory cards. See the
shared-mime-info
specification for more on x-content types.
This is a synchronous operation and as such may block doing IO;
see guess_content_type()
for the asynchronous version.
force_rescan
Whether to force a rescan of the content. Otherwise a cached result will be used if available
cancellable
optional Cancellable
object, None
to ignore
Returns
a None
-terminated array of content types or None
on error.
Caller should free this array with g_strfreev()
when done with it.
sourcefn is_shadowed(&self) -> bool
fn is_shadowed(&self) -> bool
Determines if self
is shadowed. Applications or libraries should
avoid displaying self
in the user interface if it is shadowed.
A mount is said to be shadowed if there exists one or more user
visible objects (currently Mount
objects) with a root that is
inside the root of self
.
One application of shadow mounts is when exposing a single file
system that is used to address several logical volumes. In this
situation, a VolumeMonitor
implementation would create two
Volume
objects (for example, one for the camera functionality of
the device and one for a SD card reader on the device) with
activation URIs gphoto2://[usb:001,002]/store1/
and gphoto2://[usb:001,002]/store2/
. When the
underlying mount (with root
gphoto2://[usb:001,002]/
) is mounted, said
VolumeMonitor
implementation would create two Mount
objects
(each with their root matching the corresponding volume activation
root) that would shadow the original mount.
The proxy monitor in GVfs 2.26 and later, automatically creates and
manage shadow mounts (and shadows the underlying mount) if the
activation root on a Volume
is set.
Returns
true
if self
is shadowed.
sourcefn remount<P: FnOnce(Result<(), Error>) + 'static>(
&self,
flags: MountMountFlags,
mount_operation: Option<&impl IsA<MountOperation>>,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P
)
fn remount<P: FnOnce(Result<(), Error>) + 'static>( &self, flags: MountMountFlags, mount_operation: Option<&impl IsA<MountOperation>>, cancellable: Option<&impl IsA<Cancellable>>, callback: P )
Remounts a mount. This is an asynchronous operation, and is
finished by calling g_mount_remount_finish()
with the self
and GAsyncResults
data returned in the callback
.
Remounting is useful when some setting affecting the operation of the volume has been changed, as these may need a remount to take affect. While this is semantically equivalent with unmounting and then remounting not all backends might need to actually be unmounted.
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
.
fn remount_future( &self, flags: MountMountFlags, mount_operation: Option<&impl IsA<MountOperation> + Clone + 'static> ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>
sourcefn shadow(&self)
fn shadow(&self)
Increments the shadow count on self
. Usually used by
VolumeMonitor
implementations when creating a shadow mount for
self
, see is_shadowed()
for more information. The caller
will need to emit the signal::Mount::changed
signal on self
manually.
sourcefn unmount_with_operation<P: FnOnce(Result<(), Error>) + 'static>(
&self,
flags: MountUnmountFlags,
mount_operation: Option<&impl IsA<MountOperation>>,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P
)
fn unmount_with_operation<P: FnOnce(Result<(), Error>) + 'static>( &self, flags: MountUnmountFlags, mount_operation: Option<&impl IsA<MountOperation>>, cancellable: Option<&impl IsA<Cancellable>>, callback: P )
Unmounts a mount. This is an asynchronous operation, and is
finished by calling g_mount_unmount_with_operation_finish()
with the self
and AsyncResult
data 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
.
fn unmount_with_operation_future( &self, flags: MountUnmountFlags, mount_operation: Option<&impl IsA<MountOperation> + Clone + 'static> ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>
sourcefn unshadow(&self)
fn unshadow(&self)
Decrements the shadow count on self
. Usually used by
VolumeMonitor
implementations when destroying a shadow mount for
self
, see is_shadowed()
for more information. The caller
will need to emit the signal::Mount::changed
signal on self
manually.
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 mount has been changed.
sourcefn connect_pre_unmount<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_pre_unmount<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
This signal may be emitted when the Mount
is about to be
unmounted.
This signal depends on the backend and is only emitted if GIO was used to unmount.
sourcefn connect_unmounted<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_unmounted<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
This signal is emitted when the Mount
have been
unmounted. If the recipient is holding references to the
object they should release them so the object can be
finalized.