How do I destroy window without freezing window?



#
##### some code here #####
#
 
#
gui_warning(5);
#
 
#
##### some code here that takes time to execute #####
#
 
#
 
#
### sub routines ####
#
 
#
 
#
sub gui_warning {
#
my ($video_count) = @_;
#
 
#
 
#
my $dialog = Gtk2::Dialog->new (
#
'Warning', undef, 'modal',
#
'gtk-yes' => 'yes',
#
'gtk-no' => 'no',
#
);
#
 
#
my $hbox = Gtk2::HBox->new (FALSE, 6);
#
my $question = "This will play $video_count videos. Continue?";
#
 
#
$hbox->pack_start (Gtk2::Label->new ($question), TRUE, TRUE, 0);
#
$hbox->show_all;
#
$dialog->vbox->pack_start ($hbox, TRUE, TRUE, 0);
#
$dialog->set_default_response ('ok');
#
 
#
$dialog->signal_connect (response => sub {
#
shift;
#
my $response = shift;
#
if ($response eq 'yes'){ Gtk2->main_quit; }
#
if ($response eq 'no'){ Gtk2->main_quit; exit; }
#
});
#
$dialog->show;
#
Gtk2->main;
#
 
#
 
#
 
#
 
#
return;
#
}
#
#### end of code ####


In the above code, the window is not destroyed (Gtk2->main_quit) until the rest of the code is executed, which takes time. Instead the window stays frozen until then. How do I make it immediately kill/quit/destroy the window?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]