Hm. ItemFactory vs. gtk2-perl 0.90 ? :)
- From: Christian Hamar <krics linuxforum hu>
- To: gtk-perl-list gnome org
- Subject: Hm. ItemFactory vs. gtk2-perl 0.90 ? :)
- Date: Mon, 21 Jul 2003 10:57:57 +0200
Hi there. I posted a topic about ItemFactory things and "attach" a small
source code. I had some problems with callback. Now i upgraded gtk2-perl to
0.90 and this script which running :) not run with new 0.90 version.
The error is this :
root:/works2/uhutv-0.9# ./x.pl
ItemFactory couldn't retrieve widget it just created at
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Gtk2.pm line 74.
So what is that ? :) I f*cked up something in the source ?? Or it wasn't
really good ? Or what? :)
Best Regards: Christian Hamar alias kRiX
Ps..: here is the source :
#!/usr/bin/perl -w
use Gtk2;
init Gtk2;
$m{'win'} = new Gtk2::Window;
$m{'win'}->signal_connect('delete-event', sub { Gtk2->main_quit; });
$m{'win'}->set_title("TEST");
$m{'vbox'} = new Gtk2::VBox(0,1);
$m{'win'}->add($m{'vbox'});
@menu_items = (
{
path => '/Main',
type => '<Branch>'
},
{
path => '/Main/_TV',
accelerator => '<control>T',
callback => \&do_some
},
{
path => '/Main/_Print',
accelerator => '<control>P',
callback => \&do_print
},
{
path => '/Main/_Exit',
accelerator => '<control>E',
callback => sub {Gtk2->main_quit;}
},
{
path => '/Perfs',
type => '<Branch>'
},
{
path => '/Perfs/_Settings',
accelerator => '<control>S',
callback => \&do_settings
},
{
path => 'Help',
type => '<Branch>'
},
{
path => '/Help/About',
callback => \&do_about
}
);
$m{'menubar'} = create_menubar( $m{'win'} );
$m{'vbox'}->pack_start($m{'menubar'}, 0, 1, 0);
sub create_menubar {
my ( $window ) = @_;
my $item_factory;
my $accel_group;
$accel_group = new Gtk2::AccelGroup();
$item_factory = new Gtk2::ItemFactory( 'Gtk2::MenuBar', '<main>',
$accel_group);
$item_factory->create_items( @menu_items);
$window->add_accel_group($accel_group);
return ($item_factory->get_widget('<main>'));
}
$m{'win'}->show_all;
main Gtk2;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]