StatusIcon error
- From: "Jamie Lahowetz" <deadpickle gmail com>
- To: gtk-perl-list gnome org
- Subject: StatusIcon error
- Date: Tue, 14 Aug 2007 09:27:58 -0500
I have been trying to get Gtk2::SatusIcon to work correctly. I am using ActivePerl with Gtk2 1.141 compiled with gtk+ runtime environment 2.10.11 and when I go to run a script using Gtk2::StatusIcon I get the error "Can't locate object method "new" via package "Gtk2::StatusIcon" at
test.pl line 7" where the line in question is "my $icon = Gtk2::StatusIcon->new();". Any idea on whats going on?
CODE
#!/usr/bin/perl
use Gtk2 '-init';
use strict;
my $icon = Gtk2::StatusIcon->new();
$icon->set_from_stock('open');
$icon->set_visible(1);
$icon->signal_connect('popup-menu' => sub { show_icon_menu($icon); } );
$icon->set_tooltip('Gtk2 BitlBee, Bzzzz...');
print "StatusIcon loaded\n";
sub show_icon_menu {
my $menu = Gtk2::Menu->new();
my $menuitem = Gtk2::MenuItem->new('Preferences');
my $nicksitem = Gtk2::MenuItem->new('Nicks');
$nicksitem->show();
my $allnicks = new Gtk2::Menu->new();
my @nicks = ('foo', 'bar', 'me', 'you');
foreach my $nick (@nicks) {
my $nickitem = Gtk2::MenuItem->new($nick);
$nickitem->show();
$allnicks->append($nickitem);
}
$nicksitem->set_submenu($allnicks);
$menuitem->show();
$menuitem->signal_connect('activate', sub { print "Click\n"; });
$menu->append($menuitem);
$menu->append($nicksitem);
$menu->show_all();
$menu->popup(undef, undef, sub { return
Gtk2::StatusIcon::position_menu($menu, 0, 0, $icon); }, [1,1], 0, 0 );
}
Gtk2->main;
--
Jamie Lahowetz
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]