Re: Gtk2 1.152 (unstable) available



On Jun 25, 2007, at 4:19 PM, Torsten Schoenfeld wrote:
I'd like to hear some feedback on Gtk2::Builder from people who use
Gtk2::GladeXML.

I'm an infrequent user of GladeXML so I guess that means me :-)

As for connecting signals, just as in Gtk2::GladeXML, you have three
options:

  $builder->connect_signals ($user_data)
   When invoked like this, Gtk2::Builder will connect signals to
   functions in the main package whose names are specified in the
   UI description.

 $builder->connect_signals ($user_data, $package)
   When invoked like this, Gtk2::Builder will connect signals to
   functions in the package $package.

 $builder->connect_signals ($user_data, %handlers)
   When invoked like this, %handlers is used as a mapping from
   handler names to code references.

One piece of functionality from GladeXML that isn't explicitly mentioned
in your description is:

  $builder->connect_signals ($user_data, $object)
    When invoked like this, Gtk2::Builder will connect signals to
    method calls against the object $object.

Also I looked briefly at the C API docs for GtkBuilder and it says:

  GtkBuilder also provides an interface by which it can look up the
  signal handler names in the program's symbol table and automatically
  connect as many handlers up as it can that way.

Is that type of functionality supported by the Perl bindings?  What I'm
envisaging is defining a UI in Glade but not specifying any signal
handler details.  Then having some auto connect method in the builder
package scan the object for methods matching a certain naming convention
and then hooking up the appropriate signals.  So handling an additional
signal would simply require the developer to add another method to the
object class.

The autoconnect code would probably be too expensive to be the default
behaviour.

Here's a link to my last burblings on this topic:

http://mail.gnome.org/archives/gtk-perl-list/2006-July/msg00059.html

Cheers
Grant






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