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 532904 - missing methods in Glib::KeyFile
missing methods in Glib::KeyFile
Status: RESOLVED WONTFIX
Product: gtkmm
Classification: Bindings
Component: general
2.4.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2008-05-13 06:59 UTC by Mihai Niculescu
Modified: 2008-05-16 16:21 UTC
See Also:
GNOME target: ---
GNOME version: 2.21/2.22



Description Mihai Niculescu 2008-05-13 06:59:27 UTC
Hi,
I was playing with Glib::KeyFile and I observed there are no methods to
create (add) a new Group or a new Key to an existing group.
I think it would be useful to have such methods:
- add_group(Glib::ustring group_name) - to create a new group
- add_group(Glib::ustring group_name, Glib::ustring before_group) - to
create a new group before group named 'before_group'
....
- add_key(Glib::ustring group_name, Glib::ustring key_name, Glib::ustring key_value)
etc., similar for keys
Comment 1 Murray Cumming 2008-05-13 09:22:30 UTC
> add_group(Glib::ustring group_name)

Presumably groups are added automatically when specified to set*() methods.

> add_group(Glib::ustring group_name, Glib::ustrsing before_group)

I don't believe that anything else in the GKeyFile API makes any use of the sequence of groups or keys. How would this be useful?

Comment 2 Mihai Niculescu 2008-05-13 13:07:20 UTC
>> add_group(Glib::ustring group_name)
> Presumably groups are added automatically when specified to set*() methods.

You are right, using set methods groups are automatically added if they don't exist.
But, I believe a set*() method is not as intuitive as an add*() method to create a new group or a new key.

>> add_group(Glib::ustring group_name, Glib::ustrsing before_group)

>I don't believe that anything else in the GKeyFile API makes any use of the
>sequence of groups or keys. How would this be useful?

It is only an example. I don't know the GKeyFile API.

First, I thought there are no methods to add new groups or keys because I didn't see any method named "add" or "create".
 You solved my problem and for that I thank you!
And so, I don't know if this bug should remain valid, on the other hand, it would be an enhancement for Glib::KeyFile to have such intuitive methods.

Thanks again!
Comment 3 Murray Cumming 2008-05-13 14:27:25 UTC
Personally, I don't think it would make the API clearer. It would be an unnecessary extra step. However, we should make sure that the documenation says that groups and keys are added automatically.
Comment 4 Murray Cumming 2008-05-16 16:21:24 UTC
I checked. It's already documented:
http://www.gtkmm.org/docs/glibmm-2.4/docs/reference/html/classGlib_1_1KeyFile.html#38bf60f9bdd209d28ae818e7dee6ea17

If you are still convinced that group creation should not be automatic then please file a bug in GTK+. I don't think they would want that though.