GNOME Bugzilla – Bug 620554
Adapt to GSettings API break
Last modified: 2010-06-04 12:04:56 UTC
See patch.
Created attachment 162737 [details] [review] Adapt to GSettings API break The API for setting and retrieving string arrays was changed, so all calls to g_settings_set_strv()/g_settings_get_strv() need adjusting.
Review of attachment 162737 [details] [review]: The patch looks mostly ok, but have you tested the patch? because probably the array now needs to be NULL terminated as that wasn't needed before with the len argument.
Created attachment 162740 [details] [review] Adapt to GSettings API break (In reply to comment #2) > Review of attachment 162737 [details] [review]: > The patch looks mostly ok, but have you tested the patch? Sorry for not pointing that out - no, I didn't. I checked that gedit compiles and runs, but I haven't gotten gsettings to work yet. > because probably the array now needs to be NULL terminated > as that wasn't needed before with the len argument. I'm not sure that this is truly a new requirement - the API break was requested because according to the g-i annotations the array was NULL-terminated and had its length encoded in the len argument (just mentioning this here because IMO that's a good justification for the break). That said, you are right that one of the list_to_strv functions managed to skip under my radar. Attaching updated patch, interdiff for review convenience: diff --git a/gedit/gedit-settings.c b/gedit/gedit-settings.c index 6b278d4..d0eb84e 100644 --- a/gedit/gedit-settings.c +++ b/gedit/gedit-settings.c @@ -890,12 +890,13 @@ gedit_settings_set_list (GSettings *settings, gint i, len; len = g_slist_length ((GSList *)list); - values = g_new (gchar *, len); + values = g_new (gchar *, len + 1); for (l = list, i = 0; l != NULL; l = g_slist_next (l), i++) { values[i] = l->data; } + values[i] = NULL; } g_settings_set_strv (settings, key, (const gchar * const *)values);
Thanks, now the patch looks good. I've just pushed it.