Re: Gtk2 1.152 (unstable) available




On Jun 25, 2007, at 4:19 PM, Torsten Schoenfeld wrote:

On Sun, 2007-06-24 at 14:26 +0200, Torsten Schoenfeld wrote:

* Add support for GtkBuilder.  [Torsten]

I'd like to hear some feedback on Gtk2::Builder from people who use
Gtk2::GladeXML.  The new API is roughly:

  $builder = Gtk2::Builder->new

followed by either

  $builder->add_from_file ($file)

or

  $builder->add_from_string ($buffer).

So, two boilerplate lines in all cases?

How about

    $builder = Gtk2::Builder->new_from_file ($filename);

?

Or possibly:

    $builder = Gtk2::Builder->new (
                filename => $filename,
                package => $package,
                userdata => $userdata,
    );



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.

In Gtk2::GladeXML, if you didn't supply a package to signal_autoconnect_from_package(), it default to the *calling* package, not to main.

    sub signal_autoconnect_from_package
    {
        my $self = shift;
        my $package = shift;

        ($package, undef, undef) = caller() unless $package;
        $self->signal_autoconnect(\&_autoconnect_helper, $package);
    }



--
It's all very complicated and would take a scientist to explain it.
  -- MST3K





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