GNOME Bugzilla – Bug 163585
GConf set on lists doesn't work
Last modified: 2011-01-16 23:35:15 UTC
I changed the client example and the name of the list setting methods in the attached patch to show that setting lists puts in the correct number of elements, but doesn't set their value correctly.
Created attachment 35793 [details] [review] slist_handle.diff
So, you solved the first problem. Here is a further patch, but the ints are garbage. Maybe you could look in case you see something obvious.
Created attachment 35798 [details] [review] dodgy_ints.patch
I was looking at the gconf internals and they use GPOINTER_TO_INT to convert a GSList* of ints/bools to a Value list for storing (look at gconf_value_list_from_primitive_list at http://cvs.gnome.org/viewcvs/gconf/gconf/gconf-internals.c?rev=1.130&view=auto). I think the easiest way to do that would be to reverse that and call GINT_TO_POINTER on our ints/bools. I'm still not sure how to handle the doubles.
Well done. That works for ints and bools. Now we just need to figure out the floats - there is commented-out test code in the client example.
If you look in gconf_value_list_to_primitive_list_destructive of that same file I posted here earlier, they allocate some space for a gdouble. We should probably do it that way. Here's the code: [snip] case GCONF_VALUE_FLOAT: { gdouble* d = g_new(gdouble, 1); *d = gconf_value_get_float(elem); tmp->data = d; } break; [snip]
The default BasicTypesTraits now does this, and it works.