1 /* test program for libmmanager */
3 #include <libmmanager/mm-manager.h>
4 #include <libmmanager/mm-application.h>
5 #include <libmmanager/mm-category.h>
6 #include <libmmanager/mm-filter.h>
7 #include <libmmanager/mm-hit.h>
8 #include <libmmanager/mm-hit-collection.h>
9 #include <libmmanager/mm-attribute.h>
10 #include <glib-object.h>
11 #include <gio/gdesktopappinfo.h>
16 print_all (MMAttribute
* attr
,
22 string
= g_value_get_string (val
);
23 g_print ("attr %s, name %s, desc %s, value %s\n", mm_attribute_get_id (attr
),
24 mm_attribute_get_name (attr
), mm_attribute_get_description (attr
),
29 print_all_hits (MMHitCollection
*coll
)
34 while ((h
= mm_hit_collection_get_next_hit (coll
)) != NULL
) {
35 table
= mm_hit_get_all_values (h
);
36 g_hash_table_foreach (table
, (GHFunc
) print_all
, NULL
);
41 print_all_categories (MMApplication
*app
)
46 cats
= mm_application_get_categories (app
);
47 f
= g_object_new (MM_TYPE_FILTER
, NULL
);
48 for (l
= cats
; l
; l
= l
->next
) {
49 g_print ("category name %s\n", mm_category_get_name (l
->data
));
50 print_all_hits (mm_category_get_hits (l
->data
, f
));
54 int main (int argc
, char **argv
)
57 GList
*applications
, *l
;
58 GDesktopAppInfo
*info
;
63 manager
= mm_manager_get ();
64 applications
= mm_manager_get_application_list (manager
);
66 for (l
= applications
; l
; l
= l
->next
) {
68 info
= mm_application_get_app_info (app
);
69 g_print ("found application %s\n", g_app_info_get_name (G_APP_INFO (info
)));
70 print_all_categories (app
);
73 g_print ("end of list\n");