diff options
-rw-r--r-- | perl-install/NEWS | 2 | ||||
-rw-r--r-- | perl-install/mygtk2.pm | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS index cc9498bfe..ef6b1fe7b 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,5 +1,7 @@ - interactive layer: o fix quitting app when closing "advanced" dialog (mga#1812) +- mygtk2 layer: + o popup a dialog confirming to quit when clicking "X" (mga#1812) Version 15.10 - 11 December 2012 diff --git a/perl-install/mygtk2.pm b/perl-install/mygtk2.pm index 89bcf33f0..1f97b02d6 100644 --- a/perl-install/mygtk2.pm +++ b/perl-install/mygtk2.pm @@ -1212,9 +1212,23 @@ sub mygtk2::MagicWindow::AUTOLOAD { $w->{$s1}->$meth(@args); } +state $in_callback; +sub quit_popup() { + if (!$in_callback) { + $in_callback = 1; + my $_guard = before_leaving { undef $in_callback }; + require ugtk2; + my $w = ugtk2->new(N("Confirmation"), grab => 1); + ugtk2::_ask_okcancel($w, N("Are you sure you want to quit?"), N("Quit"), N("Cancel")); + my $ret = ugtk2::main($w); + return 1 if !$ret; + } +} + sub quit_callback { my ($w) = @_; - + + return 1 if quit_popup(); if ($::isWizard) { $w->destroy; die 'wizcancel'; |