tray icon drop down menus



Below is a chunk of code I am using to make a tray icon that displays
a menu when it is clicked on. The problem I am running into is only
half the icon is displayed as some of the space is taken up by a
small chunk of the menu GUI.

Any ideas?


        #inits the gui hash
        my %gui;
        $gui{id}=rand().rand();

        #creates the tray icon
        $gui{trayicon} = Gtk2::TrayIcon->new("ZConf::Cron");
        
        #inits the menu
        $gui{menubar}=Gtk2::MenuBar->new;
        $gui{menubarmenu}=Gtk2::ImageMenuItem->new('_Zconf::Cron');
        $gui{trayiconimage}=$self->xpmGtk2Image;
        $gui{menubarmenu}->set_image($gui{trayiconimage});
        $gui{menubar}->show;
        $gui{menubarmenu}->show;
        $gui{menu}=Gtk2::Menu->new;
        $gui{menu}->show;
        $gui{menuTearoff}=Gtk2::TearoffMenuItem->new;
        $gui{menuTearoff}->show;
        $gui{menu}->append($gui{menuTearoff});
        $gui{menubarmenu}->set_submenu($gui{menu});
        $gui{menubar}->append($gui{menubarmenu});
        $gui{trayicon}->add($gui{menubar});

        #refreshes
        $gui{refresh}=Gtk2::MenuItem->new('_refresh');
        $gui{refresh}->show;
        $gui{refresh}->signal_connect(activate=>\&refreshMenuItem,
                                                                  {
                                                                   gui=>$gui{id},
                                                                   self=>$self,
                                                                   }
                                                                  );
        $gui{menu}->append($gui{refresh});

        #display it all
        $gui{trayicon}->show_all;

Attachment: signature.asc
Description: PGP signature



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