After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 350000 - Missing setter for GKeyFileFlags for GKeyFile
Missing setter for GKeyFileFlags for GKeyFile
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: gkeyfile
2.10.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2006-08-04 23:42 UTC by Simon Budig
Modified: 2018-05-24 10:51 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Simon Budig 2006-08-04 23:42:28 UTC
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.
Comment 1 Stefan Sauer (gstreamer, gtkdoc dev) 2008-04-14 06:40:44 UTC
Good catch.
Comment 2 GNOME Infrastructure Team 2018-05-24 10:51:07 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/60.