Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

212 rindas
9.8 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_VOLUME_H__
  27. #define __G_VOLUME_H__
  28. #include <gio/giotypes.h>
  29. G_BEGIN_DECLS
  30. /**
  31. * G_VOLUME_IDENTIFIER_KIND_HAL_UDI:
  32. *
  33. * The string used to obtain a Hal UDI with g_volume_get_identifier().
  34. */
  35. #define G_VOLUME_IDENTIFIER_KIND_HAL_UDI "hal-udi"
  36. /**
  37. * G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE:
  38. *
  39. * The string used to obtain a Unix device path with g_volume_get_identifier().
  40. */
  41. #define G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE "unix-device"
  42. /**
  43. * G_VOLUME_IDENTIFIER_KIND_LABEL:
  44. *
  45. * The string used to obtain a filesystem label with g_volume_get_identifier().
  46. */
  47. #define G_VOLUME_IDENTIFIER_KIND_LABEL "label"
  48. /**
  49. * G_VOLUME_IDENTIFIER_KIND_UUID:
  50. *
  51. * The string used to obtain a UUID with g_volume_get_identifier().
  52. */
  53. #define G_VOLUME_IDENTIFIER_KIND_UUID "uuid"
  54. /**
  55. * G_VOLUME_IDENTIFIER_KIND_NFS_MOUNT:
  56. *
  57. * The string used to obtain a NFS mount with g_volume_get_identifier().
  58. */
  59. #define G_VOLUME_IDENTIFIER_KIND_NFS_MOUNT "nfs-mount"
  60. #define G_TYPE_VOLUME (g_volume_get_type ())
  61. #define G_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_VOLUME, GVolume))
  62. #define G_IS_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_VOLUME))
  63. #define G_VOLUME_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_VOLUME, GVolumeIface))
  64. /**
  65. * GVolumeIface:
  66. * @g_iface: The parent interface.
  67. * @changed: Changed signal that is emitted when the volume's state has changed.
  68. * @removed: The removed signal that is emitted when the #GVolume have been removed. If the recipient is holding references to the object they should release them so the object can be finalized.
  69. * @get_name: Gets a string containing the name of the #GVolume.
  70. * @get_icon: Gets a #GIcon for the #GVolume.
  71. * @get_uuid: Gets the UUID for the #GVolume. 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.
  72. * @get_drive: Gets a #GDrive the volume is located on. Returns %NULL if the #GVolume is not associated with a #GDrive.
  73. * @get_mount: Gets a #GMount representing the mounted volume. Returns %NULL if the #GVolume is not mounted.
  74. * @can_mount: Returns %TRUE if the #GVolume can be mounted.
  75. * @can_eject: Checks if a #GVolume can be ejected.
  76. * @mount_fn: Mounts a given #GVolume.
  77. * #GVolume implementations must emit the #GMountOperation::aborted
  78. * signal before completing a mount operation that is aborted while
  79. * awaiting input from the user through a #GMountOperation instance.
  80. * @mount_finish: Finishes a mount operation.
  81. * @eject: Ejects a given #GVolume.
  82. * @eject_finish: Finishes an eject operation.
  83. * @get_identifier: Returns the <link linkend="volume-identifier">identifier</link> of the given kind, or %NULL if
  84. * the #GVolume doesn't have one.
  85. * @enumerate_identifiers: Returns an array strings listing the kinds
  86. * of <link linkend="volume-identifier">identifiers</link> which the #GVolume has.
  87. * @should_automount: Returns %TRUE if the #GVolume should be automatically mounted.
  88. * @get_activation_root: Returns the activation root for the #GVolume if it is known in advance or %NULL if
  89. * it is not known.
  90. * @eject_with_operation: Starts ejecting a #GVolume using a #GMountOperation. Since 2.22.
  91. * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22.
  92. *
  93. * Interface for implementing operations for mountable volumes.
  94. **/
  95. typedef struct _GVolumeIface GVolumeIface;
  96. struct _GVolumeIface
  97. {
  98. GTypeInterface g_iface;
  99. /* signals */
  100. void (* changed) (GVolume *volume);
  101. void (* removed) (GVolume *volume);
  102. /* Virtual Table */
  103. char * (* get_name) (GVolume *volume);
  104. GIcon * (* get_icon) (GVolume *volume);
  105. char * (* get_uuid) (GVolume *volume);
  106. GDrive * (* get_drive) (GVolume *volume);
  107. GMount * (* get_mount) (GVolume *volume);
  108. gboolean (* can_mount) (GVolume *volume);
  109. gboolean (* can_eject) (GVolume *volume);
  110. void (* mount_fn) (GVolume *volume,
  111. GMountMountFlags flags,
  112. GMountOperation *mount_operation,
  113. GCancellable *cancellable,
  114. GAsyncReadyCallback callback,
  115. gpointer user_data);
  116. gboolean (* mount_finish) (GVolume *volume,
  117. GAsyncResult *result,
  118. GError **error);
  119. void (* eject) (GVolume *volume,
  120. GMountUnmountFlags flags,
  121. GCancellable *cancellable,
  122. GAsyncReadyCallback callback,
  123. gpointer user_data);
  124. gboolean (* eject_finish) (GVolume *volume,
  125. GAsyncResult *result,
  126. GError **error);
  127. char * (* get_identifier) (GVolume *volume,
  128. const char *kind);
  129. char ** (* enumerate_identifiers) (GVolume *volume);
  130. gboolean (* should_automount) (GVolume *volume);
  131. GFile * (* get_activation_root) (GVolume *volume);
  132. void (* eject_with_operation) (GVolume *volume,
  133. GMountUnmountFlags flags,
  134. GMountOperation *mount_operation,
  135. GCancellable *cancellable,
  136. GAsyncReadyCallback callback,
  137. gpointer user_data);
  138. gboolean (* eject_with_operation_finish) (GVolume *volume,
  139. GAsyncResult *result,
  140. GError **error);
  141. };
  142. GType g_volume_get_type (void) G_GNUC_CONST;
  143. char * g_volume_get_name (GVolume *volume);
  144. GIcon * g_volume_get_icon (GVolume *volume);
  145. char * g_volume_get_uuid (GVolume *volume);
  146. GDrive * g_volume_get_drive (GVolume *volume);
  147. GMount * g_volume_get_mount (GVolume *volume);
  148. gboolean g_volume_can_mount (GVolume *volume);
  149. gboolean g_volume_can_eject (GVolume *volume);
  150. gboolean g_volume_should_automount (GVolume *volume);
  151. void g_volume_mount (GVolume *volume,
  152. GMountMountFlags flags,
  153. GMountOperation *mount_operation,
  154. GCancellable *cancellable,
  155. GAsyncReadyCallback callback,
  156. gpointer user_data);
  157. gboolean g_volume_mount_finish (GVolume *volume,
  158. GAsyncResult *result,
  159. GError **error);
  160. #ifndef G_DISABLE_DEPRECATED
  161. void g_volume_eject (GVolume *volume,
  162. GMountUnmountFlags flags,
  163. GCancellable *cancellable,
  164. GAsyncReadyCallback callback,
  165. gpointer user_data);
  166. gboolean g_volume_eject_finish (GVolume *volume,
  167. GAsyncResult *result,
  168. GError **error);
  169. #endif
  170. char * g_volume_get_identifier (GVolume *volume,
  171. const char *kind);
  172. char ** g_volume_enumerate_identifiers (GVolume *volume);
  173. GFile * g_volume_get_activation_root (GVolume *volume);
  174. void g_volume_eject_with_operation (GVolume *volume,
  175. GMountUnmountFlags flags,
  176. GMountOperation *mount_operation,
  177. GCancellable *cancellable,
  178. GAsyncReadyCallback callback,
  179. gpointer user_data);
  180. gboolean g_volume_eject_with_operation_finish (GVolume *volume,
  181. GAsyncResult *result,
  182. GError **error);
  183. G_END_DECLS
  184. #endif /* __G_VOLUME_H__ */