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