Gtk::GladeXML and Gtk::CList select-row callback prototype


I am fairly new to writing Gtk apps with perl, but I like it a lot.  I
have run into a problem, though.

I have an apps made with glade.  There is a Clist with a select-row
callback.  There is no data associated with the callback in glade.

I'd expect to see a callback prototype of (I use an OO approach, hence
the $this as the first argument)

sub on_list_select_row {
    my ($this, $list, $row, $column, $event, $user_data) = @_;

as per the C api.

It appears that I get:

sub on_list_select_row {
    my ($this, $list, $user_data, $row, $column, $event) = @_;

that is the $user_data has been shifted in front of the other parameters
to the callback.

If I attach the signal by hand I get the same result, more or less.

If I use
$clist->signal_connect('select-row'=>sub { $this->on_list_select_row(@_); });

the callback get these args:
($this, $clist, $row, $column, $event)

If I use
$clist->signal_connect('select-row'=>sub { $this->on_list_select_row(@_); },

the callback gets
($this, $clist, $arg, $row, $column, $event)

I can add more arguments to signal_connect
$clist->signal_connect('select-row'=>sub { $this->on_list_select_row(@_); },
                       $arg1, $arg2, $arg3);

and the callback gets
($this, $clist, $arg1, $arg2, $arg3, $row, $column, $event)

Frankly, I find this rather confusing.  Why on earth are the user_data
arguments to signal_connect() stuck in the middle of the callback
arguments?   I'd definitely expect to see them at the end.

Is this a bug or an undocumented feature?

I use Debian testing with libgtk-perl and libgladexml-perl 0.7008-1.2.

René Seindal (rene seindal dk)    

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