gdrive.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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, see <http://www.gnu.org/licenses/>.
  17. *
  18. * Author: Alexander Larsson <[email protected]>
  19. * David Zeuthen <[email protected]>
  20. */
  21. #ifndef __G_DRIVE_H__
  22. #define __G_DRIVE_H__
  23. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  24. #error "Only <gio/gio.h> can be included directly."
  25. #endif
  26. #include <gio/giotypes.h>
  27. G_BEGIN_DECLS
  28. #define G_TYPE_DRIVE (g_drive_get_type ())
  29. #define G_DRIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_DRIVE, GDrive))
  30. #define G_IS_DRIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_DRIVE))
  31. #define G_DRIVE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_DRIVE, GDriveIface))
  32. /**
  33. * GDriveIface:
  34. * @g_iface: The parent interface.
  35. * @changed: Signal emitted when the drive is changed.
  36. * @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.
  37. * @eject_button: Signal emitted when the physical eject button (if any) of a drive have been pressed.
  38. * @get_name: Returns the name for the given #GDrive.
  39. * @get_icon: Returns a #GIcon for the given #GDrive.
  40. * @has_volumes: Returns %TRUE if the #GDrive has mountable volumes.
  41. * @get_volumes: Returns a list #GList of #GVolume for the #GDrive.
  42. * @is_media_removable: Returns %TRUE if the #GDrive supports removal and insertion of media.
  43. * @has_media: Returns %TRUE if the #GDrive has media inserted.
  44. * @is_media_check_automatic: Returns %TRUE if the #GDrive is capabable of automatically detecting media changes.
  45. * @can_poll_for_media: Returns %TRUE if the #GDrive is capable of manually polling for media change.
  46. * @can_eject: Returns %TRUE if the #GDrive can eject media.
  47. * @eject: Ejects a #GDrive.
  48. * @eject_finish: Finishes an eject operation.
  49. * @poll_for_media: Poll for media insertion/removal on a #GDrive.
  50. * @poll_for_media_finish: Finishes a media poll operation.
  51. * @get_identifier: Returns the identifier of the given kind, or %NULL if
  52. * the #GDrive doesn't have one.
  53. * @enumerate_identifiers: Returns an array strings listing the kinds
  54. * of identifiers which the #GDrive has.
  55. * @get_start_stop_type: Gets a #GDriveStartStopType with details about starting/stopping the drive. Since 2.22.
  56. * @can_stop: Returns %TRUE if a #GDrive can be stopped. Since 2.22.
  57. * @stop: Stops a #GDrive. Since 2.22.
  58. * @stop_finish: Finishes a stop operation. Since 2.22.
  59. * @can_start: Returns %TRUE if a #GDrive can be started. Since 2.22.
  60. * @can_start_degraded: Returns %TRUE if a #GDrive can be started degraded. Since 2.22.
  61. * @start: Starts a #GDrive. Since 2.22.
  62. * @start_finish: Finishes a start operation. Since 2.22.
  63. * @stop_button: Signal emitted when the physical stop button (if any) of a drive have been pressed. Since 2.22.
  64. * @eject_with_operation: Starts ejecting a #GDrive using a #GMountOperation. Since 2.22.
  65. * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22.
  66. * @get_sort_key: Gets a key used for sorting #GDrive instances or %NULL if no such key exists. Since 2.32.
  67. * @get_symbolic_icon: Returns a symbolic #GIcon for the given #GDrive. Since 2.34.
  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. const gchar * (* get_sort_key) (GDrive *drive);
  141. GIcon * (* get_symbolic_icon) (GDrive *drive);
  142. };
  143. GLIB_AVAILABLE_IN_ALL
  144. GType g_drive_get_type (void) G_GNUC_CONST;
  145. GLIB_AVAILABLE_IN_ALL
  146. char * g_drive_get_name (GDrive *drive);
  147. GLIB_AVAILABLE_IN_ALL
  148. GIcon * g_drive_get_icon (GDrive *drive);
  149. GLIB_AVAILABLE_IN_ALL
  150. GIcon * g_drive_get_symbolic_icon (GDrive *drive);
  151. GLIB_AVAILABLE_IN_ALL
  152. gboolean g_drive_has_volumes (GDrive *drive);
  153. GLIB_AVAILABLE_IN_ALL
  154. GList * g_drive_get_volumes (GDrive *drive);
  155. GLIB_AVAILABLE_IN_ALL
  156. gboolean g_drive_is_media_removable (GDrive *drive);
  157. GLIB_AVAILABLE_IN_ALL
  158. gboolean g_drive_has_media (GDrive *drive);
  159. GLIB_AVAILABLE_IN_ALL
  160. gboolean g_drive_is_media_check_automatic (GDrive *drive);
  161. GLIB_AVAILABLE_IN_ALL
  162. gboolean g_drive_can_poll_for_media (GDrive *drive);
  163. GLIB_AVAILABLE_IN_ALL
  164. gboolean g_drive_can_eject (GDrive *drive);
  165. GLIB_DEPRECATED_FOR(g_drive_eject_with_operation)
  166. void g_drive_eject (GDrive *drive,
  167. GMountUnmountFlags flags,
  168. GCancellable *cancellable,
  169. GAsyncReadyCallback callback,
  170. gpointer user_data);
  171. GLIB_DEPRECATED_FOR(g_drive_eject_with_operation_finish)
  172. gboolean g_drive_eject_finish (GDrive *drive,
  173. GAsyncResult *result,
  174. GError **error);
  175. GLIB_AVAILABLE_IN_ALL
  176. void g_drive_poll_for_media (GDrive *drive,
  177. GCancellable *cancellable,
  178. GAsyncReadyCallback callback,
  179. gpointer user_data);
  180. GLIB_AVAILABLE_IN_ALL
  181. gboolean g_drive_poll_for_media_finish (GDrive *drive,
  182. GAsyncResult *result,
  183. GError **error);
  184. GLIB_AVAILABLE_IN_ALL
  185. char * g_drive_get_identifier (GDrive *drive,
  186. const char *kind);
  187. GLIB_AVAILABLE_IN_ALL
  188. char ** g_drive_enumerate_identifiers (GDrive *drive);
  189. GLIB_AVAILABLE_IN_ALL
  190. GDriveStartStopType g_drive_get_start_stop_type (GDrive *drive);
  191. GLIB_AVAILABLE_IN_ALL
  192. gboolean g_drive_can_start (GDrive *drive);
  193. GLIB_AVAILABLE_IN_ALL
  194. gboolean g_drive_can_start_degraded (GDrive *drive);
  195. GLIB_AVAILABLE_IN_ALL
  196. void g_drive_start (GDrive *drive,
  197. GDriveStartFlags flags,
  198. GMountOperation *mount_operation,
  199. GCancellable *cancellable,
  200. GAsyncReadyCallback callback,
  201. gpointer user_data);
  202. GLIB_AVAILABLE_IN_ALL
  203. gboolean g_drive_start_finish (GDrive *drive,
  204. GAsyncResult *result,
  205. GError **error);
  206. GLIB_AVAILABLE_IN_ALL
  207. gboolean g_drive_can_stop (GDrive *drive);
  208. GLIB_AVAILABLE_IN_ALL
  209. void g_drive_stop (GDrive *drive,
  210. GMountUnmountFlags flags,
  211. GMountOperation *mount_operation,
  212. GCancellable *cancellable,
  213. GAsyncReadyCallback callback,
  214. gpointer user_data);
  215. GLIB_AVAILABLE_IN_ALL
  216. gboolean g_drive_stop_finish (GDrive *drive,
  217. GAsyncResult *result,
  218. GError **error);
  219. GLIB_AVAILABLE_IN_ALL
  220. void g_drive_eject_with_operation (GDrive *drive,
  221. GMountUnmountFlags flags,
  222. GMountOperation *mount_operation,
  223. GCancellable *cancellable,
  224. GAsyncReadyCallback callback,
  225. gpointer user_data);
  226. GLIB_AVAILABLE_IN_ALL
  227. gboolean g_drive_eject_with_operation_finish (GDrive *drive,
  228. GAsyncResult *result,
  229. GError **error);
  230. GLIB_AVAILABLE_IN_2_32
  231. const gchar *g_drive_get_sort_key (GDrive *drive);
  232. G_END_DECLS
  233. #endif /* __G_DRIVE_H__ */