=?utf-8?q?=5Blibgdata=5D_Bug_659148_=E2=80=94_Add_search-term_query_examp?= =?utf-8?q?le_to_documentation?=



commit 1e16460f0df6d67c55569c8b2a39293aa32e0f5e
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon Oct 10 22:27:38 2011 +0100

    Bug 659148 â Add search-term query example to documentation
    
    Closes: bgo#659148

 gdata/services/youtube/gdata-youtube-service.c |   39 ++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)
---
diff --git a/gdata/services/youtube/gdata-youtube-service.c b/gdata/services/youtube/gdata-youtube-service.c
index 90a48e3..2e57984 100644
--- a/gdata/services/youtube/gdata-youtube-service.c
+++ b/gdata/services/youtube/gdata-youtube-service.c
@@ -196,6 +196,45 @@
  *	g_object_unref (feed);
  * 	</programlisting>
  * </example>
+ *
+ * <example>
+ * 	<title>Querying for Videos using Search Terms</title>
+ * 	<programlisting>
+ *	GDataYouTubeService *service;
+ *	GDataYouTubeQuery *query;
+ *	GDataFeed *feed;
+ *	GList *i;
+ *	GError *error = NULL;
+ *
+ *	/<!-- -->* Create a service *<!-- -->/
+ *	service = create_youtube_service ();
+ *
+ *	/<!-- -->* Build a query with the given search terms, also matching only videos which are CC-licensed *<!-- -->/
+ *	query = gdata_youtube_query_new (my_space_separated_search_terms);
+ *	gdata_youtube_query_set_license (query, GDATA_YOUTUBE_LICENSE_CC);
+ *
+ *	/<!-- -->* Query for the videos matching the query parameters *<!-- -->/
+ *	feed = gdata_youtube_service_query_videos (service, query, NULL, NULL, NULL, &error);
+ *
+ *	g_object_unref (query);
+ *	g_object_unref (service);
+ *
+ *	if (error != NULL) {
+ *		g_error ("Error querying for videos matching search terms â%sâ: %s", my_space_separated_search_terms, error->message);
+ *		g_error_free (error);
+ *		return;
+ *	}
+ *
+ *	/<!-- -->* Iterate through the videos *<!-- -->/
+ *	for (i = gdata_feed_get_entries (feed); i != NULL; i = i->next) {
+ *		GDataYouTubeVideo *video = GDATA_YOUTUBE_VIDEO (i->data);
+ *
+ *		/<!-- -->* Do something with the video, like insert it into the UI *<!-- -->/
+ *	}
+ *
+ *	g_object_unref (feed);
+ * 	</programlisting>
+ * </example>
  **/
 
 #include <config.h>



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