[PATCH 4/5] youtube: Make media_from_uri() a cancellable operation
- From: "Juan A. Suarez Romero" <jasuarez igalia com>
- To: grilo-list gnome org
- Subject: [PATCH 4/5] youtube: Make media_from_uri() a cancellable operation
- Date: Fri, 15 Apr 2011 09:55:14 +0200
Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>
---
src/media/youtube/grl-youtube.c | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/media/youtube/grl-youtube.c b/src/media/youtube/grl-youtube.c
index 8766062..fd6b514 100644
--- a/src/media/youtube/grl-youtube.c
+++ b/src/media/youtube/grl-youtube.c
@@ -1409,7 +1409,11 @@ media_from_uri_cb (GObject *object, GAsyncResult *result, gpointer user_data)
mfus->callback (mfus->source, mfus->media_from_uri_id, NULL, mfus->user_data, error);
g_error_free (error);
} else {
- build_media_from_entry (NULL, video, NULL, mfus->keys,
+ build_media_from_entry (NULL,
+ video,
+ grl_metadata_source_get_operation_data (GRL_METADATA_SOURCE (mfus->source),
+ mfus->media_from_uri_id),
+ mfus->keys,
build_media_from_entry_media_from_uri_cb,
mfus);
}
@@ -1653,6 +1657,7 @@ grl_youtube_get_media_from_uri (GrlMediaSource *source,
gchar *video_id;
GError *error;
+ GCancellable *cancellable;
GDataService *service;
video_id = get_video_id_from_url (mfus->uri);
@@ -1667,13 +1672,17 @@ grl_youtube_get_media_from_uri (GrlMediaSource *source,
service = GRL_YOUTUBE_SOURCE (source)->priv->service;
+ cancellable = g_cancellable_new ();
+ grl_metadata_source_set_operation_data (GRL_METADATA_SOURCE (source),
+ mfus->media_from_uri_id,
+ cancellable);
#ifdef GDATA_API_SUBJECT_TO_CHANGE
gchar *entry_id = g_strconcat ("tag:youtube.com,2008:video:", video_id, NULL);
gdata_service_query_single_entry_async (service,
entry_id,
NULL,
GDATA_TYPE_YOUTUBE_VIDEO,
- NULL,
+ cancellable,
media_from_uri_cb,
mfus);
g_free (entry_id);
@@ -1681,7 +1690,7 @@ grl_youtube_get_media_from_uri (GrlMediaSource *source,
gdata_youtube_service_query_single_video_async (GDATA_YOUTUBE_SERVICE (service),
NULL,
video_id,
- NULL,
+ cancellable,
media_from_uri_cb,
mfus);
#endif
--
1.7.4.1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]