[][src]Trait gio::MountExt

pub trait MountExt: 'static {
    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 get_default_location(&self) -> Option<File>;
fn get_drive(&self) -> Option<Drive>;
fn get_icon(&self) -> Option<Icon>;
fn get_name(&self) -> Option<GString>;
fn get_root(&self) -> Option<File>;
fn get_sort_key(&self) -> Option<GString>;
fn get_symbolic_icon(&self) -> Option<Icon>;
fn get_uuid(&self) -> Option<GString>;
fn get_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; }

Trait containing all Mount methods.

Implementors

Mount

Required methods

fn can_eject(&self) -> bool

Checks if self can be ejected.

Returns

true if the self can be ejected.

fn can_unmount(&self) -> bool

Checks if self can be unmounted.

Returns

true if the self can be unmounted.

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
)

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

user_data

user data passed to callback.

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 get_default_location(&self) -> Option<File>

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 gobject::ObjectExt::unref when no longer needed.

fn get_drive(&self) -> Option<Drive>

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 gobject::ObjectExt::unref when no longer needed.

fn get_icon(&self) -> Option<Icon>

Gets the icon for self.

Returns

a Icon. The returned object should be unreffed with gobject::ObjectExt::unref when no longer needed.

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

fn get_root(&self) -> Option<File>

Gets the root directory on self.

Returns

a File. The returned object should be unreffed with gobject::ObjectExt::unref when no longer needed.

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

fn get_symbolic_icon(&self) -> Option<Icon>

Gets the symbolic icon for self.

Returns

a Icon. The returned object should be unreffed with gobject::ObjectExt::unref when no longer needed.

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

fn get_volume(&self) -> Option<Volume>

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 gobject::ObjectExt::unref when no longer needed.

fn guess_content_type<P: IsA<Cancellable>, Q: FnOnce(Result<Vec<GString>, Error>) + Send + 'static>(
    &self,
    force_rescan: bool,
    cancellable: Option<&P>,
    callback: Q
)

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 Mount::guess_content_type_sync for the synchronous version), and is finished by calling 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

user_data

user data passed to callback

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>

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 Mount::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.

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.

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
)

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

user_data

user data passed to callback.

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)

Increments the shadow count on self. Usually used by VolumeMonitor implementations when creating a shadow mount for self, see Mount::is_shadowed for more information. The caller will need to emit the Mount::changed signal on self manually.

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
)

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

user_data

user data passed to callback.

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)

Decrements the shadow count on self. Usually used by VolumeMonitor implementations when destroying a shadow mount for self, see Mount::is_shadowed for more information. The caller will need to emit the Mount::changed signal on self manually.

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

Emitted when the mount has been changed.

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.

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.

Loading content...

Implementors

impl<O: IsA<Mount>> MountExt for O[src]

Loading content...