+2007-12-20 Alexander Larsson <alexl@redhat.com>
+
+ * gfile.[ch]:
+ * gdrive.[ch]:
+ * gmount.[ch]:
+ * gvolume.[ch]:
+ * gunixmount.c:
+ * gunixvolume.c:
+ * gio.symbols:
+ Add GMountUnmountFlags to all unmount and
+ eject calls.
+ Add g_mount_remount() call.
+
2007-12-20 Alexander Larsson <alexl@redhat.com>
* gvfs.c (get_default_vfs):
/**
* g_drive_eject:
* @drive: a #GDrive.
+ * @flags: flags affecting the unmount if required for eject
* @cancellable: optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback.
* @user_data: a #gpointer.
**/
void
g_drive_eject (GDrive *drive,
+ GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
return;
}
- (* iface->eject) (drive, cancellable, callback, user_data);
+ (* iface->eject) (drive, flags, cancellable, callback, user_data);
}
/**
gboolean (*can_eject) (GDrive *drive);
gboolean (*can_poll_for_media) (GDrive *drive);
void (*eject) (GDrive *drive,
+ GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean g_drive_can_poll_for_media (GDrive *drive);
gboolean g_drive_can_eject (GDrive *drive);
void g_drive_eject (GDrive *drive,
+ GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
/**
* g_file_unmount_mountable:
* @file: input #GFile.
+ * @flags: flags affecting the operation
* @cancellable: optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function
**/
void
g_file_unmount_mountable (GFile *file,
+ GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
_("Operation not supported"));
(* iface->unmount_mountable) (file,
+ flags,
cancellable,
callback,
user_data);
/**
* g_file_eject_mountable:
* @file: input #GFile.
+ * @flags: flags affecting the operation
* @cancellable: optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: the data to pass to callback function
**/
void
g_file_eject_mountable (GFile *file,
+ GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
_("Operation not supported"));
(* iface->eject_mountable) (file,
+ flags,
cancellable,
callback,
user_data);
G_FILE_CREATE_PRIVATE = (1<<0)
} GFileCreateFlags;
+/**
+ * GMountUnmountFlags:
+ * @G_MOUNT_UNMOUNT_NONE: No flags set.
+ * @G_MOUNT_UNMOUNT_FORCE: Unmount even if there are outstanding
+ * file operations on the mount.
+ *
+ * Flags used when an operation may create a file.
+ */
+typedef enum {
+ G_MOUNT_UNMOUNT_NONE = 0,
+ G_MOUNT_UNMOUNT_FORCE = (1<<0)
+} GMountUnmountFlags;
+
/**
* GFileCopyFlags:
* @G_FILE_COPY_NONE: No flags set.
GAsyncResult *result,
GError **error);
void (*unmount_mountable) (GFile *file,
+ GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GAsyncResult *result,
GError **error);
void (*eject_mountable) (GFile *file,
+ GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GAsyncResult *result,
GError **error);
void g_file_unmount_mountable (GFile *file,
+ GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GAsyncResult *result,
GError **error);
void g_file_eject_mountable (GFile *file,
+ GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
g_mount_unmount_finish
g_mount_eject
g_mount_eject_finish
+g_mount_remount
+g_mount_remount_finish
#endif
#endif
#if IN_HEADER(__GIO_ENUM_TYPES_H__)
#if IN_FILE(__GIO_ENUM_TYPES_C__)
+g_mount_unmount_flags_get_type G_GNUC_CONST
g_app_info_create_flags_get_type G_GNUC_CONST
g_data_stream_byte_order_get_type G_GNUC_CONST
g_data_stream_newline_type_get_type G_GNUC_CONST
/**
* g_mount_unmount:
* @mount: a #GMount.
+ * @flags: flags affecting the operation
* @cancellable: optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback.
* @user_data: user data passed to @callback.
* and #GAsyncResults data returned in the @callback.
**/
void
-g_mount_unmount (GMount *mount,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_mount_unmount (GMount *mount,
+ GMountUnmountFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GMountIface *iface;
return;
}
- (* iface->unmount) (mount, cancellable, callback, user_data);
+ (* iface->unmount) (mount, flags, cancellable, callback, user_data);
}
/**
/**
* g_mount_eject:
* @mount: a #GMount.
+ * @flags: flags affecting the unmount if required for eject
* @cancellable: optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback.
* @user_data: user data passed to @callback.
* and #GAsyncResults data returned in the @callback.
**/
void
-g_mount_eject (GMount *mount,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_mount_eject (GMount *mount,
+ GMountUnmountFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GMountIface *iface;
return;
}
- (* iface->eject) (mount, cancellable, callback, user_data);
+ (* iface->eject) (mount, flags, cancellable, callback, user_data);
}
/**
return (* iface->eject_finish) (mount, result, error);
}
+/**
+ * g_mount_remount:
+ * @mount: a #GMount.
+ * @mount_operation: a #GMountOperation or %NULL to avoid user interaction.
+ * @cancellable: optional #GCancellable object, %NULL to ignore.
+ * @callback: a #GAsyncReadyCallback.
+ * @user_data: user data passed to @callback.
+ *
+ * Remounts a mount. This is an asynchronous operation, and is
+ * finished by calling g_mount_unmount_finish() with the @mount
+ * and #GAsyncResults data returned in the @callback.
+ *
+ * Remounting is useful when some setting affecting the operation
+ * of the volume has been changed, as these may need a remount to
+ * take affect. While this is semantically equivalent with unmounting
+ * and then remounting not all backends might need to actually be
+ * unmounted.
+ **/
+void
+g_mount_remount (GMount *mount,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GMountIface *iface;
+
+ g_return_if_fail (G_IS_MOUNT (mount));
+
+ iface = G_MOUNT_GET_IFACE (mount);
+
+ if (iface->remount == NULL)
+ {
+ g_simple_async_report_error_in_idle (G_OBJECT (mount),
+ callback, user_data,
+ G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+ _("mount doesn't implement remount"));
+
+ return;
+ }
+
+ (* iface->remount) (mount, mount_operation, cancellable, callback, user_data);
+}
+
+/**
+ * g_mount_remount_finish:
+ * @mount: a #GMount.
+ * @result: a #GAsyncResult.
+ * @error: a #GError location to store the error occuring, or %NULL to
+ * ignore.
+ *
+ * Finishes remounting a mount. If any errors occured during the operation,
+ * @error will be set to contain the errors and %FALSE will be returned.
+ *
+ * Returns: %TRUE if the mount was successfully remounted. %FALSE otherwise.
+ **/
+gboolean
+g_mount_remount_finish (GMount *mount,
+ GAsyncResult *result,
+ GError **error)
+{
+ GMountIface *iface;
+
+ g_return_val_if_fail (G_IS_MOUNT (mount), FALSE);
+ g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
+
+ if (G_IS_SIMPLE_ASYNC_RESULT (result))
+ {
+ GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
+ if (g_simple_async_result_propagate_error (simple, error))
+ return FALSE;
+ }
+
+ iface = G_MOUNT_GET_IFACE (mount);
+ return (* iface->remount_finish) (mount, result, error);
+}
+
+
#define __G_MOUNT_C__
#include "gioaliasdef.c"
gboolean (*can_unmount) (GMount *mount);
gboolean (*can_eject) (GMount *mount);
void (*unmount) (GMount *mount,
+ GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GAsyncResult *result,
GError **error);
void (*eject) (GMount *mount,
+ GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (*eject_finish) (GMount *mount,
GAsyncResult *result,
GError **error);
+ void (*remount) (GMount *mount,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (*remount_finish) (GMount *mount,
+ GAsyncResult *result,
+ GError **error);
};
GType g_mount_get_type (void) G_GNUC_CONST;
gboolean g_mount_can_unmount (GMount *mount);
gboolean g_mount_can_eject (GMount *mount);
void g_mount_unmount (GMount *mount,
+ GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GAsyncResult *result,
GError **error);
void g_mount_eject (GMount *mount,
+ GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean g_mount_eject_finish (GMount *mount,
GAsyncResult *result,
GError **error);
+void g_mount_remount (GMount *mount,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean g_mount_remount_finish (GMount *mount,
+ GAsyncResult *result,
+ GError **error);
G_END_DECLS
static void
g_unix_mount_unmount (GMount *mount,
+ GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
static void
g_unix_mount_eject (GMount *mount,
+ GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
static void
g_unix_volume_eject (GVolume *volume,
+ GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
/**
* g_volume_eject:
* @volume: a #GVolume.
+ * @flags: flags affecting the unmount if required for eject
* @cancellable: optional #GCancellable object, %NULL to ignore.
* @callback: a #GAsyncReadyCallback.
* @user_data: a #gpointer.
**/
void
g_volume_eject (GVolume *volume,
+ GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
return;
}
- (* iface->eject) (volume, cancellable, callback, user_data);
+ (* iface->eject) (volume, flags, cancellable, callback, user_data);
}
/**
GAsyncResult *result,
GError **error);
void (*eject) (GVolume *volume,
+ GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GAsyncResult *result,
GError **error);
void g_volume_eject (GVolume *volume,
+ GMountUnmountFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);