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