Interface

GioMount

Description [src]

interface Gio.Mount : GObject.Object

The GMount interface represents a user-visible mount, such as a mounted file system.

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

A GMount might be associated with a GVolume (such as a USB flash drive) which hosts it.

Unmounting a GMount instance is an asynchronous operation. For more information about asynchronous operations, see GAsyncResult and GTask. To unmount a GMount instance, first call g_mount_unmount_with_operation() with (at least) the GMount instance and a GAsyncReadyCallback. The callback will be fired when the operation has resolved (either with success or failure), and a GAsyncResult structure will be passed to the callback. That callback should then call g_mount_unmount_with_operation_finish() with the GMount and the GAsyncResult data to see if the operation was completed successfully. If an error is present when g_mount_unmount_with_operation_finish() is called, then it will be filled with any error information.

Note, when porting from GnomeVFS, GMount is the moral equivalent of GnomeVFSVolume.

Prerequisite

In order to implement Mount, your type must inherit fromGObject.

Instance methods

g_mount_can_eject

Checks if mount can be ejected.

g_mount_can_unmount

Checks if mount can be unmounted.

g_mount_eject

Ejects a mount. This is an asynchronous operation, and is finished by calling g_mount_eject_finish() with the mount and GAsyncResult data returned in the callback.

deprecated: 2.22 

g_mount_eject_finish

Finishes ejecting a mount. If any errors occurred during the operation, error will be set to contain the errors and FALSE will be returned.

deprecated: 2.22 

g_mount_eject_with_operation

Ejects a mount. This is an asynchronous operation, and is finished by calling g_mount_eject_with_operation_finish() with the mount and GAsyncResult data returned in the callback.

since: 2.22

g_mount_eject_with_operation_finish

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

g_mount_get_default_location

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

g_mount_get_drive

Gets the drive for the mount.

g_mount_get_icon

Gets the icon for mount.

g_mount_get_name

Gets the name of mount.

g_mount_get_root

Gets the root directory on mount.

g_mount_get_sort_key

Gets the sort key for mount, if any.

since: 2.32

g_mount_get_symbolic_icon

Gets the symbolic icon for mount.

since: 2.34

g_mount_get_uuid

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 NULL if there is no UUID available.

g_mount_get_volume

Gets the volume for the mount.

g_mount_guess_content_type

Tries to guess the type of content stored on 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.

since: 2.18

g_mount_guess_content_type_finish

Finishes guessing content types of mount. If any errors occurred during the operation, error will be set to contain the errors and FALSE will be returned. In particular, you may get an G_IO_ERROR_NOT_SUPPORTED if the mount does not support content guessing.

since: 2.18

g_mount_guess_content_type_sync

Tries to guess the type of content stored on 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.

since: 2.18

g_mount_is_shadowed

Determines if mount is shadowed. Applications or libraries should avoid displaying mount in the user interface if it is shadowed.

since: 2.20

g_mount_remount

Remounts a mount. This is an asynchronous operation, and is finished by calling g_mount_remount_finish() with the mount and GAsyncResults data returned in the callback.

g_mount_remount_finish

Finishes remounting a mount. If any errors occurred during the operation, error will be set to contain the errors and FALSE will be returned.

g_mount_shadow

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

since: 2.20

g_mount_unmount

Unmounts a mount. This is an asynchronous operation, and is finished by calling g_mount_unmount_finish() with the mount and GAsyncResult data returned in the callback.

deprecated: 2.22 

g_mount_unmount_finish

Finishes unmounting a mount. If any errors occurred during the operation, error will be set to contain the errors and FALSE will be returned.

deprecated: 2.22 

g_mount_unmount_with_operation

Unmounts a mount. This is an asynchronous operation, and is finished by calling g_mount_unmount_with_operation_finish() with the mount and GAsyncResult data returned in the callback.

since: 2.22

g_mount_unmount_with_operation_finish

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

g_mount_unshadow

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

since: 2.20

Signals

Gio.Mount::changed

Emitted when the mount has been changed.

Gio.Mount::pre-unmount

This signal may be emitted when the GMount is about to be unmounted.

since: 2.22

Gio.Mount::unmounted

This signal is emitted when the GMount have been unmounted. If the recipient is holding references to the object they should release them so the object can be finalized.

Interface structure

struct GioMountIface {
  GTypeInterface g_iface;
  void (* changed) (
    GMount* mount
  );
  void (* unmounted) (
    GMount* mount
  );
  GFile* (* get_root) (
    GMount* mount
  );
  char* (* get_name) (
    GMount* mount
  );
  GIcon* (* get_icon) (
    GMount* mount
  );
  char* (* get_uuid) (
    GMount* mount
  );
  GVolume* (* get_volume) (
    GMount* mount
  );
  GDrive* (* get_drive) (
    GMount* mount
  );
  gboolean (* can_unmount) (
    GMount* mount
  );
  gboolean (* can_eject) (
    GMount* mount
  );
  void (* unmount) (
    GMount* mount,
    GMountUnmountFlags flags,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* unmount_finish) (
    GMount* mount,
    GAsyncResult* result,
    GError** error
  );
  void (* eject) (
    GMount* mount,
    GMountUnmountFlags flags,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* eject_finish) (
    GMount* mount,
    GAsyncResult* result,
    GError** error
  );
  void (* remount) (
    GMount* mount,
    GMountMountFlags flags,
    GMountOperation* mount_operation,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* remount_finish) (
    GMount* mount,
    GAsyncResult* result,
    GError** error
  );
  void (* guess_content_type) (
    GMount* mount,
    gboolean force_rescan,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gchar** (* guess_content_type_finish) (
    GMount* mount,
    GAsyncResult* result,
    GError** error
  );
  gchar** (* guess_content_type_sync) (
    GMount* mount,
    gboolean force_rescan,
    GCancellable* cancellable,
    GError** error
  );
  void (* pre_unmount) (
    GMount* mount
  );
  void (* unmount_with_operation) (
    GMount* mount,
    GMountUnmountFlags flags,
    GMountOperation* mount_operation,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* unmount_with_operation_finish) (
    GMount* mount,
    GAsyncResult* result,
    GError** error
  );
  void (* eject_with_operation) (
    GMount* mount,
    GMountUnmountFlags flags,
    GMountOperation* mount_operation,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* eject_with_operation_finish) (
    GMount* mount,
    GAsyncResult* result,
    GError** error
  );
  GFile* (* get_default_location) (
    GMount* mount
  );
  const gchar* (* get_sort_key) (
    GMount* mount
  );
  GIcon* (* get_symbolic_icon) (
    GMount* mount
  );
  
}

Interface for implementing operations for mounts.

Interface members
g_iface
GTypeInterface
 

The parent interface.

changed
void (* changed) (
    GMount* mount
  )
 

Changed signal that is emitted when the mount’s state has changed.

unmounted
void (* unmounted) (
    GMount* mount
  )
 

The unmounted signal that is emitted when the GMount have been unmounted. If the recipient is holding references to the object they should release them so the object can be finalized.

get_root
GFile* (* get_root) (
    GMount* mount
  )
 

Gets a GFile to the root directory of the GMount.

get_name
char* (* get_name) (
    GMount* mount
  )
 

Gets a string containing the name of the GMount.

get_icon
GIcon* (* get_icon) (
    GMount* mount
  )
 

Gets a GIcon for the GMount.

get_uuid
char* (* get_uuid) (
    GMount* mount
  )
 

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

get_volume
GVolume* (* get_volume) (
    GMount* mount
  )
 

Gets a GVolume the mount is located on. Returns NULL if the GMount is not associated with a GVolume.

get_drive
GDrive* (* get_drive) (
    GMount* mount
  )
 

Gets a GDrive the volume of the mount is located on. Returns NULL if the GMount is not associated with a GDrive or a GVolume. This is convenience method for getting the GVolume and using that to get the GDrive.

can_unmount
gboolean (* can_unmount) (
    GMount* mount
  )
 

Checks if a GMount can be unmounted.

can_eject
gboolean (* can_eject) (
    GMount* mount
  )
 

Checks if a GMount can be ejected.

unmount
void (* unmount) (
    GMount* mount,
    GMountUnmountFlags flags,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Starts unmounting a GMount.

unmount_finish
gboolean (* unmount_finish) (
    GMount* mount,
    GAsyncResult* result,
    GError** error
  )
 

Finishes an unmounting operation.

eject
void (* eject) (
    GMount* mount,
    GMountUnmountFlags flags,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Starts ejecting a GMount.

eject_finish
gboolean (* eject_finish) (
    GMount* mount,
    GAsyncResult* result,
    GError** error
  )
 

Finishes an eject operation.

remount
void (* remount) (
    GMount* mount,
    GMountMountFlags flags,
    GMountOperation* mount_operation,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Starts remounting a GMount.

remount_finish
gboolean (* remount_finish) (
    GMount* mount,
    GAsyncResult* result,
    GError** error
  )
 

Finishes a remounting operation.

guess_content_type
void (* guess_content_type) (
    GMount* mount,
    gboolean force_rescan,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Starts guessing the type of the content of a GMount. See g_mount_guess_content_type() for more information on content type guessing. This operation was added in 2.18.

guess_content_type_finish
gchar** (* guess_content_type_finish) (
    GMount* mount,
    GAsyncResult* result,
    GError** error
  )
 

Finishes a content type guessing operation. Added in 2.18.

guess_content_type_sync
gchar** (* guess_content_type_sync) (
    GMount* mount,
    gboolean force_rescan,
    GCancellable* cancellable,
    GError** error
  )
 

Synchronous variant of guess_content_type. Added in 2.18.

pre_unmount
void (* pre_unmount) (
    GMount* mount
  )
 

The ::pre-unmount signal that is emitted when the GMount will soon be emitted. If the recipient is somehow holding the mount open by keeping an open file on it it should close the file.

unmount_with_operation
void (* unmount_with_operation) (
    GMount* mount,
    GMountUnmountFlags flags,
    GMountOperation* mount_operation,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Starts unmounting a GMount using a GMountOperation. Since 2.22.

unmount_with_operation_finish
gboolean (* unmount_with_operation_finish) (
    GMount* mount,
    GAsyncResult* result,
    GError** error
  )
 

Finishes an unmounting operation using a GMountOperation. Since 2.22.

eject_with_operation
void (* eject_with_operation) (
    GMount* mount,
    GMountUnmountFlags flags,
    GMountOperation* mount_operation,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Starts ejecting a GMount using a GMountOperation. Since 2.22.

eject_with_operation_finish
gboolean (* eject_with_operation_finish) (
    GMount* mount,
    GAsyncResult* result,
    GError** error
  )
 

Finishes an eject operation using a GMountOperation. Since 2.22.

get_default_location
GFile* (* get_default_location) (
    GMount* mount
  )
 

Gets a GFile indication a start location that can be use as the entry point for this mount. Since 2.24.

get_sort_key
const gchar* (* get_sort_key) (
    GMount* mount
  )
 

Gets a key used for sorting GMount instance or NULL if no such key exists. Since 2.32.

get_symbolic_icon
GIcon* (* get_symbolic_icon) (
    GMount* mount
  )
 

Gets a symbolic GIcon for the GMount. Since 2.34.

Virtual methods

Gio.Mount.can_eject

Checks if mount can be ejected.

Gio.Mount.can_unmount

Checks if mount can be unmounted.

Gio.Mount.changed

Changed signal that is emitted when the mount’s state has changed.

Gio.Mount.eject

Ejects a mount. This is an asynchronous operation, and is finished by calling g_mount_eject_finish() with the mount and GAsyncResult data returned in the callback.

deprecated: 2.22 

Gio.Mount.eject_finish

Finishes ejecting a mount. If any errors occurred during the operation, error will be set to contain the errors and FALSE will be returned.

deprecated: 2.22 

Gio.Mount.eject_with_operation

Ejects a mount. This is an asynchronous operation, and is finished by calling g_mount_eject_with_operation_finish() with the mount and GAsyncResult data returned in the callback.

since: 2.22

Gio.Mount.eject_with_operation_finish

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

Gio.Mount.get_default_location

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

Gio.Mount.get_drive

Gets the drive for the mount.

Gio.Mount.get_icon

Gets the icon for mount.

Gio.Mount.get_name

Gets the name of mount.

Gio.Mount.get_root

Gets the root directory on mount.

Gio.Mount.get_sort_key

Gets the sort key for mount, if any.

since: 2.32

Gio.Mount.get_symbolic_icon

Gets the symbolic icon for mount.

since: 2.34

Gio.Mount.get_uuid

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 NULL if there is no UUID available.

Gio.Mount.get_volume

Gets the volume for the mount.

Gio.Mount.guess_content_type

Tries to guess the type of content stored on 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.

since: 2.18

Gio.Mount.guess_content_type_finish

Finishes guessing content types of mount. If any errors occurred during the operation, error will be set to contain the errors and FALSE will be returned. In particular, you may get an G_IO_ERROR_NOT_SUPPORTED if the mount does not support content guessing.

since: 2.18

Gio.Mount.guess_content_type_sync

Tries to guess the type of content stored on 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.

since: 2.18

Gio.Mount.pre_unmount

The ::pre-unmount signal that is emitted when the GMount will soon be emitted. If the recipient is somehow holding the mount open by keeping an open file on it it should close the file.

Gio.Mount.remount

Remounts a mount. This is an asynchronous operation, and is finished by calling g_mount_remount_finish() with the mount and GAsyncResults data returned in the callback.

Gio.Mount.remount_finish

Finishes remounting a mount. If any errors occurred during the operation, error will be set to contain the errors and FALSE will be returned.

Gio.Mount.unmount

Unmounts a mount. This is an asynchronous operation, and is finished by calling g_mount_unmount_finish() with the mount and GAsyncResult data returned in the callback.

deprecated: 2.22 

Gio.Mount.unmount_finish

Finishes unmounting a mount. If any errors occurred during the operation, error will be set to contain the errors and FALSE will be returned.

deprecated: 2.22 

Gio.Mount.unmount_with_operation

Unmounts a mount. This is an asynchronous operation, and is finished by calling g_mount_unmount_with_operation_finish() with the mount and GAsyncResult data returned in the callback.

since: 2.22

Gio.Mount.unmount_with_operation_finish

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

Gio.Mount.unmounted

The unmounted signal that is emitted when the GMount have been unmounted. If the recipient is holding references to the object they should release them so the object can be finalized.