Re: converting from gtk2-perl to gtk2-perl-xs (work in progress)

Thierry Vignaud said:

gtk_exit is deprecated, and even worse, doesn't let perl clean up.   don't use


in 95% of cases you'll want to do

  use Gtk2 -init;

a la old gtk-perl, because it's a small portion of the time that you want to
make sure things are okay before initializing Gtk.  (not "never", just not so

the inline-based gtk2-perl required you to pass argv, as Gtk2->init(\ ARGV);
--- gtk2-perl-xs doesn't need to you pass anything, as it looks automatically
at @main::ARGV.


said more succinctly, the GType concept is completely hidden from the perl
developer by the bindings, replaced completely by the perl package name.  in
practice, GTypes are needed only in two places: as the parent type when
registering a new GObject subclass, and more commonly for specifying the
column types of a GtkTreeModel.

# Pango constants are pain in the ass to get

just 'use Gtk2::Pango' -- this will export to you the rest of the pango
constants which cannot be used in the normal nickname manner.

# maybe indirect calls:
# s/->free//g;
# s/->unref//g;

you should never see ->ref, either.

# ItemFactory creation from hash is bogus: switch to arrays
# this way, you won't miss <type> anyway ...

the current implementation supports both array and hash forms, like gtk-perl
did.  personally, i found the hash form nicely self-documenting, if verbose;
the array form is more concise.

# TextBuffer->set_text lost its last arg

this has been done in quite a few places, as it makes the interface more
perlish; perl already knows the lengths of strings.

muppet <scott at asofyet dot org>

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