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