Re: libglade with Gtk2 and Gnome2

On Sat, 2003-04-12 at 04:41, Sylvain Daubert wrote:
Le Fri, 11 Apr 2003 15:19:32 -0400 (EDT)
Chas Owens <alas widomaker com> a Ãcrit :

Has anyone written a wrapper for the new libglade?  Gtk::GladeXML is why I fell
in love with the original gtk perl module, but I don't see anything like it in
the new modules.
gtk-perl-list mailing list
gtk-perl-list gnome org
Envie de discuter en "live" avec vos amis ? TÃlÃcharger MSN Messenger la 1Ãre messagerie instantanÃe de France

Dermot Musgrove wrote GladePerl and he has begun writing Glade-Two-Perl. But last release is from last 


Glade-Two-Perl is not the same thing as Gtk::GladeXML.  The former is a
Perl script that builds Perl code from the glade file.  The later is a
Perl Module that takes XML (normally the glade file) and returns a
widget tree.  The biggest difference is that the UI can be changed
without modifying the Perl code with Gtk::GladeXML.  Gtk::GladeXML
doesn't have to build the whole glade file; you can specify a widget to
start building from.  One of my programs allows you to add multiple
copies of a widget tree (an editor + other stuff) to a Gtk::Notebook. 
With Glade-Two-Perl I would have to build that widget tree by hand since
it is dynamically generated, but with Gtk::GladeXML I can create a
placeholder window with the widget tree in it and then call
Gtk::GladeXML->new with the top level widget in that placeholder window.


use strict;

use Gtk;
use Gtk::GladeXML;





package MainWindow {

        our $editor_count = 0;

        sub new {
                my $class = shift;
                my $self;
                $self = Gtk::GladeXML->new(
                return bless $class, $self;

        sub new_tab {
                my $thing = shift;

                my $self;

                if (ref $thing == "MainWindow") {
                        $self = $thing;
                } else {
                        $self = $thing->get_widget_tree;


        sub AddEditor {
                my ($self, $editor, $text) = @_;
                my $notebook = $self->get_widget('notebook');
                        Gtk::Label->new('Tab ' . $editor_count++)

package Editor;

        sub new {
                my $class = shift;
                my $self = Gtk::GladeXML->new(
                return bless $class, $self;

        sub run {

        sub stop {

        sub refresh {

        sub save {

        sub open {

        sub close {


Chas Owens <alas widomaker com>

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