gmount.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. /* GIO - GLib Input, Output and Streaming Library
  2. *
  3. * Copyright (C) 2006-2008 Red Hat, Inc.
  4. *
  5. * SPDX-License-Identifier: LGPL-2.1-or-later
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General
  18. * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  19. *
  20. * Author: Alexander Larsson <alexl@redhat.com>
  21. * David Zeuthen <davidz@redhat.com>
  22. */
  23. #ifndef __G_MOUNT_H__
  24. #define __G_MOUNT_H__
  25. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  26. #error "Only <gio/gio.h> can be included directly."
  27. #endif
  28. #include <gio/giotypes.h>
  29. G_BEGIN_DECLS
  30. #define G_TYPE_MOUNT (g_mount_get_type ())
  31. #define G_MOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_MOUNT, GMount))
  32. #define G_IS_MOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_MOUNT))
  33. #define G_MOUNT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_MOUNT, GMountIface))
  34. typedef struct _GMountIface GMountIface;
  35. /**
  36. * GMountIface:
  37. * @g_iface: The parent interface.
  38. * @changed: Changed signal that is emitted when the mount's state has changed.
  39. * @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.
  40. * @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.
  41. * @get_root: Gets a #GFile to the root directory of the #GMount.
  42. * @get_name: Gets a string containing the name of the #GMount.
  43. * @get_icon: Gets a #GIcon for the #GMount.
  44. * @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.
  45. * @get_volume: Gets a #GVolume the mount is located on. Returns %NULL if the #GMount is not associated with a #GVolume.
  46. * @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.
  47. * @can_unmount: Checks if a #GMount can be unmounted.
  48. * @can_eject: Checks if a #GMount can be ejected.
  49. * @unmount: Starts unmounting a #GMount.
  50. * @unmount_finish: Finishes an unmounting operation.
  51. * @eject: Starts ejecting a #GMount.
  52. * @eject_finish: Finishes an eject operation.
  53. * @remount: Starts remounting a #GMount.
  54. * @remount_finish: Finishes a remounting operation.
  55. * @guess_content_type: Starts guessing the type of the content of a #GMount.
  56. * See g_mount_guess_content_type() for more information on content
  57. * type guessing. This operation was added in 2.18.
  58. * @guess_content_type_finish: Finishes a content type guessing operation. Added in 2.18.
  59. * @guess_content_type_sync: Synchronous variant of @guess_content_type. Added in 2.18
  60. * @unmount_with_operation: Starts unmounting a #GMount using a #GMountOperation. Since 2.22.
  61. * @unmount_with_operation_finish: Finishes an unmounting operation using a #GMountOperation. Since 2.22.
  62. * @eject_with_operation: Starts ejecting a #GMount using a #GMountOperation. Since 2.22.
  63. * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22.
  64. * @get_default_location: Gets a #GFile indication a start location that can be use as the entry point for this mount. Since 2.24.
  65. * @get_sort_key: Gets a key used for sorting #GMount instance or %NULL if no such key exists. Since 2.32.
  66. * @get_symbolic_icon: Gets a symbolic #GIcon for the #GMount. Since 2.34.
  67. *
  68. * Interface for implementing operations for mounts.
  69. **/
  70. struct _GMountIface
  71. {
  72. GTypeInterface g_iface;
  73. /* signals */
  74. void (* changed) (GMount *mount);
  75. void (* unmounted) (GMount *mount);
  76. /* Virtual Table */
  77. GFile * (* get_root) (GMount *mount);
  78. char * (* get_name) (GMount *mount);
  79. GIcon * (* get_icon) (GMount *mount);
  80. char * (* get_uuid) (GMount *mount);
  81. GVolume * (* get_volume) (GMount *mount);
  82. GDrive * (* get_drive) (GMount *mount);
  83. gboolean (* can_unmount) (GMount *mount);
  84. gboolean (* can_eject) (GMount *mount);
  85. void (* unmount) (GMount *mount,
  86. GMountUnmountFlags flags,
  87. GCancellable *cancellable,
  88. GAsyncReadyCallback callback,
  89. gpointer user_data);
  90. gboolean (* unmount_finish) (GMount *mount,
  91. GAsyncResult *result,
  92. GError **error);
  93. void (* eject) (GMount *mount,
  94. GMountUnmountFlags flags,
  95. GCancellable *cancellable,
  96. GAsyncReadyCallback callback,
  97. gpointer user_data);
  98. gboolean (* eject_finish) (GMount *mount,
  99. GAsyncResult *result,
  100. GError **error);
  101. void (* remount) (GMount *mount,
  102. GMountMountFlags flags,
  103. GMountOperation *mount_operation,
  104. GCancellable *cancellable,
  105. GAsyncReadyCallback callback,
  106. gpointer user_data);
  107. gboolean (* remount_finish) (GMount *mount,
  108. GAsyncResult *result,
  109. GError **error);
  110. void (* guess_content_type) (GMount *mount,
  111. gboolean force_rescan,
  112. GCancellable *cancellable,
  113. GAsyncReadyCallback callback,
  114. gpointer user_data);
  115. gchar ** (* guess_content_type_finish) (GMount *mount,
  116. GAsyncResult *result,
  117. GError **error);
  118. gchar ** (* guess_content_type_sync) (GMount *mount,
  119. gboolean force_rescan,
  120. GCancellable *cancellable,
  121. GError **error);
  122. /* Signal, not VFunc */
  123. void (* pre_unmount) (GMount *mount);
  124. void (* unmount_with_operation) (GMount *mount,
  125. GMountUnmountFlags flags,
  126. GMountOperation *mount_operation,
  127. GCancellable *cancellable,
  128. GAsyncReadyCallback callback,
  129. gpointer user_data);
  130. gboolean (* unmount_with_operation_finish) (GMount *mount,
  131. GAsyncResult *result,
  132. GError **error);
  133. void (* eject_with_operation) (GMount *mount,
  134. GMountUnmountFlags flags,
  135. GMountOperation *mount_operation,
  136. GCancellable *cancellable,
  137. GAsyncReadyCallback callback,
  138. gpointer user_data);
  139. gboolean (* eject_with_operation_finish) (GMount *mount,
  140. GAsyncResult *result,
  141. GError **error);
  142. GFile * (* get_default_location) (GMount *mount);
  143. const gchar * (* get_sort_key) (GMount *mount);
  144. GIcon * (* get_symbolic_icon) (GMount *mount);
  145. };
  146. GIO_AVAILABLE_IN_ALL
  147. GType g_mount_get_type (void) G_GNUC_CONST;
  148. GIO_AVAILABLE_IN_ALL
  149. GFile * g_mount_get_root (GMount *mount);
  150. GIO_AVAILABLE_IN_ALL
  151. GFile * g_mount_get_default_location (GMount *mount);
  152. GIO_AVAILABLE_IN_ALL
  153. char * g_mount_get_name (GMount *mount);
  154. GIO_AVAILABLE_IN_ALL
  155. GIcon * g_mount_get_icon (GMount *mount);
  156. GIO_AVAILABLE_IN_ALL
  157. GIcon * g_mount_get_symbolic_icon (GMount *mount);
  158. GIO_AVAILABLE_IN_ALL
  159. char * g_mount_get_uuid (GMount *mount);
  160. GIO_AVAILABLE_IN_ALL
  161. GVolume * g_mount_get_volume (GMount *mount);
  162. GIO_AVAILABLE_IN_ALL
  163. GDrive * g_mount_get_drive (GMount *mount);
  164. GIO_AVAILABLE_IN_ALL
  165. gboolean g_mount_can_unmount (GMount *mount);
  166. GIO_AVAILABLE_IN_ALL
  167. gboolean g_mount_can_eject (GMount *mount);
  168. GIO_DEPRECATED_FOR(g_mount_unmount_with_operation)
  169. void g_mount_unmount (GMount *mount,
  170. GMountUnmountFlags flags,
  171. GCancellable *cancellable,
  172. GAsyncReadyCallback callback,
  173. gpointer user_data);
  174. GIO_DEPRECATED_FOR(g_mount_unmount_with_operation_finish)
  175. gboolean g_mount_unmount_finish (GMount *mount,
  176. GAsyncResult *result,
  177. GError **error);
  178. GIO_DEPRECATED_FOR(g_mount_eject_with_operation)
  179. void g_mount_eject (GMount *mount,
  180. GMountUnmountFlags flags,
  181. GCancellable *cancellable,
  182. GAsyncReadyCallback callback,
  183. gpointer user_data);
  184. GIO_DEPRECATED_FOR(g_mount_eject_with_operation_finish)
  185. gboolean g_mount_eject_finish (GMount *mount,
  186. GAsyncResult *result,
  187. GError **error);
  188. GIO_AVAILABLE_IN_ALL
  189. void g_mount_remount (GMount *mount,
  190. GMountMountFlags flags,
  191. GMountOperation *mount_operation,
  192. GCancellable *cancellable,
  193. GAsyncReadyCallback callback,
  194. gpointer user_data);
  195. GIO_AVAILABLE_IN_ALL
  196. gboolean g_mount_remount_finish (GMount *mount,
  197. GAsyncResult *result,
  198. GError **error);
  199. GIO_AVAILABLE_IN_ALL
  200. void g_mount_guess_content_type (GMount *mount,
  201. gboolean force_rescan,
  202. GCancellable *cancellable,
  203. GAsyncReadyCallback callback,
  204. gpointer user_data);
  205. GIO_AVAILABLE_IN_ALL
  206. gchar ** g_mount_guess_content_type_finish (GMount *mount,
  207. GAsyncResult *result,
  208. GError **error);
  209. GIO_AVAILABLE_IN_ALL
  210. gchar ** g_mount_guess_content_type_sync (GMount *mount,
  211. gboolean force_rescan,
  212. GCancellable *cancellable,
  213. GError **error);
  214. GIO_AVAILABLE_IN_ALL
  215. gboolean g_mount_is_shadowed (GMount *mount);
  216. GIO_AVAILABLE_IN_ALL
  217. void g_mount_shadow (GMount *mount);
  218. GIO_AVAILABLE_IN_ALL
  219. void g_mount_unshadow (GMount *mount);
  220. GIO_AVAILABLE_IN_ALL
  221. void g_mount_unmount_with_operation (GMount *mount,
  222. GMountUnmountFlags flags,
  223. GMountOperation *mount_operation,
  224. GCancellable *cancellable,
  225. GAsyncReadyCallback callback,
  226. gpointer user_data);
  227. GIO_AVAILABLE_IN_ALL
  228. gboolean g_mount_unmount_with_operation_finish (GMount *mount,
  229. GAsyncResult *result,
  230. GError **error);
  231. GIO_AVAILABLE_IN_ALL
  232. void g_mount_eject_with_operation (GMount *mount,
  233. GMountUnmountFlags flags,
  234. GMountOperation *mount_operation,
  235. GCancellable *cancellable,
  236. GAsyncReadyCallback callback,
  237. gpointer user_data);
  238. GIO_AVAILABLE_IN_ALL
  239. gboolean g_mount_eject_with_operation_finish (GMount *mount,
  240. GAsyncResult *result,
  241. GError **error);
  242. GIO_AVAILABLE_IN_ALL
  243. const gchar *g_mount_get_sort_key (GMount *mount);
  244. G_END_DECLS
  245. #endif /* __G_MOUNT_H__ */