<GDrive> represents a piece of hardware connected to
the machine. It’s generally only created for removable hardware or
hardware with removable media. For example, an optical disc drive, or a
USB flash drive.
<GDrive> is a container class for
<GVolume> objects that stem from the same piece of
media. As such, <GDrive> abstracts a drive with (or
without) removable media and provides operations for querying whether
media is available, determining whether media change is automatically
detected and ejecting the media.
If the <GDrive> reports that media isn’t
automatically detected, one can poll for media; typically one should not
do this periodically as a poll for media operation is potentially
expensive and may spin up the drive creating noise.
<GDrive> supports starting and stopping drives with
authentication support for the former. This can be used to support a
diverse set of use cases including connecting/disconnecting iSCSI
devices, powering down external disk enclosures and starting/stopping
multi-disk devices such as RAID devices. Note that the actual semantics
and side-effects of starting/stopping a <GDrive> may
vary according to implementation. To choose the correct verbs in e.g. a
file manager, use drive:get-start-stop-type.
For porting from GnomeVFS note that there is no equivalent of
<GDrive> in that API.
Checks if a drive can be ejected.
Checks if a drive can be polled for media changes.
Checks if a drive can be started degraded.
Checks if a drive can be started.
Checks if a drive can be stopped.
Asynchronously ejects a drive.
When the operation is finished, callback will be called. You can
then call drive:eject-finish? to obtain
the result of the operation.
Passed: a <GDrive>.
a <GDrive>.
Passed: a <GMountUnmountFlags>, or a
list of its symbols, or one of them.
flags affecting the unmount if required for eject
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Passed, or left out: a procedure, or #f.
a GAsyncReadyCallback, or #f.
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
user data to pass to callback
Finishes ejecting a drive.
Passed: a <GDrive>.
a <GDrive>.
Passed: a <GAsyncResult>.
Returned: a boolean.
#t if the drive has been ejected successfully, #f
otherwise.
Ejects a drive. This is an asynchronous operation, and is finished by
calling drive:eject-with-operation-finish? with
the self and <GAsyncResult> data
returned in the callback.
Passed: a <GDrive>.
a <GDrive>.
Passed: a <GMountUnmountFlags>, or a
list of its symbols, or one of them.
flags affecting the unmount if required for eject
Passed, or left out: a <GMountOperation>,
or #f.
a <GMountOperation> or #f to avoid
user interaction.
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Passed, or left out: a procedure, or #f.
a GAsyncReadyCallback, or #f.
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
user data passed to callback.
Finishes ejecting a drive. If any errors occurred during the operation,
error will be set to contain the errors and #f will be
returned.
Passed: a <GDrive>.
a <GDrive>.
Passed: a <GAsyncResult>.
Returned: a boolean.
#t if the drive was successfully ejected. #f otherwise.
Gets the kinds of identifiers that self has. Use drive:get-identifier to obtain the identifiers
themselves.
Gets the icon for self.
Passed: a <GDrive>.
a <GDrive>.
Returned: a <GIcon>.
<GIcon> for the self. Free the returned object
with object:unref.
Gets the identifier of the given kind for self. The only
identifier currently available is
G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE.
Gets the sort key for self, if any.
Gets a hint about how a drive can be started/stopped.
Passed: a <GDrive>.
a <GDrive>.
Returned: a <GDriveStartStopType>.
A value from the <GDriveStartStopType>
enumeration.
Gets the icon for self.
Passed: a <GDrive>.
a <GDrive>.
Returned: a <GIcon>.
symbolic <GIcon> for the self. Free the
returned object with object:unref.
Get a list of mountable volumes for self.
The returned list should be freed with g_list_free(), after its
elements have been unreffed with object:unref.
Checks if the self has media. Note that the OS may not be polling
the drive for media changes; see drive:is-media-check-automatic? for more
details.
Check if self has any mountable volumes.
Checks if self is capable of automatically detecting media changes.
Checks if the self supports removable media.
Checks if the <GDrive> and/or its media is
considered removable by the user. See drive:is-media-removable?.
Asynchronously polls self to see if media has been inserted or removed.
When the operation is finished, callback will be called. You can
then call drive:poll-for-media-finish? to obtain the
result of the operation.
Passed: a <GDrive>.
a <GDrive>.
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Passed, or left out: a procedure, or #f.
a GAsyncReadyCallback, or #f.
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
user data to pass to callback
Finishes an operation started with drive:poll-for-media on a drive.
Passed: a <GDrive>.
a <GDrive>.
Passed: a <GAsyncResult>.
Returned: a boolean.
#t if the drive has been poll_for_mediaed successfully, #f
otherwise.
Asynchronously starts a drive.
When the operation is finished, callback will be called. You can
then call drive:start-finish? to obtain
the result of the operation.
Passed: a <GDrive>.
a <GDrive>.
Passed: a <GDriveStartFlags>, or a list of
its symbols, or one of them.
flags affecting the start operation.
Passed, or left out: a <GMountOperation>,
or #f.
a <GMountOperation> or #f to avoid
user interaction.
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Passed, or left out: a procedure, or #f.
a GAsyncReadyCallback, or #f.
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
user data to pass to callback
Finishes starting a drive.
Passed: a <GDrive>.
a <GDrive>.
Passed: a <GAsyncResult>.
Returned: a boolean.
#t if the drive has been started successfully, #f
otherwise.
Asynchronously stops a drive.
When the operation is finished, callback will be called. You can
then call drive:stop-finish? to obtain
the result of the operation.
Passed: a <GDrive>.
a <GDrive>.
Passed: a <GMountUnmountFlags>, or a
list of its symbols, or one of them.
flags affecting the unmount if required for stopping.
Passed, or left out: a <GMountOperation>,
or #f.
a <GMountOperation> or #f to avoid
user interaction.
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Passed, or left out: a procedure, or #f.
a GAsyncReadyCallback, or #f.
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
user data to pass to callback
Finishes stopping a drive.
Passed: a <GDrive>.
a <GDrive>.
Passed: a <GAsyncResult>.
Returned: a boolean.
#t if the drive has been stopped successfully, #f
otherwise.
Connect a handler with (connect object drive:changed handler). It
is called as (handler self).
Emitted when the drive’s state has changed.
Passed: a <GDrive>.
Connect a handler with (connect object drive:disconnected
handler). It is called as (handler self).
This signal is emitted when the <GDrive> have been
disconnected. If the recipient is holding references to the object they
should release them so the object can be finalized.
Passed: a <GDrive>.
Connect a handler with (connect object drive:eject-button
handler). It is called as (handler self).
Emitted when the physical eject button (if any) of a drive has been pressed.
Passed: a <GDrive>.
Connect a handler with (connect object drive:stop-button
handler). It is called as (handler self).
Emitted when the physical stop button (if any) of a drive has been pressed.
Passed: a <GDrive>.
Checks if a drive can be ejected.
To override it in a new class, give register-type #:vfuncs
`((can-eject . ,procedure)). The procedure is called as
(procedure self) ⇒ %return.
Checks if a drive can be polled for media changes.
To override it in a new class, give register-type #:vfuncs
`((can-poll-for-media . ,procedure)). The procedure is called as
(procedure self) ⇒ %return.
Checks if a drive can be started.
To override it in a new class, give register-type #:vfuncs
`((can-start . ,procedure)). The procedure is called as
(procedure self) ⇒ %return.
Checks if a drive can be started degraded.
To override it in a new class, give register-type #:vfuncs
`((can-start-degraded . ,procedure)). The procedure is called as
(procedure self) ⇒ %return.
Checks if a drive can be stopped.
To override it in a new class, give register-type #:vfuncs
`((can-stop . ,procedure)). The procedure is called as
(procedure self) ⇒ %return.
Signal emitted when the drive is changed.
To override it in a new class, give register-type #:vfuncs
`((changed . ,procedure)). The procedure is called as
(procedure self).
The removed signal that is emitted when the <GDrive>
have been disconnected. If the recipient is holding references to the
object they should release them so the object can be finalized.
To override it in a new class, give register-type #:vfuncs
`((disconnected . ,procedure)). The procedure is called as
(procedure self).
Asynchronously ejects a drive.
When the operation is finished, callback will be called. You can
then call drive:eject-finish? to obtain
the result of the operation.
To override it in a new class, give register-type #:vfuncs
`((eject . ,procedure)). The procedure is called as (procedure
self flags cancellable callback user-data).
Passed: the class whose implementation to call: a class that implements
<GDrive>, or its GType number.
Passed: a <GDrive>.
a <GDrive>.
Passed: a <GMountUnmountFlags>, or a
list of its symbols, or one of them.
flags affecting the unmount if required for eject
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Passed, or left out: a procedure, or #f.
a GAsyncReadyCallback, or #f.
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
user data to pass to callback
Signal emitted when the physical eject button (if any) of a drive have been pressed.
To override it in a new class, give register-type #:vfuncs
`((eject-button . ,procedure)). The procedure is called as
(procedure self).
Finishes ejecting a drive.
To override it in a new class, give register-type #:vfuncs
`((eject-finish . ,procedure)). The procedure is called as
(procedure self result) ⇒ %return.
Passed: the class whose implementation to call: a class that implements
<GDrive>, or its GType number.
Passed: a <GDrive>.
a <GDrive>.
Passed: a <GAsyncResult>.
Returned: a boolean.
#t if the drive has been ejected successfully, #f
otherwise.
Ejects a drive. This is an asynchronous operation, and is finished by
calling drive:eject-with-operation-finish? with
the self and <GAsyncResult> data
returned in the callback.
To override it in a new class, give register-type #:vfuncs
`((eject-with-operation . ,procedure)). The procedure is called as
(procedure self flags mount-operation cancellable callback
user-data).
Passed: the class whose implementation to call: a class that implements
<GDrive>, or its GType number.
Passed: a <GDrive>.
a <GDrive>.
Passed: a <GMountUnmountFlags>, or a
list of its symbols, or one of them.
flags affecting the unmount if required for eject
Passed, or left out: a <GMountOperation>,
or #f.
a <GMountOperation> or #f to avoid
user interaction.
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Passed, or left out: a procedure, or #f.
a GAsyncReadyCallback, or #f.
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
user data passed to callback.
Finishes ejecting a drive. If any errors occurred during the operation,
error will be set to contain the errors and #f will be
returned.
To override it in a new class, give register-type #:vfuncs
`((eject-with-operation-finish . ,procedure)). The procedure is
called as (procedure self result) ⇒ %return.
Passed: the class whose implementation to call: a class that implements
<GDrive>, or its GType number.
Passed: a <GDrive>.
a <GDrive>.
Passed: a <GAsyncResult>.
Returned: a boolean.
#t if the drive was successfully ejected. #f otherwise.
Gets the kinds of identifiers that self has. Use drive:get-identifier to obtain the identifiers
themselves.
To override it in a new class, give register-type #:vfuncs
`((enumerate-identifiers . ,procedure)). The procedure is called as
(procedure self) ⇒ %return.
Gets the icon for self.
To override it in a new class, give register-type #:vfuncs
`((get-icon . ,procedure)). The procedure is called as
(procedure self) ⇒ %return.
Gets the identifier of the given kind for self. The only
identifier currently available is
G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE.
To override it in a new class, give register-type #:vfuncs
`((get-identifier . ,procedure)). The procedure is called as
(procedure self kind) ⇒ %return.
Passed: the class whose implementation to call: a class that implements
<GDrive>, or its GType number.
Passed: a <GDrive>.
a <GDrive>
Passed: a string.
the kind of identifier to return
Returned: a string, or #f.
a newly allocated string containing the requested identifier, or
#f if the <GDrive> doesn’t have this kind of
identifier.
Gets the name of self.
To override it in a new class, give register-type #:vfuncs
`((get-name . ,procedure)). The procedure is called as
(procedure self) ⇒ %return.
Gets the sort key for self, if any.
To override it in a new class, give register-type #:vfuncs
`((get-sort-key . ,procedure)). The procedure is called as
(procedure self) ⇒ %return.
Gets a hint about how a drive can be started/stopped.
To override it in a new class, give register-type #:vfuncs
`((get-start-stop-type . ,procedure)). The procedure is called as
(procedure self) ⇒ %return.
Passed: the class whose implementation to call: a class that implements
<GDrive>, or its GType number.
Passed: a <GDrive>.
a <GDrive>.
Returned: a <GDriveStartStopType>.
A value from the <GDriveStartStopType>
enumeration.
Gets the icon for self.
To override it in a new class, give register-type #:vfuncs
`((get-symbolic-icon . ,procedure)). The procedure is called as
(procedure self) ⇒ %return.
Get a list of mountable volumes for self.
The returned list should be freed with g_list_free(), after its
elements have been unreffed with object:unref.
To override it in a new class, give register-type #:vfuncs
`((get-volumes . ,procedure)). The procedure is called as
(procedure self) ⇒ %return.
Checks if the self has media. Note that the OS may not be polling
the drive for media changes; see drive:is-media-check-automatic? for more
details.
To override it in a new class, give register-type #:vfuncs
`((has-media . ,procedure)). The procedure is called as
(procedure self) ⇒ %return.
Check if self has any mountable volumes.
To override it in a new class, give register-type #:vfuncs
`((has-volumes . ,procedure)). The procedure is called as
(procedure self) ⇒ %return.
Checks if self is capable of automatically detecting media changes.
To override it in a new class, give register-type #:vfuncs
`((is-media-check-automatic . ,procedure)). The procedure is called
as (procedure self) ⇒ %return.
Checks if the self supports removable media.
To override it in a new class, give register-type #:vfuncs
`((is-media-removable . ,procedure)). The procedure is called as
(procedure self) ⇒ %return.
Checks if the <GDrive> and/or its media is
considered removable by the user. See drive:is-media-removable?.
To override it in a new class, give register-type #:vfuncs
`((is-removable . ,procedure)). The procedure is called as
(procedure self) ⇒ %return.
Asynchronously polls self to see if media has been inserted or removed.
When the operation is finished, callback will be called. You can
then call drive:poll-for-media-finish? to obtain the
result of the operation.
To override it in a new class, give register-type #:vfuncs
`((poll-for-media . ,procedure)). The procedure is called as
(procedure self cancellable callback user-data).
Passed: the class whose implementation to call: a class that implements
<GDrive>, or its GType number.
Passed: a <GDrive>.
a <GDrive>.
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Passed, or left out: a procedure, or #f.
a GAsyncReadyCallback, or #f.
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
user data to pass to callback
Finishes an operation started with drive:poll-for-media on a drive.
To override it in a new class, give register-type #:vfuncs
`((poll-for-media-finish . ,procedure)). The procedure is called as
(procedure self result) ⇒ %return.
Passed: the class whose implementation to call: a class that implements
<GDrive>, or its GType number.
Passed: a <GDrive>.
a <GDrive>.
Passed: a <GAsyncResult>.
Returned: a boolean.
#t if the drive has been poll_for_mediaed successfully, #f
otherwise.
Asynchronously starts a drive.
When the operation is finished, callback will be called. You can
then call drive:start-finish? to obtain
the result of the operation.
To override it in a new class, give register-type #:vfuncs
`((start . ,procedure)). The procedure is called as (procedure
self flags mount-operation cancellable callback user-data).
Passed: the class whose implementation to call: a class that implements
<GDrive>, or its GType number.
Passed: a <GDrive>.
a <GDrive>.
Passed: a <GDriveStartFlags>, or a list of
its symbols, or one of them.
flags affecting the start operation.
Passed, or left out: a <GMountOperation>,
or #f.
a <GMountOperation> or #f to avoid
user interaction.
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Passed, or left out: a procedure, or #f.
a GAsyncReadyCallback, or #f.
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
user data to pass to callback
Finishes starting a drive.
To override it in a new class, give register-type #:vfuncs
`((start-finish . ,procedure)). The procedure is called as
(procedure self result) ⇒ %return.
Passed: the class whose implementation to call: a class that implements
<GDrive>, or its GType number.
Passed: a <GDrive>.
a <GDrive>.
Passed: a <GAsyncResult>.
Returned: a boolean.
#t if the drive has been started successfully, #f
otherwise.
Asynchronously stops a drive.
When the operation is finished, callback will be called. You can
then call drive:stop-finish? to obtain
the result of the operation.
To override it in a new class, give register-type #:vfuncs
`((stop . ,procedure)). The procedure is called as (procedure
self flags mount-operation cancellable callback user-data).
Passed: the class whose implementation to call: a class that implements
<GDrive>, or its GType number.
Passed: a <GDrive>.
a <GDrive>.
Passed: a <GMountUnmountFlags>, or a
list of its symbols, or one of them.
flags affecting the unmount if required for stopping.
Passed, or left out: a <GMountOperation>,
or #f.
a <GMountOperation> or #f to avoid
user interaction.
Passed, or left out: a <GCancellable>, or
#f.
optional <GCancellable> object, #f to
ignore.
Passed, or left out: a procedure, or #f.
a GAsyncReadyCallback, or #f.
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
user data to pass to callback
Signal emitted when the physical stop button (if any) of a drive have been pressed. Since 2.22.
To override it in a new class, give register-type #:vfuncs
`((stop-button . ,procedure)). The procedure is called as
(procedure self).
Finishes stopping a drive.
To override it in a new class, give register-type #:vfuncs
`((stop-finish . ,procedure)). The procedure is called as
(procedure self result) ⇒ %return.
Passed: the class whose implementation to call: a class that implements
<GDrive>, or its GType number.
Passed: a <GDrive>.
a <GDrive>.
Passed: a <GAsyncResult>.
Returned: a boolean.
#t if the drive has been stopped successfully, #f
otherwise.