Re: Applets

On 2/1/07, Juan José 'Peco' San Martín <peco microbotica es> wrote:
Is PerlPanel currently the best approach to deploy Applets?. Do you have
another solution?.

Depending on what you want to do Gtk2::TrayIcon may suit your needs.
It acts as a container for widgets in the Notification Area.  I use
the following code to turn my vpn connection on and off.


use strict;
use Gtk2::TrayIcon;


my $current;
if (grep { /vpnc/ } `ps -ef`) {
       $current = 'connect';
} else {
       $current = 'disconnect';

my $size    = 'small-toolbar';
my $icon    = Gtk2::TrayIcon->new("vpn control");
my $ev      = Gtk2::EventBox->new;
my $img     = Gtk2::Image->new_from_stock("gtk-$current", $size);

$ev->signal_connect('button_release_event', sub {
       if ($current eq 'connect') {
               $current = 'disconnect';
               system "gksudo vpnc-disconnect";
       } else {
               $current = 'connect';
               system "gksudo vpnc /home/cowens/.vpn.conf";
       $img->set_from_stock("gtk-$current", $size);



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