Bug 585591 – Starting/stopping drives
[platform/upstream/glib.git] / gio / gdrive.h
index e1bc321..4c932f6 100644 (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__ */