glibmm 2.30.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions

# Gio::Mount Class Reference
Stream Classes

The Mount interface represents user-visible mounts. More...

`#include <giomm/mount.h>`

Inheritance diagram for Gio::Mount:
[legend]

List of all members.

## Public Member Functions
virtual | ~Mount ()
GMount* | gobj ()
| Provides access to the underlying C GObject.
const GMount* | gobj () const
| Provides access to the underlying C GObject.
Glib::RefPtr< File > | get_root ()
| Gets the root directory on mount.
Glib::RefPtr< const File > | get_root () const
| Gets the root directory on mount.
std::string | get_name () const
| Gets the name of mount.
Glib::RefPtr< Icon > | get_icon ()
| Gets the icon for mount.
Glib::RefPtr< const Icon > | get_icon () const
| Gets the icon for mount.
std::string | get_uuid () const
| Gets the UUID for the mount.
Glib::RefPtr< Volume > | get_volume ()
| Gets the volume for the mount.
Glib::RefPtr< const Volume > | get_volume () const
| Gets the volume for the mount.
Glib::RefPtr< Drive > | get_drive ()
| Gets the drive for the mount.
Glib::RefPtr< const Drive > | get_drive () const
| Gets the drive for the mount.
bool | can_unmount () const
| Checks if mount can be mounted.
bool | can_eject () const
| Checks if mount can be eject.
void | unmount (const SlotAsyncReady& slot, const Glib::RefPtr< Cancellable >& cancellable, MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
void | unmount (const SlotAsyncReady& slot, MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
void | unmount (MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
void | unmount (const Glib::RefPtr< MountOperation >& mount_operation, MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
void | unmount (const Glib::RefPtr< MountOperation >& mount_operation, const SlotAsyncReady& slot, MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
void | unmount (const Glib::RefPtr< MountOperation >& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr< Cancellable >& cancellable, MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
bool | unmount_finish (const Glib::RefPtr< AsyncResult >& result)
| Finishes unmounting a mount.
void | remount (const Glib::RefPtr< MountOperation >& operation, const SlotAsyncReady& slot, const Glib::RefPtr< Cancellable >& cancellable, MountMountFlags flags=MOUNT_MOUNT_NONE)
| Remounts a mount.
void | remount (const Glib::RefPtr< MountOperation >& operation, const SlotAsyncReady& slot, MountMountFlags flags=MOUNT_MOUNT_NONE)
| Remounts a mount.
void | remount (const Glib::RefPtr< MountOperation >& operation, MountMountFlags flags=MOUNT_MOUNT_NONE)
| Remounts a mount.
void | remount (MountMountFlags flags=MOUNT_MOUNT_NONE)
| Remounts a mount, without user interaction.
bool | remount_finish (const Glib::RefPtr< AsyncResult >& result)
| Finishes remounting a mount.
void | eject (const SlotAsyncReady& slot, const Glib::RefPtr< Cancellable >& cancellable, MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
void | eject (const SlotAsyncReady& slot, MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
void | eject (MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
void | eject (const Glib::RefPtr< MountOperation >& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr< Cancellable >& cancellable, MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
void | eject (const Glib::RefPtr< MountOperation >& mount_operation, const SlotAsyncReady& slot, MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
void | eject (const Glib::RefPtr< MountOperation >& mount_operation, MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
bool | eject_finish (const Glib::RefPtr< AsyncResult >& result)
| Finishes ejecting a mount.
void | guess_content_type (const SlotAsyncReady& slot, const Glib::RefPtr< Cancellable >& cancellable, bool force_rescan=true)
| Tries to guess the type of content stored on the mount.
void | guess_content_type (const SlotAsyncReady& slot, bool force_rescan=true)
| Tries to guess the type of content stored on the mount.
void | guess_content_type (bool force_rescan=true)
| Tries to guess the type of content stored on the mount.
void | guess_content_type_sync (const Glib::RefPtr< Cancellable >& cancellable, bool force_rescan=true)
void | guess_content_type_sync (bool force_rescan=true)
Glib::StringArrayHandle | guess_content_type_finish (const Glib::RefPtr< AsyncResult >& result)
| Finishes guessing content types of mount.
bool | is_shadowed () const
| Determines if mount is shadowed.
void | shadow ()
| Increments the shadow count on mount.
void | unshadow ()
| Decrements the shadow count on mount.
Glib::RefPtr< File > | get_default_location () const
| Gets the default location of mount.
Glib::SignalProxy0< void > | signal_changed ()
Glib::SignalProxy0< void > | signal_unmounted ()
Glib::SignalProxy0< void > | signal_pre_unmount ()
## Static Public Member Functions
static void | add_interface (GType gtype_implementer)
## Protected Member Functions
virtual void | on_changed ()
virtual void | on_unmounted ()
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gio::Mount > | wrap (GMount* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

The Mount interface represents user-visible mounts.

Mount is a "mounted" filesystem that you can access. Mounted is in quotes because it's not the same as a unix mount: it might be a gvfs mount, but you can still access the files on it if you use GIO. It might or might not be related to a volume object.

Unmounting a Mount instance is an asynchronous operation. For more information about asynchronous operations, see AsyncReady. To unmount a Mount instance, first call unmount(). The callback slot will be called when the operation has resolved (either with success or failure), and a AsyncReady structure will be passed to the callback. That callback should then call unmount_finish() with the AsyncReady data to see if the operation was completed successfully.

Since glibmm 2.16:

## Constructor & Destructor Documentation

virtual Gio::Mount::~Mount | ( |  | ) | `[virtual]`

## Member Function Documentation

static void Gio::Mount::add_interface | ( | GType | gtype_implementer | ) | `[static]`

bool Gio::Mount::can_eject | ( |  | ) | const

Checks if mount can be eject.

Returns:
  `true` if the mount can be ejected.

bool Gio::Mount::can_unmount | ( |  | ) | const

Checks if mount can be mounted.

Returns:
  `true` if the mount can be unmounted.

void Gio::Mount::eject | ( | const Glib::RefPtr< MountOperation >& | mount_operation,
|  | const SlotAsyncReady & | slot,
|  | MountUnmountFlags | flags = `MOUNT_UNMOUNT_NONE`
| ) |  |

void Gio::Mount::eject | ( | const Glib::RefPtr< MountOperation >& | mount_operation,
|  | MountUnmountFlags | flags = `MOUNT_UNMOUNT_NONE`
| ) |  |

void Gio::Mount::eject | ( | const SlotAsyncReady & | slot,
|  | const Glib::RefPtr< Cancellable >& | cancellable,
|  | MountUnmountFlags | flags = `MOUNT_UNMOUNT_NONE`
| ) |  |

void Gio::Mount::eject | ( | const SlotAsyncReady & | slot,
|  | MountUnmountFlags | flags = `MOUNT_UNMOUNT_NONE`
| ) |  |

void Gio::Mount::eject | ( | MountUnmountFlags | flags = `MOUNT_UNMOUNT_NONE` | ) |

void Gio::Mount::eject | ( | const Glib::RefPtr< MountOperation >& | mount_operation,
|  | const SlotAsyncReady & | slot,
|  | const Glib::RefPtr< Cancellable >& | cancellable,
|  | MountUnmountFlags | flags = `MOUNT_UNMOUNT_NONE`
| ) |  |

bool Gio::Mount::eject_finish | ( | const Glib::RefPtr< AsyncResult >& | result | ) |

Finishes ejecting a mount.

If any errors occurred during the operation, error will be set to contain the errors and `false` will be returned.

Since glibmm 2.22:

Parameters:

  result | A AsyncResult.

Returns:
  `true` if the mount was successfully ejected. `false` otherwise.

Glib::RefPtr<File> Gio::Mount::get_default_location | ( |  | ) | const

Gets the default location of mount.

The default location of the given mount 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 Glib::object_unref() when no longer needed.

Glib::RefPtr<const Drive> Gio::Mount::get_drive | ( |  | ) | const

Gets the drive for the mount.

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

Returns:
  A Drive or `0` if mount is not associated with a volume or a drive. The returned object should be unreffed with Glib::object_unref() when no longer needed.

Glib::RefPtr<Drive> Gio::Mount::get_drive | ( |  | ) |

Gets the drive for the mount.

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

Returns:
  A Drive or `0` if mount is not associated with a volume or a drive. The returned object should be unreffed with Glib::object_unref() when no longer needed.

Glib::RefPtr<const Icon> Gio::Mount::get_icon | ( |  | ) | const

Gets the icon for mount.

Returns:
  A Icon. The returned object should be unreffed with Glib::object_unref() when no longer needed.

Glib::RefPtr<Icon> Gio::Mount::get_icon | ( |  | ) |

Gets the icon for mount.

Returns:
  A Icon. The returned object should be unreffed with Glib::object_unref() when no longer needed.

std::string Gio::Mount::get_name | ( |  | ) | const

Gets the name of mount.

Returns:
  The name for the given mount. The returned string should be freed with Glib::free() when no longer needed.

Glib::RefPtr<File> Gio::Mount::get_root | ( |  | ) |

Gets the root directory on mount.

Returns:
  A File. The returned object should be unreffed with Glib::object_unref() when no longer needed.

Glib::RefPtr<const File> Gio::Mount::get_root | ( |  | ) | const

Gets the root directory on mount.

Returns:
  A File. The returned object should be unreffed with Glib::object_unref() when no longer needed.

std::string Gio::Mount::get_uuid | ( |  | ) | const

Gets the UUID for the mount.

The reference is typically based on the file system UUID for the mount in question and should be considered an opaque string. Returns `0` if there is no UUID available.

Returns:
  The UUID for mount or `0` if no UUID can be computed. The returned string should be freed with Glib::free() when no longer needed.

Glib::RefPtr<Volume> Gio::Mount::get_volume | ( |  | ) |

Gets the volume for the mount.

Returns:
  A Volume or `0` if mount is not associated with a volume. The returned object should be unreffed with Glib::object_unref() when no longer needed.

Glib::RefPtr<const Volume> Gio::Mount::get_volume | ( |  | ) | const

Gets the volume for the mount.

Returns:
  A Volume or `0` if mount is not associated with a volume. The returned object should be unreffed with Glib::object_unref() when no longer needed.

GMount* Gio::Mount::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::Interface.

const GMount* Gio::Mount::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::Interface.

void Gio::Mount::guess_content_type | ( | const SlotAsyncReady & | slot,
|  | const Glib::RefPtr< Cancellable >& | cancellable,
|  | bool | force_rescan = `true`
| ) |  |

Tries to guess the type of content stored on the mount.

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 <ulink url="http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec">shared-mime-info</ulink> specification for more on x-content types.

This is an asynchronous operation, and is finished by calling guess_content_type_finish().

Parameters:

  slot | A callback which will be called when the operation is completed or canceled.
  cancellable | A cancellable object which can be used to cancel the operation.
  force_rescan | Whether to force a rescan of the content. Otherwise a cached result will be used if available.

Since glibmm 2.18:

void Gio::Mount::guess_content_type | ( | bool | force_rescan = `true` | ) |

Tries to guess the type of content stored on the mount.

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 <ulink url="http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec">shared-mime-info</ulink> specification for more on x-content types.

Parameters:

  force_rescan | Whether to force a rescan of the content. Otherwise a cached result will be used if available.

Since glibmm 2.18:

void Gio::Mount::guess_content_type | ( | const SlotAsyncReady & | slot,
|  | bool | force_rescan = `true`
| ) |  |

Tries to guess the type of content stored on the mount.

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 <ulink url="http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec">shared-mime-info</ulink> specification for more on x-content types.

This is an asynchronous operation, and is finished by calling guess_content_type_finish().

Parameters:

  slot | A callback which will be called when the operation is completed or canceled.
  force_rescan | Whether to force a rescan of the content. Otherwise a cached result will be used if available.

Since glibmm 2.18:

Glib::StringArrayHandle Gio::Mount::guess_content_type_finish | ( | const Glib::RefPtr< AsyncResult >& | result | ) |

Finishes guessing content types of mount.

If any errors occured during the operation, error will be set to contain the errors and `false` will be returned. In particular, you may get an IO_ERROR_NOT_SUPPORTED if the mount does not support content guessing.

Since glibmm 2.18:

Parameters:

  result | A AsyncResult.

Returns:
  A `0`-terminated array of content types or `0` on error. Caller should free this array with Glib::strfreev() when done with it.

void Gio::Mount::guess_content_type_sync | ( | const Glib::RefPtr< Cancellable >& | cancellable,
|  | bool | force_rescan = `true`
| ) |  |

void Gio::Mount::guess_content_type_sync | ( | bool | force_rescan = `true` | ) |

bool Gio::Mount::is_shadowed | ( |  | ) | const

Determines if mount is shadowed.

Applications or libraries should avoid displaying mount 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 mount.

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.

Since glibmm 2.20:

Returns:
  `true` if mount is shadowed.

virtual void Gio::Mount::on_changed | ( |  | ) | `[protected, virtual]`

virtual void Gio::Mount::on_unmounted | ( |  | ) | `[protected, virtual]`

void Gio::Mount::remount | ( | const Glib::RefPtr< MountOperation >& | operation,
|  | const SlotAsyncReady & | slot,
|  | const Glib::RefPtr< Cancellable >& | cancellable,
|  | MountMountFlags | flags = `MOUNT_MOUNT_NONE`
| ) |  |

Remounts a mount.

This is an asynchronous operation, and is finished by calling mount_finish() with the AsyncResult data returned in the callback slot.

Remounting is useful when some setting affecting the operation of the volume has been changed, as this 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.

Parameters:

  operation | A mount operation.
  slot | A callback which will be called when the operation is completed or canceled.
  cancellable | A cancellable object which can be used to cancel the operation.

void Gio::Mount::remount | ( | const Glib::RefPtr< MountOperation >& | operation,
|  | MountMountFlags | flags = `MOUNT_MOUNT_NONE`
| ) |  |

Remounts a mount.

Remounting is useful when some setting affecting the operation of the volume has been changed, as this 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.

Parameters:

  operation | A mount operation.

void Gio::Mount::remount | ( | MountMountFlags | flags = `MOUNT_MOUNT_NONE` | ) |

Remounts a mount, without user interaction.

Remounting is useful when some setting affecting the operation of the volume has been changed, as this 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.

void Gio::Mount::remount | ( | const Glib::RefPtr< MountOperation >& | operation,
|  | const SlotAsyncReady & | slot,
|  | MountMountFlags | flags = `MOUNT_MOUNT_NONE`
| ) |  |

Remounts a mount.

This is an asynchronous operation, and is finished by calling mount_finish() with the AsyncResult data returned in the callback slot.

Remounting is useful when some setting affecting the operation of the volume has been changed, as this 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.

Parameters:

  operation | A mount operation.
  slot | A callback which will be called when the operation is completed or canceled.

bool Gio::Mount::remount_finish | ( | const Glib::RefPtr< AsyncResult >& | result | ) |

Finishes remounting a mount.

If any errors occurred during the operation, error will be set to contain the errors and `false` will be returned.

Parameters:

  result | A AsyncResult.

Returns:
  `true` if the mount was successfully remounted. `false` otherwise.

void Gio::Mount::shadow | ( |  | ) |

Increments the shadow count on mount.

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

Since glibmm 2.20:

Glib::SignalProxy0< void > Gio::Mount::signal_changed | ( |  | ) |

Prototype:
  `void on_my_changed()`

Glib::SignalProxy0< void > Gio::Mount::signal_pre_unmount | ( |  | ) |

Prototype:
  `void on_my_pre_unmount()`

Glib::SignalProxy0< void > Gio::Mount::signal_unmounted | ( |  | ) |

Prototype:
  `void on_my_unmounted()`

void Gio::Mount::unmount | ( | const Glib::RefPtr< MountOperation >& | mount_operation,
|  | MountUnmountFlags | flags = `MOUNT_UNMOUNT_NONE`
| ) |  |

void Gio::Mount::unmount | ( | const SlotAsyncReady & | slot,
|  | MountUnmountFlags | flags = `MOUNT_UNMOUNT_NONE`
| ) |  |

void Gio::Mount::unmount | ( | MountUnmountFlags | flags = `MOUNT_UNMOUNT_NONE` | ) |

void Gio::Mount::unmount | ( | const Glib::RefPtr< MountOperation >& | mount_operation,
|  | const SlotAsyncReady & | slot,
|  | MountUnmountFlags | flags = `MOUNT_UNMOUNT_NONE`
| ) |  |

void Gio::Mount::unmount | ( | const Glib::RefPtr< MountOperation >& | mount_operation,
|  | const SlotAsyncReady & | slot,
|  | const Glib::RefPtr< Cancellable >& | cancellable,
|  | MountUnmountFlags | flags = `MOUNT_UNMOUNT_NONE`
| ) |  |

void Gio::Mount::unmount | ( | const SlotAsyncReady & | slot,
|  | const Glib::RefPtr< Cancellable >& | cancellable,
|  | MountUnmountFlags | flags = `MOUNT_UNMOUNT_NONE`
| ) |  |

bool Gio::Mount::unmount_finish | ( | const Glib::RefPtr< AsyncResult >& | result | ) |

Finishes unmounting a mount.

If any errors occurred during the operation, error will be set to contain the errors and `false` will be returned.

Since glibmm 2.22:

Parameters:

  result | A AsyncResult.

Returns:
  `true` if the mount was successfully unmounted. `false` otherwise.

void Gio::Mount::unshadow | ( |  | ) |

Decrements the shadow count on mount.

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

Since glibmm 2.20:

## Friends And Related Function Documentation

Glib::RefPtr< Gio::Mount > wrap | ( | GMount * | object,
|  | bool | take_copy = `false`
| ) |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.