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_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_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_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::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 |
|
The parent interface. |
|
changed |
|
Changed signal that is emitted when the mount’s state has changed. |
|
unmounted |
|
The unmounted signal that is emitted when the |
|
get_root |
|
Gets a |
|
get_name |
|
Gets a string containing the name of the |
|
get_icon |
|
Gets a |
|
get_uuid |
|
Gets the UUID for the |
|
get_volume |
|
Gets a |
|
get_drive |
|
Gets a |
|
can_unmount |
|
Checks if a |
|
can_eject |
|
Checks if a |
|
unmount |
|
Starts unmounting a |
|
unmount_finish |
|
Finishes an unmounting operation. |
|
eject |
|
Starts ejecting a |
|
eject_finish |
|
Finishes an eject operation. |
|
remount |
|
Starts remounting a |
|
remount_finish |
|
Finishes a remounting operation. |
|
guess_content_type |
|
Starts guessing the type of the content of a |
|
guess_content_type_finish |
|
Finishes a content type guessing operation. Added in 2.18. |
|
guess_content_type_sync |
|
Synchronous variant of |
|
pre_unmount |
|
The ::pre-unmount signal that is emitted when the |
|
unmount_with_operation |
|
Starts unmounting a |
|
unmount_with_operation_finish |
|
Finishes an unmounting operation using a |
|
eject_with_operation |
|
Starts ejecting a |
|
eject_with_operation_finish |
|
Finishes an eject operation using a |
|
get_default_location |
|
Gets a |
|
get_sort_key |
|
Gets a key used for sorting |
|
get_symbolic_icon |
|
Gets a symbolic |
Virtual methods
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_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.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.