[gnome-font-viewer] Ported thumbnailing io scheduler job to g_task_run_in_thread



commit ec331eab852c138ede97ba62784129597cfd7b5c
Author: Robert Roth <robert roth off gmail com>
Date:   Mon Jan 19 22:07:15 2015 +0200

    Ported thumbnailing io scheduler job to g_task_run_in_thread
    
    https://bugzilla.gnome.org/show_bug.cgi?id=739224

 src/font-model.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/src/font-model.c b/src/font-model.c
index d27ea64..b7c0446 100644
--- a/src/font-model.c
+++ b/src/font-model.c
@@ -228,10 +228,11 @@ create_thumbnail (ThumbInfoData *thumb_info)
   return pixbuf;
 }
 
-static gboolean
-ensure_thumbnails_job (GIOSchedulerJob *job,
-                       GCancellable *cancellable,
-                       gpointer user_data)
+static void
+ensure_thumbnails_job (GTask *task,
+                       gpointer source_object,
+                       gpointer user_data,
+                       GCancellable *cancellable)
 {
     GList *thumb_infos = user_data, *l;
 
@@ -303,8 +304,6 @@ ensure_thumbnails_job (GIOSchedulerJob *job,
     }
 
     g_list_free (thumb_infos);
-
-    return FALSE;
 }
 
 typedef struct {
@@ -367,6 +366,7 @@ font_infos_loaded (gpointer user_data)
 {
     LoadFontInfosData *data = user_data;
     FontViewModel *self = data->self;
+    GTask *task = NULL;
     GList *l, *thumb_infos = NULL;
 
     ensure_fallback_icon (self);
@@ -396,10 +396,12 @@ font_infos_loaded (gpointer user_data)
 
     g_signal_emit (self, signals[CONFIG_CHANGED], 0);
 
-    g_io_scheduler_push_job (ensure_thumbnails_job,
-                             thumb_infos, NULL,
-                             G_PRIORITY_DEFAULT, NULL);
+    task = g_task_new (NULL, NULL, NULL, NULL);
+
+    g_task_set_task_data (task, thumb_infos, NULL);
 
+    g_task_run_in_thread (task, ensure_thumbnails_job);
+    g_object_unref (task);
     return FALSE;
 }
 


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