Trait gio::prelude::MountExt[][src]

pub trait MountExt: 'static {
Show methods fn can_eject(&self) -> bool;
fn can_unmount(&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 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: IsA<Cancellable>, Q: FnOnce(Result<Vec<GString>, Error>) + Send + 'static>(
        &self,
        force_rescan: bool,
        cancellable: Option<&P>,
        callback: Q
    );
fn guess_content_type_future(
        &self,
        force_rescan: bool
    ) -> Pin<Box_<dyn Future<Output = Result<Vec<GString>, Error>> + 'static>>;
fn guess_content_type_sync<P: IsA<Cancellable>>(
        &self,
        force_rescan: bool,
        cancellable: Option<&P>
    ) -> Result<Vec<GString>, Error>;
fn is_shadowed(&self) -> bool;
fn remount<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 remount_future<P: IsA<MountOperation> + Clone + 'static>(
        &self,
        flags: MountMountFlags,
        mount_operation: Option<&P>
    ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>;
fn shadow(&self);
fn unmount_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 unmount_with_operation_future<P: IsA<MountOperation> + Clone + 'static>(
        &self,
        flags: MountUnmountFlags,
        mount_operation: Option<&P>
    ) -> 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

Trait containing all Mount methods.

Implementors

Mount

Required methods

Checks if self can be ejected.

Returns

true if the self can be ejected.

Checks if self can be unmounted.

Returns

true if the self can be unmounted.

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.

Gets the default location of self. The default location of the given self is a path that reflects the main entry point for the user (e.g. the home directory, or the root of the volume).

Returns

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

Gets the drive for the self.

This is a convenience method for getting the Volume and then using that object to get the Drive.

Returns

a Drive or None if self is not associated with a volume or 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 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 root directory on self.

Returns

a File. The returned object should be unreffed with g_object_unref() 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 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.

Gets the volume for the self.

Returns

a Volume or None if self is not associated with a volume. The returned object should be unreffed with g_object_unref() when no longer needed.

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

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.

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.

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.

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.

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.

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.

Emitted when the mount has been changed.

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.

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.

Implementors