Re: Notebooks and GLists



On 30 August 2011 23:08, Neil Munro <neilmunro gmail com> wrote:
Hi folks
     Not a very descript title, but I fail to come up with a better
one. Anyway my problem is as follows.

I have a notebook with reorderable tabs which each displays a sourceview
widget.
Each sourceview widget represents a document where a document is an instance
of an object/struct.
When the tabs are re-ordered the glist becomes out of order with the tabs
and needs to be updated to reflect the new page positions.

Using the page-reordered signal and callback I can get the new page position
but not the old position.

If there is a better way to go about implementing a system like this, I
would be willing to hear it and any help is appreciated.

Finally you can get the code here: https://gitorious.org/x2

You did not implement any Reorder. In absence of any code to comment
on I suggest you save the old order (= the last order known to your
code) in another GList and when you receive a reorder event you can
compare the new position with the saved position.

You need these two GLists to hold the same (or convertible) unique
values. eg. pointer to tab is one sufficiently unique value.

Pointer to tab and pointer a struct containing a pointer to tab is an
example of trivially convertible (and often very useful) unique
values.

HTH

Michal



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