Re: Implement TreeModel signal "rows-reordered"



Roderich Schupp said:
the TreeModel signal "rows-reordered" has the problem
that it has a gint* parameter which points to a vector
of reordered indexes. The generic signal marshaller
cannot cope with this since it doesn't know the length
of the vector (it's the number of children of the
node given by the treepath or treeiter parameter).
Here's a custom marshaller to convert the gint*
into an array ref (was against Gtk2 1.014, but applies
cleanly to 1.020).

the patch needed a couple minor changes:

- although recent versions of GCC seem to allow it, C does not allow variables
to be declared in the middle of the code; they must be at the top of the
function.  namely, the declaration of AV * av needs to be at the top of the
file, before the dGPERL_CLOSURE_MARSHAL_ARGS statement.

- the array reference should be made mortal as it goes onto the stack, so that
it will be properly cleaned up by FREETMPS.


with those changes, i applied it to HEAD, along with an implementation of the
method that emits the rows-reordered signal.  this is necessary for
implementing new models (as mentioned in my message about GInterfaces) and
lets me add some stress-testing to the testcase you supplied offlist.

also, while porting that test into the TreeStore test as well, i found (and
fixed) an off-by-one bug in the implementation of a Gtk2::TreeStore::reorder.

-- 
muppet <scott at asofyet dot org>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]