#!/usr/bin/perl use Gtk2; use strict; Gtk2->init; my $window = Gtk2::Window->new('toplevel'); $window->signal_connect('delete_event', sub { exit }); my $button = Gtk2::Button->new('Menu'); my @items = ( [ '/', undef, undef, undef, '' ], [ '/Run Galeon', undef, sub { system('galeon &') }, undef, '', 'gtk-execute' ], [ '/Run Terminal', undef, sub { system('gnome-terminal &') }, undef, '', 'gtk-execute' ], [ '/Run GIMP', undef, sub { system('gimp &') }, undef, '', 'gtk-execute' ], [ '/Editors', undef, undef, undef, '', ], [ '/Editors/Run Gedit', undef, sub { system('gedit --new-window &') }, undef, '', 'gtk-execute' ], [ '/Editors/Run Emacs', undef, sub { system('gnome-terminal -e emacs &') }, undef, '', 'gtk-execute' ], [ '/Editors/Run nipples', undef, sub { system('xnipples &') }, undef, '', 'gtk-execute' ], ); my $factory = Gtk2::ItemFactory->new('Gtk2::Menu', '
', undef); $factory->create_items(@items); my $menu = $factory->get_widget('
'); $button->signal_connect('clicked', sub { $menu->popup(undef, undef, undef, undef, $button, undef) }); $window->add($button); $window->show_all; Gtk2->main;