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 754152 - Add g_list_store_sort
Add g_list_store_sort
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-08-27 03:29 UTC by Matthias Clasen
Modified: 2015-08-31 14:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add g_list_store_store (2.88 KB, patch)
2015-08-27 03:29 UTC, Matthias Clasen
none Details | Review
Add g_list_store_sort (3.07 KB, patch)
2015-08-31 14:43 UTC, Matthias Clasen
committed Details | Review

Description Matthias Clasen 2015-08-27 03:29:04 UTC
This makes it much more practical to use model-based sorting,
with possibly changing sort functions.
Comment 1 Matthias Clasen 2015-08-27 03:29:08 UTC
Created attachment 310069 [details] [review]
Add g_list_store_store
Comment 2 Lars Karlitski 2015-08-27 07:21:18 UTC
Patch looks good, thanks.

We already have g_list_store_insert_sorted(). Is this meant for the case that the model should be resorted for viewing?
Comment 3 Timm Bäder 2015-08-27 09:19:36 UTC
2 nitpicks:

The commit message should say g_list_store_sort and not g_list_store_store.
Is "$GListStore" a syntax I don't know about or should it be #GListStore in the doc comment?
Comment 4 Matthias Clasen 2015-08-31 14:43:12 UTC
Created attachment 310367 [details] [review]
Add g_list_store_sort

GListStore already has a g_list_store_insert_sorted function,
which can be used to keep the list sorted according to a fixed
sort function. But if the sort function changes (as e.g. with
sort columns in a list UI), the entire list needs to be
resorted. In that case, you want g_list_store_sort().
Comment 5 Matthias Clasen 2015-08-31 14:43:36 UTC
Typos fixed, better rationale added.
Comment 6 Matthias Clasen 2015-08-31 14:44:03 UTC
Attachment 310367 [details] pushed as e5734c3 - Add g_list_store_sort