[gtksourceview/wip/loader-saver] File: simplify a little the code



commit e9c15eb87155c077c54d81513fa0ee8e041baa1c
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Dec 26 22:01:05 2013 +0100

    File: simplify a little the code

 gtksourceview/gtksourcefile.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/gtksourceview/gtksourcefile.c b/gtksourceview/gtksourcefile.c
index 0f7a682..4369472 100644
--- a/gtksourceview/gtksourcefile.c
+++ b/gtksourceview/gtksourcefile.c
@@ -424,18 +424,15 @@ gtk_source_file_save_async (GtkSourceFile          *file,
 
        if (file->priv->saver != NULL)
        {
-               GTask *task;
-
-               task = g_task_new (file, cancellable, callback, user_data);
-               g_task_set_source_tag (task, file);
-
-               g_task_return_new_error (task,
+               g_task_report_new_error (file,
+                                        callback,
+                                        user_data,
+                                        file,
                                         G_IO_ERROR,
                                         G_IO_ERROR_PENDING,
                                         "Another save operation is already running on the file \"%s\".",
                                         g_file_get_parse_name (file->priv->location));
 
-               g_object_unref (task);
                return;
        }
 
@@ -468,7 +465,7 @@ gtk_source_file_save_finish (GtkSourceFile  *file,
        g_return_val_if_fail (GTK_SOURCE_IS_FILE (file), FALSE);
        g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-       if (g_task_get_source_tag (G_TASK (result)) == file)
+       if (g_async_result_is_tagged (result, file))
        {
                return g_task_propagate_boolean (G_TASK (result), error);
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]