summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mandriva.org>2009-01-21 14:50:42 +0000
committerPascal Terjan <pterjan@mandriva.org>2009-01-21 14:50:42 +0000
commit899fee5c1610739a985511f66dea1492b35c9a31 (patch)
tree0705431a772500b206fdcb84ab352ae0d2e8c596 /perl-install/standalone
parent9ced6b2a11727ae7f004e16262e3f64617c35f08 (diff)
downloaddrakx-899fee5c1610739a985511f66dea1492b35c9a31.tar
drakx-899fee5c1610739a985511f66dea1492b35c9a31.tar.gz
drakx-899fee5c1610739a985511f66dea1492b35c9a31.tar.bz2
drakx-899fee5c1610739a985511f66dea1492b35c9a31.tar.xz
drakx-899fee5c1610739a985511f66dea1492b35c9a31.zip
Fork myself to not freeze the interface
Diffstat (limited to 'perl-install/standalone')
-rw-r--r--perl-install/standalone/drakdvb43
1 files changed, 33 insertions, 10 deletions
diff --git a/perl-install/standalone/drakdvb b/perl-install/standalone/drakdvb
index e98f35e7d..addc52aab 100644
--- a/perl-install/standalone/drakdvb
+++ b/perl-install/standalone/drakdvb
@@ -21,7 +21,6 @@ use lib qw(/usr/lib/libDrakX);
use common;
use standalone;
-use run_program;
use mygtk2;
use interactive;
use ugtk2 qw(:create :helpers :wrappers);
@@ -37,27 +36,51 @@ my $config_file = "$ENV{HOME}/.mplayer/channels.conf";
my $channel_list = Gtk2::SimpleList->new(N("Channel")=> "text", "id" => "hidden");
my %buttons;
+my $pid;
sub get_selected_channel() {
my ($index) = $channel_list->get_selected_indices;
defined $index && $channel_list->{data}[$index][1];
}
+sub exitapp {
+ local $SIG{TERM} = 'IGNORE';
+ kill TERM => -$$;
+ Gtk2->main_quit;
+}
+
sub detect_channels {
$in->ask_okcancel(N("Warning"), N("%s already exists and its contents will be lost", $config_file)) or return;
gtkset_mousecursor_wait($w->{window}->window);
$channel_list->set_sensitive(0);
$_->set_sensitive(0) foreach values %buttons;
+
gtkflush();
- my $_w = $in->wait_message(N("Please wait"), N("Detecting DVB channels, this will take a few minutes"));
- if(run_program::run("w_scan -X > $config_file")){
- load_channels();
+
+ if ($pid = fork()) {
+ $SIG{CHLD} = sub {
+ $SIG{CHLD} = 'IGNORE';
+ waitpid($pid, 0);
+ if($?){
+ load_channels();
+ } else {
+ $in->ask_warn(N("Error"), N("Could not get the list of available channels"));
+ };
+ gtkset_mousecursor_normal($w->{window}->window);
+ $buttons{detect}->set_sensitive(1);
+ $channel_list->set_sensitive(1);
+ };
+ my $_w = ugtk2->new(N("Please wait"), grab => 1);
+ gtkadd($_w->{window},
+ gtkpack($_w->create_box_with_title(N("Detecting DVB channels, this will take a few minutes")),
+ my $w = gtknew('Button', text => N("Cancel"), clicked => \&exitapp),
+ )
+ );
+ $_w->main;
} else {
- $in->ask_warn(N("Error"), N("Could not get the list of available channels"));
- };
- gtkset_mousecursor_normal($w->{window}->window);
- $buttons{detect}->set_sensitive(1);
- $channel_list->set_sensitive(1);
+ system("w_scan -X > $config_file");
+ POSIX::_exit($?);
+ }
}
sub load_channels {
@@ -87,7 +110,7 @@ gtkadd($w->{window},
1, gtknew('ScrolledWindow', width => 300, height => 400, child => $channel_list),
0, gtknew('HButtonBox', layout => 'end', children_loose => [
$buttons{detect} = gtknew('Button', text => N("Detect Channels"), clicked => \&detect_channels),
- gtknew('Button', text => N("Quit"), clicked => sub { Gtk2->main_quit }),
+ gtknew('Button', text => N("Quit"), clicked => \&exitapp),
$buttons{view} = gtknew('Button', text => N("View Channel"), clicked => \&launch_tv),
]),
]),