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 705558 - [listbox] convenience methods to prepend and insert at index
[listbox] convenience methods to prepend and insert at index
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2013-08-06 12:32 UTC by Paolo Borelli
Modified: 2013-08-08 09:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add gtk_list_box_prepend (3.83 KB, patch)
2013-08-06 13:17 UTC, Paolo Borelli
committed Details | Review
listbox: Add gtk_list_box_append() for symmetricity (2.46 KB, patch)
2013-08-08 06:15 UTC, Kalev Lember
rejected Details | Review
listbox: Implement gtk_list_box_insert() (4.64 KB, patch)
2013-08-08 06:15 UTC, Kalev Lember
committed Details | Review
listbox: Reorder code (5.42 KB, patch)
2013-08-08 06:50 UTC, Kalev Lember
committed Details | Review

Description Paolo Borelli 2013-08-06 12:32:47 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.
Comment 1 Paolo Borelli 2013-08-06 13:17:24 UTC
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.
Comment 2 Alexander Larsson 2013-08-07 08:49:33 UTC
Review of attachment 250964 [details] [review]:

looks good
Comment 3 Paolo Borelli 2013-08-07 09:01:39 UTC
Comment on attachment 250964 [details] [review]
Add gtk_list_box_prepend

pushed
Comment 4 Paolo Borelli 2013-08-07 09:09:33 UTC
Comment on attachment 250964 [details] [review]
Add gtk_list_box_prepend

pushed
Comment 5 Paolo Borelli 2013-08-07 09:12:53 UTC
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...)
Comment 6 Kalev Lember 2013-08-08 06:15:03 UTC
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.
Comment 7 Kalev Lember 2013-08-08 06:15:15 UTC
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.
Comment 8 Kalev Lember 2013-08-08 06:50:47 UTC
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.
Comment 9 Kalev Lember 2013-08-08 06:53:44 UTC
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.
Comment 10 Alexander Larsson 2013-08-08 08:55:31 UTC
Review of attachment 251120 [details] [review]:

looks good
Comment 11 Alexander Larsson 2013-08-08 08:55:50 UTC
Review of attachment 251121 [details] [review]:

ack
Comment 12 Alexander Larsson 2013-08-08 08:56:26 UTC
Review of attachment 251119 [details] [review]:

I'd rather avoid this and just use add.
Comment 13 Kalev Lember 2013-08-08 09:13:35 UTC
Thanks Alex!

Attachment 251120 [details] pushed as 43c68e1 - listbox: Implement gtk_list_box_insert()
Attachment 251121 [details] pushed as 653fc4f - listbox: Reorder code