Re: libglade with Gtk2 and Gnome2



under new-gtk2-perl it shouldn't be much of an issue to get things in
order so that Gtk:GladeXML can be done. i.e. adding GladeXML to the
typemaps, adding the necessary. cflags/libs, etc. i (or muppet) can do
the initial steps toward that in about 5 minutes.i have no experience
with libglade so i wouldn't be the person to do the xs bindings.after
looking at the glade-xml.h header file the complicated part(s) would be
the dealing with functions that involve callbacks.(as is the case with
gtk -> anything mappings) 

short version: can be done, relatively easy to do, someone that knowns
libglade/GladeXML needs to volunteer to do it.

-rm

On Sat, 2003-04-12 at 09:26, Chas Owens wrote:
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
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
_____________________________________________________________________
Envie de discuter en "live" avec vos amis ? Télécharger MSN Messenger
http://www.ifrance.com/_reloc/m 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 
september...

Sylvain

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.

#!/usr/bin/perl

use strict;

use Gtk;
use Gtk::GladeXML;

Gtk->init;

MainWindow->new;

Gtk->main;

BEGIN {

package MainWindow {

      our $editor_count = 0;

      sub new {
              my $class = shift;
              my $self;
              $self = Gtk::GladeXML->new(
                      'example.glade',
                      'main_window'
              );
              $self->autoconnect('MainWindow');
              return bless $class, $self;
      }

      sub new_tab {
              my $thing = shift;

              my $self;

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

              $self->AddEditor(Editor->new);
      }

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


package Editor;

      sub new {
              my $class = shift;
              my $self = Gtk::GladeXML->new(
                      'example.glade',
                      'editor_vbox'
              );
              $self->autoconnect('Editor');
              return bless $class, $self;
      }

      sub run {
      }

      sub stop {
      }

      sub refresh {
      }

      sub save {
      }

      sub open {
      }

      sub close {
      }

}






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