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 = GDrive.html 27 * outPack = gio 28 * outFile = DriveIF 29 * strct = GDrive 30 * realStrct= 31 * ctorStrct= 32 * clss = DriveT 33 * interf = DriveIF 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - g_drive_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * - glib.ErrorG 48 * - glib.GException 49 * - glib.ListG 50 * - gobject.Signals 51 * - gio.AsyncResultIF 52 * - gio.Cancellable 53 * - gio.Icon 54 * - gio.IconIF 55 * - gio.MountOperation 56 * structWrap: 57 * - GAsyncResult* -> AsyncResultIF 58 * - GCancellable* -> Cancellable 59 * - GIcon* -> IconIF 60 * - GList* -> ListG 61 * - GMountOperation* -> MountOperation 62 * module aliases: 63 * local aliases: 64 * overrides: 65 */ 66 67 module gio.DriveIF; 68 69 public import gtkc.giotypes; 70 71 private import gtkc.gio; 72 private import glib.ConstructionException; 73 private import gobject.ObjectG; 74 75 private import gobject.Signals; 76 public import gtkc.gdktypes; 77 private import glib.Str; 78 private import glib.ErrorG; 79 private import glib.GException; 80 private import glib.ListG; 81 private import gobject.Signals; 82 private import gio.AsyncResultIF; 83 private import gio.Cancellable; 84 private import gio.Icon; 85 private import gio.IconIF; 86 private import gio.MountOperation; 87 88 89 90 /** 91 * GDrive - this represent a piece of hardware connected to the machine. 92 * It's generally only created for removable hardware or hardware with 93 * removable media. 94 * 95 * GDrive is a container class for GVolume objects that stem from 96 * the same piece of media. As such, GDrive abstracts a drive with 97 * (or without) removable media and provides operations for querying 98 * whether media is available, determining whether media change is 99 * automatically detected and ejecting the media. 100 * 101 * If the GDrive reports that media isn't automatically detected, one 102 * can poll for media; typically one should not do this periodically 103 * as a poll for media operation is potententially expensive and may 104 * spin up the drive creating noise. 105 * 106 * GDrive supports starting and stopping drives with authentication 107 * support for the former. This can be used to support a diverse set 108 * of use cases including connecting/disconnecting iSCSI devices, 109 * powering down external disk enclosures and starting/stopping 110 * multi-disk devices such as RAID devices. Note that the actual 111 * semantics and side-effects of starting/stopping a GDrive may vary 112 * according to implementation. To choose the correct verbs in e.g. a 113 * file manager, use g_drive_get_start_stop_type(). 114 * 115 * For porting from GnomeVFS note that there is no equivalent of 116 * GDrive in that API. 117 */ 118 public interface DriveIF 119 { 120 121 122 /** Get the main Gtk struct */ 123 public GDrive* getDriveTStruct(); 124 125 /** the main Gtk struct as a void* */ 126 protected void* getStruct(); 127 128 129 /** 130 */ 131 132 @property void delegate(DriveIF)[] onChangedListeners(); 133 /** 134 * Emitted when the drive's state has changed. 135 */ 136 void addOnChanged(void delegate(DriveIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0); 137 @property void delegate(DriveIF)[] onDisconnectedListeners(); 138 /** 139 * This signal is emitted when the GDrive have been 140 * disconnected. If the recipient is holding references to the 141 * object they should release them so the object can be 142 * finalized. 143 */ 144 void addOnDisconnected(void delegate(DriveIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0); 145 @property void delegate(DriveIF)[] onEjectButtonListeners(); 146 /** 147 * Emitted when the physical eject button (if any) of a drive has 148 * been pressed. 149 */ 150 void addOnEjectButton(void delegate(DriveIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0); 151 @property void delegate(DriveIF)[] onStopButtonListeners(); 152 /** 153 * Emitted when the physical stop button (if any) of a drive has 154 * been pressed. 155 * Since 2.22 156 */ 157 void addOnStopButton(void delegate(DriveIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0); 158 159 /** 160 * Gets the name of drive. 161 * Returns: a string containing drive's name. The returned string should be freed when no longer needed. 162 */ 163 public string getName(); 164 165 /** 166 * Gets the icon for drive. 167 * Returns: GIcon for the drive. Free the returned object with g_object_unref(). [transfer full] 168 */ 169 public IconIF getIcon(); 170 171 /** 172 * Gets the icon for drive. 173 * Since 2.34 174 * Returns: symbolic GIcon for the drive. Free the returned object with g_object_unref(). [transfer full] 175 */ 176 public IconIF getSymbolicIcon(); 177 178 /** 179 * Check if drive has any mountable volumes. 180 * Returns: TRUE if the drive contains volumes, FALSE otherwise. 181 */ 182 public int hasVolumes(); 183 184 /** 185 * Get a list of mountable volumes for drive. 186 * The returned list should be freed with g_list_free(), after 187 * its elements have been unreffed with g_object_unref(). 188 * Returns: GList containing any GVolume objects on the given drive. [element-type GVolume][transfer full] 189 */ 190 public ListG getVolumes(); 191 192 /** 193 * Checks if a drive can be ejected. 194 * Returns: TRUE if the drive can be ejected, FALSE otherwise. 195 */ 196 public int canEject(); 197 198 /** 199 * Gets a hint about how a drive can be started/stopped. 200 * Since 2.22 201 * Returns: A value from the GDriveStartStopType enumeration. 202 */ 203 public GDriveStartStopType getStartStopType(); 204 205 /** 206 * Checks if a drive can be started. 207 * Since 2.22 208 * Returns: TRUE if the drive can be started, FALSE otherwise. 209 */ 210 public int canStart(); 211 212 /** 213 * Checks if a drive can be started degraded. 214 * Since 2.22 215 * Returns: TRUE if the drive can be started degraded, FALSE otherwise. 216 */ 217 public int canStartDegraded(); 218 219 /** 220 * Checks if a drive can be stopped. 221 * Since 2.22 222 * Returns: TRUE if the drive can be stopped, FALSE otherwise. 223 */ 224 public int canStop(); 225 226 /** 227 * Checks if a drive can be polled for media changes. 228 * Returns: TRUE if the drive can be polled for media changes, FALSE otherwise. 229 */ 230 public int canPollForMedia(); 231 232 /** 233 * Asynchronously polls drive to see if media has been inserted or removed. 234 * When the operation is finished, callback will be called. 235 * You can then call g_drive_poll_for_media_finish() to obtain the 236 * result of the operation. 237 * Params: 238 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 239 * callback = a GAsyncReadyCallback, or NULL. [allow-none] 240 * userData = user data to pass to callback 241 */ 242 public void pollForMedia(Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 243 244 /** 245 * Finishes an operation started with g_drive_poll_for_media() on a drive. 246 * Params: 247 * result = a GAsyncResult. 248 * Returns: TRUE if the drive has been poll_for_mediaed successfully, FALSE otherwise. 249 * Throws: GException on failure. 250 */ 251 public int pollForMediaFinish(AsyncResultIF result); 252 253 /** 254 * Checks if the drive has media. Note that the OS may not be polling 255 * the drive for media changes; see g_drive_is_media_check_automatic() 256 * for more details. 257 * Returns: TRUE if drive has media, FALSE otherwise. 258 */ 259 public int hasMedia(); 260 261 /** 262 * Checks if drive is capabable of automatically detecting media changes. 263 * Returns: TRUE if the drive is capabable of automatically detecting media changes, FALSE otherwise. 264 */ 265 public int isMediaCheckAutomatic(); 266 267 /** 268 * Checks if the drive supports removable media. 269 * Returns: TRUE if drive supports removable media, FALSE otherwise. 270 */ 271 public int isMediaRemovable(); 272 273 /** 274 * Warning 275 * g_drive_eject has been deprecated since version 2.22 and should not be used in newly-written code. Use g_drive_eject_with_operation() instead. 276 * Asynchronously ejects a drive. 277 * When the operation is finished, callback will be called. 278 * You can then call g_drive_eject_finish() to obtain the 279 * result of the operation. 280 * Params: 281 * flags = flags affecting the unmount if required for eject 282 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 283 * callback = a GAsyncReadyCallback, or NULL. [allow-none] 284 * userData = user data to pass to callback 285 */ 286 public void eject(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 287 288 /** 289 * Warning 290 * g_drive_eject_finish has been deprecated since version 2.22 and should not be used in newly-written code. Use g_drive_eject_with_operation_finish() instead. 291 * Finishes ejecting a drive. 292 * Params: 293 * result = a GAsyncResult. 294 * Returns: TRUE if the drive has been ejected successfully, FALSE otherwise. 295 * Throws: GException on failure. 296 */ 297 public int ejectFinish(AsyncResultIF result); 298 299 /** 300 * Ejects a drive. This is an asynchronous operation, and is 301 * finished by calling g_drive_eject_with_operation_finish() with the drive 302 * and GAsyncResult data returned in the callback. 303 * Since 2.22 304 * Params: 305 * flags = flags affecting the unmount if required for eject 306 * mountOperation = a GMountOperation or NULL to avoid 307 * user interaction. [allow-none] 308 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 309 * callback = a GAsyncReadyCallback, or NULL. [allow-none] 310 * userData = user data passed to callback. 311 */ 312 public void ejectWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 313 314 /** 315 * Finishes ejecting a drive. If any errors occurred during the operation, 316 * error will be set to contain the errors and FALSE will be returned. 317 * Since 2.22 318 * Params: 319 * result = a GAsyncResult. 320 * Returns: TRUE if the drive was successfully ejected. FALSE otherwise. 321 * Throws: GException on failure. 322 */ 323 public int ejectWithOperationFinish(AsyncResultIF result); 324 325 /** 326 * Asynchronously starts a drive. 327 * When the operation is finished, callback will be called. 328 * You can then call g_drive_start_finish() to obtain the 329 * result of the operation. 330 * Since 2.22 331 * Params: 332 * flags = flags affecting the start operation. 333 * mountOperation = a GMountOperation or NULL to avoid 334 * user interaction. [allow-none] 335 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 336 * callback = a GAsyncReadyCallback, or NULL. [allow-none] 337 * userData = user data to pass to callback 338 */ 339 public void start(GDriveStartFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 340 341 /** 342 * Finishes starting a drive. 343 * Since 2.22 344 * Params: 345 * result = a GAsyncResult. 346 * Returns: TRUE if the drive has been started successfully, FALSE otherwise. 347 * Throws: GException on failure. 348 */ 349 public int startFinish(AsyncResultIF result); 350 351 /** 352 * Asynchronously stops a drive. 353 * When the operation is finished, callback will be called. 354 * You can then call g_drive_stop_finish() to obtain the 355 * result of the operation. 356 * Since 2.22 357 * Params: 358 * flags = flags affecting the unmount if required for stopping. 359 * mountOperation = a GMountOperation or NULL to avoid 360 * user interaction. [allow-none] 361 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 362 * callback = a GAsyncReadyCallback, or NULL. [allow-none] 363 * userData = user data to pass to callback 364 */ 365 public void stop(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 366 367 /** 368 * Finishes stopping a drive. 369 * Since 2.22 370 * Params: 371 * result = a GAsyncResult. 372 * Returns: TRUE if the drive has been stopped successfully, FALSE otherwise. 373 * Throws: GException on failure. 374 */ 375 public int stopFinish(AsyncResultIF result); 376 377 /** 378 * Gets the kinds of identifiers that drive has. 379 * Use g_drive_get_identifier() to obtain the identifiers 380 * themselves. 381 * Returns: a NULL-terminated array of strings containing kinds of identifiers. Use g_strfreev() to free. [transfer full][array zero-terminated=1] 382 */ 383 public string[] enumerateIdentifiers(); 384 385 /** 386 * Gets the identifier of the given kind for drive. 387 * Params: 388 * kind = the kind of identifier to return 389 * Returns: a newly allocated string containing the requested identfier, or NULL if the GDrive doesn't have this kind of identifier. 390 */ 391 public string getIdentifier(string kind); 392 393 /** 394 * Gets the sort key for drive, if any. 395 * Since 2.32 396 * Signal Details 397 * The "changed" signal 398 * void user_function (GDrive *drive, 399 * gpointer user_data) : Run Last 400 * Emitted when the drive's state has changed. 401 * Returns: Sorting key for drive or NULL if no such key is available. 402 */ 403 public string getSortKey(); 404 }