[PATCH] all: use the new operation API



From: Lionel Landwerlin <lionel g landwerlin linux intel com>

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/tracker/grl-tracker-utils.c              |    2 +-
 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 ++----
 8 files changed, 26 insertions(+), 53 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/tracker/grl-tracker-utils.c b/src/media/tracker/grl-tracker-utils.c
index fee63c8..febefa5 100644
--- a/src/media/tracker/grl-tracker-utils.c
+++ b/src/media/tracker/grl-tracker-utils.c
@@ -348,7 +348,7 @@ grl_tracker_media_get_select_string (const GList *keys)
                           assoc->sparql_key_name);
 
   while (key != NULL) {
-    assoc_list = get_mapping_from_grl ((GrlKeyID) key->data);
+    assoc_list = get_mapping_from_grl (GPOINTER_TO_SIZE (key->data));
     while (assoc_list != NULL) {
       assoc = (tracker_grl_sparql_t *) assoc_list->data;
       if (assoc != NULL) {
diff --git a/src/media/youtube/grl-youtube.c b/src/media/youtube/grl-youtube.c
index e125980..973fcb4 100644
--- a/src/media/youtube/grl-youtube.c
+++ b/src/media/youtube/grl-youtube.c
@@ -403,8 +403,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);
@@ -916,8 +915,7 @@ metadata_cb (GObject *object,
   } else {
     build_media_from_entry (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);
@@ -1211,9 +1209,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);
@@ -1338,8 +1334,7 @@ media_from_uri_cb (GObject *object, GAsyncResult *result, gpointer user_data)
   } else {
     build_media_from_entry (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);
@@ -1409,9 +1404,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),
@@ -1533,9 +1526,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);
@@ -1605,9 +1596,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,
@@ -1635,8 +1624,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);
-- 
1.7.5.4



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