[gtksourceview/wip/loader-saver] File and FileSaver: fixes
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/loader-saver] File and FileSaver: fixes
- Date: Sat, 21 Dec 2013 22:43:29 +0000 (UTC)
commit df935f7ee6fc11e41a6ffcd68064a4d58bbde63d
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Dec 21 23:39:52 2013 +0100
File and FileSaver: fixes
The unit tests pass for me, but not all unit tests can be run. Remote
files can not be mounted, even on localhost.
gtksourceview/gtksourcefile.c | 3 ++-
gtksourceview/gtksourcefilesaver.c | 8 ++++++--
gtksourceview/gtksourcefilesaver.h | 2 ++
tests/test-file-saver.c | 4 ++++
4 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/gtksourceview/gtksourcefile.c b/gtksourceview/gtksourcefile.c
index 456ec41..17e316f 100644
--- a/gtksourceview/gtksourcefile.c
+++ b/gtksourceview/gtksourcefile.c
@@ -447,6 +447,7 @@ gtk_source_file_save_async (GtkSourceFile *file,
file->priv->ensure_trailing_newline);
gtk_source_file_saver_save_async (file->priv->saver,
+ file,
io_priority,
NULL,
cancellable,
@@ -467,7 +468,7 @@ gtk_source_file_save_finish (GtkSourceFile *file,
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
g_return_val_if_fail (file->priv->saver != NULL, FALSE);
- ok = gtk_source_file_saver_save_finish (file->priv->saver, result, error);
+ ok = gtk_source_file_saver_save_finish (file->priv->saver, file, result, error);
g_clear_object (&file->priv->saver);
diff --git a/gtksourceview/gtksourcefilesaver.c b/gtksourceview/gtksourcefilesaver.c
index b6449a4..940c1aa 100644
--- a/gtksourceview/gtksourcefilesaver.c
+++ b/gtksourceview/gtksourcefilesaver.c
@@ -933,6 +933,7 @@ gtk_source_file_saver_set_mount_operation_factory (GtkSourceFileSaver
void
gtk_source_file_saver_save_async (GtkSourceFileSaver *saver,
+ GtkSourceFile *file,
gint io_priority,
GTimeVal *old_mtime,
GCancellable *cancellable,
@@ -942,9 +943,10 @@ gtk_source_file_saver_save_async (GtkSourceFileSaver *saver,
gpointer user_data)
{
g_return_if_fail (GTK_SOURCE_IS_FILE_SAVER (saver));
+ g_return_if_fail (GTK_SOURCE_IS_FILE (file));
g_return_if_fail (saver->priv->task == NULL);
- saver->priv->task = g_task_new (saver, cancellable, callback, user_data);
+ saver->priv->task = g_task_new (file, cancellable, callback, user_data);
g_task_set_priority (saver->priv->task, io_priority);
if (old_mtime != NULL)
@@ -979,12 +981,14 @@ gtk_source_file_saver_save_async (GtkSourceFileSaver *saver,
gboolean
gtk_source_file_saver_save_finish (GtkSourceFileSaver *saver,
+ GtkSourceFile *file,
GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (GTK_SOURCE_IS_FILE_SAVER (saver), FALSE);
+ g_return_val_if_fail (GTK_SOURCE_IS_FILE (file), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
- g_return_val_if_fail (g_task_is_valid (result, saver), FALSE);
+ g_return_val_if_fail (g_task_is_valid (result, file), FALSE);
return g_task_propagate_boolean (G_TASK (result), error);
}
diff --git a/gtksourceview/gtksourcefilesaver.h b/gtksourceview/gtksourcefilesaver.h
index 17fb62f..c2208c3 100644
--- a/gtksourceview/gtksourcefilesaver.h
+++ b/gtksourceview/gtksourcefilesaver.h
@@ -83,6 +83,7 @@ void gtk_source_file_saver_set_mount_operation_factory
G_GNUC_INTERNAL
void gtk_source_file_saver_save_async (GtkSourceFileSaver *saver,
+ GtkSourceFile *file,
gint io_priority,
GTimeVal *old_mtime,
GCancellable *cancellable,
@@ -93,6 +94,7 @@ void gtk_source_file_saver_save_async (GtkSourceFileSaver
*saver,
G_GNUC_INTERNAL
gboolean gtk_source_file_saver_save_finish (GtkSourceFileSaver *saver,
+ GtkSourceFile *file,
GAsyncResult *result,
GError **error);
diff --git a/tests/test-file-saver.c b/tests/test-file-saver.c
index 7149215..ef4e13a 100644
--- a/tests/test-file-saver.c
+++ b/tests/test-file-saver.c
@@ -143,6 +143,10 @@ mount_cb (GFile *location,
else if (error != NULL && error->code == G_IO_ERROR_NOT_SUPPORTED)
{
g_error_free (error);
+
+ /* The unit test can not be run */
+ gtk_main_quit ();
+ return;
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]