Re: Can this be used from Gtk2-perl? GtkDatabox




On Apr 30, 2005, at 2:21 PM, zentara wrote:

On Sat, 30 Apr 2005 11:02:06 -0400 muppet <scott asofyet org> wrote:

On Apr 30, 2005, at 9:55 AM, zentara wrote:

  GtkDatabox

http://mail.gnome.org/archives/gtk-perl-list/2004-March/msg00077.html

Hi, thanks, it runs good, and it is a nice example of doing xs with Gtk2.

If i recall correctly (and i probably don't) i didn't put a whole lot of work into the binding -- i just did it to see if the thing was any good to use with a particular perl app i was working on. I never did do any leak-testing on it. Let me know if you have problems.


I did notice 1 small error in the examples, which I have also seen throughout
the tutorials, that is using   :: notation where you need a  ->.

In what contexts in the tutorials? When referring to a particular method the convention is to use the Fully::Qualified::method_name(), whereas when showing how to invoke something it will be $object->method_name().


For example in lissajous.pl around line 75,

#$window->signal_connect (destroy => \&Gkt2::main_quit);
needs to be
$window->signal_connect (destroy => sub {Gtk2->main_quit});

Congratulations!  You have found an "interesting" special case!

There's a default parameter on the class argument to Gtk2::main_quit() to allow it to be called with no argument. This was done, IIRC, specifically to allow Gtk2::main_quit() to be used directly as a signal callback, without a useless closure.

Now, i say that was the reason, but in going back to the CVS logs to confirm this, i find that it is an undocumented feature that very well may have been committed by accident. It happened in revision 1.39 of Gtk2.xs (just before the 1.04x stable series): http://cvs.sourceforge.net/viewcvs.py/gtk2-perl/gtk2-perl-xs/Gtk2/xs/ Gtk2.xs?r1=1.38&r2=1.39 Interestingly, this is not mentioned in the ChangeLog entry, and isn't done for Gtk2::main().


When I've been going thru the tutorials, I've seen this in quit a few of
the code snippets and code, and it probably will confuse alot of
beginners...it took me a bit of time to figure it out. :-)

That's true.  Still, TIMTOWTDI.




--
"Ears! They help us -- Ears! They help us hear th-- Ea--E--E--E--Ears!"
  -- A Sesame Street singing toy, with Yvonne gleefully pressing
    the button over and over and over and over and...




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