[grilo-plugins] youtube: Use GDataYouTubeQuery when building GData queries



commit fe4253a5a346903f9d412748aeae06a56acbb854
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sat Apr 18 23:18:08 2015 +0100

    youtube: Use GDataYouTubeQuery when building GData queries
    
    Do not use the parent GDataQuery class. While this worked previously, it
    is not a valid use of the API, as it prevents any overrides in
    GDataYouTubeQuery from being used when building query APIs. This will
    cause queries to break in the transition from Google’s v2 to v3 API,
    since the GDataYouTubeQuery behaviour has to diverge from GDataQuery.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=748395

 src/youtube/grl-youtube.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/youtube/grl-youtube.c b/src/youtube/grl-youtube.c
index e14aa65..412ce13 100644
--- a/src/youtube/grl-youtube.c
+++ b/src/youtube/grl-youtube.c
@@ -1155,7 +1155,9 @@ produce_from_feed (OperationSpec *os)
   service = GRL_YOUTUBE_SOURCE (os->source)->priv->service;
 
   /* Index in GData starts at 1 */
-  query = gdata_query_new_with_limits (NULL , os->skip + 1, os->count);
+  query = gdata_youtube_query_new (NULL);
+  gdata_query_set_start_index (query, os->skip + 1);
+  gdata_query_set_max_results (query, os->count);
   os->category_info = &feeds_dir[feed_type];
 
   gdata_youtube_service_query_standard_feed_async (GDATA_YOUTUBE_SERVICE (service),
@@ -1205,7 +1207,9 @@ produce_from_category (OperationSpec *os)
   service = GRL_YOUTUBE_SOURCE (os->source)->priv->service;
 
   /* Index in GData starts at 1 */
-  query = gdata_query_new_with_limits (NULL , os->skip + 1, os->count);
+  query = gdata_youtube_query_new (NULL);
+  gdata_query_set_start_index (query, os->skip + 1);
+  gdata_query_set_max_results (query, os->count);
   os->category_info = &categories_dir[category_index];
   gdata_query_set_categories (query, category_term);
 
@@ -1392,7 +1396,9 @@ grl_youtube_source_search (GrlSource *source,
   grl_operation_set_data (ss->operation_id, os->cancellable);
 
   /* Index in GData starts at 1 */
-  query = gdata_query_new_with_limits (ss->text, os->skip + 1, os->count);
+  query = gdata_youtube_query_new (ss->text);
+  gdata_query_set_start_index (query, os->skip + 1);
+  gdata_query_set_max_results (query, os->count);
 
   gdata_youtube_service_query_videos_async (GDATA_YOUTUBE_SERVICE (GRL_YOUTUBE_SOURCE 
(source)->priv->service),
                                             query,


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