[plugins v2] all: Use the new "content-changed" API
- From: "Juan A. Suarez Romero" <jasuarez igalia com>
- To: grilo-list gnome org
- Subject: [plugins v2] all: Use the new "content-changed" API
- Date: Thu, 7 Apr 2011 17:00:21 +0200
The new API to notify changes in source content requires to specify a list with
the changed medias, instead of just the changed media.
Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>
---
src/media/bookmarks/grl-bookmarks.c | 16 +++++-----
src/media/filesystem/grl-filesystem.c | 2 +-
src/media/podcasts/grl-podcasts.c | 40 +++++++++++++-------------
src/media/tracker/grl-tracker-media-notif.c | 14 +++++----
src/media/upnp/grl-upnp.c | 13 +++++---
5 files changed, 45 insertions(+), 40 deletions(-)
diff --git a/src/media/bookmarks/grl-bookmarks.c b/src/media/bookmarks/grl-bookmarks.c
index 1c7de10..10189fd 100644
--- a/src/media/bookmarks/grl-bookmarks.c
+++ b/src/media/bookmarks/grl-bookmarks.c
@@ -570,10 +570,10 @@ remove_bookmark (GrlBookmarksSource *bookmarks_source,
if (bookmarks_source->priv->notify_changes) {
/* We can improve accuracy computing the parent container of removed
element */
- grl_media_source_notify_change (GRL_MEDIA_SOURCE (bookmarks_source),
- NULL,
- GRL_CONTENT_REMOVED,
- TRUE);
+ grl_media_source_notify_change_single (GRL_MEDIA_SOURCE (bookmarks_source),
+ NULL,
+ GRL_CONTENT_REMOVED,
+ TRUE);
}
}
@@ -679,10 +679,10 @@ store_bookmark (GrlBookmarksSource *bookmarks_source,
g_free (id);
if (bookmarks_source->priv->notify_changes) {
- grl_media_source_notify_change (GRL_MEDIA_SOURCE (bookmarks_source),
- GRL_MEDIA (parent),
- GRL_CONTENT_ADDED,
- FALSE);
+ grl_media_source_notify_change_single (GRL_MEDIA_SOURCE (bookmarks_source),
+ GRL_MEDIA (parent),
+ GRL_CONTENT_ADDED,
+ FALSE);
}
}
diff --git a/src/media/filesystem/grl-filesystem.c b/src/media/filesystem/grl-filesystem.c
index 553e3e4..7f573c5 100644
--- a/src/media/filesystem/grl-filesystem.c
+++ b/src/media/filesystem/grl-filesystem.c
@@ -980,7 +980,7 @@ notify_parent_change (GrlMediaSource *source, GFile *child, GrlMediaSourceChange
}
media = create_content (NULL, parent_path, GRL_RESOLVE_FAST_ONLY, parent == NULL);
- grl_media_source_notify_change (source, media, change, FALSE);
+ grl_media_source_notify_change_single (source, media, change, FALSE);
g_object_unref (media);
if (parent) {
diff --git a/src/media/podcasts/grl-podcasts.c b/src/media/podcasts/grl-podcasts.c
index 759a36d..fc09398 100644
--- a/src/media/podcasts/grl-podcasts.c
+++ b/src/media/podcasts/grl-podcasts.c
@@ -765,10 +765,10 @@ remove_podcast (GrlPodcastsSource *podcasts_source,
"Failed to remove podcast");
sqlite3_free (sql_error);
} else if (podcasts_source->priv->notify_changes) {
- grl_media_source_notify_change (GRL_MEDIA_SOURCE (podcasts_source),
- NULL,
- GRL_CONTENT_REMOVED,
- TRUE);
+ grl_media_source_notify_change_single (GRL_MEDIA_SOURCE (podcasts_source),
+ NULL,
+ GRL_CONTENT_REMOVED,
+ TRUE);
}
}
@@ -796,10 +796,10 @@ remove_stream (GrlPodcastsSource *podcasts_source,
"Failed to remove podcast stream");
sqlite3_free (sql_error);
} else if (podcasts_source->priv->notify_changes) {
- grl_media_source_notify_change (GRL_MEDIA_SOURCE (podcasts_source),
- NULL,
- GRL_CONTENT_REMOVED,
- TRUE);
+ grl_media_source_notify_change_single (GRL_MEDIA_SOURCE (podcasts_source),
+ NULL,
+ GRL_CONTENT_REMOVED,
+ TRUE);
}
}
@@ -865,10 +865,10 @@ store_podcast (GrlPodcastsSource *podcasts_source,
g_free (id);
if (podcasts_source->priv->notify_changes) {
- grl_media_source_notify_change (GRL_MEDIA_SOURCE (podcasts_source),
- NULL,
- GRL_CONTENT_ADDED,
- FALSE);
+ grl_media_source_notify_change_single (GRL_MEDIA_SOURCE (podcasts_source),
+ NULL,
+ GRL_CONTENT_ADDED,
+ FALSE);
}
}
@@ -1032,10 +1032,10 @@ parse_entry_idle (gpointer user_data)
if (GRL_PODCASTS_SOURCE (osp->os->source)->priv->notify_changes) {
media = grl_media_box_new ();
grl_media_set_id (media, osp->os->media_id);
- grl_media_source_notify_change (osp->os->source,
- media,
- GRL_CONTENT_CHANGED,
- FALSE);
+ grl_media_source_notify_change_single (osp->os->source,
+ media,
+ GRL_CONTENT_CHANGED,
+ FALSE);
g_object_unref (media);
}
g_slice_free (OperationSpec, osp->os);
@@ -1106,10 +1106,10 @@ parse_feed (OperationSpec *os, const gchar *str, GError **error)
if (GRL_PODCASTS_SOURCE (os->source)->priv->notify_changes) {
podcast = grl_media_box_new ();
grl_media_set_id (podcast, os->media_id);
- grl_media_source_notify_change (os->source,
- podcast,
- GRL_CONTENT_CHANGED,
- FALSE);
+ grl_media_source_notify_change_single (os->source,
+ podcast,
+ GRL_CONTENT_CHANGED,
+ FALSE);
g_object_unref (podcast);
}
os->callback (os->source,
diff --git a/src/media/tracker/grl-tracker-media-notif.c b/src/media/tracker/grl-tracker-media-notif.c
index 615e299..4128895 100644
--- a/src/media/tracker/grl-tracker-media-notif.c
+++ b/src/media/tracker/grl-tracker-media-notif.c
@@ -234,8 +234,8 @@ tracker_evt_update_orphan_item_cb (GObject *object,
GRL_DEBUG ("\tNotify id=%u source=%s p=%p", id,
grl_metadata_source_get_name (GRL_METADATA_SOURCE (source)),
source);
- grl_media_source_notify_change (GRL_MEDIA_SOURCE (source), media,
- change_type, FALSE);
+ grl_media_source_notify_change_single (GRL_MEDIA_SOURCE (source), media,
+ change_type, FALSE);
g_object_unref (media);
}
@@ -320,8 +320,10 @@ tracker_evt_update_orphans (tracker_evt_update_t *evt)
grl_media_set_id (media, str_id);
g_free (str_id);
- grl_media_source_notify_change (GRL_MEDIA_SOURCE (source->data),
- media, GRL_CONTENT_REMOVED, FALSE);
+ grl_media_source_notify_change_single (GRL_MEDIA_SOURCE (source->data),
+ media,
+ GRL_CONTENT_REMOVED,
+ FALSE);
g_object_unref (media);
}
}
@@ -382,8 +384,8 @@ tracker_evt_update_items_cb (gpointer key,
GRL_DEBUG ("\tNotify id=%u source=%s", id,
grl_metadata_source_get_name (GRL_METADATA_SOURCE (source)));
- grl_media_source_notify_change (GRL_MEDIA_SOURCE (source), media,
- evt->change_type, FALSE);
+ grl_media_source_notify_change_single (GRL_MEDIA_SOURCE (source), media,
+ evt->change_type, FALSE);
g_object_unref (media);
}
diff --git a/src/media/upnp/grl-upnp.c b/src/media/upnp/grl-upnp.c
index 424e900..a28be20 100644
--- a/src/media/upnp/grl-upnp.c
+++ b/src/media/upnp/grl-upnp.c
@@ -284,6 +284,7 @@ container_changed_cb (GUPnPServiceProxy *proxy,
GValue *value,
gpointer user_data)
{
+ GPtrArray *changed_medias;
GrlMedia *container;
GrlMediaSource *source = GRL_MEDIA_SOURCE (user_data);
gchar **tokens;
@@ -293,16 +294,18 @@ container_changed_cb (GUPnPServiceProxy *proxy,
/* Value is a list of pairs (id, number), where "id" is the container id */
tokens = g_strsplit (g_value_get_string (value), ",", -1);
+ changed_medias = g_ptr_array_sized_new (g_strv_length (tokens) / 2);
while (tokens[i]) {
container = grl_media_box_new ();
grl_media_set_id (container, tokens[i]);
- grl_media_source_notify_change (source,
- container,
- GRL_CONTENT_CHANGED,
- FALSE);
- g_object_unref (container);
+ g_ptr_array_add (changed_medias, container);
i += 2;
}
+
+ grl_media_source_notify_change (source,
+ changed_medias,
+ GRL_CONTENT_CHANGED,
+ FALSE);
g_strfreev (tokens);
}
--
1.7.4.1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]