From: Daniel Kahn Gillmor Date: Mon, 4 Oct 2010 02:51:26 +0000 (-0400) Subject: removed dependency on Gtk2::Glade X-Git-Tag: msva-perl/0.4~13 X-Git-Url: http://git.tremily.us/?p=monkeysphere-validation-agent.git;a=commitdiff_plain;h=1afc22d2a5b40c9d635a992cfae6d1e36df8e192 removed dependency on Gtk2::Glade --- diff --git a/Crypt/Monkeysphere/MSVA/MarginalUI.glade b/Crypt/Monkeysphere/MSVA/MarginalUI.glade deleted file mode 100644 index fe3bb9e..0000000 --- a/Crypt/Monkeysphere/MSVA/MarginalUI.glade +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - True - 5 - normal - False - - - True - vertical - 2 - - - True - True - - - 1 - - - - - True - end - - - gtk-yes - True - True - True - True - - - - False - False - 0 - - - - - gtk-no - True - True - True - True - - - - False - False - 1 - - - - - False - end - 0 - - - - - - diff --git a/Crypt/Monkeysphere/MSVA/MarginalUI.pm b/Crypt/Monkeysphere/MSVA/MarginalUI.pm index d544c24..b89ad0c 100755 --- a/Crypt/Monkeysphere/MSVA/MarginalUI.pm +++ b/Crypt/Monkeysphere/MSVA/MarginalUI.pm @@ -11,39 +11,36 @@ use strict; use warnings; - - my $resp = 0; + use Gtk2 '-init'; sub prompt { - use Gtk2 '-init'; # auto-initializes Gtk2 - use Gtk2::GladeXML; - - my $glade; - my $label; - - # populate UI from - $glade = Gtk2::GladeXML->new("Crypt/Monkeysphere/MSVA/MarginalUI.glade"); - - # Connect the signals - $glade->signal_autoconnect_from_package('Crypt::Monkeysphere::MSVA::MarginalUI'); - $label = $glade->get_widget('messageLabel'); - my $labeltxt = shift; - $label->set_text($labeltxt); - # Start it up - Gtk2->main; + # create a new dialog with some buttons - one stock, one not. + my $dialog = Gtk2::Dialog->new ('msva-perl prompt!', undef, qw( modal ), + 'gtk-cancel' => 'cancel', + 'Lemme at it!' => 'ok'); + my $label = Gtk2::Label->new($labeltxt); + $label->show(); + $dialog->get_content_area()->add($label); + my $resp = 0; + + $dialog->set_default_response ('cancel'); + + # show and interact modally -- blocks until the user + # activates a response. + my $response = $dialog->run(); + if ($response eq 'ok') { + $resp = 1; + } + + $dialog->hide(); + # activating a response does not destroy the window, + # that's up to you. + $dialog->destroy(); return $resp; } - sub on_yesButton_clicked { - $resp = 1; - Gtk2->main_quit; - } - sub on_noButton_clicked { - Gtk2->main_quit; - } - 1; }