You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

226 lines
13 KiB

  1. /* GIO - GLib Input, Output and Streaming Library
  2. *
  3. * Copyright (C) 2006-2007 Red Hat, Inc.
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General
  16. * Public License along with this library; if not, write to the
  17. * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  18. * Boston, MA 02111-1307, USA.
  19. *
  20. * Author: Alexander Larsson <alexl@redhat.com>
  21. * David Zeuthen <davidz@redhat.com>
  22. */
  23. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  24. #error "Only <gio/gio.h> can be included directly."
  25. #endif
  26. #ifndef __G_DRIVE_H__
  27. #define __G_DRIVE_H__
  28. #include <gio/giotypes.h>
  29. G_BEGIN_DECLS
  30. #define G_TYPE_DRIVE (g_drive_get_type ())
  31. #define G_DRIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_DRIVE, GDrive))
  32. #define G_IS_DRIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_DRIVE))
  33. #define G_DRIVE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_DRIVE, GDriveIface))
  34. /**
  35. * GDriveIface:
  36. * @g_iface: The parent interface.
  37. * @changed: Signal emitted when the drive is changed.
  38. * @disconnected: 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.
  39. * @eject_button: Signal emitted when the physical eject button (if any) of a drive have been pressed.
  40. * @get_name: Returns the name for the given #GDrive.
  41. * @get_icon: Returns a #GIcon for the given #GDrive.
  42. * @has_volumes: Returns %TRUE if the #GDrive has mountable volumes.
  43. * @get_volumes: Returns a list #GList of #GVolume for the #GDrive.
  44. * @is_media_removable: Returns %TRUE if the #GDrive supports removal and insertion of media.
  45. * @has_media: Returns %TRUE if the #GDrive has media inserted.
  46. * @is_media_check_automatic: Returns %TRUE if the #GDrive is capabable of automatically detecting media changes.
  47. * @can_poll_for_media: Returns %TRUE if the #GDrive is capable of manually polling for media change.
  48. * @can_eject: Returns %TRUE if the #GDrive can eject media.
  49. * @eject: Ejects a #GDrive.
  50. * @eject_finish: Finishes an eject operation.
  51. * @poll_for_media: Poll for media insertion/removal on a #GDrive.
  52. * @poll_for_media_finish: Finishes a media poll operation.
  53. * @get_identifier: Returns the identifier of the given kind, or %NULL if
  54. * the #GDrive doesn't have one.
  55. * @enumerate_identifiers: Returns an array strings listing the kinds
  56. * of identifiers which the #GDrive has.
  57. * @get_start_stop_type: Gets a #GDriveStartStopType with details about starting/stopping the drive. Since 2.22.
  58. * @can_stop: Returns %TRUE if a #GDrive can be stopped. Since 2.22.
  59. * @stop: Stops a #GDrive. Since 2.22.
  60. * @stop_finish: Finishes a stop operation. Since 2.22.
  61. * @can_start: Returns %TRUE if a #GDrive can be started. Since 2.22.
  62. * @can_start_degraded: Returns %TRUE if a #GDrive can be started degraded. Since 2.22.
  63. * @start: Starts a #GDrive. Since 2.22.
  64. * @start_finish: Finishes a start operation. Since 2.22.
  65. * @stop_button: Signal emitted when the physical stop button (if any) of a drive have been pressed. Since 2.22.
  66. * @eject_with_operation: Starts ejecting a #GDrive using a #GMountOperation. Since 2.22.
  67. * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22.
  68. *
  69. * Interface for creating #GDrive implementations.
  70. */
  71. typedef struct _GDriveIface GDriveIface;
  72. struct _GDriveIface
  73. {
  74. GTypeInterface g_iface;
  75. /* signals */
  76. void (* changed) (GDrive *drive);
  77. void (* disconnected) (GDrive *drive);
  78. void (* eject_button) (GDrive *drive);
  79. /* Virtual Table */
  80. char * (* get_name) (GDrive *drive);
  81. GIcon * (* get_icon) (GDrive *drive);
  82. gboolean (* has_volumes) (GDrive *drive);
  83. GList * (* get_volumes) (GDrive *drive);
  84. gboolean (* is_media_removable) (GDrive *drive);
  85. gboolean (* has_media) (GDrive *drive);
  86. gboolean (* is_media_check_automatic) (GDrive *drive);
  87. gboolean (* can_eject) (GDrive *drive);
  88. gboolean (* can_poll_for_media) (GDrive *drive);
  89. void (* eject) (GDrive *drive,
  90. GMountUnmountFlags flags,
  91. GCancellable *cancellable,
  92. GAsyncReadyCallback callback,
  93. gpointer user_data);
  94. gboolean (* eject_finish) (GDrive *drive,
  95. GAsyncResult *result,
  96. GError **error);
  97. void (* poll_for_media) (GDrive *drive,
  98. GCancellable *cancellable,
  99. GAsyncReadyCallback callback,
  100. gpointer user_data);
  101. gboolean (* poll_for_media_finish) (GDrive *drive,
  102. GAsyncResult *result,
  103. GError **error);
  104. char * (* get_identifier) (GDrive *drive,
  105. const char *kind);
  106. char ** (* enumerate_identifiers) (GDrive *drive);
  107. GDriveStartStopType (* get_start_stop_type) (GDrive *drive);
  108. gboolean (* can_start) (GDrive *drive);
  109. gboolean (* can_start_degraded) (GDrive *drive);
  110. void (* start) (GDrive *drive,
  111. GDriveStartFlags flags,
  112. GMountOperation *mount_operation,
  113. GCancellable *cancellable,
  114. GAsyncReadyCallback callback,
  115. gpointer user_data);
  116. gboolean (* start_finish) (GDrive *drive,
  117. GAsyncResult *result,
  118. GError **error);
  119. gboolean (* can_stop) (GDrive *drive);
  120. void (* stop) (GDrive *drive,
  121. GMountUnmountFlags flags,
  122. GMountOperation *mount_operation,
  123. GCancellable *cancellable,
  124. GAsyncReadyCallback callback,
  125. gpointer user_data);
  126. gboolean (* stop_finish) (GDrive *drive,
  127. GAsyncResult *result,
  128. GError **error);
  129. /* signal, not VFunc */
  130. void (* stop_button) (GDrive *drive);
  131. void (* eject_with_operation) (GDrive *drive,
  132. GMountUnmountFlags flags,
  133. GMountOperation *mount_operation,
  134. GCancellable *cancellable,
  135. GAsyncReadyCallback callback,
  136. gpointer user_data);
  137. gboolean (* eject_with_operation_finish) (GDrive *drive,
  138. GAsyncResult *result,
  139. GError **error);
  140. };
  141. GType g_drive_get_type (void) G_GNUC_CONST;
  142. char * g_drive_get_name (GDrive *drive);
  143. GIcon * g_drive_get_icon (GDrive *drive);
  144. gboolean g_drive_has_volumes (GDrive *drive);
  145. GList * g_drive_get_volumes (GDrive *drive);
  146. gboolean g_drive_is_media_removable (GDrive *drive);
  147. gboolean g_drive_has_media (GDrive *drive);
  148. gboolean g_drive_is_media_check_automatic (GDrive *drive);
  149. gboolean g_drive_can_poll_for_media (GDrive *drive);
  150. gboolean g_drive_can_eject (GDrive *drive);
  151. #ifndef G_DISABLE_DEPRECATED
  152. void g_drive_eject (GDrive *drive,
  153. GMountUnmountFlags flags,
  154. GCancellable *cancellable,
  155. GAsyncReadyCallback callback,
  156. gpointer user_data);
  157. gboolean g_drive_eject_finish (GDrive *drive,
  158. GAsyncResult *result,
  159. GError **error);
  160. #endif
  161. void g_drive_poll_for_media (GDrive *drive,
  162. GCancellable *cancellable,
  163. GAsyncReadyCallback callback,
  164. gpointer user_data);
  165. gboolean g_drive_poll_for_media_finish (GDrive *drive,
  166. GAsyncResult *result,
  167. GError **error);
  168. char * g_drive_get_identifier (GDrive *drive,
  169. const char *kind);
  170. char ** g_drive_enumerate_identifiers (GDrive *drive);
  171. GDriveStartStopType g_drive_get_start_stop_type (GDrive *drive);
  172. gboolean g_drive_can_start (GDrive *drive);
  173. gboolean g_drive_can_start_degraded (GDrive *drive);
  174. void g_drive_start (GDrive *drive,
  175. GDriveStartFlags flags,
  176. GMountOperation *mount_operation,
  177. GCancellable *cancellable,
  178. GAsyncReadyCallback callback,
  179. gpointer user_data);
  180. gboolean g_drive_start_finish (GDrive *drive,
  181. GAsyncResult *result,
  182. GError **error);
  183. gboolean g_drive_can_stop (GDrive *drive);
  184. void g_drive_stop (GDrive *drive,
  185. GMountUnmountFlags flags,
  186. GMountOperation *mount_operation,
  187. GCancellable *cancellable,
  188. GAsyncReadyCallback callback,
  189. gpointer user_data);
  190. gboolean g_drive_stop_finish (GDrive *drive,
  191. GAsyncResult *result,
  192. GError **error);
  193. void g_drive_eject_with_operation (GDrive *drive,
  194. GMountUnmountFlags flags,
  195. GMountOperation *mount_operation,
  196. GCancellable *cancellable,
  197. GAsyncReadyCallback callback,
  198. gpointer user_data);
  199. gboolean g_drive_eject_with_operation_finish (GDrive *drive,
  200. GAsyncResult *result,
  201. GError **error);
  202. G_END_DECLS
  203. #endif /* __G_DRIVE_H__ */