Bug 585591 – Starting/stopping drives

Add API for starting/stopping drives. This new API will enable
GVolumeMonitor and GVfs implementations to add support for the
following features

 1. Powering down external hard disk enclosures / drives

 2. Starting/stopping multi-disk devices (such as RAID/btrfs/ZFS)

 3. Connecting/disconnecting iSCSI devices

 4. Reacting to the user pressing e.g. the "remove drive" button on
    a IBM/Lenovo Ultrabay: http://www.thinkwiki.org/wiki/Ultrabay

See the bug for the corresponding GVfs and Nautilus changes.
This commit is contained in:
David Zeuthen
2009-06-15 10:53:41 -04:00
parent bb4f7c48f9
commit fae755e056
11 changed files with 666 additions and 4 deletions

View File

@@ -60,6 +60,14 @@ G_BEGIN_DECLS
* the #GDrive doesn't have one.
* @enumerate_identifiers: Returns an array strings listing the kinds
* of identifiers which the #GDrive has.
* @get_start_stop_type: Gets a #GDriveStartStopType with details about starting/stopping the drive. Since 2.22.
* @can_stop: Returns %TRUE if a #GDrive can be stopped. Since 2.22.
* @stop: Stops a #GDrive. Since 2.22.
* @stop_finish: Finishes a stop operation. Since 2.22.
* @can_start: Returns %TRUE if a #GDrive can be started. Since 2.22.
* @start: Starts a #GDrive. Since 2.22.
* @start_finish: Finishes a start operation. Since 2.22.
* @stop_button: Signal emitted when the physical stop button (if any) of a drive have been pressed. Since 2.22.
*
* Interface for creating #GDrive implementations.
*/
@@ -103,6 +111,32 @@ struct _GDriveIface
char * (* get_identifier) (GDrive *drive,
const char *kind);
char ** (* enumerate_identifiers) (GDrive *drive);
GDriveStartStopType (* get_start_stop_type) (GDrive *drive);
gboolean (* can_start) (GDrive *drive);
void (* start) (GDrive *drive,
GDriveStartFlags flags,
GMountOperation *start_operation,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (* start_finish) (GDrive *drive,
GAsyncResult *result,
GError **error);
gboolean (* can_stop) (GDrive *drive);
void (* stop) (GDrive *drive,
GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (* stop_finish) (GDrive *drive,
GAsyncResult *result,
GError **error);
/* signal, not VFunc */
void (* stop_button) (GDrive *drive);
};
GType g_drive_get_type (void) G_GNUC_CONST;
@@ -135,6 +169,29 @@ char * g_drive_get_identifier (GDrive *drive,
const char *kind);
char ** g_drive_enumerate_identifiers (GDrive *drive);
GDriveStartStopType g_drive_get_start_stop_type (GDrive *drive);
gboolean g_drive_can_start (GDrive *drive);
void g_drive_start (GDrive *drive,
GDriveStartFlags flags,
GMountOperation *start_operation,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean g_drive_start_finish (GDrive *drive,
GAsyncResult *result,
GError **error);
gboolean g_drive_can_stop (GDrive *drive);
void g_drive_stop (GDrive *drive,
GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean g_drive_stop_finish (GDrive *drive,
GAsyncResult *result,
GError **error);
G_END_DECLS
#endif /* __G_DRIVE_H__ */