Re: StatusIcon error
- From: "Tijmen Ruizendaal" <tijmen ruizendaal gmail com>
- To: "Jamie Lahowetz" <deadpickle gmail com>
- Cc: gtk-perl-list gnome org
- Subject: Re: StatusIcon error
- Date: Tue, 14 Aug 2007 16:42:12 +0200
Cool to see some old code from me here :-)
Anyway, StatusIcon is not yet supported in the latest Gtk2 for ActivePerl afaik.
To create a icon in the windows statusbar, try this code:
if ($w32) {
my $main = Win32::GUI::Window->new(
-name => 'Main',
-text => 'Perl',
-width => 0,
-height => 0
);
$trayicon = new Win32::GUI::Icon('glade/BeeHive.ico');
my $ni = $main->AddNotifyIcon(
-name => "NI",
-icon => $trayicon,
-tip => "Gtk2 BitlBee"
);
}
Btw, you might want to download the latest stable version of Gtk2 BitlBee here:
http://the-timing.nl/stuff/gtk2-bitlbeeThere are more changes coming in a month or so.
On 8/14/07,
Jamie Lahowetz <deadpickle gmail com> wrote:
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
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]