glibmm 2.4: Gio::Mount Class Reference

Main Page glibmm Namespaces Book

# Gio::Mount Class Reference
[Stream Classes]

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

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)
| Unmounts a mount.
void | unmount (const SlotAsyncReady& slot, MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
| Unmounts a mount.
void | unmount (MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
| Unmounts a mount.
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)
| Ejects a mount.
void | eject (const SlotAsyncReady& slot, MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
| Ejects a mount.
void | eject (MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
| Ejects a mount.
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.
Glib::StringArrayHandle | guess_content_type_finish (const Glib::RefPtr<AsyncResult>& result)
Glib::SignalProxy0<void> | signal_changed ()
Glib::SignalProxy0<void> | signal_unmounted ()
## 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]`

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.

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

Gets the root directory on mount.

Returns:
  A File.

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

Gets the root directory on mount.

Returns:
  A File.

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 when no longer needed.

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

Gets the icon for mount.

Returns:
  A Icon.

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

Gets the icon for mount.

Returns:
  A Icon.

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.

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.

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.

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.

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.

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

Checks if mount can be mounted.

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

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

Checks if mount can be eject.

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

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

Unmounts a mount.

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

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.
  | flags | Flags affecting the unmount.

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

Unmounts a mount.

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

Parameters:

  | slot | A callback which will be called when the operation is completed or canceled.
  | flags | Flags affecting the unmount.

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

Unmounts a mount.

Parameters:

  | cancellable | A cancellable object which can be used to cancel the operation.

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.

Parameters:

  | result | A AsyncResult.

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

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,
|  | 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.

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.

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::eject | ( | const SlotAsyncReady& | slot,
|  | const Glib::RefPtr<Cancellable>& | cancellable,
|  | MountUnmountFlags | flags = `MOUNT_UNMOUNT_NONE` |
| ) |  |  |

Ejects a mount.

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

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.
  | flags | Flags affecting the unmount if required for eject.

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

Ejects a mount.

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

Parameters:

  | slot | A callback which will be called when the operation is completed or canceled.
  | flags | Flags affecting the unmount if required for eject.

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

Ejects a mount.

Parameters:

  | flags | Flags affecting the unmount if required for eject.

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.

Parameters:

  | result | A AsyncResult.

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

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 | ( | 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:

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:

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

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

Prototype:
  `void on_my_changed()`

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

Prototype:
  `void on_my_unmounted()`

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

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

## 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.

The documentation for this class was generated from the following file:

- mount.h