[grilo-plugins/0.1.x] all: use the new operation API



commit 06e7a2b9f352253902c8cd32a7fb195ddd3986c1
Author: Lionel Landwerlin <lionel g landwerlin linux intel com>
Date:   Fri Jun 17 10:07:11 2011 +0100

    all: use the new operation API
    
    Signed-off-by: Lionel Landwerlin <lionel g landwerlin linux intel com>

 src/media/apple-trailers/grl-apple-trailers.c      |    6 +---
 src/media/jamendo/grl-jamendo.c                    |   12 +++-----
 src/media/shoutcast/grl-shoutcast.c                |    9 ++----
 src/media/tracker/grl-tracker-media-api.c          |    4 +-
 src/media/youtube/grl-youtube.c                    |   28 +++++--------------
 src/metadata/lastfm-albumart/grl-lastfm-albumart.c |    9 ++----
 src/metadata/local-metadata/grl-local-metadata.c   |    9 ++----
 7 files changed, 25 insertions(+), 52 deletions(-)
---
diff --git a/src/media/apple-trailers/grl-apple-trailers.c b/src/media/apple-trailers/grl-apple-trailers.c
index fc9d92a..949f188 100644
--- a/src/media/apple-trailers/grl-apple-trailers.c
+++ b/src/media/apple-trailers/grl-apple-trailers.c
@@ -574,8 +574,7 @@ grl_apple_trailers_source_browse (GrlMediaSource *source,
 
   op_data = g_slice_new0 (OperationData);
   op_data->bs = bs;
-  grl_metadata_source_set_operation_data (GRL_METADATA_SOURCE (source),
-                                          bs->browse_id, op_data);
+  grl_operation_set_data (bs->browse_id, op_data);
 
   if (at_source->priv->hd) {
     read_url_async (at_source, APPLE_TRAILERS_CURRENT_HD, op_data);
@@ -600,8 +599,7 @@ grl_apple_trailers_source_cancel (GrlMetadataSource *source, guint operation_id)
   if (priv->wc)
     grl_net_wc_flush_delayed_requests (priv->wc);
 
-  op_data =
-    (OperationData *) grl_metadata_source_get_operation_data (source, operation_id);
+  op_data = (OperationData *) grl_operation_get_data (operation_id);
 
   if (op_data) {
     op_data->cancelled = TRUE;
diff --git a/src/media/jamendo/grl-jamendo.c b/src/media/jamendo/grl-jamendo.c
index f0e2a59..97bda5c 100644
--- a/src/media/jamendo/grl-jamendo.c
+++ b/src/media/jamendo/grl-jamendo.c
@@ -1208,8 +1208,7 @@ grl_jamendo_source_browse (GrlMediaSource *source,
   xpe->offset = page_offset;
   xpe->spec.bs = bs;
 
-  grl_metadata_source_set_operation_data (GRL_METADATA_SOURCE (source),
-                                          bs->browse_id, xpe);
+  grl_operation_set_data (bs->browse_id, xpe);
 
   read_url_async (GRL_JAMENDO_SOURCE (source), url, xpe);
   g_free (url);
@@ -1288,8 +1287,7 @@ grl_jamendo_source_query (GrlMediaSource *source,
   xpe->offset = page_offset;
   xpe->spec.qs = qs;
 
-  grl_metadata_source_set_operation_data (GRL_METADATA_SOURCE (source),
-                                          qs->query_id, xpe);
+  grl_operation_set_data (qs->query_id, xpe);
 
   read_url_async (GRL_JAMENDO_SOURCE (source), url, xpe);
   g_free (url);
@@ -1342,8 +1340,7 @@ grl_jamendo_source_search (GrlMediaSource *source,
   xpe->offset = page_offset;
   xpe->spec.ss = ss;
 
-  grl_metadata_source_set_operation_data (GRL_METADATA_SOURCE (source),
-                                          ss->search_id, xpe);
+  grl_operation_set_data (ss->search_id, xpe);
 
   read_url_async (GRL_JAMENDO_SOURCE (source), url, xpe);
   g_free (jamendo_keys);
@@ -1369,8 +1366,7 @@ grl_jamendo_source_cancel (GrlMetadataSource *source, guint operation_id)
 
   GRL_DEBUG ("grl_jamendo_source_cancel");
 
-  xpe =
-    (XmlParseEntries *) grl_metadata_source_get_operation_data (source, operation_id);
+  xpe = (XmlParseEntries *) grl_operation_get_data (operation_id);
 
   if (xpe) {
     xpe->cancelled = TRUE;
diff --git a/src/media/shoutcast/grl-shoutcast.c b/src/media/shoutcast/grl-shoutcast.c
index d45146e..57b2240 100644
--- a/src/media/shoutcast/grl-shoutcast.c
+++ b/src/media/shoutcast/grl-shoutcast.c
@@ -654,8 +654,7 @@ grl_shoutcast_source_browse (GrlMediaSource *source,
     data->genre = g_strdup (container_id);
   }
 
-  grl_metadata_source_set_operation_data (GRL_METADATA_SOURCE (source),
-                                          bs->browse_id, data);
+  grl_operation_set_data (bs->browse_id, data);
 
   read_url_async (url, data);
 
@@ -695,8 +694,7 @@ grl_shoutcast_source_search (GrlMediaSource *source,
   data->user_data = ss->user_data;
   data->error_code = GRL_CORE_ERROR_SEARCH_FAILED;
 
-  grl_metadata_source_set_operation_data (GRL_METADATA_SOURCE (source),
-                                          ss->search_id, data);
+  grl_operation_set_data (ss->search_id, data);
 
   url = g_strdup_printf (SHOUTCAST_SEARCH_RADIOS,
                          ss->text,
@@ -718,8 +716,7 @@ grl_shoutcast_source_cancel (GrlMetadataSource *source, guint operation_id)
     g_cancellable_cancel (cancellable);
   cancellable = NULL;
 
-  op_data =
-    (OperationData *) grl_metadata_source_get_operation_data (source, operation_id);
+  op_data = (OperationData *) grl_operation_get_data (operation_id);
 
   if (op_data) {
     op_data->cancelled = TRUE;
diff --git a/src/media/tracker/grl-tracker-media-api.c b/src/media/tracker/grl-tracker-media-api.c
index d0606ca..00293d7 100644
--- a/src/media/tracker/grl-tracker-media-api.c
+++ b/src/media/tracker/grl-tracker-media-api.c
@@ -227,8 +227,8 @@ fill_grilo_media_from_sparql (GrlTrackerMedia    *source,
 }
 
 /* I can haz templatze ?? */
-#define TRACKER_QUERY_CB(spec_type,name)                             \
-                                                                     \
+#define TRACKER_QUERY_CB(spec_type,name)                                \
+                                                                        \
   static void                                                           \
   tracker_##name##_result_cb (GObject      *source_object,              \
                               GAsyncResult *result,                     \
diff --git a/src/media/youtube/grl-youtube.c b/src/media/youtube/grl-youtube.c
index 021bd9c..eadd506 100644
--- a/src/media/youtube/grl-youtube.c
+++ b/src/media/youtube/grl-youtube.c
@@ -416,8 +416,7 @@ static void
 release_operation_data (GrlMetadataSource *source,
                         guint operation_id)
 {
-  GCancellable *cancellable = grl_metadata_source_get_operation_data (source,
-                                                                      operation_id);
+  GCancellable *cancellable = grl_operation_get_data (operation_id);
 
   if (cancellable) {
     g_object_unref (cancellable);
@@ -828,8 +827,7 @@ metadata_cb (GObject *object,
     build_media_from_entry (GRL_YOUTUBE_SOURCE (ms->source),
                             ms->media,
                             video,
-                            grl_metadata_source_get_operation_data (GRL_METADATA_SOURCE (ms->source),
-                                                                    ms->metadata_id),
+                            grl_operation_get_data (ms->metadata_id),
                             ms->keys,
 			    build_media_from_entry_metadata_cb,
                             ms);
@@ -1128,9 +1126,7 @@ produce_from_feed (OperationSpec *os)
   operation_spec_ref (os);
 
   os->cancellable = g_cancellable_new ();
-  grl_metadata_source_set_operation_data (GRL_METADATA_SOURCE (os->source),
-                                          os->operation_id,
-                                          os->cancellable);
+  grl_operation_set_data (os->operation_id, os->cancellable);
 
   service = GRL_YOUTUBE_SOURCE (os->source)->priv->service;
   query = gdata_query_new_with_limits (NULL , os->skip, os->count);
@@ -1256,8 +1252,7 @@ media_from_uri_cb (GObject *object, GAsyncResult *result, gpointer user_data)
     build_media_from_entry (GRL_YOUTUBE_SOURCE (mfus->source),
                             NULL,
                             video,
-                            grl_metadata_source_get_operation_data (GRL_METADATA_SOURCE (mfus->source),
-                                                                    mfus->media_from_uri_id),
+                            grl_operation_get_data (mfus->media_from_uri_id),
                             mfus->keys,
 			    build_media_from_entry_media_from_uri_cb,
 			    mfus);
@@ -1327,9 +1322,7 @@ grl_youtube_source_search (GrlMediaSource *source,
   /* Look for OPERATION_SPEC_REF_RATIONALE for details */
   operation_spec_ref (os);
 
-  grl_metadata_source_set_operation_data (GRL_METADATA_SOURCE (source),
-                                          ss->search_id,
-                                          os->cancellable);
+  grl_operation_set_data (ss->search_id, os->cancellable);
 
   query = gdata_query_new_with_limits (ss->text, os->skip, os->count);
   gdata_youtube_service_query_videos_async (GDATA_YOUTUBE_SERVICE (GRL_YOUTUBE_SOURCE (source)->priv->service),
@@ -1451,9 +1444,7 @@ grl_youtube_source_metadata (GrlMediaSource *source,
   case YOUTUBE_MEDIA_TYPE_VIDEO:
   default:
     cancellable = g_cancellable_new ();
-    grl_metadata_source_set_operation_data (GRL_METADATA_SOURCE (source),
-                                            ms->metadata_id,
-                                            cancellable);
+    grl_operation_set_data (ms->metadata_id, cancellable);
 #ifdef GDATA_API_SUBJECT_TO_CHANGE
     {
       gchar *entryid = g_strconcat ("tag:youtube.com,2008:video:", id, NULL);
@@ -1523,9 +1514,7 @@ 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);
+  grl_operation_set_data (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,
@@ -1553,8 +1542,7 @@ grl_youtube_source_cancel (GrlMetadataSource *source,
   GRL_DEBUG (__FUNCTION__);
 
   GCancellable *cancellable =
-    (GCancellable *) grl_metadata_source_get_operation_data (source,
-                                                              operation_id);
+    (GCancellable *) grl_operation_get_data (operation_id);
 
   if (cancellable) {
     g_cancellable_cancel (cancellable);
diff --git a/src/metadata/lastfm-albumart/grl-lastfm-albumart.c b/src/metadata/lastfm-albumart/grl-lastfm-albumart.c
index 4c802a1..b65c840 100644
--- a/src/metadata/lastfm-albumart/grl-lastfm-albumart.c
+++ b/src/metadata/lastfm-albumart/grl-lastfm-albumart.c
@@ -204,9 +204,7 @@ read_done_cb (GObject *source_object,
   gchar *image = NULL;
 
   /* Get rid of stored operation data */
-  cancellable =
-    grl_metadata_source_get_operation_data (GRL_METADATA_SOURCE (rs->source),
-                                            rs->resolve_id);
+  cancellable = grl_operation_get_data (rs->resolve_id);
   if (cancellable) {
     g_object_unref (cancellable);
   }
@@ -285,7 +283,7 @@ read_url_async (GrlMetadataSource *source,
     wc = grl_net_wc_new ();
 
   cancellable = g_cancellable_new ();
-  grl_metadata_source_set_operation_data (source, rs->resolve_id, cancellable);
+  grl_operation_set_data (rs->resolve_id, cancellable);
 
   GRL_DEBUG ("Opening '%s'", url);
   grl_net_wc_request_async (wc, url, cancellable, read_done_cb, rs);
@@ -395,8 +393,7 @@ grl_lastfm_albumart_source_cancel (GrlMetadataSource *source,
                                    guint operation_id)
 {
   GCancellable *cancellable =
-    (GCancellable *) grl_metadata_source_get_operation_data (source,
-                                                             operation_id);
+    (GCancellable *) grl_operation_get_data (operation_id);
 
   if (cancellable) {
     g_cancellable_cancel (cancellable);
diff --git a/src/metadata/local-metadata/grl-local-metadata.c b/src/metadata/local-metadata/grl-local-metadata.c
index b356f25..0ba1fcc 100644
--- a/src/metadata/local-metadata/grl-local-metadata.c
+++ b/src/metadata/local-metadata/grl-local-metadata.c
@@ -426,9 +426,7 @@ got_file_info (GFile *file, GAsyncResult *result,
   GRL_DEBUG ("got_file_info");
 
   /* Free stored operation data */
-  cancellable =
-    grl_metadata_source_get_operation_data (GRL_METADATA_SOURCE (rs->source),
-                                            rs->resolve_id);
+  cancellable = grl_operation_get_data (rs->resolve_id);
 
   if (cancellable) {
     g_object_unref (cancellable);
@@ -568,7 +566,7 @@ resolve_image (GrlMetadataSource *source,
     file = g_file_new_for_uri (grl_media_get_url (rs->media));
 
     cancellable = g_cancellable_new ();
-    grl_metadata_source_set_operation_data (source, rs->resolve_id, cancellable);
+    grl_operation_set_data (rs->resolve_id, cancellable);
     g_file_query_info_async (file, G_FILE_ATTRIBUTE_THUMBNAIL_PATH,
                              G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, cancellable,
                              (GAsyncReadyCallback)got_file_info, rs);
@@ -741,8 +739,7 @@ grl_local_metadata_source_cancel (GrlMetadataSource *source,
                                   guint operation_id)
 {
   GCancellable *cancellable =
-    (GCancellable *) grl_metadata_source_get_operation_data (source,
-                                                             operation_id);
+          (GCancellable *) grl_operation_get_data (operation_id);
 
   if (cancellable) {
     g_cancellable_cancel (cancellable);



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