From: Daniel Kahn Gillmor Date: Mon, 4 Oct 2010 03:36:31 +0000 (-0400) Subject: dialog box actually goes away! (at the cost of re-initializing Gtk2 in every child... X-Git-Tag: msva-perl/0.4~12 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ea437dd7038f50fdae345c27fba698443b2584ee;p=monkeysphere-validation-agent.git dialog box actually goes away! (at the cost of re-initializing Gtk2 in every child process, bleh) --- diff --git a/Crypt/Monkeysphere/MSVA/MarginalUI.pm b/Crypt/Monkeysphere/MSVA/MarginalUI.pm index b89ad0c..af7dbc9 100755 --- a/Crypt/Monkeysphere/MSVA/MarginalUI.pm +++ b/Crypt/Monkeysphere/MSVA/MarginalUI.pm @@ -11,13 +11,14 @@ use strict; use warnings; - use Gtk2 '-init'; + use Gtk2; sub prompt { my $labeltxt = shift; + Gtk2->init(); # create a new dialog with some buttons - one stock, one not. - my $dialog = Gtk2::Dialog->new ('msva-perl prompt!', undef, qw( modal ), + my $dialog = Gtk2::Dialog->new ('msva-perl prompt!', undef, [], 'gtk-cancel' => 'cancel', 'Lemme at it!' => 'ok'); my $label = Gtk2::Label->new($labeltxt); @@ -27,17 +28,13 @@ $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(); + # we'll let the fact that the process is about to terminate + # destroy the window. so lazy! return $resp; }