From 6e9b39c2bc9307d996870df320c7004a790df264 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Sun, 8 Jun 2008 17:38:18 +0200 Subject: [PATCH] Update the test to check for categories and hits too --- test/clients/test-applications.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/test/clients/test-applications.c b/test/clients/test-applications.c index c16522c..ee9a8be 100644 --- a/test/clients/test-applications.c +++ b/test/clients/test-applications.c @@ -2,11 +2,44 @@ #include #include +#include +#include +#include +#include #include #include #include #include +static void +print_all_hits (MMHitCollection *coll) +{ + MMHit *h; + char *name, *uri; + + while ((h = mm_hit_collection_get_next_hit (coll)) != NULL) { + g_object_get (h, "name", &name, + "uri", &uri, NULL); + g_print ("hit: name %s, uri %s\n", name, uri); + g_free (name); + g_free (uri); + } +} + +static void +print_all_categories (MMApplication *app) +{ + GList *cats, *l; + MMFilter *f; + + cats = mm_application_get_categories (app); + f = g_object_new (MM_TYPE_FILTER, NULL); + for (l = cats; l; l = l->next) { + g_print ("category name %s\n", mm_category_get_name (l->data)); + print_all_hits (mm_category_get_hits (l->data, f)); + } + +} int main (int argc, char **argv) { MMManager *manager; @@ -23,6 +56,7 @@ int main (int argc, char **argv) app = l->data; info = mm_application_get_app_info (app); g_print ("found application %s\n", g_app_info_get_name (G_APP_INFO (info))); + print_all_categories (app); } g_print ("end of list\n"); -- 2.11.4.GIT