diff options
author | damien <damien@mandriva.com> | 2001-06-10 22:08:31 +0000 |
---|---|---|
committer | damien <damien@mandriva.com> | 2001-06-10 22:08:31 +0000 |
commit | 88e2498bb2bb12ab994453fa0042a1fc40bb8497 (patch) | |
tree | 1f3edc6e3d5a1788d5562b18af8878084ed2d165 | |
parent | 4a6eb6597446517391f8ff8d2dd402087d93f08e (diff) | |
download | control-center-88e2498bb2bb12ab994453fa0042a1fc40bb8497.tar control-center-88e2498bb2bb12ab994453fa0042a1fc40bb8497.tar.gz control-center-88e2498bb2bb12ab994453fa0042a1fc40bb8497.tar.bz2 control-center-88e2498bb2bb12ab994453fa0042a1fc40bb8497.tar.xz control-center-88e2498bb2bb12ab994453fa0042a1fc40bb8497.zip |
new ugly beta code. nunstable, but X windows embedding
-rwxr-xr-x | control-center | 94 |
1 files changed, 72 insertions, 22 deletions
diff --git a/control-center b/control-center index 4999b416..59b0a271 100755 --- a/control-center +++ b/control-center @@ -105,7 +105,7 @@ $hpane_global->pack1($scrolled_global,0,1); my $notebook_global = new Gtk::Notebook; $notebook_global->set_show_border(0); -$notebook_global->set_show_tabs(0); +$notebook_global->set_show_tabs(1); $hpane_global->pack2($notebook_global,0,1); @@ -174,6 +174,7 @@ $window_global->show_all; $SIG{USR1} = sub { ${$tree_launched{$_}->[1]}->deselect() foreach (keys %tree_launched); $notebook_global->set_page(0); + $scrolled_global->set_usize(210, 0); }; # embedded applications will send me that signal in order to "hide" them $SIG{TERM} = \&quit_global; # embedded applications will send me that signal in order to quit the cc. my $global_vbox; @@ -380,6 +381,7 @@ sub xpm_label_box { sub exec_treeitem { my ($label, $exec_string, $available) = @_; + $scrolled_global->set_usize($label eq _("Software Manager") ? 1 : 210, 0); if (!$available) { my $vbox = new Gtk::VBox(0, 0); $vbox->pack_start( new Gtk::Label (_("The application cannot be loaded,\nthe file '%s' has not be found.\nTry to install it.", $exec_string)), 1, 0, 0); @@ -391,7 +393,22 @@ sub exec_treeitem { return; } if (!$tree_launched{$label}->[0]) { - $label eq _("Software Manager") and system($exec_string . " --embedded &" ), return; + + if ($label eq _("Printer") && -e "/usr/bin/kups") { +# if ($label eq _("Printer") && -e "/usr/bin/mozilla") { + my $socket = new Gtk::Socket; + $notebook_global->append_page($socket, new Gtk::Label("")); + $nb_pages++; + $tree_launched{$label}->[0]=$nb_pages; + $notebook_global->set_page($nb_pages); + $socket->realize; + $socket->steal(launch_wait("kups", "kups")); +# $socket->steal(launch_wait("xchat", "xchat")); + $notebook_global->show_all(); + $notebook_global->set_page($nb_pages); + return; + } +# $label eq _("Software Manager") and system($exec_string . " --embedded &" ), return; $label eq _("LinuxConf") and system($exec_string . " & "), return; my $vbox = new Gtk::VBox(0, 0); $vbox->show; @@ -433,31 +450,64 @@ sub exec_treeitem { $anim_nb > 9 and $anim_nb=0; 1; }); - $lock_time_tag = Gtk->timeout_add(15000, sub { - Gtk->timeout_remove($global_time_tag); - ${$tree_launched{$_}->[1]} and ${$tree_launched{$_}->[1]}->set_sensitive(1) foreach (keys %tree_launched); - $vbox->pack_start(new Gtk::Label (_("After 20 sec., Failed to launch \nSee if it's installed")), 1, 1, 0); - $label_->set(_("After 15 sec., Failed to launch \nSee if it's installed")); $darea1->hide; - }); - -$socket->realize; -# $label->destroy; -my $a = $exec_string . " --embedded " . $socket->window->XWINDOW . " " . $$; -my $pid; -unless ($pid = fork) { - splash_warning(_("cannot fork: $~")) unless defined $pid; - exec("$a"); -} + $lock_time_tag = Gtk->timeout_add(15000, sub { + Gtk->timeout_remove($global_time_tag); + ${$tree_launched{$_}->[1]} and ${$tree_launched{$_}->[1]}->set_sensitive(1) foreach (keys %tree_launched); + $vbox->pack_start(new Gtk::Label (_("After 20 sec., Failed to launch \nSee if it's installed")), 1, 1, 0); + $label_->set(_("After 15 sec., Failed to launch \nSee if it's installed")); $darea1->hide; + }); + + $socket->realize; + # $label->destroy; + my $a = $exec_string . " --embedded " . $socket->window->XWINDOW . " " . $$; + my $pid; + unless ($pid = fork) { + splash_warning(_("cannot fork: $~")) unless defined $pid; + exec("$a"); + } -$pid_launched[$nb_pages-1] = $pid; + $pid_launched[$nb_pages-1] = $pid; -print "test 1\n $nb_pages\n"; -print "$pid_launched[$nb_pages]\n"; -} else { - $notebook_global->set_page($tree_launched{$label}->[0]); + print "test 1\n $nb_pages\n"; + print "$pid_launched[$nb_pages]\n"; + } else { + $notebook_global->set_page($tree_launched{$label}->[0]); + } } + +sub launch_wait { + my $exec = $_[0]; + my $grep = $_[1]; + print "{{ $exec }}\n"; + my $b = "xwininfo -root -children -tree -int | grep '" . $grep . "'"; + my @before = split ('\n', `$b`); + unless ($pid = fork) { + die(_("cannot fork: $~")) unless defined $pid; + exec($_[0]); + } + $pid_launched[$nb_pages] = $pid; + $nb_pages++; + sleep(1); + my $res = 0; + while (!$res) { + my @after = split ('\n', `$b`); + my $i = 0; + my $c; + foreach (@after) { + print "[[" . $after[$i] . "]]\n" if !member($after[$i], @before); + $c = $after[$i] if !member($after[$i], @before); + $i++; + } + $c =~ /\s*([0-9]*)\s*/; + $res=$1; + print "[" . $res . "]\n"; + } + sleep(1); + $res; } +sub member { my $e = shift; foreach (@_) { $e eq $_ and return 1 } 0 } + sub item_factory_cb { my ($widget, $action, @data) = @_; $action == 1 and quit_global(); |