diff options
author | damien <damien@mandriva.com> | 2001-02-08 15:48:55 +0000 |
---|---|---|
committer | damien <damien@mandriva.com> | 2001-02-08 15:48:55 +0000 |
commit | 0e8aba76ba7c264621bb94a81e1f0720f4569f41 (patch) | |
tree | 497d0eb5d13e5974c3ea579433284e94a029fccb /control-center3 | |
parent | 3046ac1206698d014a5dd2b1dbda7045acbb98c6 (diff) | |
download | control-center-0e8aba76ba7c264621bb94a81e1f0720f4569f41.tar control-center-0e8aba76ba7c264621bb94a81e1f0720f4569f41.tar.gz control-center-0e8aba76ba7c264621bb94a81e1f0720f4569f41.tar.bz2 control-center-0e8aba76ba7c264621bb94a81e1f0720f4569f41.tar.xz control-center-0e8aba76ba7c264621bb94a81e1f0720f4569f41.zip |
killing applications at the end
Diffstat (limited to 'control-center3')
-rwxr-xr-x | control-center3 | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/control-center3 b/control-center3 index f7484d68..997d779e 100755 --- a/control-center3 +++ b/control-center3 @@ -36,7 +36,7 @@ my @treeitem_sub; my $nb_pages=0; my $window_global = new Gtk::Window -toplevel; $window_global->set_usize(800, 600); -$window_global->signal_connect ( delete_event => sub { Gtk->exit(0); }); +$window_global->signal_connect ( delete_event => sub { quit_global(); }); $window_global->set_position(1); $window_global->set_title("Mandrake Control Center"); $window_global->border_width(0); @@ -192,7 +192,7 @@ map { "Userdrake" => "userdrake" , "Draknet" => "draknet" , "Drakgw" => "drakgw" , "Menudrake" => "menudrake" , "Drakfont" => "drakfont" ); - +my @pid_launched; %tree_launched = ("Drakboot" => -1, "Drakfloppy" => -1, "Drakelogo" => -1 , "xfdrake" => -1 , "Hardrake" => -1 , "Mousedrake" => -1 , @@ -213,6 +213,15 @@ $SIG{USR1} = sub { $notebook_global->set_page(0); }; # embedded applications wil Gtk->main; +sub quit_global { + print "Cleaning...\n"; + foreach (@pid_launched) { + print "$_\n"; + } + kill TERM, @pid_launched; + Gtk->exit(0); +} + sub about_mdk_cc() { my $window_about = new Gtk::Dialog(); @@ -309,9 +318,13 @@ sub exec_treeitem { $notebook_global->append_page($socket, ""); $socket->realize; print ("The XID of the sockets window n° is [" . $socket->window->XWINDOW . "]\nMy PID is [" . $$ . "]\n"); - my $a = $exec_string . " --embedded " . $socket->window->XWINDOW . " " . $$ . "&"; + my $a = $exec_string . " --embedded " . $socket->window->XWINDOW . " " . $$; print "$a\n"; - system ($a); + if (my $pid = fork()) { + $pid_launched[$nb_pages]=$pid; + } else { + exec ($a) or print STDERR "couldn't exec $a: $!"; + } $nb_pages++; $tree_launched{$label}=$nb_pages; $notebook_global->set_page($nb_pages); @@ -326,7 +339,7 @@ sub item_factory_cb { my ($widget, $action, @data) = @_; print "ItemFactory: activated ", $widget->item_factory_path(), " -> ", $action, "\n"; - $action == 1 and Gtk->exit(0); + $action == 1 and quit_global(); $action == 4 and about_mdk_cc(); } |