Perl/Gtk: how to get the data from a Gtk::ListItem ?



Hi,

I'm writing a Perl Gtk program which creates a Gtk::List, and adds
several items to it, like this (boiler-plate code omitted):

  @items = qw(one two three four);
  $l = new Gtk::List;

  for $item (@items) {
    my $li = new Gtk::ListItem($item);
    $list->add($li);
    $li->show;
  }
  $list->signal_connect('selection_changed' => \&sel_callback);

Now, this works fine - the items appear in the list as I'd expect.
Here's the callback:

  sub sel_callback {
    my ($w) = @_;
    my @list = $w->selection;
    my $item = $list[0];
    # now what?
  }

This gives me back a Gtk::ListItem, but how do I get the original data
from it?  It seems that in C I would use gtk_object_get_data() - is this
right?  Is this missing from the Perl binding or should I be using 
something else?

-- 
Des Herriott
des@corp.netcom.net.uk



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