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