GNOME Bugzilla – Bug 612283
Clarification for GtkListStore::gtk_list_store_insert_with_values() API doc
Last modified: 2012-02-20 10:27:52 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.
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.
Created attachment 208032 [details] [review] documentation improvement for position = -1
Review of attachment 208032 [details] [review]: looks good to me.
Comment on attachment 208032 [details] [review] documentation improvement for position = -1 Pushed to master as commit 9a732c40fc07e5aa3c9b946f935527c89bf905f3, thanks.