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 612283 - Clarification for GtkListStore::gtk_list_store_insert_with_values() API doc
Clarification for GtkListStore::gtk_list_store_insert_with_values() API doc
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Documentation
unspecified
Other All
: Normal minor
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2010-03-09 11:47 UTC by Hong Jen Yee
Modified: 2012-02-20 10:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
documentation improvement for position = -1 (1.38 KB, patch)
2012-02-20 10:08 UTC, David King
committed Details | Review

Description Hong Jen Yee 2010-03-09 11:47:22 UTC
quote the original API doc:
"If position is larger than the number of rows on the list, then the new row will be appended to the list."

Actually, the internal implantation uses GSequence, and according to GSequence API doc, if position is -1, end iter is returned.
So actually if we pass -1 to gtk_list_store_insert_with_values, we can append the item to the list store.
This behavior should be documented as using -1 is much more convinient than using a value > numbers of row if you simply want to append the item.
This behavior is also consistent with other GTK+ APIs like gtk_notebook_insert_page(). So I'd suggest get position = -1 documented.
This won't break anything as previously the behavior when position = -1 is undefined.

Thanks.
Comment 1 Christian Dywan 2010-03-09 15:54:04 UTC
As you already noted, you can simply use a sufficiently big number to append. Or even G_MAXINT if you want to be sure that it is big enough.

Albeit I somewhat agree that having consistent behaviour would be nice. So maybe avertising -1 for appending, just like GtkNotebook supports it, would be a good idea.
Comment 2 David King 2012-02-20 10:08:50 UTC
Created attachment 208032 [details] [review]
documentation improvement for position = -1
Comment 3 Emmanuele Bassi (:ebassi) 2012-02-20 10:12:16 UTC
Review of attachment 208032 [details] [review]:

looks good to me.
Comment 4 David King 2012-02-20 10:26:33 UTC
Comment on attachment 208032 [details] [review]
documentation improvement for position = -1

Pushed to master as commit 9a732c40fc07e5aa3c9b946f935527c89bf905f3, thanks.