Gio.Drive¶
| Implementations: | |
|---|---|
| None | |
Methods¶
can_eject () |
|
can_poll_for_media () |
|
can_start () |
|
can_start_degraded () |
|
can_stop () |
|
eject (flags, cancellable, callback, *user_data) |
|
eject_finish (result) |
|
eject_with_operation (flags, mount_operation, cancellable, callback, *user_data) |
|
eject_with_operation_finish (result) |
|
enumerate_identifiers () |
|
get_icon () |
|
get_identifier (kind) |
|
get_name () |
|
get_sort_key () |
|
get_start_stop_type () |
|
get_symbolic_icon () |
|
get_volumes () |
|
has_media () |
|
has_volumes () |
|
is_media_check_automatic () |
|
is_media_removable () |
|
is_removable () |
|
poll_for_media (cancellable, callback, *user_data) |
|
poll_for_media_finish (result) |
|
start (flags, mount_operation, cancellable, callback, *user_data) |
|
start_finish (result) |
|
stop (flags, mount_operation, cancellable, callback, *user_data) |
|
stop_finish (result) |
Virtual Methods¶
do_can_eject () |
|
do_can_poll_for_media () |
|
do_can_start () |
|
do_can_start_degraded () |
|
do_can_stop () |
|
do_changed () |
|
do_disconnected () |
|
do_eject (flags, cancellable, callback, *user_data) |
|
do_eject_button () |
|
do_eject_finish (result) |
|
do_eject_with_operation (flags, mount_operation, cancellable, callback, *user_data) |
|
do_eject_with_operation_finish (result) |
|
do_enumerate_identifiers () |
|
do_get_icon () |
|
do_get_identifier (kind) |
|
do_get_name () |
|
do_get_sort_key () |
|
do_get_start_stop_type () |
|
do_get_symbolic_icon () |
|
do_get_volumes () |
|
do_has_media () |
|
do_has_volumes () |
|
do_is_media_check_automatic () |
|
do_is_media_removable () |
|
do_is_removable () |
|
do_poll_for_media (cancellable, callback, *user_data) |
|
do_poll_for_media_finish (result) |
|
do_start (flags, mount_operation, cancellable, callback, *user_data) |
|
do_start_finish (result) |
|
do_stop (flags, mount_operation, cancellable, callback, *user_data) |
|
do_stop_button () |
|
do_stop_finish (result) |
Properties¶
None
Signals¶
| Name | Short Description |
|---|---|
changed |
Emitted when the drive’s state has changed. |
disconnected |
This signal is emitted when the Gio.Drive have been disconnected. |
eject-button |
Emitted when the physical eject button (if any) of a drive has been pressed. |
stop-button |
Emitted when the physical stop button (if any) of a drive has been pressed. |
Fields¶
None
Class Details¶
-
class
Gio.Drive¶ Bases: GObject.GInterfaceStructure: Gio.DriveIfaceGio.Drive- this represent a piece of hardware connected to the machine. It’s generally only created for removable hardware or hardware with removable media.Gio.Driveis a container class forGio.Volumeobjects that stem from the same piece of media. As such,Gio.Driveabstracts 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
Gio.Drivereports 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.Gio.Drivesupports 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 aGio.Drivemay vary according to implementation. To choose the correct verbs in e.g. a file manager, useGio.Drive.get_start_stop_type().For porting from GnomeVFS note that there is no equivalent of
Gio.Drivein that API.-
can_eject()[source]¶ Returns: Trueif the self can be ejected,Falseotherwise.Return type: boolChecks if a drive can be ejected.
-
can_poll_for_media()[source]¶ Returns: Trueif the self can be polled for media changes,Falseotherwise.Return type: boolChecks if a drive can be polled for media changes.
-
can_start()[source]¶ Returns: Trueif the self can be started,Falseotherwise.Return type: boolChecks if a drive can be started.
New in version 2.22.
-
can_start_degraded()[source]¶ Returns: Trueif the self can be started degraded,Falseotherwise.Return type: boolChecks if a drive can be started degraded.
New in version 2.22.
-
can_stop()[source]¶ Returns: Trueif the self can be stopped,Falseotherwise.Return type: boolChecks if a drive can be stopped.
New in version 2.22.
-
eject(flags, cancellable, callback, *user_data)[source]¶ Parameters: - flags (
Gio.MountUnmountFlags) – flags affecting the unmount if required for eject - cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore. - callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback, orNone. - user_data (
objectorNone) – user data to pass to callback
Asynchronously ejects a drive.
When the operation is finished, callback will be called. You can then call
Gio.Drive.eject_finish() to obtain the result of the operation.Deprecated since version 2.22: Use
Gio.Drive.eject_with_operation() instead.- flags (
-
eject_finish(result)[source]¶ Parameters: result ( Gio.AsyncResult) – aGio.AsyncResult.Raises: GLib.ErrorReturns: Trueif the drive has been ejected successfully,Falseotherwise.Return type: boolFinishes ejecting a drive.
Deprecated since version 2.22: Use
Gio.Drive.eject_with_operation_finish() instead.
-
eject_with_operation(flags, mount_operation, cancellable, callback, *user_data)[source]¶ Parameters: - flags (
Gio.MountUnmountFlags) – flags affecting the unmount if required for eject - mount_operation (
Gio.MountOperationorNone) – aGio.MountOperationorNoneto avoid user interaction. - cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore. - callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback, orNone. - user_data (
objectorNone) – user data passed to callback.
Ejects a drive. This is an asynchronous operation, and is finished by calling
Gio.Drive.eject_with_operation_finish() with the self andGio.AsyncResultdata returned in the callback.New in version 2.22.
- flags (
-
eject_with_operation_finish(result)[source]¶ Parameters: result ( Gio.AsyncResult) – aGio.AsyncResult.Raises: GLib.ErrorReturns: Trueif the drive was successfully ejected.Falseotherwise.Return type: boolFinishes ejecting a drive. If any errors occurred during the operation, error will be set to contain the errors and
Falsewill be returned.New in version 2.22.
-
enumerate_identifiers()[source]¶ Returns: a None-terminated array of strings containing kinds of identifiers. UseGLib.strfreev() to free.Return type: [ str]Gets the kinds of identifiers that self has. Use
Gio.Drive.get_identifier() to obtain the identifiers themselves.
-
get_icon()[source]¶ Returns: Gio.Iconfor the self. Free the returned object withGObject.Object.unref().Return type: Gio.IconGets the icon for self.
-
get_identifier(kind)[source]¶ Parameters: kind ( str) – the kind of identifier to returnReturns: a newly allocated string containing the requested identifier, or Noneif theGio.Drivedoesn’t have this kind of identifier.Return type: strorNoneGets the identifier of the given kind for self. The only identifier currently available is
Gio.DRIVE_IDENTIFIER_KIND_UNIX_DEVICE.
-
get_name()[source]¶ Returns: a string containing self’s name. The returned string should be freed when no longer needed. Return type: strGets the name of self.
-
get_sort_key()[source]¶ Returns: Sorting key for self or Noneif no such key is available.Return type: strorNoneGets the sort key for self, if any.
New in version 2.32.
-
get_start_stop_type()[source]¶ Returns: A value from the Gio.DriveStartStopTypeenumeration.Return type: Gio.DriveStartStopTypeGets a hint about how a drive can be started/stopped.
New in version 2.22.
-
get_symbolic_icon()[source]¶ Returns: symbolic Gio.Iconfor the self. Free the returned object withGObject.Object.unref().Return type: Gio.IconGets the icon for self.
New in version 2.34.
-
get_volumes()[source]¶ Returns: GLib.Listcontaining anyGio.Volumeobjects on the given self.Return type: [ Gio.Volume]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
GObject.Object.unref().
-
has_media()[source]¶ Returns: Trueif self has media,Falseotherwise.Return type: boolChecks if the self has media. Note that the OS may not be polling the drive for media changes; see
Gio.Drive.is_media_check_automatic() for more details.
-
has_volumes()[source]¶ Returns: Trueif the self contains volumes,Falseotherwise.Return type: boolCheck if self has any mountable volumes.
-
is_media_check_automatic()[source]¶ Returns: Trueif the self is capable of automatically detecting media changes,Falseotherwise.Return type: boolChecks if self is capable of automatically detecting media changes.
-
is_media_removable()[source]¶ Returns: Trueif self supports removable media,Falseotherwise.Return type: boolChecks if the self supports removable media.
-
is_removable()[source]¶ Returns: Trueif self and/or its media is considered removable,Falseotherwise.Return type: boolChecks if the
Gio.Driveand/or its media is considered removable by the user. SeeGio.Drive.is_media_removable().New in version 2.50.
-
poll_for_media(cancellable, callback, *user_data)[source]¶ Parameters: - cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore. - callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback, orNone. - user_data (
objectorNone) – user data to pass to callback
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
Gio.Drive.poll_for_media_finish() to obtain the result of the operation.- cancellable (
-
poll_for_media_finish(result)[source]¶ Parameters: result ( Gio.AsyncResult) – aGio.AsyncResult.Raises: GLib.ErrorReturns: Trueif the drive has been poll_for_mediaed successfully,Falseotherwise.Return type: boolFinishes an operation started with
Gio.Drive.poll_for_media() on a drive.
-
start(flags, mount_operation, cancellable, callback, *user_data)[source]¶ Parameters: - flags (
Gio.DriveStartFlags) – flags affecting the start operation. - mount_operation (
Gio.MountOperationorNone) – aGio.MountOperationorNoneto avoid user interaction. - cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore. - callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback, orNone. - user_data (
objectorNone) – user data to pass to callback
Asynchronously starts a drive.
When the operation is finished, callback will be called. You can then call
Gio.Drive.start_finish() to obtain the result of the operation.New in version 2.22.
- flags (
-
start_finish(result)[source]¶ Parameters: result ( Gio.AsyncResult) – aGio.AsyncResult.Raises: GLib.ErrorReturns: Trueif the drive has been started successfully,Falseotherwise.Return type: boolFinishes starting a drive.
New in version 2.22.
-
stop(flags, mount_operation, cancellable, callback, *user_data)[source]¶ Parameters: - flags (
Gio.MountUnmountFlags) – flags affecting the unmount if required for stopping. - mount_operation (
Gio.MountOperationorNone) – aGio.MountOperationorNoneto avoid user interaction. - cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore. - callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback, orNone. - user_data (
objectorNone) – user data to pass to callback
Asynchronously stops a drive.
When the operation is finished, callback will be called. You can then call
Gio.Drive.stop_finish() to obtain the result of the operation.New in version 2.22.
- flags (
-
stop_finish(result)[source]¶ Parameters: result ( Gio.AsyncResult) – aGio.AsyncResult.Raises: GLib.ErrorReturns: Trueif the drive has been stopped successfully,Falseotherwise.Return type: boolFinishes stopping a drive.
New in version 2.22.
-
do_can_eject() virtual¶ Returns: Trueif the drive can be ejected,Falseotherwise.Return type: boolChecks if a drive can be ejected.
-
do_can_poll_for_media() virtual¶ Returns: Trueif the drive can be polled for media changes,Falseotherwise.Return type: boolChecks if a drive can be polled for media changes.
-
do_can_start() virtual¶ Returns: Trueif the drive can be started,Falseotherwise.Return type: boolChecks if a drive can be started.
New in version 2.22.
-
do_can_start_degraded() virtual¶ Returns: Trueif the drive can be started degraded,Falseotherwise.Return type: boolChecks if a drive can be started degraded.
New in version 2.22.
-
do_can_stop() virtual¶ Returns: Trueif the drive can be stopped,Falseotherwise.Return type: boolChecks if a drive can be stopped.
New in version 2.22.
-
do_changed() virtual¶
-
do_disconnected() virtual¶
-
do_eject(flags, cancellable, callback, *user_data) virtual¶ Parameters: - flags (
Gio.MountUnmountFlags) – flags affecting the unmount if required for eject - cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore. - callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback, orNone. - user_data (
objectorNone) – user data to pass to callback
Asynchronously ejects a drive.
When the operation is finished, callback will be called. You can then call
Gio.Drive.eject_finish() to obtain the result of the operation.Deprecated since version 2.22: Use
Gio.Drive.eject_with_operation() instead.- flags (
-
do_eject_finish(result) virtual¶ Parameters: result ( Gio.AsyncResult) – aGio.AsyncResult.Returns: Trueif the drive has been ejected successfully,Falseotherwise.Return type: boolFinishes ejecting a drive.
Deprecated since version 2.22: Use
Gio.Drive.eject_with_operation_finish() instead.
-
do_eject_with_operation(flags, mount_operation, cancellable, callback, *user_data) virtual¶ Parameters: - flags (
Gio.MountUnmountFlags) – flags affecting the unmount if required for eject - mount_operation (
Gio.MountOperationorNone) – aGio.MountOperationorNoneto avoid user interaction. - cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore. - callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback, orNone. - user_data (
objectorNone) – user data passed to callback.
Ejects a drive. This is an asynchronous operation, and is finished by calling
Gio.Drive.eject_with_operation_finish() with the drive andGio.AsyncResultdata returned in the callback.New in version 2.22.
- flags (
-
do_eject_with_operation_finish(result) virtual¶ Parameters: result ( Gio.AsyncResult) – aGio.AsyncResult.Returns: Trueif the drive was successfully ejected.Falseotherwise.Return type: boolFinishes ejecting a drive. If any errors occurred during the operation, error will be set to contain the errors and
Falsewill be returned.New in version 2.22.
-
do_enumerate_identifiers() virtual¶ Returns: a None-terminated array of strings containing kinds of identifiers. UseGLib.strfreev() to free.Return type: [ str]Gets the kinds of identifiers that drive has. Use
Gio.Drive.get_identifier() to obtain the identifiers themselves.
-
do_get_icon() virtual¶ Returns: Gio.Iconfor the drive. Free the returned object withGObject.Object.unref().Return type: Gio.IconGets the icon for drive.
-
do_get_identifier(kind) virtual¶ Parameters: kind ( str) – the kind of identifier to returnReturns: a newly allocated string containing the requested identifier, or Noneif theGio.Drivedoesn’t have this kind of identifier.Return type: strorNoneGets the identifier of the given kind for drive. The only identifier currently available is
Gio.DRIVE_IDENTIFIER_KIND_UNIX_DEVICE.
-
do_get_name() virtual¶ Returns: a string containing drive’s name. The returned string should be freed when no longer needed. Return type: strGets the name of drive.
-
do_get_sort_key() virtual¶ Returns: Sorting key for drive or Noneif no such key is available.Return type: strorNoneGets the sort key for drive, if any.
New in version 2.32.
-
do_get_start_stop_type() virtual¶ Returns: A value from the Gio.DriveStartStopTypeenumeration.Return type: Gio.DriveStartStopTypeGets a hint about how a drive can be started/stopped.
New in version 2.22.
-
do_get_symbolic_icon() virtual¶ Returns: symbolic Gio.Iconfor the drive. Free the returned object withGObject.Object.unref().Return type: Gio.IconGets the icon for drive.
New in version 2.34.
-
do_get_volumes() virtual¶ Returns: GLib.Listcontaining anyGio.Volumeobjects on the given drive.Return type: [ Gio.Volume]Get a list of mountable volumes for drive.
The returned list should be freed with g_list_free(), after its elements have been unreffed with
GObject.Object.unref().
-
do_has_media() virtual¶ Returns: Trueif drive has media,Falseotherwise.Return type: boolChecks if the drive has media. Note that the OS may not be polling the drive for media changes; see
Gio.Drive.is_media_check_automatic() for more details.
-
do_has_volumes() virtual¶ Returns: Trueif the drive contains volumes,Falseotherwise.Return type: boolCheck if drive has any mountable volumes.
-
do_is_media_check_automatic() virtual¶ Returns: Trueif the drive is capable of automatically detecting media changes,Falseotherwise.Return type: boolChecks if drive is capable of automatically detecting media changes.
-
do_is_media_removable() virtual¶ Returns: Trueif drive supports removable media,Falseotherwise.Return type: boolChecks if the drive supports removable media.
-
do_is_removable() virtual¶ Returns: Trueif drive and/or its media is considered removable,Falseotherwise.Return type: boolChecks if the
Gio.Driveand/or its media is considered removable by the user. SeeGio.Drive.is_media_removable().New in version 2.50.
-
do_poll_for_media(cancellable, callback, *user_data) virtual¶ Parameters: - cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore. - callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback, orNone. - user_data (
objectorNone) – user data to pass to callback
Asynchronously polls drive to see if media has been inserted or removed.
When the operation is finished, callback will be called. You can then call
Gio.Drive.poll_for_media_finish() to obtain the result of the operation.- cancellable (
-
do_poll_for_media_finish(result) virtual¶ Parameters: result ( Gio.AsyncResult) – aGio.AsyncResult.Returns: Trueif the drive has been poll_for_mediaed successfully,Falseotherwise.Return type: boolFinishes an operation started with
Gio.Drive.poll_for_media() on a drive.
-
do_start(flags, mount_operation, cancellable, callback, *user_data) virtual¶ Parameters: - flags (
Gio.DriveStartFlags) – flags affecting the start operation. - mount_operation (
Gio.MountOperationorNone) – aGio.MountOperationorNoneto avoid user interaction. - cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore. - callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback, orNone. - user_data (
objectorNone) – user data to pass to callback
Asynchronously starts a drive.
When the operation is finished, callback will be called. You can then call
Gio.Drive.start_finish() to obtain the result of the operation.New in version 2.22.
- flags (
-
do_start_finish(result) virtual¶ Parameters: result ( Gio.AsyncResult) – aGio.AsyncResult.Returns: Trueif the drive has been started successfully,Falseotherwise.Return type: boolFinishes starting a drive.
New in version 2.22.
-
do_stop(flags, mount_operation, cancellable, callback, *user_data) virtual¶ Parameters: - flags (
Gio.MountUnmountFlags) – flags affecting the unmount if required for stopping. - mount_operation (
Gio.MountOperationorNone) – aGio.MountOperationorNoneto avoid user interaction. - cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore. - callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback, orNone. - user_data (
objectorNone) – user data to pass to callback
Asynchronously stops a drive.
When the operation is finished, callback will be called. You can then call
Gio.Drive.stop_finish() to obtain the result of the operation.New in version 2.22.
- flags (
-
do_stop_finish(result) virtual¶ Parameters: result ( Gio.AsyncResult) – aGio.AsyncResult.Returns: Trueif the drive has been stopped successfully,Falseotherwise.Return type: boolFinishes stopping a drive.
New in version 2.22.
-
Signal Details¶
-
Gio.Drive.signals.changed(drive)¶ Signal Name: changedFlags: RUN_LASTParameters: drive ( Gio.Drive) – The object which received the signalEmitted when the drive’s state has changed.
-
Gio.Drive.signals.disconnected(drive)¶ Signal Name: disconnectedFlags: RUN_LASTParameters: drive ( Gio.Drive) – The object which received the signalThis signal is emitted when the
Gio.Drivehave been disconnected. If the recipient is holding references to the object they should release them so the object can be finalized.