[grilo] core: Use higher priorities when dealing with no IDLE_RELAY flag



commit 1b5c6c253d708ce73371c6c5267d26e2f13782f3
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Thu Mar 31 11:42:46 2011 +0000

    core: Use higher priorities when dealing with no IDLE_RELAY flag
    
    When user do not use the GRL_RESOLVE_IDLE_RELAY, usually means he needs the
    results as soon as possible.
    
    As we relay on g_idle_add() to do our internal work, we should handle this idle
    functions with higher priority in this case.
    
    This patch makes to use G_PRIORITY_DEFAULT_IDLE when user requests the
    GRL_RESOLVE_IDLE_RELAY, while G_PRIORITY_HIGH_IDLE is used when the flag is not
    set up.
    
    This fixes https://bugzilla.gnome.org/show_bug.cgi?id=645525
    
    Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>

 src/grl-media-source.c    |   27 ++++++++++++++++++++++-----
 src/grl-metadata-source.c |   12 ++++++++++--
 2 files changed, 32 insertions(+), 7 deletions(-)
---
diff --git a/src/grl-media-source.c b/src/grl-media-source.c
index 12a8cfa..d700660 100644
--- a/src/grl-media-source.c
+++ b/src/grl-media-source.c
@@ -1492,7 +1492,10 @@ grl_media_source_browse (GrlMediaSource *source,
   }
 
   set_operation_ongoing (source, browse_id);
-  g_idle_add (browse_idle, bs);
+  g_idle_add_full (brc->use_idle? G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
+                   browse_idle,
+                   bs,
+                   NULL);
 
   return browse_id;
 }
@@ -1681,7 +1684,10 @@ grl_media_source_search (GrlMediaSource *source,
   }
 
   set_operation_ongoing (source, search_id);
-  g_idle_add (search_idle, ss);
+  g_idle_add_full (brc->use_idle? G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
+                   search_idle,
+                   ss,
+                   NULL);
 
   return search_id;
 }
@@ -1877,7 +1883,10 @@ grl_media_source_query (GrlMediaSource *source,
   }
 
   set_operation_ongoing (source, query_id);
-  g_idle_add (query_idle, qs);
+  g_idle_add_full (brc->use_idle? G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
+                   query_idle,
+                   qs,
+                   NULL);
 
   return query_id;
 }
@@ -2046,7 +2055,11 @@ grl_media_source_metadata (GrlMediaSource *source,
   mrc->spec = ms;
 
   set_operation_ongoing (source, metadata_id);
-  g_idle_add (metadata_idle, ms);
+  g_idle_add_full (flags & GRL_RESOLVE_IDLE_RELAY?
+                   G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
+                   metadata_idle,
+                   ms,
+                   NULL);
 
   return metadata_id;
 }
@@ -2570,7 +2583,11 @@ grl_media_source_get_media_from_uri (GrlMediaSource *source,
      user_data so that we can free the spec there */
   mfsrc->spec = mfus;
 
-  g_idle_add (media_from_uri_idle, mfus);
+  g_idle_add_full (flags & GRL_RESOLVE_IDLE_RELAY?
+                   G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
+                   media_from_uri_idle,
+                   mfus,
+                   NULL);
 }
 
 /**
diff --git a/src/grl-metadata-source.c b/src/grl-metadata-source.c
index 9625b5d..163d8e0 100644
--- a/src/grl-metadata-source.c
+++ b/src/grl-metadata-source.c
@@ -924,7 +924,11 @@ grl_metadata_source_resolve (GrlMetadataSource *source,
      user_data so that we can free the spec there */
   rrc->spec = rs;
 
-  g_idle_add (resolve_idle, rs);
+  g_idle_add_full (flags & GRL_RESOLVE_IDLE_RELAY?
+                   G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
+                   resolve_idle,
+                   rs,
+                   NULL);
 }
 
 /**
@@ -1316,7 +1320,11 @@ grl_metadata_source_set_metadata (GrlMetadataSource *source,
   smctlcb->pending = g_list_length (keymaps);
   smctlcb->next = keymaps;
 
-  g_idle_add (set_metadata_idle, smctlcb);
+  g_idle_add_full (flags & GRL_RESOLVE_IDLE_RELAY?
+                   G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
+                   set_metadata_idle,
+                   smctlcb,
+                   NULL);
 }
 
 /**



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