glibmm 2.80.0
|
The Mount interface represents user-visible mounts. More...
#include <giomm/mount.h>
Public Types | |
enum class | UnmountFlags { NONE = 0x0 , FORCE = (1 << 0) } |
enum class | MountFlags { NONE = 0x0 } |
Public Member Functions | |
Mount (Mount &&src) noexcept | |
Mount & | operator= (Mount &&src) noexcept |
~Mount () noexcept override | |
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. | |
Glib::RefPtr< Icon > | get_symbolic_icon () |
Gets the symbolic icon for mount. | |
Glib::RefPtr< const Icon > | get_symbolic_icon () const |
Gets the symbolic 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 unmounted. | |
bool | can_eject () const |
Checks if mount can be ejected. | |
void | unmount (const SlotAsyncReady &slot, const Glib::RefPtr< Cancellable > &cancellable, UnmountFlags flags=UnmountFlags::NONE) |
void | unmount (const SlotAsyncReady &slot, UnmountFlags flags=UnmountFlags::NONE) |
void | unmount (UnmountFlags flags=UnmountFlags::NONE) |
void | unmount (const Glib::RefPtr< MountOperation > &mount_operation, UnmountFlags flags=UnmountFlags::NONE) |
void | unmount (const Glib::RefPtr< MountOperation > &mount_operation, const SlotAsyncReady &slot, UnmountFlags flags=UnmountFlags::NONE) |
void | unmount (const Glib::RefPtr< MountOperation > &mount_operation, const SlotAsyncReady &slot, const Glib::RefPtr< Cancellable > &cancellable, UnmountFlags flags=UnmountFlags::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, MountFlags flags=MountFlags::NONE) |
Remounts a mount. | |
void | remount (const Glib::RefPtr< MountOperation > &operation, const SlotAsyncReady &slot, MountFlags flags=MountFlags::NONE) |
Remounts a mount. | |
void | remount (const Glib::RefPtr< MountOperation > &operation, MountFlags flags=MountFlags::NONE) |
Remounts a mount. | |
void | remount (MountFlags flags=MountFlags::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, UnmountFlags flags=UnmountFlags::NONE) |
void | eject (const SlotAsyncReady &slot, UnmountFlags flags=UnmountFlags::NONE) |
void | eject (UnmountFlags flags=UnmountFlags::NONE) |
void | eject (const Glib::RefPtr< MountOperation > &mount_operation, const SlotAsyncReady &slot, const Glib::RefPtr< Cancellable > &cancellable, UnmountFlags flags=UnmountFlags::NONE) |
void | eject (const Glib::RefPtr< MountOperation > &mount_operation, const SlotAsyncReady &slot, UnmountFlags flags=UnmountFlags::NONE) |
void | eject (const Glib::RefPtr< MountOperation > &mount_operation, UnmountFlags flags=UnmountFlags::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) |
std::vector< Glib::ustring > | guess_content_type_finish (const Glib::RefPtr< AsyncResult > &result) |
Finishes guessing content types of the 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::ustring | get_sort_key () const |
Gets the sort key for mount, if any. | |
Glib::SignalProxy< void()> | signal_changed () |
Glib::SignalProxy< void()> | signal_unmounted () |
Glib::SignalProxy< void()> | signal_pre_unmount () |
Public Member Functions inherited from Glib::Interface | |
Interface () | |
A Default constructor. | |
Interface (Interface &&src) noexcept | |
Interface & | operator= (Interface &&src) noexcept |
Interface (const Glib::Interface_Class &interface_class) | |
Called by constructors of derived classes. | |
Interface (GObject *castitem) | |
Called by constructors of derived classes. | |
~Interface () noexcept override | |
Interface (const Interface &)=delete | |
Interface & | operator= (const Interface &)=delete |
GObject * | gobj () |
const GObject * | gobj () const |
Public Member Functions inherited from Glib::ObjectBase | |
ObjectBase (const ObjectBase &)=delete | |
ObjectBase & | operator= (const ObjectBase &)=delete |
void | set_property_value (const Glib::ustring & property_name, const Glib::ValueBase & value) |
You probably want to use a specific property_*() accessor method instead. | |
void | get_property_value (const Glib::ustring & property_name, Glib::ValueBase & value) const |
You probably want to use a specific property_*() accessor method instead. | |
template<class PropertyType > | |
void | set_property (const Glib::ustring & property_name, const PropertyType & value) |
You probably want to use a specific property_*() accessor method instead. | |
template<class PropertyType > | |
void | get_property (const Glib::ustring & property_name, PropertyType & value) const |
You probably want to use a specific property_*() accessor method instead. | |
template<class PropertyType > | |
PropertyType | get_property (const Glib::ustring & property_name) const |
You probably want to use a specific property_*() accessor method instead. | |
sigc::connection | connect_property_changed (const Glib::ustring & property_name, const sigc::slot< void()> &slot) |
You can use the signal_changed() signal of the property proxy instead. | |
sigc::connection | connect_property_changed (const Glib::ustring & property_name, sigc::slot< void()> &&slot) |
You can use the signal_changed() signal of the property proxy instead. | |
void | freeze_notify () |
Increases the freeze count on object. | |
void | thaw_notify () |
Reverts the effect of a previous call to freeze_notify(). | |
virtual void | reference () const |
Increment the reference count for this object. | |
virtual void | unreference () const |
Decrement the reference count for this object. | |
GObject * | gobj () |
Provides access to the underlying C GObject. | |
const GObject * | gobj () const |
Provides access to the underlying C GObject. | |
GObject * | gobj_copy () const |
Give a ref-ed copy to someone. Use for direct struct access. | |
Static Public Member Functions | |
static void | add_interface (GType gtype_implementer) |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. | |
Protected Member Functions | |
Mount () | |
You should derive from this class to use it. | |
virtual void | on_changed () |
This is a default handler for the signal signal_changed(). | |
virtual void | on_unmounted () |
This is a default handler for the signal signal_unmounted(). | |
virtual void | on_pre_unmount () |
This is a default handler for the signal signal_pre_unmount(). | |
Protected Member Functions inherited from Glib::ObjectBase | |
ObjectBase () | |
This default constructor is called implicitly from the constructor of user-derived classes, even if, for instance, Gtk::Button calls a different ObjectBase constructor. | |
ObjectBase (const char *custom_type_name) | |
A derived constructor always overrides this choice. | |
ObjectBase (const std::type_info &custom_type_info) | |
This constructor is a special feature to allow creation of derived types on the fly, without having to use g_object_new() manually. | |
ObjectBase (ObjectBase &&src) noexcept | |
ObjectBase & | operator= (ObjectBase &&src) noexcept |
virtual | ~ObjectBase () noexcept=0 |
void | initialize (GObject *castitem) |
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper) |
Related Symbols | |
(Note that these are not member symbols.) | |
Glib::RefPtr< Gio::Mount > | wrap (GMount *object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
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.
|
strong |
|
strong |
|
protected |
You should derive from this class to use it.
|
noexcept |
|
overridenoexcept |
bool Gio::Mount::can_eject | ( | ) | const |
Checks if mount can be ejected.
true
if the mount can be ejected. bool Gio::Mount::can_unmount | ( | ) | const |
Checks if mount can be unmounted.
true
if the mount can be unmounted. void Gio::Mount::eject | ( | const Glib::RefPtr< MountOperation > & | mount_operation, |
const SlotAsyncReady & | slot, | ||
const Glib::RefPtr< Cancellable > & | cancellable, | ||
UnmountFlags | flags = UnmountFlags::NONE |
||
) |
void Gio::Mount::eject | ( | const Glib::RefPtr< MountOperation > & | mount_operation, |
const SlotAsyncReady & | slot, | ||
UnmountFlags | flags = UnmountFlags::NONE |
||
) |
void Gio::Mount::eject | ( | const Glib::RefPtr< MountOperation > & | mount_operation, |
UnmountFlags | flags = UnmountFlags::NONE |
||
) |
void Gio::Mount::eject | ( | const SlotAsyncReady & | slot, |
const Glib::RefPtr< Cancellable > & | cancellable, | ||
UnmountFlags | flags = UnmountFlags::NONE |
||
) |
void Gio::Mount::eject | ( | const SlotAsyncReady & | slot, |
UnmountFlags | flags = UnmountFlags::NONE |
||
) |
void Gio::Mount::eject | ( | UnmountFlags | flags = UnmountFlags::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.
result | A AsyncResult. |
true
if the mount was successfully ejected. false
otherwise.Glib::Error |
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).
Glib::RefPtr< Drive > Gio::Mount::get_drive | ( | ) |
Glib::RefPtr< const Drive > Gio::Mount::get_drive | ( | ) | const |
Glib::RefPtr< Icon > Gio::Mount::get_icon | ( | ) |
Gets the icon for mount.
Glib::RefPtr< const Icon > Gio::Mount::get_icon | ( | ) | const |
Gets the icon for mount.
std::string Gio::Mount::get_name | ( | ) | const |
Gets the name of mount.
Glib::RefPtr< File > Gio::Mount::get_root | ( | ) |
Gets the root directory on mount.
Glib::RefPtr< const File > Gio::Mount::get_root | ( | ) | const |
Gets the root directory on mount.
Glib::ustring Gio::Mount::get_sort_key | ( | ) | const |
Gets the sort key for mount, if any.
nullptr
if no such key is available. Glib::RefPtr< Icon > Gio::Mount::get_symbolic_icon | ( | ) |
Gets the symbolic icon for mount.
Glib::RefPtr< const Icon > Gio::Mount::get_symbolic_icon | ( | ) | const |
Gets the symbolic icon for mount.
Get the GType for this class, for use with the underlying GObject type system.
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 nullptr
if there is no UUID available.
nullptr
if no UUID can be computed. Glib::RefPtr< Volume > Gio::Mount::get_volume | ( | ) |
Gets the volume for the mount.
nullptr
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.
nullptr
if mount is not associated with a volume. The returned object should be unreffed with Glib::object_unref() when no longer needed.
|
inline |
Provides access to the underlying C GObject.
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 shared-mime-info specification for more on x-content types.
force_rescan | Whether to force a rescan of the content. Otherwise a cached result will be used if available. |
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 shared-mime-info specification for more on x-content types.
This is an asynchronous operation, and is finished by calling guess_content_type_finish().
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. |
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 shared-mime-info specification for more on x-content types.
This is an asynchronous operation, and is finished by calling guess_content_type_finish().
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. |
std::vector< Glib::ustring > Gio::Mount::guess_content_type_finish | ( | const Glib::RefPtr< AsyncResult > & | result | ) |
Finishes guessing content types of the Mount.
If any errors occurred during the operation, an exception will be thrown. In particular, you may get a Gio::Error::NOT_SUPPORTED if the mount does not support content guessing.
result | An AsyncResult. |
Glib::Error |
void Gio::Mount::guess_content_type_sync | ( | const Glib::RefPtr< Cancellable > & | cancellable, |
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.
true
if mount is shadowed. This is a default handler for the signal signal_changed().
This is a default handler for the signal signal_pre_unmount().
This is a default handler for the signal signal_unmounted().
void Gio::Mount::remount | ( | const Glib::RefPtr< MountOperation > & | operation, |
const SlotAsyncReady & | slot, | ||
const Glib::RefPtr< Cancellable > & | cancellable, | ||
MountFlags | flags = MountFlags::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.
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. |
flags | Flags affecting the operation. |
void Gio::Mount::remount | ( | const Glib::RefPtr< MountOperation > & | operation, |
const SlotAsyncReady & | slot, | ||
MountFlags | flags = MountFlags::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.
operation | A mount operation. |
slot | A callback which will be called when the operation is completed or canceled. |
flags | Flags affecting the operation. |
void Gio::Mount::remount | ( | const Glib::RefPtr< MountOperation > & | operation, |
MountFlags | flags = MountFlags::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.
operation | A mount operation. |
flags | Flags affecting the operation. |
void Gio::Mount::remount | ( | MountFlags | flags = MountFlags::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.
flags | Flags affecting the operation. |
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.
result | A AsyncResult. |
true
if the mount was successfully remounted. false
otherwise.Glib::Error |
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::signal_changed() signal on mount manually.
Glib::SignalProxy< void()> Gio::Mount::signal_changed | ( | ) |
void on_my_changed()
Flags: Run Last
Emitted when the mount has been changed.
Glib::SignalProxy< void()> Gio::Mount::signal_pre_unmount | ( | ) |
void on_my_pre_unmount()
Flags: Run Last
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.
Glib::SignalProxy< void()> Gio::Mount::signal_unmounted | ( | ) |
void on_my_unmounted()
Flags: Run Last
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.
void Gio::Mount::unmount | ( | const Glib::RefPtr< MountOperation > & | mount_operation, |
const SlotAsyncReady & | slot, | ||
const Glib::RefPtr< Cancellable > & | cancellable, | ||
UnmountFlags | flags = UnmountFlags::NONE |
||
) |
void Gio::Mount::unmount | ( | const Glib::RefPtr< MountOperation > & | mount_operation, |
const SlotAsyncReady & | slot, | ||
UnmountFlags | flags = UnmountFlags::NONE |
||
) |
void Gio::Mount::unmount | ( | const Glib::RefPtr< MountOperation > & | mount_operation, |
UnmountFlags | flags = UnmountFlags::NONE |
||
) |
void Gio::Mount::unmount | ( | const SlotAsyncReady & | slot, |
const Glib::RefPtr< Cancellable > & | cancellable, | ||
UnmountFlags | flags = UnmountFlags::NONE |
||
) |
void Gio::Mount::unmount | ( | const SlotAsyncReady & | slot, |
UnmountFlags | flags = UnmountFlags::NONE |
||
) |
void Gio::Mount::unmount | ( | UnmountFlags | flags = UnmountFlags::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.
result | A AsyncResult. |
true
if the mount was successfully unmounted. false
otherwise.Glib::Error |
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::signal_changed() signal on mount manually.
|
related |
A Glib::wrap() method for this object.
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. |