Gtk2-perl: Menu containing Progressbar

I am using Gtk2-perl. What I am trying to do is use the Gtk2::Menu to add a Gtk2::Progressbar to the Menu widget. The idea is to have a window that pops up only when the user left clicks the system tray icon. Is this possible to do? If not is there another way I can do this? Below is a code snippet of the program I am writing. the Gtk2::Progressbar widget will be located in the interface subroutine.

#!/usr/bin/perl -w
use strict;
use warnings;
use threads;
use threads::shared;
use Glib qw/TRUE FALSE/;
use Gtk2 '-init';
use Gtk2::TrayIcon;

#user variables
my $icon_main = Gtk2::Gdk::Pixbuf->new_from
my $icon_nav = Gtk2::Gdk::Pixbuf->new_from_file("/home/deadpickle/Desktop/Gtk2/uvnav.png");
my $icon_vci = Gtk2::Gdk::Pixbuf->new_from_file("/home/deadpickle/Desktop/Gtk2/vci.png");
my $time = 1200000;

#icon goes in box, box goes in tray
my $icon = Gtk2::Image->new_from_pixbuf($icon_main);
my $eventbox = Gtk2::EventBox->new;
my $tray = Gtk2::TrayIcon->new('Test');

my $tooltip = Gtk2::Tooltips->new;
$tooltip->set_tip($tray, "GRRUVI v1.0");

#events and timeouts
$eventbox->signal_connect('button_release_event', \&click);

#show tray

#end event loop

#handles tray clicks
sub click {

    #left mouse button
    if ($_[1]->button == 1) {
    #right mouse button
    elsif ($_[1]->button == 3) {
    return 1;

#right click menu
sub menu {
    my $menu = Gtk2::Menu->new();

    my $menu_VCI = Gtk2::ImageMenuItem->new_with_label("VCI");
    $menu_VCI->set_image(Gtk2::Image->new_from_stock('gtk-refresh', 'menu'));

    my $menu_pref = Gtk2::ImageMenuItem->new_with_label("Configure");
    $menu_pref->set_image(Gtk2::Image->new_from_stock('gtk-preferences', 'menu'));

    my $menu_sep = Gtk2::SeparatorMenuItem->new();

    my $menu_quit = Gtk2::ImageMenuItem->new_with_label("Quit");
    $menu_quit->signal_connect(activate => sub {Gtk2->main_quit});
    $menu_quit->set_image(Gtk2::Image->new_from_stock('gtk-quit', 'menu'));

    #popup menu, the three is for right mouse button

    return 1;

#Program interfaces
sub interface {
    my $interface = Gtk2::Menu->new;
    #menu items for VCI
    #Progress bar for number of downloads; just a countng bar
    #Add the correct controls to menu
    my $menu_vci_connect = Gtk2::ImageMenuItem->new_with_label("Connect");
    my $menu_vci_stop = Gtk2::ImageMenuItem->new_with_label("Stop");


Jamie Lahowetz

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