| 75 | | mixin MountT!(GMount); |
|---|
| | 75 | //mixin MountT!(GMount); |
|---|
| | 76 | // MANUAL TEMPLATE |
|---|
| | 77 | /** the main Gtk struct */ |
|---|
| | 78 | protected GMount* gMount; |
|---|
| | 79 | |
|---|
| | 80 | |
|---|
| | 81 | public GMount* getMountTStruct() |
|---|
| | 82 | { |
|---|
| | 83 | return cast(GMount*)getStruct(); |
|---|
| | 84 | } |
|---|
| | 85 | |
|---|
| | 86 | |
|---|
| | 87 | /** |
|---|
| | 88 | */ |
|---|
| | 89 | int[char[]] connectedSignals; |
|---|
| | 90 | |
|---|
| | 91 | void delegate(MountIF)[] _onChangedListeners; |
|---|
| | 92 | void delegate(MountIF)[] onChangedListeners() |
|---|
| | 93 | { |
|---|
| | 94 | return _onChangedListeners; |
|---|
| | 95 | } |
|---|
| | 96 | /** |
|---|
| | 97 | * Emitted when the mount has been changed. |
|---|
| | 98 | */ |
|---|
| | 99 | void addOnChanged(void delegate(MountIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| | 100 | { |
|---|
| | 101 | if ( !("changed" in connectedSignals) ) |
|---|
| | 102 | { |
|---|
| | 103 | Signals.connectData( |
|---|
| | 104 | getStruct(), |
|---|
| | 105 | "changed", |
|---|
| | 106 | cast(GCallback)&callBackChanged, |
|---|
| | 107 | cast(void*)cast(MountIF)this, |
|---|
| | 108 | null, |
|---|
| | 109 | connectFlags); |
|---|
| | 110 | connectedSignals["changed"] = 1; |
|---|
| | 111 | } |
|---|
| | 112 | _onChangedListeners ~= dlg; |
|---|
| | 113 | } |
|---|
| | 114 | extern(C) static void callBackChanged(GMount* mountStruct, MountIF mountIF) |
|---|
| | 115 | { |
|---|
| | 116 | foreach ( void delegate(MountIF) dlg ; mountIF.onChangedListeners ) |
|---|
| | 117 | { |
|---|
| | 118 | dlg(mountIF); |
|---|
| | 119 | } |
|---|
| | 120 | } |
|---|
| | 121 | |
|---|
| | 122 | void delegate(MountIF)[] _onPreUnmountListeners; |
|---|
| | 123 | void delegate(MountIF)[] onPreUnmountListeners() |
|---|
| | 124 | { |
|---|
| | 125 | return _onPreUnmountListeners; |
|---|
| | 126 | } |
|---|
| | 127 | /** |
|---|
| | 128 | * This signal is emitted when the GMount is about to be |
|---|
| | 129 | * unmounted. |
|---|
| | 130 | * Since 2.22 |
|---|
| | 131 | */ |
|---|
| | 132 | void addOnPreUnmount(void delegate(MountIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| | 133 | { |
|---|
| | 134 | if ( !("pre-unmount" in connectedSignals) ) |
|---|
| | 135 | { |
|---|
| | 136 | Signals.connectData( |
|---|
| | 137 | getStruct(), |
|---|
| | 138 | "pre-unmount", |
|---|
| | 139 | cast(GCallback)&callBackPreUnmount, |
|---|
| | 140 | cast(void*)cast(MountIF)this, |
|---|
| | 141 | null, |
|---|
| | 142 | connectFlags); |
|---|
| | 143 | connectedSignals["pre-unmount"] = 1; |
|---|
| | 144 | } |
|---|
| | 145 | _onPreUnmountListeners ~= dlg; |
|---|
| | 146 | } |
|---|
| | 147 | extern(C) static void callBackPreUnmount(GMount* mountStruct, MountIF mountIF) |
|---|
| | 148 | { |
|---|
| | 149 | foreach ( void delegate(MountIF) dlg ; mountIF.onPreUnmountListeners ) |
|---|
| | 150 | { |
|---|
| | 151 | dlg(mountIF); |
|---|
| | 152 | } |
|---|
| | 153 | } |
|---|
| | 154 | |
|---|
| | 155 | void delegate(MountIF)[] _onUnmountedListeners; |
|---|
| | 156 | void delegate(MountIF)[] onUnmountedListeners() |
|---|
| | 157 | { |
|---|
| | 158 | return _onUnmountedListeners; |
|---|
| | 159 | } |
|---|
| | 160 | /** |
|---|
| | 161 | * This signal is emitted when the GMount have been |
|---|
| | 162 | * unmounted. If the recipient is holding references to the |
|---|
| | 163 | * object they should release them so the object can be |
|---|
| | 164 | * finalized. |
|---|
| | 165 | */ |
|---|
| | 166 | void addOnUnmounted(void delegate(MountIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| | 167 | { |
|---|
| | 168 | if ( !("unmounted" in connectedSignals) ) |
|---|
| | 169 | { |
|---|
| | 170 | Signals.connectData( |
|---|
| | 171 | getStruct(), |
|---|
| | 172 | "unmounted", |
|---|
| | 173 | cast(GCallback)&callBackUnmounted, |
|---|
| | 174 | cast(void*)cast(MountIF)this, |
|---|
| | 175 | null, |
|---|
| | 176 | connectFlags); |
|---|
| | 177 | connectedSignals["unmounted"] = 1; |
|---|
| | 178 | } |
|---|
| | 179 | _onUnmountedListeners ~= dlg; |
|---|
| | 180 | } |
|---|
| | 181 | extern(C) static void callBackUnmounted(GMount* mountStruct, MountIF mountIF) |
|---|
| | 182 | { |
|---|
| | 183 | foreach ( void delegate(MountIF) dlg ; mountIF.onUnmountedListeners ) |
|---|
| | 184 | { |
|---|
| | 185 | dlg(mountIF); |
|---|
| | 186 | } |
|---|
| | 187 | } |
|---|
| | 188 | |
|---|
| | 189 | |
|---|
| | 190 | /** |
|---|
| | 191 | * Gets the name of mount. |
|---|
| | 192 | * Returns: the name for the given mount. The returned string should be freed with g_free() when no longer needed. |
|---|
| | 193 | */ |
|---|
| | 194 | public string getName() |
|---|
| | 195 | { |
|---|
| | 196 | // char * g_mount_get_name (GMount *mount); |
|---|
| | 197 | return Str.toString(g_mount_get_name(getMountTStruct())); |
|---|
| | 198 | } |
|---|
| | 199 | |
|---|
| | 200 | /** |
|---|
| | 201 | * Gets the UUID for the mount. The reference is typically based on |
|---|
| | 202 | * the file system UUID for the mount in question and should be |
|---|
| | 203 | * considered an opaque string. Returns NULL if there is no UUID |
|---|
| | 204 | * available. |
|---|
| | 205 | * Returns: the UUID for mount or NULL if no UUID can be computed. The returned string should be freed with g_free() when no longer needed. |
|---|
| | 206 | */ |
|---|
| | 207 | public string getUuid() |
|---|
| | 208 | { |
|---|
| | 209 | // char * g_mount_get_uuid (GMount *mount); |
|---|
| | 210 | return Str.toString(g_mount_get_uuid(getMountTStruct())); |
|---|
| | 211 | } |
|---|
| | 212 | |
|---|
| | 213 | /** |
|---|
| | 214 | * Gets the icon for mount. |
|---|
| | 215 | * Returns: a GIcon. The returned object should be unreffed with g_object_unref() when no longer needed. |
|---|
| | 216 | */ |
|---|
| | 217 | public IconIF getIcon() |
|---|
| | 218 | { |
|---|
| | 219 | // GIcon * g_mount_get_icon (GMount *mount); |
|---|
| | 220 | auto p = g_mount_get_icon(getMountTStruct()); |
|---|
| | 221 | if(p is null) |
|---|
| | 222 | { |
|---|
| | 223 | return null; |
|---|
| | 224 | } |
|---|
| | 225 | return new Icon(cast(GIcon*) p); |
|---|
| | 226 | } |
|---|
| | 227 | |
|---|
| | 228 | /** |
|---|
| | 229 | * Gets the drive for the mount. |
|---|
| | 230 | * This is a convenience method for getting the GVolume and then |
|---|
| | 231 | * using that object to get the GDrive. |
|---|
| | 232 | * Returns: a GDrive or NULL if mount is not associated with a volume or a drive. The returned object should be unreffed with g_object_unref() when no longer needed. |
|---|
| | 233 | */ |
|---|
| | 234 | public DriveIF getDrive() |
|---|
| | 235 | { |
|---|
| | 236 | // GDrive * g_mount_get_drive (GMount *mount); |
|---|
| | 237 | auto p = g_mount_get_drive(getMountTStruct()); |
|---|
| | 238 | if(p is null) |
|---|
| | 239 | { |
|---|
| | 240 | return null; |
|---|
| | 241 | } |
|---|
| | 242 | return new Drive(cast(GDrive*) p); |
|---|
| | 243 | } |
|---|
| | 244 | |
|---|
| | 245 | /** |
|---|
| | 246 | * Gets the root directory on mount. |
|---|
| | 247 | * Returns: a GFile. The returned object should be unreffed with g_object_unref() when no longer needed. |
|---|
| | 248 | */ |
|---|
| | 249 | public File getRoot() |
|---|
| | 250 | { |
|---|
| | 251 | // GFile * g_mount_get_root (GMount *mount); |
|---|
| | 252 | auto p = g_mount_get_root(getMountTStruct()); |
|---|
| | 253 | if(p is null) |
|---|
| | 254 | { |
|---|
| | 255 | return null; |
|---|
| | 256 | } |
|---|
| | 257 | return new File(cast(GFile*) p); |
|---|
| | 258 | } |
|---|
| | 259 | |
|---|
| | 260 | /** |
|---|
| | 261 | * Gets the volume for the mount. |
|---|
| | 262 | * Returns: a GVolume or NULL if mount is not associated with a volume. The returned object should be unreffed with g_object_unref() when no longer needed. |
|---|
| | 263 | */ |
|---|
| | 264 | public VolumeIF getVolume() |
|---|
| | 265 | { |
|---|
| | 266 | // GVolume * g_mount_get_volume (GMount *mount); |
|---|
| | 267 | auto p = g_mount_get_volume(getMountTStruct()); |
|---|
| | 268 | if(p is null) |
|---|
| | 269 | { |
|---|
| | 270 | return null; |
|---|
| | 271 | } |
|---|
| | 272 | return new Volume(cast(GVolume*) p); |
|---|
| | 273 | } |
|---|
| | 274 | |
|---|
| | 275 | /** |
|---|
| | 276 | * Checks if mount can be mounted. |
|---|
| | 277 | * Params: |
|---|
| | 278 | * mount = a GMount. |
|---|
| | 279 | * Returns: TRUE if the mount can be unmounted. |
|---|
| | 280 | */ |
|---|
| | 281 | public int canUnmount() |
|---|
| | 282 | { |
|---|
| | 283 | // gboolean g_mount_can_unmount (GMount *mount); |
|---|
| | 284 | return g_mount_can_unmount(getMountTStruct()); |
|---|
| | 285 | } |
|---|
| | 286 | |
|---|
| | 287 | /** |
|---|
| | 288 | * Warning |
|---|
| | 289 | * g_mount_unmount has been deprecated since version 2.22 and should not be used in newly-written code. Use g_mount_unmount_with_operation() instead. |
|---|
| | 290 | * Unmounts a mount. This is an asynchronous operation, and is |
|---|
| | 291 | * finished by calling g_mount_unmount_finish() with the mount |
|---|
| | 292 | * and GAsyncResult data returned in the callback. |
|---|
| | 293 | * Params: |
|---|
| | 294 | * mount = a GMount. |
|---|
| | 295 | * flags = flags affecting the operation |
|---|
| | 296 | * cancellable = optional GCancellable object, NULL to ignore. |
|---|
| | 297 | * callback = a GAsyncReadyCallback, or NULL. |
|---|
| | 298 | * userData = user data passed to callback. |
|---|
| | 299 | */ |
|---|
| | 300 | public void unmount(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) |
|---|
| | 301 | { |
|---|
| | 302 | // void g_mount_unmount (GMount *mount, GMountUnmountFlags flags, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); |
|---|
| | 303 | g_mount_unmount(getMountTStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); |
|---|
| | 304 | } |
|---|
| | 305 | |
|---|
| | 306 | /** |
|---|
| | 307 | * Warning |
|---|
| | 308 | * g_mount_unmount_finish has been deprecated since version 2.22 and should not be used in newly-written code. Use g_mount_unmount_with_operation_finish() instead. |
|---|
| | 309 | * Finishes unmounting a mount. If any errors occurred during the operation, |
|---|
| | 310 | * error will be set to contain the errors and FALSE will be returned. |
|---|
| | 311 | * Params: |
|---|
| | 312 | * mount = a GMount. |
|---|
| | 313 | * result = a GAsyncResult. |
|---|
| | 314 | * Returns: TRUE if the mount was successfully unmounted. FALSE otherwise. |
|---|
| | 315 | * Throws: GException on failure. |
|---|
| | 316 | */ |
|---|
| | 317 | public int unmountFinish(AsyncResultIF result) |
|---|
| | 318 | { |
|---|
| | 319 | // gboolean g_mount_unmount_finish (GMount *mount, GAsyncResult *result, GError **error); |
|---|
| | 320 | GError* err = null; |
|---|
| | 321 | |
|---|
| | 322 | auto p = g_mount_unmount_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); |
|---|
| | 323 | |
|---|
| | 324 | if (err !is null) |
|---|
| | 325 | { |
|---|
| | 326 | throw new GException( new ErrorG(err) ); |
|---|
| | 327 | } |
|---|
| | 328 | |
|---|
| | 329 | return p; |
|---|
| | 330 | } |
|---|
| | 331 | |
|---|
| | 332 | /** |
|---|
| | 333 | * Unmounts a mount. This is an asynchronous operation, and is |
|---|
| | 334 | * finished by calling g_mount_unmount_with_operation_finish() with the mount |
|---|
| | 335 | * and GAsyncResult data returned in the callback. |
|---|
| | 336 | * Since 2.22 |
|---|
| | 337 | * Params: |
|---|
| | 338 | * mount = a GMount. |
|---|
| | 339 | * flags = flags affecting the operation |
|---|
| | 340 | * mountOperation = a GMountOperation or NULL to avoid user interaction. |
|---|
| | 341 | * cancellable = optional GCancellable object, NULL to ignore. |
|---|
| | 342 | * callback = a GAsyncReadyCallback, or NULL. |
|---|
| | 343 | * userData = user data passed to callback. |
|---|
| | 344 | */ |
|---|
| | 345 | public void unmountWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) |
|---|
| | 346 | { |
|---|
| | 347 | // void g_mount_unmount_with_operation (GMount *mount, GMountUnmountFlags flags, GMountOperation *mount_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); |
|---|
| | 348 | g_mount_unmount_with_operation(getMountTStruct(), flags, (mountOperation is null) ? null : mountOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); |
|---|
| | 349 | } |
|---|
| | 350 | |
|---|
| | 351 | /** |
|---|
| | 352 | * Finishes unmounting a mount. If any errors occurred during the operation, |
|---|
| | 353 | * error will be set to contain the errors and FALSE will be returned. |
|---|
| | 354 | * Since 2.22 |
|---|
| | 355 | * Params: |
|---|
| | 356 | * mount = a GMount. |
|---|
| | 357 | * result = a GAsyncResult. |
|---|
| | 358 | * Returns: TRUE if the mount was successfully unmounted. FALSE otherwise. |
|---|
| | 359 | * Throws: GException on failure. |
|---|
| | 360 | */ |
|---|
| | 361 | public int unmountWithOperationFinish(AsyncResultIF result) |
|---|
| | 362 | { |
|---|
| | 363 | // gboolean g_mount_unmount_with_operation_finish (GMount *mount, GAsyncResult *result, GError **error); |
|---|
| | 364 | GError* err = null; |
|---|
| | 365 | |
|---|
| | 366 | auto p = g_mount_unmount_with_operation_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); |
|---|
| | 367 | |
|---|
| | 368 | if (err !is null) |
|---|
| | 369 | { |
|---|
| | 370 | throw new GException( new ErrorG(err) ); |
|---|
| | 371 | } |
|---|
| | 372 | |
|---|
| | 373 | return p; |
|---|
| | 374 | } |
|---|
| | 375 | |
|---|
| | 376 | /** |
|---|
| | 377 | * Remounts a mount. This is an asynchronous operation, and is |
|---|
| | 378 | * finished by calling g_mount_remount_finish() with the mount |
|---|
| | 379 | * and GAsyncResults data returned in the callback. |
|---|
| | 380 | * Remounting is useful when some setting affecting the operation |
|---|
| | 381 | * of the volume has been changed, as these may need a remount to |
|---|
| | 382 | * take affect. While this is semantically equivalent with unmounting |
|---|
| | 383 | * and then remounting not all backends might need to actually be |
|---|
| | 384 | * unmounted. |
|---|
| | 385 | * Params: |
|---|
| | 386 | * mount = a GMount. |
|---|
| | 387 | * flags = flags affecting the operation |
|---|
| | 388 | * mountOperation = a GMountOperation or NULL to avoid user interaction. |
|---|
| | 389 | * cancellable = optional GCancellable object, NULL to ignore. |
|---|
| | 390 | * callback = a GAsyncReadyCallback, or NULL. |
|---|
| | 391 | * userData = user data passed to callback. |
|---|
| | 392 | */ |
|---|
| | 393 | public void remount(GMountMountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) |
|---|
| | 394 | { |
|---|
| | 395 | // void g_mount_remount (GMount *mount, GMountMountFlags flags, GMountOperation *mount_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); |
|---|
| | 396 | g_mount_remount(getMountTStruct(), flags, (mountOperation is null) ? null : mountOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); |
|---|
| | 397 | } |
|---|
| | 398 | |
|---|
| | 399 | /** |
|---|
| | 400 | * Finishes remounting a mount. If any errors occurred during the operation, |
|---|
| | 401 | * error will be set to contain the errors and FALSE will be returned. |
|---|
| | 402 | * Params: |
|---|
| | 403 | * mount = a GMount. |
|---|
| | 404 | * result = a GAsyncResult. |
|---|
| | 405 | * Returns: TRUE if the mount was successfully remounted. FALSE otherwise. |
|---|
| | 406 | * Throws: GException on failure. |
|---|
| | 407 | */ |
|---|
| | 408 | public int remountFinish(AsyncResultIF result) |
|---|
| | 409 | { |
|---|
| | 410 | // gboolean g_mount_remount_finish (GMount *mount, GAsyncResult *result, GError **error); |
|---|
| | 411 | GError* err = null; |
|---|
| | 412 | |
|---|
| | 413 | auto p = g_mount_remount_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); |
|---|
| | 414 | |
|---|
| | 415 | if (err !is null) |
|---|
| | 416 | { |
|---|
| | 417 | throw new GException( new ErrorG(err) ); |
|---|
| | 418 | } |
|---|
| | 419 | |
|---|
| | 420 | return p; |
|---|
| | 421 | } |
|---|
| | 422 | |
|---|
| | 423 | /** |
|---|
| | 424 | * Checks if mount can be eject. |
|---|
| | 425 | * Returns: TRUE if the mount can be ejected. |
|---|
| | 426 | */ |
|---|
| | 427 | public int canEject() |
|---|
| | 428 | { |
|---|
| | 429 | // gboolean g_mount_can_eject (GMount *mount); |
|---|
| | 430 | return g_mount_can_eject(getMountTStruct()); |
|---|
| | 431 | } |
|---|
| | 432 | |
|---|
| | 433 | /** |
|---|
| | 434 | * Warning |
|---|
| | 435 | * g_mount_eject has been deprecated since version 2.22 and should not be used in newly-written code. Use g_mount_eject_with_operation() instead. |
|---|
| | 436 | * Ejects a mount. This is an asynchronous operation, and is |
|---|
| | 437 | * finished by calling g_mount_eject_finish() with the mount |
|---|
| | 438 | * and GAsyncResult data returned in the callback. |
|---|
| | 439 | * Params: |
|---|
| | 440 | * mount = a GMount. |
|---|
| | 441 | * flags = flags affecting the unmount if required for eject |
|---|
| | 442 | * cancellable = optional GCancellable object, NULL to ignore. |
|---|
| | 443 | * callback = a GAsyncReadyCallback, or NULL. |
|---|
| | 444 | * userData = user data passed to callback. |
|---|
| | 445 | */ |
|---|
| | 446 | public void eject(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) |
|---|
| | 447 | { |
|---|
| | 448 | // void g_mount_eject (GMount *mount, GMountUnmountFlags flags, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); |
|---|
| | 449 | g_mount_eject(getMountTStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); |
|---|
| | 450 | } |
|---|
| | 451 | |
|---|
| | 452 | /** |
|---|
| | 453 | * Warning |
|---|
| | 454 | * g_mount_eject_finish has been deprecated since version 2.22 and should not be used in newly-written code. Use g_mount_eject_with_operation_finish() instead. |
|---|
| | 455 | * Finishes ejecting a mount. If any errors occurred during the operation, |
|---|
| | 456 | * error will be set to contain the errors and FALSE will be returned. |
|---|
| | 457 | * Params: |
|---|
| | 458 | * result = a GAsyncResult. |
|---|
| | 459 | * Returns: TRUE if the mount was successfully ejected. FALSE otherwise. |
|---|
| | 460 | * Throws: GException on failure. |
|---|
| | 461 | */ |
|---|
| | 462 | public int ejectFinish(AsyncResultIF result) |
|---|
| | 463 | { |
|---|
| | 464 | // gboolean g_mount_eject_finish (GMount *mount, GAsyncResult *result, GError **error); |
|---|
| | 465 | GError* err = null; |
|---|
| | 466 | |
|---|
| | 467 | auto p = g_mount_eject_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); |
|---|
| | 468 | |
|---|
| | 469 | if (err !is null) |
|---|
| | 470 | { |
|---|
| | 471 | throw new GException( new ErrorG(err) ); |
|---|
| | 472 | } |
|---|
| | 473 | |
|---|
| | 474 | return p; |
|---|
| | 475 | } |
|---|
| | 476 | |
|---|
| | 477 | /** |
|---|
| | 478 | * Ejects a mount. This is an asynchronous operation, and is |
|---|
| | 479 | * finished by calling g_mount_eject_with_operation_finish() with the mount |
|---|
| | 480 | * and GAsyncResult data returned in the callback. |
|---|
| | 481 | * Since 2.22 |
|---|
| | 482 | * Params: |
|---|
| | 483 | * mount = a GMount. |
|---|
| | 484 | * flags = flags affecting the unmount if required for eject |
|---|
| | 485 | * mountOperation = a GMountOperation or NULL to avoid user interaction. |
|---|
| | 486 | * cancellable = optional GCancellable object, NULL to ignore. |
|---|
| | 487 | * callback = a GAsyncReadyCallback, or NULL. |
|---|
| | 488 | * userData = user data passed to callback. |
|---|
| | 489 | */ |
|---|
| | 490 | public void ejectWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) |
|---|
| | 491 | { |
|---|
| | 492 | // void g_mount_eject_with_operation (GMount *mount, GMountUnmountFlags flags, GMountOperation *mount_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); |
|---|
| | 493 | g_mount_eject_with_operation(getMountTStruct(), flags, (mountOperation is null) ? null : mountOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); |
|---|
| | 494 | } |
|---|
| | 495 | |
|---|
| | 496 | /** |
|---|
| | 497 | * Finishes ejecting a mount. If any errors occurred during the operation, |
|---|
| | 498 | * error will be set to contain the errors and FALSE will be returned. |
|---|
| | 499 | * Since 2.22 |
|---|
| | 500 | * Params: |
|---|
| | 501 | * result = a GAsyncResult. |
|---|
| | 502 | * Returns: TRUE if the mount was successfully ejected. FALSE otherwise. |
|---|
| | 503 | * Throws: GException on failure. |
|---|
| | 504 | */ |
|---|
| | 505 | public int ejectWithOperationFinish(AsyncResultIF result) |
|---|
| | 506 | { |
|---|
| | 507 | // gboolean g_mount_eject_with_operation_finish (GMount *mount, GAsyncResult *result, GError **error); |
|---|
| | 508 | GError* err = null; |
|---|
| | 509 | |
|---|
| | 510 | auto p = g_mount_eject_with_operation_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); |
|---|
| | 511 | |
|---|
| | 512 | if (err !is null) |
|---|
| | 513 | { |
|---|
| | 514 | throw new GException( new ErrorG(err) ); |
|---|
| | 515 | } |
|---|
| | 516 | |
|---|
| | 517 | return p; |
|---|
| | 518 | } |
|---|
| | 519 | |
|---|
| | 520 | /** |
|---|
| | 521 | * Tries to guess the type of content stored on mount. Returns one or |
|---|
| | 522 | * more textual identifiers of well-known content types (typically |
|---|
| | 523 | * prefixed with "x-content/"), e.g. x-content/image-dcf for camera |
|---|
| | 524 | * memory cards. See the shared-mime-info |
|---|
| | 525 | * specification for more on x-content types. |
|---|
| | 526 | * This is an asynchronous operation (see |
|---|
| | 527 | * g_mount_guess_content_type_sync() for the synchronous version), and |
|---|
| | 528 | * is finished by calling g_mount_guess_content_type_finish() with the |
|---|
| | 529 | * mount and GAsyncResult data returned in the callback. |
|---|
| | 530 | * Since 2.18 |
|---|
| | 531 | * Params: |
|---|
| | 532 | * forceRescan = Whether to force a rescan of the content. |
|---|
| | 533 | * Otherwise a cached result will be used if available |
|---|
| | 534 | * cancellable = optional GCancellable object, NULL to ignore |
|---|
| | 535 | * callback = a GAsyncReadyCallback |
|---|
| | 536 | * userData = user data passed to callback |
|---|
| | 537 | */ |
|---|
| | 538 | public void guessContentType(int forceRescan, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) |
|---|
| | 539 | { |
|---|
| | 540 | // void g_mount_guess_content_type (GMount *mount, gboolean force_rescan, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); |
|---|
| | 541 | g_mount_guess_content_type(getMountTStruct(), forceRescan, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); |
|---|
| | 542 | } |
|---|
| | 543 | |
|---|
| | 544 | /** |
|---|
| | 545 | * Finishes guessing content types of mount. If any errors occured |
|---|
| | 546 | * during the operation, error will be set to contain the errors and |
|---|
| | 547 | * FALSE will be returned. In particular, you may get an |
|---|
| | 548 | * G_IO_ERROR_NOT_SUPPORTED if the mount does not support content |
|---|
| | 549 | * guessing. |
|---|
| | 550 | * Since 2.18 |
|---|
| | 551 | * Params: |
|---|
| | 552 | * result = a GAsyncResult |
|---|
| | 553 | * Returns: a NULL-terminated array of content types or NULL on error. Caller should free this array with g_strfreev() when done with it. |
|---|
| | 554 | * Throws: GException on failure. |
|---|
| | 555 | */ |
|---|
| | 556 | public string[] guessContentTypeFinish(AsyncResultIF result) |
|---|
| | 557 | { |
|---|
| | 558 | // gchar ** g_mount_guess_content_type_finish (GMount *mount, GAsyncResult *result, GError **error); |
|---|
| | 559 | GError* err = null; |
|---|
| | 560 | |
|---|
| | 561 | auto p = Str.toStringArray(g_mount_guess_content_type_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err)); |
|---|
| | 562 | |
|---|
| | 563 | if (err !is null) |
|---|
| | 564 | { |
|---|
| | 565 | throw new GException( new ErrorG(err) ); |
|---|
| | 566 | } |
|---|
| | 567 | |
|---|
| | 568 | return p; |
|---|
| | 569 | } |
|---|
| | 570 | |
|---|
| | 571 | /** |
|---|
| | 572 | * Tries to guess the type of content stored on mount. Returns one or |
|---|
| | 573 | * more textual identifiers of well-known content types (typically |
|---|
| | 574 | * prefixed with "x-content/"), e.g. x-content/image-dcf for camera |
|---|
| | 575 | * memory cards. See the shared-mime-info |
|---|
| | 576 | * specification for more on x-content types. |
|---|
| | 577 | * This is an synchronous operation and as such may block doing IO; |
|---|
| | 578 | * see g_mount_guess_content_type() for the asynchronous version. |
|---|
| | 579 | * Since 2.18 |
|---|
| | 580 | * Params: |
|---|
| | 581 | * forceRescan = Whether to force a rescan of the content. |
|---|
| | 582 | * Otherwise a cached result will be used if available |
|---|
| | 583 | * cancellable = optional GCancellable object, NULL to ignore |
|---|
| | 584 | * Returns: a NULL-terminated array of content types or NULL on error. Caller should free this array with g_strfreev() when done with it. |
|---|
| | 585 | * Throws: GException on failure. |
|---|
| | 586 | */ |
|---|
| | 587 | public string[] guessContentTypeSync(int forceRescan, Cancellable cancellable) |
|---|
| | 588 | { |
|---|
| | 589 | // gchar ** g_mount_guess_content_type_sync (GMount *mount, gboolean force_rescan, GCancellable *cancellable, GError **error); |
|---|
| | 590 | GError* err = null; |
|---|
| | 591 | |
|---|
| | 592 | auto p = Str.toStringArray(g_mount_guess_content_type_sync(getMountTStruct(), forceRescan, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err)); |
|---|
| | 593 | |
|---|
| | 594 | if (err !is null) |
|---|
| | 595 | { |
|---|
| | 596 | throw new GException( new ErrorG(err) ); |
|---|
| | 597 | } |
|---|
| | 598 | |
|---|
| | 599 | return p; |
|---|
| | 600 | } |
|---|
| | 601 | |
|---|
| | 602 | /** |
|---|
| | 603 | * Determines if mount is shadowed. Applications or libraries should |
|---|
| | 604 | * avoid displaying mount in the user interface if it is shadowed. |
|---|
| | 605 | * A mount is said to be shadowed if there exists one or more user |
|---|
| | 606 | * visible objects (currently GMount objects) with a root that is |
|---|
| | 607 | * inside the root of mount. |
|---|
| | 608 | * One application of shadow mounts is when exposing a single file |
|---|
| | 609 | * system that is used to address several logical volumes. In this |
|---|
| | 610 | * situation, a GVolumeMonitor implementation would create two |
|---|
| | 611 | * GVolume objects (for example, one for the camera functionality of |
|---|
| | 612 | * the device and one for a SD card reader on the device) with |
|---|
| | 613 | * activation URIs gphoto2://[usb:001,002]/store1/ |
|---|
| | 614 | * and gphoto2://[usb:001,002]/store2/. When the |
|---|
| | 615 | * underlying mount (with root |
|---|
| | 616 | * gphoto2://[usb:001,002]/) is mounted, said |
|---|
| | 617 | * GVolumeMonitor implementation would create two GMount objects |
|---|
| | 618 | * (each with their root matching the corresponding volume activation |
|---|
| | 619 | * root) that would shadow the original mount. |
|---|
| | 620 | * The proxy monitor in GVfs 2.26 and later, automatically creates and |
|---|
| | 621 | * manage shadow mounts (and shadows the underlying mount) if the |
|---|
| | 622 | * activation root on a GVolume is set. |
|---|
| | 623 | * Since 2.20 |
|---|
| | 624 | * Returns: TRUE if mount is shadowed. |
|---|
| | 625 | */ |
|---|
| | 626 | public int isShadowed() |
|---|
| | 627 | { |
|---|
| | 628 | // gboolean g_mount_is_shadowed (GMount *mount); |
|---|
| | 629 | return g_mount_is_shadowed(getMountTStruct()); |
|---|
| | 630 | } |
|---|
| | 631 | |
|---|
| | 632 | /** |
|---|
| | 633 | * Increments the shadow count on mount. Usually used by |
|---|
| | 634 | * GVolumeMonitor implementations when creating a shadow mount for |
|---|
| | 635 | * mount, see g_mount_is_shadowed() for more information. The caller |
|---|
| | 636 | * will need to emit the "changed" signal on mount manually. |
|---|
| | 637 | * Since 2.20 |
|---|
| | 638 | */ |
|---|
| | 639 | public void shadow() |
|---|
| | 640 | { |
|---|
| | 641 | // void g_mount_shadow (GMount *mount); |
|---|
| | 642 | g_mount_shadow(getMountTStruct()); |
|---|
| | 643 | } |
|---|
| | 644 | |
|---|
| | 645 | /** |
|---|
| | 646 | * Decrements the shadow count on mount. Usually used by |
|---|
| | 647 | * GVolumeMonitor implementations when destroying a shadow mount for |
|---|
| | 648 | * mount, see g_mount_is_shadowed() for more information. The caller |
|---|
| | 649 | * will need to emit the "changed" signal on mount manually. |
|---|
| | 650 | * Since 2.20 |
|---|
| | 651 | * Signal Details |
|---|
| | 652 | * The "changed" signal |
|---|
| | 653 | * void user_function (GMount *mount, |
|---|
| | 654 | * gpointer user_data) : Run Last |
|---|
| | 655 | * Emitted when the mount has been changed. |
|---|
| | 656 | */ |
|---|
| | 657 | public void unshadow() |
|---|
| | 658 | { |
|---|
| | 659 | // void g_mount_unshadow (GMount *mount); |
|---|
| | 660 | g_mount_unshadow(getMountTStruct()); |
|---|
| | 661 | } |
|---|
| | 662 | // MANUAL TEMPLATE |
|---|