GNOME Bugzilla – Bug 705558
[listbox] convenience methods to prepend and insert at index
Last modified: 2013-08-08 09:13:50 UTC
Right now rows can just be appended with container_add(). It would be good to have a way to prepend rows and/or insert rows at a given index instead of appending them and then fiddle with a sort function.
Created attachment 250964 [details] [review] Add gtk_list_box_prepend Add a convenience method for prepending rows to a list box without having to fiddle with a sort function.
Review of attachment 250964 [details] [review]: looks good
Comment on attachment 250964 [details] [review] Add gtk_list_box_prepend pushed
I am leaving the bug open for insert_at_index since Kalev said it would be useful for glade (and sorry about the duplicated comment, slow guadec wifi...)
Created attachment 251119 [details] [review] listbox: Add gtk_list_box_append() for symmetricity Just a convenience API that has the same effect as gtk_container_add(). Commit 0b200aaa324075dff3aff2e0a764936b5ed204d9 added prepend(), and this one adds append() as well for symmetricity.
Created attachment 251120 [details] [review] listbox: Implement gtk_list_box_insert() ... to make it possible to insert rows in the middle of the list without having to fiddle with the sort functions. One of the first users is going to be Glade.
Created attachment 251121 [details] [review] listbox: Reorder code This just moves the gtk_list_box_insert function to where the rest of the public API is defined.
I won't mind leaving the append() patch out if you think the API with only gtk_container_add() is cleaner. A lot of existing API does seem to have all three though: append, prepend, insert.
Review of attachment 251120 [details] [review]: looks good
Review of attachment 251121 [details] [review]: ack
Review of attachment 251119 [details] [review]: I'd rather avoid this and just use add.
Thanks Alex! Attachment 251120 [details] pushed as 43c68e1 - listbox: Implement gtk_list_box_insert() Attachment 251121 [details] pushed as 653fc4f - listbox: Reorder code