Add libmmanager-gtk, fix some parts of src/Makefile.am and
[mmediamanager.git] / test / clients / test-serialize.c
blob70fcf26490c9d635b4d35c7e508ab02c15adb7db
1 #include "mm.h"
3 int main (int argc, char ** argv)
5 MMFilter *filter, *unserialized;
6 MMFilterParam *fp;
7 MMAttribute *attr;
8 GValue *val;
9 MMAttributeManager *am;
10 char * serialized;
11 GError *error = NULL;
13 g_type_init ();
15 am = mm_attribute_base_manager_get ();
16 filter = mm_filter_new ();
18 attr = mm_attribute_manager_lookup_attribute (am, "base::uri");
19 val = mm_create_gvalue_for_attribute (attr);
20 g_value_set_string (val, "file:///foo");
21 fp = mm_filter_param_new (attr, val, MM_COMP_EQUAL);
22 mm_filter_add_filtering_param (filter, fp);
23 g_object_unref (fp);
24 g_free (val);
26 attr = mm_attribute_manager_lookup_attribute (am, "base::name");
27 val = mm_create_gvalue_for_attribute (attr);
28 g_value_set_string (val, "Pippo");
29 fp = mm_filter_param_new (attr, val, MM_COMP_GREATER);
30 mm_filter_add_filtering_param (filter, fp);
31 g_object_unref (fp);
32 g_free (val);
34 serialized = mm_filter_serialize (filter, &error);
35 g_print ("serialized filter \n%s\n", serialized);
37 unserialized = mm_filter_unserialize (serialized, &error);
39 g_free (serialized);
40 g_object_unref (filter);
42 return 0;