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

Gtk2::ItemFactory



The attached script produces a line of this:

Use of uninitialized value in subroutine entry at 
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Gtk2.pm line 71.

for each item in the @items array. I'm pretty sure that I've got the
layout of the items correct - it does actually run. I guess this has 
something to do with warnings in Gtk2.pm.

I would test against CVS but I think Sourceforge are having problems.

I've come across a number of weird errors using item factories, but I'm 
not sure that it isn't my own code at fault. But this one seems to be in 
Gtk2.pm itself.

Thanks a lot,

Gavin.

-- 
Gavin Brown
e: gavin brown uk com
w: http://jodrell.net/
PGP/GPG key ID: 891D8FCA
#!/usr/bin/perl
use Gtk2;
use strict;

Gtk2->init;

my $window = Gtk2::Window->new('toplevel');
$window->signal_connect('delete_event', sub { exit });

my $button = Gtk2::Button->new('Menu');

my @items = (
	[
		'/',
		undef,
		undef,
		undef,
		'<Branch>'
	],
	[
		'/Run Galeon',
		undef,
		sub { system('galeon &') },
		undef,
		'<StockItem>',
		'gtk-execute'
	],
	[
		'/Run Terminal',
		undef,
		sub { system('gnome-terminal &') },
		undef,
		'<StockItem>',
		'gtk-execute'
	],	[
		'/Run GIMP',
		undef,
		sub { system('gimp &') },
		undef,
		'<StockItem>',
		'gtk-execute'
	],	[
		'/Run Gedit',
		undef,
		sub { system('gedit --new-window &') },
		undef,
		'<StockItem>',
		'gtk-execute'
	],
);

my $factory = Gtk2::ItemFactory->new('Gtk2::Menu', '<main>', undef);

$factory->create_items(@items);

my $menu = $factory->get_widget('<main>');

$button->signal_connect('clicked', sub { $menu->popup(undef, undef, undef, undef, $button, undef) });

$window->add($button);

$window->show_all;

Gtk2->main;


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