gmount.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. /* GIO - GLib Input, Output and Streaming Library
  2. *
  3. * Copyright (C) 2006-2008 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_MOUNT_H__
  22. #define __G_MOUNT_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_MOUNT (g_mount_get_type ())
  29. #define G_MOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_MOUNT, GMount))
  30. #define G_IS_MOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_MOUNT))
  31. #define G_MOUNT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_MOUNT, GMountIface))
  32. typedef struct _GMountIface GMountIface;
  33. /**
  34. * GMountIface:
  35. * @g_iface: The parent interface.
  36. * @changed: Changed signal that is emitted when the mount's state has changed.
  37. * @unmounted: The unmounted signal that is emitted when the #GMount have been unmounted. If the recipient is holding references to the object they should release them so the object can be finalized.
  38. * @pre_unmount: The ::pre-unmount signal that is emitted when the #GMount will soon be emitted. If the recipient is somehow holding the mount open by keeping an open file on it it should close the file.
  39. * @get_root: Gets a #GFile to the root directory of the #GMount.
  40. * @get_name: Gets a string containing the name of the #GMount.
  41. * @get_icon: Gets a #GIcon for the #GMount.
  42. * @get_uuid: Gets the UUID for the #GMount. The reference is typically based on the file system UUID for the mount in question and should be considered an opaque string. Returns %NULL if there is no UUID available.
  43. * @get_volume: Gets a #GVolume the mount is located on. Returns %NULL if the #GMount is not associated with a #GVolume.
  44. * @get_drive: Gets a #GDrive the volume of the mount is located on. Returns %NULL if the #GMount is not associated with a #GDrive or a #GVolume. This is convenience method for getting the #GVolume and using that to get the #GDrive.
  45. * @can_unmount: Checks if a #GMount can be unmounted.
  46. * @can_eject: Checks if a #GMount can be ejected.
  47. * @unmount: Starts unmounting a #GMount.
  48. * @unmount_finish: Finishes an unmounting operation.
  49. * @eject: Starts ejecting a #GMount.
  50. * @eject_finish: Finishes an eject operation.
  51. * @remount: Starts remounting a #GMount.
  52. * @remount_finish: Finishes a remounting operation.
  53. * @guess_content_type: Starts guessing the type of the content of a #GMount.
  54. * See g_mount_guess_content_type() for more information on content
  55. * type guessing. This operation was added in 2.18.
  56. * @guess_content_type_finish: Finishes a content type guessing operation. Added in 2.18.
  57. * @guess_content_type_sync: Synchronous variant of @guess_content_type. Added in 2.18
  58. * @unmount_with_operation: Starts unmounting a #GMount using a #GMountOperation. Since 2.22.
  59. * @unmount_with_operation_finish: Finishes an unmounting operation using a #GMountOperation. Since 2.22.
  60. * @eject_with_operation: Starts ejecting a #GMount using a #GMountOperation. Since 2.22.
  61. * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22.
  62. * @get_default_location: Gets a #GFile indication a start location that can be use as the entry point for this mount. Since 2.24.
  63. * @get_sort_key: Gets a key used for sorting #GMount instance or %NULL if no such key exists. Since 2.32.
  64. * @get_symbolic_icon: Gets a symbolic #GIcon for the #GMount. Since 2.34.
  65. *
  66. * Interface for implementing operations for mounts.
  67. **/
  68. struct _GMountIface
  69. {
  70. GTypeInterface g_iface;
  71. /* signals */
  72. void (* changed) (GMount *mount);
  73. void (* unmounted) (GMount *mount);
  74. /* Virtual Table */
  75. GFile * (* get_root) (GMount *mount);
  76. char * (* get_name) (GMount *mount);
  77. GIcon * (* get_icon) (GMount *mount);
  78. char * (* get_uuid) (GMount *mount);
  79. GVolume * (* get_volume) (GMount *mount);
  80. GDrive * (* get_drive) (GMount *mount);
  81. gboolean (* can_unmount) (GMount *mount);
  82. gboolean (* can_eject) (GMount *mount);
  83. void (* unmount) (GMount *mount,
  84. GMountUnmountFlags flags,
  85. GCancellable *cancellable,
  86. GAsyncReadyCallback callback,
  87. gpointer user_data);
  88. gboolean (* unmount_finish) (GMount *mount,
  89. GAsyncResult *result,
  90. GError **error);
  91. void (* eject) (GMount *mount,
  92. GMountUnmountFlags flags,
  93. GCancellable *cancellable,
  94. GAsyncReadyCallback callback,
  95. gpointer user_data);
  96. gboolean (* eject_finish) (GMount *mount,
  97. GAsyncResult *result,
  98. GError **error);
  99. void (* remount) (GMount *mount,
  100. GMountMountFlags flags,
  101. GMountOperation *mount_operation,
  102. GCancellable *cancellable,
  103. GAsyncReadyCallback callback,
  104. gpointer user_data);
  105. gboolean (* remount_finish) (GMount *mount,
  106. GAsyncResult *result,
  107. GError **error);
  108. void (* guess_content_type) (GMount *mount,
  109. gboolean force_rescan,
  110. GCancellable *cancellable,
  111. GAsyncReadyCallback callback,
  112. gpointer user_data);
  113. gchar ** (* guess_content_type_finish) (GMount *mount,
  114. GAsyncResult *result,
  115. GError **error);
  116. gchar ** (* guess_content_type_sync) (GMount *mount,
  117. gboolean force_rescan,
  118. GCancellable *cancellable,
  119. GError **error);
  120. /* Signal, not VFunc */
  121. void (* pre_unmount) (GMount *mount);
  122. void (* unmount_with_operation) (GMount *mount,
  123. GMountUnmountFlags flags,
  124. GMountOperation *mount_operation,
  125. GCancellable *cancellable,
  126. GAsyncReadyCallback callback,
  127. gpointer user_data);
  128. gboolean (* unmount_with_operation_finish) (GMount *mount,
  129. GAsyncResult *result,
  130. GError **error);
  131. void (* eject_with_operation) (GMount *mount,
  132. GMountUnmountFlags flags,
  133. GMountOperation *mount_operation,
  134. GCancellable *cancellable,
  135. GAsyncReadyCallback callback,
  136. gpointer user_data);
  137. gboolean (* eject_with_operation_finish) (GMount *mount,
  138. GAsyncResult *result,
  139. GError **error);
  140. GFile * (* get_default_location) (GMount *mount);
  141. const gchar * (* get_sort_key) (GMount *mount);
  142. GIcon * (* get_symbolic_icon) (GMount *mount);
  143. };
  144. GLIB_AVAILABLE_IN_ALL
  145. GType g_mount_get_type (void) G_GNUC_CONST;
  146. GLIB_AVAILABLE_IN_ALL
  147. GFile * g_mount_get_root (GMount *mount);
  148. GLIB_AVAILABLE_IN_ALL
  149. GFile * g_mount_get_default_location (GMount *mount);
  150. GLIB_AVAILABLE_IN_ALL
  151. char * g_mount_get_name (GMount *mount);
  152. GLIB_AVAILABLE_IN_ALL
  153. GIcon * g_mount_get_icon (GMount *mount);
  154. GLIB_AVAILABLE_IN_ALL
  155. GIcon * g_mount_get_symbolic_icon (GMount *mount);
  156. GLIB_AVAILABLE_IN_ALL
  157. char * g_mount_get_uuid (GMount *mount);
  158. GLIB_AVAILABLE_IN_ALL
  159. GVolume * g_mount_get_volume (GMount *mount);
  160. GLIB_AVAILABLE_IN_ALL
  161. GDrive * g_mount_get_drive (GMount *mount);
  162. GLIB_AVAILABLE_IN_ALL
  163. gboolean g_mount_can_unmount (GMount *mount);
  164. GLIB_AVAILABLE_IN_ALL
  165. gboolean g_mount_can_eject (GMount *mount);
  166. GLIB_DEPRECATED_FOR(g_mount_unmount_with_operation)
  167. void g_mount_unmount (GMount *mount,
  168. GMountUnmountFlags flags,
  169. GCancellable *cancellable,
  170. GAsyncReadyCallback callback,
  171. gpointer user_data);
  172. GLIB_DEPRECATED_FOR(g_mount_unmount_with_operation_finish)
  173. gboolean g_mount_unmount_finish (GMount *mount,
  174. GAsyncResult *result,
  175. GError **error);
  176. GLIB_DEPRECATED_FOR(g_mount_eject_with_operation)
  177. void g_mount_eject (GMount *mount,
  178. GMountUnmountFlags flags,
  179. GCancellable *cancellable,
  180. GAsyncReadyCallback callback,
  181. gpointer user_data);
  182. GLIB_DEPRECATED_FOR(g_mount_eject_with_operation_finish)
  183. gboolean g_mount_eject_finish (GMount *mount,
  184. GAsyncResult *result,
  185. GError **error);
  186. GLIB_AVAILABLE_IN_ALL
  187. void g_mount_remount (GMount *mount,
  188. GMountMountFlags flags,
  189. GMountOperation *mount_operation,
  190. GCancellable *cancellable,
  191. GAsyncReadyCallback callback,
  192. gpointer user_data);
  193. GLIB_AVAILABLE_IN_ALL
  194. gboolean g_mount_remount_finish (GMount *mount,
  195. GAsyncResult *result,
  196. GError **error);
  197. GLIB_AVAILABLE_IN_ALL
  198. void g_mount_guess_content_type (GMount *mount,
  199. gboolean force_rescan,
  200. GCancellable *cancellable,
  201. GAsyncReadyCallback callback,
  202. gpointer user_data);
  203. GLIB_AVAILABLE_IN_ALL
  204. gchar ** g_mount_guess_content_type_finish (GMount *mount,
  205. GAsyncResult *result,
  206. GError **error);
  207. GLIB_AVAILABLE_IN_ALL
  208. gchar ** g_mount_guess_content_type_sync (GMount *mount,
  209. gboolean force_rescan,
  210. GCancellable *cancellable,
  211. GError **error);
  212. GLIB_AVAILABLE_IN_ALL
  213. gboolean g_mount_is_shadowed (GMount *mount);
  214. GLIB_AVAILABLE_IN_ALL
  215. void g_mount_shadow (GMount *mount);
  216. GLIB_AVAILABLE_IN_ALL
  217. void g_mount_unshadow (GMount *mount);
  218. GLIB_AVAILABLE_IN_ALL
  219. void g_mount_unmount_with_operation (GMount *mount,
  220. GMountUnmountFlags flags,
  221. GMountOperation *mount_operation,
  222. GCancellable *cancellable,
  223. GAsyncReadyCallback callback,
  224. gpointer user_data);
  225. GLIB_AVAILABLE_IN_ALL
  226. gboolean g_mount_unmount_with_operation_finish (GMount *mount,
  227. GAsyncResult *result,
  228. GError **error);
  229. GLIB_AVAILABLE_IN_ALL
  230. void g_mount_eject_with_operation (GMount *mount,
  231. GMountUnmountFlags flags,
  232. GMountOperation *mount_operation,
  233. GCancellable *cancellable,
  234. GAsyncReadyCallback callback,
  235. gpointer user_data);
  236. GLIB_AVAILABLE_IN_ALL
  237. gboolean g_mount_eject_with_operation_finish (GMount *mount,
  238. GAsyncResult *result,
  239. GError **error);
  240. GLIB_AVAILABLE_IN_ALL
  241. const gchar *g_mount_get_sort_key (GMount *mount);
  242. G_END_DECLS
  243. #endif /* __G_MOUNT_H__ */