Missing setter for GKeyFileFlags for GKeyFile
Submitted by Simon Budig
Link to original bug (#350000)
Description
The API lacks a setter function for the GKeyFileFlags of a newly created GKeyFile.
If you generate a new GKeyFile you can add values and comments just fine, but the comments won't get written out by g_key_file_to_data (), since G_KEY_FILE_KEEP_COMMENTS is not set. It cannot be set without sideeffects with the current API.
My workaround is
kfile = g_key_file_new (); g_key_file_load_from_data (kfile, "\n", 1, G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS, NULL);
[set the values and invoke _to_data()]
but this has the side effect that the newline gets written to the output file as well - it is also not possible to load 0 bytes from data to avoid that.
A g_key_file_[gs]et_flags () would not hurt.
Version: 2.10.x