Re: Blocking Main Window destroy siginal
- From: "A. Pagaltzis" <pagaltzis gmx de>
- To: Gtk2-Perl List <gtk-perl-list gnome org>
- Subject: Re: Blocking Main Window destroy siginal
- Date: Mon, 20 Sep 2004 23:36:11 +0200
* Jasun Wurster <jasun pnxcorp com> [2004-09-20 04:46]:
I would like to prevent my app from being closed by the user
during some database writes and data transfers.
Is there a way to block the Window destroy signal so that if
the 'x' button in the main window is clicked it is ignored and
the app keeps running?
It would be nice if you'd actually handle the click though,
providing the user with a visual indication also. Something like
the following, around the part of the code which handles the
updates.
my $exit_request = 0;
my $block_exit = $window->signal_connect( delete_event => sub {
my $monolog = Gtk2::Dialog->new(
'Please wait.',
$window,
[ qw( destroy-with-parent no-separator ) ],
);
$monolog->vbox->add( Gtk2::Label->new( "Updating database." ) );
$monolog->show_all();
$exit_request = TRUE;
return TRUE; # we handled it, no further processing
} );
# ...
# database updates here
# ...
$window->signal_handler_disconnect( $block_exit );
Gtk2->main_quit if $exit_request;
Regards,
--
Aristotle
"If you can't laugh at yourself, you don't take life seriously enough."
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]