[grilo] source: Only replace source ID in notify if unset



commit af52aa57f579026e3a6d6b4b4a757522774abd19
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Mar 30 16:45:15 2015 +0200

    source: Only replace source ID in notify if unset
    
    In other cases where grl_media_set_source() is used, it only sets the
    source of a media if it is the special root container media, or if the
    source was previously unset.
    
    This avoids sources being overwritten when sending change notifications
    when sending changes from an aggregating source (such as the one
    embedded in Totem).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=747029

 src/grl-source.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/grl-source.c b/src/grl-source.c
index 2ddd823..a562239 100644
--- a/src/grl-source.c
+++ b/src/grl-source.c
@@ -4531,6 +4531,15 @@ grl_source_notify_change_stop (GrlSource *source,
   return GRL_SOURCE_GET_CLASS (source)->notify_change_stop (source, error);
 }
 
+static void
+grl_media_set_source_if_unset (GrlMedia    *media,
+                               const gchar *source)
+{
+  if (grl_media_get_source (media) != NULL)
+    return;
+  grl_media_set_source (media, source);
+}
+
 /**
  * grl_source_notify_change_list:
  * @source: a source
@@ -4569,7 +4578,7 @@ void grl_source_notify_change_list (GrlSource *source,
   /* Set the source */
   source_id = grl_source_get_id (source);
   g_ptr_array_foreach (changed_medias,
-                       (GFunc) grl_media_set_source,
+                       (GFunc) grl_media_set_source_if_unset,
                        (gpointer) source_id);
 
   /* Add hook to free content when freeing the array */


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