1 /* test program for libmmanager */
4 #include <libmmanager/mm.h>
5 #include <glib-object.h>
10 print_all (MMAttribute
* attr
,
16 string
= g_value_get_string (val
);
17 g_print ("attr %s, name %s, desc %s, value %s\n", mm_attribute_get_id (attr
),
18 mm_attribute_get_name (attr
), mm_attribute_get_description (attr
),
23 print_all_hits (MMHitCollection
*coll
)
28 while ((h
= mm_hit_collection_get_next_hit (coll
)) != NULL
) {
29 table
= mm_hit_get_all_values (h
);
30 g_hash_table_foreach (table
, (GHFunc
) print_all
, NULL
);
35 print_all_categories (MMApplication
*app
)
44 cats
= mm_application_get_categories (app
, &error
);
45 f
= g_object_new (MM_TYPE_FILTER
, NULL
);
46 a
= mm_attribute_manager_lookup_attribute (mm_attribute_base_manager_get (), MM_ATTRIBUTE_BASE_URI
);
47 val
= mm_create_gvalue_for_attribute (a
);
48 g_value_set_string (val
, "file:///home/anarki/blah");
49 fp
= mm_filter_param_new (a
, val
, MM_COMP_EQUAL
);
50 mm_filter_add_filtering_param (f
, fp
);
53 for (l
= cats
; l
; l
= l
->next
) {
54 g_print ("category name %s\n", mm_category_get_name (l
->data
));
55 print_all_hits (mm_category_get_hits (l
->data
, f
, &error
));
59 int main (int argc
, char **argv
)
62 GList
*applications
, *l
;
68 manager
= mm_manager_get ();
69 applications
= mm_manager_get_application_list (manager
);
71 for (l
= applications
; l
; l
= l
->next
) {
73 info
= mm_application_get_app_info (app
);
74 g_print ("found application %s\n", g_app_info_get_name (G_APP_INFO (info
)));
75 print_all_categories (app
);
78 g_print ("end of list\n");