Re: Gtk2::SimpleList



On Fri, 2003-07-18 at 09:54, muppet wrote:
Gavin Brown said:
Basically this is an RFC - I'd like to get an idea of how people want to
use/are using Gtk2 lists and how closely this might meet their needs.

i'll look at this and my stuff when i have more time.

i would use them more if they weren't such a pain, so i am excited about your
effort.

i've got some code that's the beginnings of a possible tree helper. i
decided that a good way to learn about how the whole MVC stuff works
would be to look at that.

how about Tie'ing the perl representation (an array for a GtkListStore, maybe
a hash for a GtkTreeStore) to the underlying GtkTreeModel, so that you don't
maintain two structures?  the perl variable would always be up to date,
because FETCH would call $treemodel->get and STORE would call $treemodel->set.

well, the tree thing might be problematic because of the undefined order for
hash elements, even though the underlying structure would preserve the order. 
just an idea.

my stuff was an array of anon hashes so as to preserve order :)

my @tree = (
        {
                name => 'p1',
                number => 42,
                children => (
                        {
                                name => 'c1p1',
                                number => 42.1
                        },
                        {
                                name => 'c2p1',
                                number => 42.2
                        },
                ),
        },
        {
                name => 'p2',
                number => 1,
                children => (
                        {
                                name => 'c1p2',
                                number => 1.1
                        },
                        {
                                name => 'c2p2',
                                number => 1.2
                        },
                ),
        },
        ...
)

and a function that recursively descended the tree, handling the
appropriate parent iter usage.

this may make more sense implemented as another type of model...  i dunno.

that would be an interesting experiment.

-rm




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