109
109
* take a very long time to finish, and blocking may leave an application
110
110
* unusable. Notable cases include:
111
111
* g_file_mount_mountable() to mount a mountable file.
112
* g_file_unmount_mountable() to unmount a mountable file.
113
* g_file_eject_mountable() to eject a mountable file.
112
* g_file_unmount_mountable_with_operation() to unmount a mountable file.
113
* g_file_eject_mountable_with_operation() to eject a mountable file.
115
115
* <para id="gfile-etag"><indexterm><primary>entity tag</primary></indexterm>
116
116
* One notable feature of #GFile<!-- -->s are entity tags, or "etags" for
4239
* g_file_unmount_mountable_with_operation:
4240
* @file: input #GFile.
4241
* @flags: flags affecting the operation
4242
* @mount_operation: a #GMountOperation, or %NULL to avoid user interaction.
4243
* @cancellable: optional #GCancellable object, %NULL to ignore.
4244
* @callback: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
4245
* @user_data: the data to pass to callback function
4247
* Unmounts a file of type G_FILE_TYPE_MOUNTABLE.
4249
* If @cancellable is not %NULL, then the operation can be cancelled by
4250
* triggering the cancellable object from another thread. If the operation
4251
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
4253
* When the operation is finished, @callback will be called. You can then call
4254
* g_file_unmount_mountable_finish() to get the result of the operation.
4259
g_file_unmount_mountable_with_operation (GFile *file,
4260
GMountUnmountFlags flags,
4261
GMountOperation *mount_operation,
4262
GCancellable *cancellable,
4263
GAsyncReadyCallback callback,
4268
g_return_if_fail (G_IS_FILE (file));
4270
iface = G_FILE_GET_IFACE (file);
4272
if (iface->unmount_mountable == NULL && iface->unmount_mountable_with_operation == NULL)
4274
g_simple_async_report_error_in_idle (G_OBJECT (file),
4278
G_IO_ERROR_NOT_SUPPORTED,
4279
_("Operation not supported"));
4283
if (iface->unmount_mountable_with_operation != NULL)
4284
(* iface->unmount_mountable_with_operation) (file,
4291
(* iface->unmount_mountable) (file,
4299
* g_file_unmount_mountable_with_operation_finish:
4300
* @file: input #GFile.
4301
* @result: a #GAsyncResult.
4302
* @error: a #GError, or %NULL
4304
* Finishes an unmount operation, see g_file_unmount_mountable_with_operation() for details.
4306
* Finish an asynchronous unmount operation that was started
4307
* with g_file_unmount_mountable_with_operation().
4309
* Returns: %TRUE if the operation finished successfully. %FALSE
4315
g_file_unmount_mountable_with_operation_finish (GFile *file,
4316
GAsyncResult *result,
4321
g_return_val_if_fail (G_IS_FILE (file), FALSE);
4322
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
4324
if (G_IS_SIMPLE_ASYNC_RESULT (result))
4326
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
4327
if (g_simple_async_result_propagate_error (simple, error))
4331
iface = G_FILE_GET_IFACE (file);
4332
if (iface->unmount_mountable_with_operation_finish != NULL)
4333
return (* iface->unmount_mountable_with_operation_finish) (file, result, error);
4335
return (* iface->unmount_mountable_finish) (file, result, error);
4235
4339
* g_file_eject_mountable:
4236
4340
* @file: input #GFile.
4237
4341
* @flags: flags affecting the operation
4424
* g_file_eject_mountable_with_operation:
4425
* @file: input #GFile.
4426
* @flags: flags affecting the operation
4427
* @mount_operation: a #GMountOperation, or %NULL to avoid user interaction.
4428
* @cancellable: optional #GCancellable object, %NULL to ignore.
4429
* @callback: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
4430
* @user_data: the data to pass to callback function
4432
* Starts an asynchronous eject on a mountable.
4433
* When this operation has completed, @callback will be called with
4434
* @user_user data, and the operation can be finalized with
4435
* g_file_eject_mountable_with_operation_finish().
4437
* If @cancellable is not %NULL, then the operation can be cancelled by
4438
* triggering the cancellable object from another thread. If the operation
4439
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
4444
g_file_eject_mountable_with_operation (GFile *file,
4445
GMountUnmountFlags flags,
4446
GMountOperation *mount_operation,
4447
GCancellable *cancellable,
4448
GAsyncReadyCallback callback,
4453
g_return_if_fail (G_IS_FILE (file));
4455
iface = G_FILE_GET_IFACE (file);
4457
if (iface->eject_mountable == NULL && iface->eject_mountable_with_operation == NULL)
4459
g_simple_async_report_error_in_idle (G_OBJECT (file),
4463
G_IO_ERROR_NOT_SUPPORTED,
4464
_("Operation not supported"));
4468
if (iface->eject_mountable_with_operation != NULL)
4469
(* iface->eject_mountable_with_operation) (file,
4476
(* iface->eject_mountable) (file,
4484
* g_file_eject_mountable_with_operation_finish:
4485
* @file: input #GFile.
4486
* @result: a #GAsyncResult.
4487
* @error: a #GError, or %NULL
4489
* Finishes an asynchronous eject operation started by
4490
* g_file_eject_mountable_with_operation().
4492
* Returns: %TRUE if the @file was ejected successfully. %FALSE
4498
g_file_eject_mountable_with_operation_finish (GFile *file,
4499
GAsyncResult *result,
4504
g_return_val_if_fail (G_IS_FILE (file), FALSE);
4505
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
4507
if (G_IS_SIMPLE_ASYNC_RESULT (result))
4509
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
4510
if (g_simple_async_result_propagate_error (simple, error))
4514
iface = G_FILE_GET_IFACE (file);
4515
if (iface->eject_mountable_with_operation_finish != NULL)
4516
return (* iface->eject_mountable_with_operation_finish) (file, result, error);
4518
return (* iface->eject_mountable_finish) (file, result, error);
4316
4522
* g_file_monitor_directory:
4317
4523
* @file: input #GFile.
4318
4524
* @flags: a set of #GFileMonitorFlags.
6751
6960
return (* iface->stop_mountable_finish) (file, result, error);
6964
* g_file_poll_mountable:
6965
* @file: input #GFile.
6966
* @cancellable: optional #GCancellable object, %NULL to ignore.
6967
* @callback: a #GAsyncReadyCallback to call when the request is satisfied, or %NULL.
6968
* @user_data: the data to pass to callback function
6970
* Polls a file of type G_FILE_TYPE_MOUNTABLE.
6972
* If @cancellable is not %NULL, then the operation can be cancelled by
6973
* triggering the cancellable object from another thread. If the operation
6974
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
6976
* When the operation is finished, @callback will be called. You can then call
6977
* g_file_mount_mountable_finish() to get the result of the operation.
6982
g_file_poll_mountable (GFile *file,
6983
GCancellable *cancellable,
6984
GAsyncReadyCallback callback,
6989
g_return_if_fail (G_IS_FILE (file));
6991
iface = G_FILE_GET_IFACE (file);
6993
if (iface->poll_mountable == NULL)
6995
g_simple_async_report_error_in_idle (G_OBJECT (file),
6999
G_IO_ERROR_NOT_SUPPORTED,
7000
_("Operation not supported"));
7004
(* iface->poll_mountable) (file,
7011
* g_file_poll_mountable_finish:
7012
* @file: input #GFile.
7013
* @result: a #GAsyncResult.
7014
* @error: a #GError, or %NULL
7016
* Finishes a poll operation. See g_file_poll_mountable() for details.
7018
* Finish an asynchronous poll operation that was polled
7019
* with g_file_poll_mountable().
7021
* Returns: %TRUE if the operation finished successfully. %FALSE
7027
g_file_poll_mountable_finish (GFile *file,
7028
GAsyncResult *result,
7033
g_return_val_if_fail (G_IS_FILE (file), FALSE);
7034
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
7036
if (G_IS_SIMPLE_ASYNC_RESULT (result))
7038
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
7039
if (g_simple_async_result_propagate_error (simple, error))
7043
iface = G_FILE_GET_IFACE (file);
7044
return (* iface->poll_mountable_finish) (file, result, error);
7048
* g_file_supports_thread_contexts:
7051
* Checks if @file supports <link
7052
* linkend="g-main-context-push-thread-default-context">thread-default
7053
* contexts</link>. If this returns %FALSE, you cannot perform
7054
* asynchronous operations on @file in a thread that has a
7055
* thread-default context.
7057
* Returns: Whether or not @file supports thread-default contexts.
7062
g_file_supports_thread_contexts (GFile *file)
7066
g_return_val_if_fail (G_IS_FILE (file), FALSE);
7068
iface = G_FILE_GET_IFACE (file);
7069
return iface->supports_thread_contexts;
6754
7072
#define __G_FILE_C__
6755
7073
#include "gioaliasdef.c"