#!/usr/bin/perl -w use strict; use Glib qw/TRUE FALSE/; use Gtk2 '-init'; my($d,$hbox,$stock,$label,$table,$response); $d = Gtk2::Dialog->new('torrent', undef, [qw/modal/], 'gtk-cancel' => 'cancel', 'Store' => 'no', 'Download' => 'yes' ); $d->set_title('Torrent Handler'); $d->set_default_response ('yes'); $hbox = Gtk2::HBox->new (FALSE, 8); $hbox->set_border_width (8); $d->vbox->pack_start ($hbox, FALSE, FALSE, 0); $stock = Gtk2::Image->new_from_stock ('gtk-file', 'dialog'); $hbox->pack_start ($stock, FALSE, FALSE, 0); $table = Gtk2::Table->new (2, 2, FALSE); $hbox->pack_start ($table, TRUE, TRUE, 0); $label = Gtk2::Label->new ("What shall we do with this torrent?"); $table->attach_defaults ($label, 0, 1, 0, 1); $hbox->show_all; while ($response = $d->run) { for($response) { if(/delete-event/) {exit} elsif(/cancel/) {exit} elsif(/no/) {print "no\n";exit} elsif(/yes/) {print "yes\n";exit} } } Gtk2->main();