[totem] main: Avoid queueing multiple thumbnail updates



commit 2f714e1289e0afe136abc6247e8813c501e3ebf1
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Feb 28 18:09:30 2014 +0100

    main: Avoid queueing multiple thumbnail updates
    
    When one is queued up, we don't need to reschedule another one.

 src/totem-grilo.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/totem-grilo.c b/src/totem-grilo.c
index cff626d..c7dbd40 100644
--- a/src/totem-grilo.c
+++ b/src/totem-grilo.c
@@ -104,6 +104,7 @@ struct _TotemGriloPrivate {
        GtkTreeModel *browser_filter_model;
        gboolean in_search;
        GList *metadata_keys;
+       guint thumbnail_update_id;
 
        /* Search widgets */
        GtkWidget *search_bar;
@@ -527,7 +528,9 @@ update_search_thumbnails_idle (TotemGrilo *self)
 static void
 update_search_thumbnails (TotemGrilo *self)
 {
-       g_idle_add ((GSourceFunc) update_search_thumbnails_idle, self);
+       if (self->priv->thumbnail_update_id > 0)
+               return;
+       self->priv->thumbnail_update_id = g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc) 
update_search_thumbnails_idle, self, NULL);
 }
 
 static void
@@ -2386,6 +2389,11 @@ totem_grilo_finalize (GObject *object)
        GList *s;
        GrlRegistry *registry;
 
+       if (self->priv->thumbnail_update_id > 0) {
+               g_source_remove (self->priv->thumbnail_update_id);
+               self->priv->thumbnail_update_id = 0;
+       }
+
        registry = grl_registry_get_default ();
        g_signal_handlers_disconnect_by_func (registry, source_added_cb, self);
        g_signal_handlers_disconnect_by_func (registry, source_removed_cb, self);


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