Re: how to sort / swap rows
- From: muppet man <scott asofyet org>
- To: Jens Luedicke <jens irs-net com>
- Cc: gtk-perl-list gnome org
- Subject: Re: how to sort / swap rows
- Date: Sat, 13 Sep 2003 19:15:26 -0400
On Saturday, September 13, 2003, at 03:40 PM, Jens Luedicke wrote:
I added a sort function to one of the columns in a ListStore
and need to swap rows but gtk complains
that I can't to it. (sorted model)
how can I achive the desired effect? I don't
know if it is exactly what I want/need, but I would
try something like this.
my best guess is that the sort func is supposed to return 1, 0, or -1,
and the model code will do the swapping for you, as the sorted model
doesn't let you change the order from the outside.
indeed, poking through the source for gtk reveals a call to
g_array_sort under the hood, with a proxy that returns the value from
your supplied callback. g_array_sort uses a GCompareFunc, which
returns 1, 0, or -1, like the c library's qsort.
muppet <scott at asofyet dot org>
] [Thread Prev