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