PageRenderTime 62ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/generated/gtkd/gio/VolumeIF.d

http://github.com/gtkd-developers/GtkD
D | 354 lines | 46 code | 30 blank | 278 comment | 0 complexity | 5abffb2f53c870a81d81b45fe4db7725 MD5 | raw file
Possible License(s): LGPL-3.0
  1. /*
  2. * This file is part of gtkD.
  3. *
  4. * gtkD is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU Lesser General Public License
  6. * as published by the Free Software Foundation; either version 3
  7. * of the License, or (at your option) any later version, with
  8. * some exceptions, please read the COPYING file.
  9. *
  10. * gtkD 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
  13. * GNU Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public License
  16. * along with gtkD; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
  18. */
  19. // generated automatically - do not change
  20. // find conversion definition on APILookup.txt
  21. // implement new conversion functionalities on the wrap.utils pakage
  22. module gio.VolumeIF;
  23. private import gio.AsyncResultIF;
  24. private import gio.Cancellable;
  25. private import gio.DriveIF;
  26. private import gio.FileIF;
  27. private import gio.IconIF;
  28. private import gio.MountIF;
  29. private import gio.MountOperation;
  30. private import gio.c.functions;
  31. public import gio.c.types;
  32. private import glib.ErrorG;
  33. private import glib.GException;
  34. private import glib.Str;
  35. private import gobject.ObjectG;
  36. private import gobject.Signals;
  37. public import gtkc.giotypes;
  38. private import std.algorithm;
  39. /**
  40. * The #GVolume interface represents user-visible objects that can be
  41. * mounted. Note, when porting from GnomeVFS, #GVolume is the moral
  42. * equivalent of #GnomeVFSDrive.
  43. *
  44. * Mounting a #GVolume instance is an asynchronous operation. For more
  45. * information about asynchronous operations, see #GAsyncResult and
  46. * #GTask. To mount a #GVolume, first call g_volume_mount() with (at
  47. * least) the #GVolume instance, optionally a #GMountOperation object
  48. * and a #GAsyncReadyCallback.
  49. *
  50. * Typically, one will only want to pass %NULL for the
  51. * #GMountOperation if automounting all volumes when a desktop session
  52. * starts since it's not desirable to put up a lot of dialogs asking
  53. * for credentials.
  54. *
  55. * The callback will be fired when the operation has resolved (either
  56. * with success or failure), and a #GAsyncResult instance will be
  57. * passed to the callback. That callback should then call
  58. * g_volume_mount_finish() with the #GVolume instance and the
  59. * #GAsyncResult data to see if the operation was completed
  60. * successfully. If an @error is present when g_volume_mount_finish()
  61. * is called, then it will be filled with any error information.
  62. *
  63. * ## Volume Identifiers # {#volume-identifier}
  64. *
  65. * It is sometimes necessary to directly access the underlying
  66. * operating system object behind a volume (e.g. for passing a volume
  67. * to an application via the commandline). For this purpose, GIO
  68. * allows to obtain an 'identifier' for the volume. There can be
  69. * different kinds of identifiers, such as Hal UDIs, filesystem labels,
  70. * traditional Unix devices (e.g. `/dev/sda2`), UUIDs. GIO uses predefined
  71. * strings as names for the different kinds of identifiers:
  72. * #G_VOLUME_IDENTIFIER_KIND_UUID, #G_VOLUME_IDENTIFIER_KIND_LABEL, etc.
  73. * Use g_volume_get_identifier() to obtain an identifier for a volume.
  74. *
  75. *
  76. * Note that #G_VOLUME_IDENTIFIER_KIND_HAL_UDI will only be available
  77. * when the gvfs hal volume monitor is in use. Other volume monitors
  78. * will generally be able to provide the #G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE
  79. * identifier, which can be used to obtain a hal device by means of
  80. * libhal_manager_find_device_string_match().
  81. */
  82. public interface VolumeIF{
  83. /** Get the main Gtk struct */
  84. public GVolume* getVolumeStruct(bool transferOwnership = false);
  85. /** the main Gtk struct as a void* */
  86. protected void* getStruct();
  87. /** */
  88. public static GType getType()
  89. {
  90. return g_volume_get_type();
  91. }
  92. /**
  93. * Checks if a volume can be ejected.
  94. *
  95. * Returns: %TRUE if the @volume can be ejected. %FALSE otherwise
  96. */
  97. public bool canEject();
  98. /**
  99. * Checks if a volume can be mounted.
  100. *
  101. * Returns: %TRUE if the @volume can be mounted. %FALSE otherwise
  102. */
  103. public bool canMount();
  104. /**
  105. * Ejects a volume. This is an asynchronous operation, and is
  106. * finished by calling g_volume_eject_finish() with the @volume
  107. * and #GAsyncResult returned in the @callback.
  108. *
  109. * Deprecated: Use g_volume_eject_with_operation() instead.
  110. *
  111. * Params:
  112. * flags = flags affecting the unmount if required for eject
  113. * cancellable = optional #GCancellable object, %NULL to ignore
  114. * callback = a #GAsyncReadyCallback, or %NULL
  115. * userData = user data that gets passed to @callback
  116. */
  117. public void eject(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
  118. /**
  119. * Finishes ejecting a volume. If any errors occurred during the operation,
  120. * @error will be set to contain the errors and %FALSE will be returned.
  121. *
  122. * Deprecated: Use g_volume_eject_with_operation_finish() instead.
  123. *
  124. * Params:
  125. * result = a #GAsyncResult
  126. *
  127. * Returns: %TRUE, %FALSE if operation failed
  128. *
  129. * Throws: GException on failure.
  130. */
  131. public bool ejectFinish(AsyncResultIF result);
  132. /**
  133. * Ejects a volume. This is an asynchronous operation, and is
  134. * finished by calling g_volume_eject_with_operation_finish() with the @volume
  135. * and #GAsyncResult data returned in the @callback.
  136. *
  137. * Params:
  138. * flags = flags affecting the unmount if required for eject
  139. * mountOperation = a #GMountOperation or %NULL to
  140. * avoid user interaction
  141. * cancellable = optional #GCancellable object, %NULL to ignore
  142. * callback = a #GAsyncReadyCallback, or %NULL
  143. * userData = user data passed to @callback
  144. *
  145. * Since: 2.22
  146. */
  147. public void ejectWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
  148. /**
  149. * Finishes ejecting a volume. If any errors occurred during the operation,
  150. * @error will be set to contain the errors and %FALSE will be returned.
  151. *
  152. * Params:
  153. * result = a #GAsyncResult
  154. *
  155. * Returns: %TRUE if the volume was successfully ejected. %FALSE otherwise
  156. *
  157. * Since: 2.22
  158. *
  159. * Throws: GException on failure.
  160. */
  161. public bool ejectWithOperationFinish(AsyncResultIF result);
  162. /**
  163. * Gets the kinds of [identifiers][volume-identifier] that @volume has.
  164. * Use g_volume_get_identifier() to obtain the identifiers themselves.
  165. *
  166. * Returns: a %NULL-terminated array
  167. * of strings containing kinds of identifiers. Use g_strfreev() to free.
  168. */
  169. public string[] enumerateIdentifiers();
  170. /**
  171. * Gets the activation root for a #GVolume if it is known ahead of
  172. * mount time. Returns %NULL otherwise. If not %NULL and if @volume
  173. * is mounted, then the result of g_mount_get_root() on the
  174. * #GMount object obtained from g_volume_get_mount() will always
  175. * either be equal or a prefix of what this function returns. In
  176. * other words, in code
  177. *
  178. * |[<!-- language="C" -->
  179. * GMount *mount;
  180. * GFile *mount_root
  181. * GFile *volume_activation_root;
  182. *
  183. * mount = g_volume_get_mount (volume); // mounted, so never NULL
  184. * mount_root = g_mount_get_root (mount);
  185. * volume_activation_root = g_volume_get_activation_root (volume); // assume not NULL
  186. * ]|
  187. * then the expression
  188. * |[<!-- language="C" -->
  189. * (g_file_has_prefix (volume_activation_root, mount_root) ||
  190. * g_file_equal (volume_activation_root, mount_root))
  191. * ]|
  192. * will always be %TRUE.
  193. *
  194. * Activation roots are typically used in #GVolumeMonitor
  195. * implementations to find the underlying mount to shadow, see
  196. * g_mount_is_shadowed() for more details.
  197. *
  198. * Returns: the activation root of @volume
  199. * or %NULL. Use g_object_unref() to free.
  200. *
  201. * Since: 2.18
  202. */
  203. public FileIF getActivationRoot();
  204. /**
  205. * Gets the drive for the @volume.
  206. *
  207. * Returns: a #GDrive or %NULL if @volume is not
  208. * associated with a drive. The returned object should be unreffed
  209. * with g_object_unref() when no longer needed.
  210. */
  211. public DriveIF getDrive();
  212. /**
  213. * Gets the icon for @volume.
  214. *
  215. * Returns: a #GIcon.
  216. * The returned object should be unreffed with g_object_unref()
  217. * when no longer needed.
  218. */
  219. public IconIF getIcon();
  220. /**
  221. * Gets the identifier of the given kind for @volume.
  222. * See the [introduction][volume-identifier] for more
  223. * information about volume identifiers.
  224. *
  225. * Params:
  226. * kind = the kind of identifier to return
  227. *
  228. * Returns: a newly allocated string containing the
  229. * requested identifier, or %NULL if the #GVolume
  230. * doesn't have this kind of identifier
  231. */
  232. public string getIdentifier(string kind);
  233. /**
  234. * Gets the mount for the @volume.
  235. *
  236. * Returns: a #GMount or %NULL if @volume isn't mounted.
  237. * The returned object should be unreffed with g_object_unref()
  238. * when no longer needed.
  239. */
  240. public MountIF getMount();
  241. /**
  242. * Gets the name of @volume.
  243. *
  244. * Returns: the name for the given @volume. The returned string should
  245. * be freed with g_free() when no longer needed.
  246. */
  247. public string getName();
  248. /**
  249. * Gets the sort key for @volume, if any.
  250. *
  251. * Returns: Sorting key for @volume or %NULL if no such key is available
  252. *
  253. * Since: 2.32
  254. */
  255. public string getSortKey();
  256. /**
  257. * Gets the symbolic icon for @volume.
  258. *
  259. * Returns: a #GIcon.
  260. * The returned object should be unreffed with g_object_unref()
  261. * when no longer needed.
  262. *
  263. * Since: 2.34
  264. */
  265. public IconIF getSymbolicIcon();
  266. /**
  267. * Gets the UUID for the @volume. The reference is typically based on
  268. * the file system UUID for the volume in question and should be
  269. * considered an opaque string. Returns %NULL if there is no UUID
  270. * available.
  271. *
  272. * Returns: the UUID for @volume or %NULL if no UUID
  273. * can be computed.
  274. * The returned string should be freed with g_free()
  275. * when no longer needed.
  276. */
  277. public string getUuid();
  278. /**
  279. * Mounts a volume. This is an asynchronous operation, and is
  280. * finished by calling g_volume_mount_finish() with the @volume
  281. * and #GAsyncResult returned in the @callback.
  282. *
  283. * Params:
  284. * flags = flags affecting the operation
  285. * mountOperation = a #GMountOperation or %NULL to avoid user interaction
  286. * cancellable = optional #GCancellable object, %NULL to ignore
  287. * callback = a #GAsyncReadyCallback, or %NULL
  288. * userData = user data that gets passed to @callback
  289. */
  290. public void mount(GMountMountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
  291. /**
  292. * Finishes mounting a volume. If any errors occurred during the operation,
  293. * @error will be set to contain the errors and %FALSE will be returned.
  294. *
  295. * If the mount operation succeeded, g_volume_get_mount() on @volume
  296. * is guaranteed to return the mount right after calling this
  297. * function; there's no need to listen for the 'mount-added' signal on
  298. * #GVolumeMonitor.
  299. *
  300. * Params:
  301. * result = a #GAsyncResult
  302. *
  303. * Returns: %TRUE, %FALSE if operation failed
  304. *
  305. * Throws: GException on failure.
  306. */
  307. public bool mountFinish(AsyncResultIF result);
  308. /**
  309. * Returns whether the volume should be automatically mounted.
  310. *
  311. * Returns: %TRUE if the volume should be automatically mounted
  312. */
  313. public bool shouldAutomount();
  314. /**
  315. * Emitted when the volume has been changed.
  316. */
  317. gulong addOnChanged(void delegate(VolumeIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
  318. /**
  319. * This signal is emitted when the #GVolume have been removed. If
  320. * the recipient is holding references to the object they should
  321. * release them so the object can be finalized.
  322. */
  323. gulong addOnRemoved(void delegate(VolumeIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
  324. }