[gnome-logs] journalmodel: only load one entry per idle



commit 9a2dc043ae688c38f09c8dd23ddb32472e190fdf
Author: Lars Uebernickel <lars uebernic de>
Date:   Thu Feb 19 11:14:59 2015 +0100

    journalmodel: only load one entry per idle
    
    Creating and layouting row widgets is too slow to do it five at a time.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=728317

 src/gl-journal-model.c |   31 +++++++++++++------------------
 1 files changed, 13 insertions(+), 18 deletions(-)
---
diff --git a/src/gl-journal-model.c b/src/gl-journal-model.c
index bebaa07..ef078a5 100644
--- a/src/gl-journal-model.c
+++ b/src/gl-journal-model.c
@@ -31,29 +31,24 @@ static gboolean
 gl_journal_model_fetch_entries (gpointer user_data)
 {
     GlJournalModel *model = user_data;
+    GlJournalEntry *entry;
     guint last;
-    gint i;
 
     last = model->entries->len;
-    for (i = 0; i < 5; i++)
+
+    entry = gl_journal_previous (model->journal);
+    if (entry)
     {
-        GlJournalEntry *entry;
-
-        entry = gl_journal_previous (model->journal);
-        if (entry)
-        {
-            g_ptr_array_add (model->entries, entry);
-        }
-        else
-        {
-            model->idle_source = 0;
-            g_object_notify_by_pspec (G_OBJECT (model), properties[PROP_LOADING]);
-            return G_SOURCE_REMOVE;
-        }
+        g_ptr_array_add (model->entries, entry);
+        g_list_model_items_changed (G_LIST_MODEL (model), last, 0, 1);
+        return G_SOURCE_CONTINUE;
+    }
+    else
+    {
+        model->idle_source = 0;
+        g_object_notify_by_pspec (G_OBJECT (model), properties[PROP_LOADING]);
+        return G_SOURCE_REMOVE;
     }
-
-    g_list_model_items_changed (G_LIST_MODEL (model), last, 0, i);
-    return G_SOURCE_CONTINUE;
 }
 
 static void


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