summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordamien <damien@mandriva.com>2002-02-05 17:54:24 +0000
committerdamien <damien@mandriva.com>2002-02-05 17:54:24 +0000
commit5c21a7f2bab5aecaae362be938ef5a65cc19b642 (patch)
tree698454f65af7a567c747c6462ec44b31b0b8c76f
parent9339bd555c9c11c175e16031abdd8bf71bd764fc (diff)
downloadcontrol-center-5c21a7f2bab5aecaae362be938ef5a65cc19b642.tar
control-center-5c21a7f2bab5aecaae362be938ef5a65cc19b642.tar.gz
control-center-5c21a7f2bab5aecaae362be938ef5a65cc19b642.tar.bz2
control-center-5c21a7f2bab5aecaae362be938ef5a65cc19b642.tar.xz
control-center-5c21a7f2bab5aecaae362be938ef5a65cc19b642.zip
big update
-rwxr-xr-xcontrol-center485
1 files changed, 137 insertions, 348 deletions
diff --git a/control-center b/control-center
index eac0a06a..9c058c51 100755
--- a/control-center
+++ b/control-center
@@ -24,8 +24,6 @@ my $_xbindir = "/usr/X11R6/bin";
my $_bindir = "/usr/bin";
my $_sbindir = "/usr/sbin";
my $_iconsdir = "/usr/share/icons";
-#my $_docdir = "/usr/share/doc";
-#my $_wizdir = "/usr/share/wizards";
!$ENV{DISPLAY} and exec ("$_sbindir/drakxconf; reset");
@@ -38,11 +36,6 @@ use standalone;
use my_gtk qw(:helpers :wrappers);
use strict;
-# require Gtk;
-# require Gtk::Gdk::ImlibImage;
-# init Gtk;
-# Gtk::Gdk::ImlibImage->init;
-
# set the locale, needed for proper fontset and charset selection
Gtk->set_locale;
use Config;
@@ -57,61 +50,42 @@ my %h = getVarsFromSh($conffile);
my $embedded;
my $logs;
defined $h{EMBEDDED} or $h{EMBEDDED} = bool2text(1);
-defined $h{LOGS} or $h{LOGS} = bool2text(1);
+defined $h{LOGS} or $h{LOGS} = bool2text(0);
($embedded, $logs) = (text2bool($h{EMBEDDED}), text2bool($h{LOGS}));
my ($log_check_box, $embedded_check_box);
-#my %pixmaps_global;
-#my $xpm_path="$_iconsdir";
-#my $xpm_path_l="$_iconsdir";
my $png_path="$_iconsdir";
-#my $tree_depth_max = 1;
-#my $treeitem_old;
-#my @treeitem_sub;
-
-#-------------------------------------------------------------
-# tree def
-#-------------------------------------------------------------
-# proposal for the ultimate conf file.. ??
-# leaf: label, icon, parent, file_to_seek, exec, gtk/x, grep, num_xwininfo
-# hum need to have a function to install a package when clicked. => rpmdrake
-
$::isWiz = -e "/usr/sbin/wizdrake"; #- $in->do_pkgs->is_installed(q(wizard));
my $exec_hash =
{
- _("Boot Disk") => {
- arg => "$_xbindir/drakfloppy.real",
- function => \&compute_exec_string,
- },
- _("Boot Config") => {
- arg => "$_sbindir/drakboot",
- function => \&compute_exec_string,
- },
- _("Auto Install") => "$_sbindir/drakautoinst",
- _("Display") => "$_sbindir/XFdrake",
- _("Hardware") => "$_sbindir/harddrake",
- _("Mouse") => "$_sbindir/mousedrake",
- _("Printer") => "$_sbindir/print.pm",
- _("Keyboard") => "$_sbindir/keyboarddrake",
- _("Hard Drives") => "$_sbindir/diskdrake --hd",
- _("Removable disks") => "$_sbindir/diskdrake --removable",
- _("NFS mount points") => "$_sbindir/diskdrake --nfs",
- _("Samba mount points") => "$_sbindir/diskdrake --smb",
- _("Connection") => "$_sbindir/draknet",
- _("Connection Sharing") => "$_sbindir/drakgw",
- _("Security Level") => "$_sbindir/draksec",
- _("Firewalling") => "$_sbindir/tinyfirewall",
- _("Menus") => "$_sbindir/menus.pm",
- _("Services") => "$_sbindir/drakxservices",
- _("Fonts") => "$_sbindir/drakfont",
- _("Date & Time") => "$_sbindir/clock.pm",
- _("Software Manager") => "$_bindir/rpmdrake",
- _("Logs") => "$_sbindir/logdrake",
- _("Console") => "$_xbindir/rxvt",
- _("Servers") => "$_sbindir/wizdrake",
+#- ("label") => [ "exec", gtk_plug? if not, then xplug, "exec_alternative" for when not embedded, or [ args for xplug ] ],
+ _("Boot Disk") => [ "$_xbindir/drakfloppy.real", 1],
+ _("Boot Config") => [ "$_sbindir/drakboot", 1 ],
+ _("Auto Install") => [ "$_sbindir/drakautoinst", 1 ],
+ _("Display") => [ "$_sbindir/XFdrake", 1 ],
+ _("Hardware") => [ "$_sbindir/harddrake", 1 ],
+ _("Mouse") => [ "$_sbindir/mousedrake", 1 ],
+ _("Printer") => [ "$_sbindir/print.pm", 1 ],
+ _("Keyboard") => [ "$_sbindir/keyboarddrake", 1 ],
+ _("Hard Drives") => [ "$_sbindir/diskdrake --hd", 1 ],
+ _("Removable disks") => [ "$_sbindir/diskdrake --removable", 1 ],
+ _("NFS mount points") => [ "$_sbindir/diskdrake --nfs", 1 ],
+ _("Samba mount points") => [ "$_sbindir/diskdrake --smb", 1 ],
+ _("Connection") => [ "$_sbindir/draknet", 1 ],
+ _("Connection Sharing") => [ "$_sbindir/drakgw", 1 ],
+ _("Security Level") => [ "$_sbindir/draksec", 1 ],
+ _("Firewalling") => [ "$_sbindir/tinyfirewall", 1 ],
+ _("Menus") => [ "$_sbindir/menus.pm", 1 ],
+ _("Services") => [ "$_sbindir/drakxservices", 1 ],
+ _("Fonts") => [ "$_sbindir/drakfont", 1 ],
+ _("Date & Time") => [ "$_sbindir/clock.pm", 1 ],
+ _("Software Manager") => [ "$_bindir/rpmdrake", 1 ],
+ _("Logs") => [ "$_sbindir/logdrake", 1 ],
+ _("Console") => [ "$_xbindir/rxvt", 0, ["rxvt", "rxvt", 1] ],
+ _("Servers") => [ "$_sbindir/wizdrake", 1 ],
};
my @tree =
@@ -171,7 +145,6 @@ my @tree =
]),
);
-
#-------------------------------------------------------------
my @menu_items =
@@ -180,7 +153,7 @@ my $window_global = new Gtk::Window -toplevel;
$window_global->signal_connect ( delete_event => \&quit_global );
$window_global->set_position(1);
$window_global->set_title( _("Mandrake Control Center %s", 'beta' )); #$_version));
-$window_global->set_policy(0, 1, 0);
+$window_global->set_policy(0, 1, 1);
my $notebook_global;
@@ -244,7 +217,10 @@ foreach (@tree) {
$darea_left->draw(undef);
}
});
+ my $darea_left_sav;
$darea_left->signal_connect( button_release_event => sub {
+ clean_socket();
+ $notebook_global->show;
$darea_left->{state} == 2 and $notebook_global->set_page($index), return;
foreach (@darea_left_list) {
$_->[1]->window->set_cursor($cursor_hand);
@@ -256,44 +232,116 @@ foreach (@tree) {
$darea_left->window->set_cursor($cursor_normal);
$darea_left->{state} = 2, $darea_left->draw(undef);
$notebook_global->set_page($index);
+ $darea_left_sav = $darea_left;
});
push @darea_left_list, [ ($index-1)*45, $darea_left ];
}
+my $exp_frame;
my $exp_socket;
my $emb_box;
my $emb_socket;
+my @pid_launched;
sub compute_exec_string {
my ($arg) = @_;
+ my ($exec, $gtkplug, $alternate) = @$arg;
if ($embedded) {
- $arg . " --embedded " . $emb_socket->window->XWINDOW . " " . $$;
$notebook_global->hide;
+ res_socket();
$emb_box->show;
+ $emb_socket->realize;
+ my $exec = $exec . " --embedded " . $emb_socket->window->XWINDOW . " " . $$;
+ if ($gtkplug) {
+ my $pid;
+ unless ($pid = fork) {
+ splash_warning(_("cannot fork: %s", $~)) unless defined $pid;
+ exec("$exec");
+ }
+ push @pid_launched, $pid;
+ } else {
+ $emb_socket->steal(launch_xapp($alternate));
+ }
+ } else {
+ system("$exec &");
+ }
+ if($logs) {
+ $exp_socket->realize;
+ my $pid;
+ unless ($pid = fork) {
+ splash_warning(_("cannot fork: %s", $~)) unless defined $pid;
+ exec("logdrake --explain=drakfloppy.real --embedded " . $exp_socket->window->XWINDOW . " " . $$);
+ }
+ push @pid_launched, $pid;
+ }
+ foreach (@darea_left_list) {
+ $_->[1]->window->set_cursor($cursor_hand);
+ if($_->[1]->{state} != 0) {
+ $_->[1]->{state} = 0;
+ $_->[1]->draw(undef);
+ }
+ }
+}
+
+sub launch_xapp {
+# my ($exec, $grep, $num) = @_;
+ my $b = "xwininfo -root -tree -int | grep '" . $_[0]->[1] . "'";
+ my @before = split ('\n', `$b`);
+ my $pid;
+ unless ($pid = fork) {
+ splash_warning(_("cannot fork: %s", $~)) unless defined $pid;
+ exec($_[0]->[0]);
+ }
+ push @pid_launched, $pid;
+ my $res = 0;
+ while (!$res) {
+ my @after = split ('\n', `$b`);
+ while (@after ne ($_[0]->[2]+@before)) {
+ @after = split ('\n', `$b`);
+ }
+ my $i = 0;
+ my $c;
+ foreach (@after) {
+ $c = $after[$i] if !member($after[$i], @before);
+ $i++;
+ }
+ $c =~ /\s*([0-9]*)\s*/;
+ $res=$1;
+ }
+ $res;
+}
+
+sub clean_socket {
+ $emb_box->hide;
+ $logs and $exp_frame->hide;
+ foreach (@pid_launched) {
+ kill 'TERM', $_ if (defined $_);
}
+ @pid_launched = ();
+ $emb_socket and $emb_socket->destroy();
+ $exp_socket and $exp_socket->destroy();
+ $logs and $exp_frame->show;
}
sub res_socket {
- $emb_box and $emb_box->destroy();
- gtkshow(gtkpack($emb_box, $emb_socket = new Gtk::Socket));
+ clean_socket();
+ gtkpack($emb_box, $emb_socket = new Gtk::Socket);
+ $logs and gtkadd($exp_frame, $exp_socket = new Gtk::Socket);
}
+my ($rootheight, undef) = my_gtk::gtkroot()->get_size;
+
$window_global->add(
gtkpack_(new Gtk::VBox(0, 0),
0, my $title_w = get_main_menu($window_global),
0, my $fixed_title = gtkset_usize(new Gtk::Fixed, 640, 55),
-# 0, my $darea_title = gtkset_usize(new Gtk::DrawingArea, 450, 55),
0, new Gtk::HSeparator,
1, gtkpack_(new Gtk::HBox(0, 0),
0, my $fixed_left = new Gtk::Fixed,
-# gtkpack2_(new Gtk::VBox(0, 0),
-# @darea_left_list,
-# 1, my $last_darea = new Gtk::DrawingArea,
-# ),
1, gtkpack_(my $right_box = new Gtk::VBox(0, 0),
- 0, $emb_box = new Gtk::HBox(0, 0),
+ 1, $emb_box = new Gtk::HBox(0, 0),
1, $notebook_global = new Gtk::Widget ('Gtk::Notebook',
show_border => 0,
show_tabs => 0),
@@ -302,20 +350,26 @@ $window_global->add(
)
);
-my $exp_frame;
sub update_exp {
if($logs && !$exp_frame) {
- gtkpack($right_box,
- $exp_frame = gtkset_shadow_type(gtkset_usize(gtkset_border_width(new Gtk::Frame(_("Logs")), 5), 0, 100), 'etched_out')
+ gtkpack__($right_box,
+ gtkadd($exp_frame = gtkset_shadow_type(gtkset_usize(gtkset_border_width(new Gtk::Frame(_("Logs")), 5), 0, 100), 'etched_out'),
+ $exp_socket = new Gtk::Socket,
+ )
);
+ $rootheight <= 600 and $fixed_title->hide;
+ $exp_frame->show_all;
}
if (!$logs && $exp_frame) {
$exp_frame->destroy();
undef $exp_frame;
+ defined($exp_socket) and $exp_socket->destroy();
+ $fixed_title->show;
}
}
-$notebook_global->set_usize(0, ($index) * 45);
+$notebook_global->set_usize(540, max(420, ($index) * 45));
+$emb_box->set_usize(540, max(420, ($index) * 45));
$log_check_box->set_active($logs);
$embedded_check_box->set_active($embedded);
@@ -328,20 +382,6 @@ foreach (@darea_left_list) {
$fixed_left->signal_connect( realize => sub { $fixed_left->window->set_back_pixmap($pixmap_back_left, 0) });
-# my $dbl_arealast;
-# $last_darea->signal_connect( size_allocate => sub { $dbl_arealast = undef });
-# $last_darea->signal_connect( expose_event => sub {
-# my ($dx, $dy) = ($last_darea->allocation->[2], $last_darea->allocation->[3]);
-# if (!defined($dbl_arealast)) {
-# $dbl_arealast = new Gtk::Gdk::Pixmap($last_darea->window, $dx, $dy);
-# #FIXME
-# fill_tiled($last_darea, $dbl_arealast, $back[0], $dx, $dy, 160, 45);
-# }
-# $last_darea->window->draw_pixmap($last_darea->style->bg_gc('normal'),
-# $dbl_arealast, 0, 0, 0, 0, ($dx, $dy));
-# });
-
-
my $dbl_area;
my ($pixmap_back, undef) = gtkcreate_png('mcc-title-back');
my ($pixmap_icon, undef) = gtkcreate_png('mcc-title-icon');
@@ -365,17 +405,10 @@ $darea_title->signal_connect( expose_event => sub {
my @dim = @{$_[1]->{area}};
my ($dx, $dy) = ($darea_title->allocation->[2], $darea_title->allocation->[3]);
if (!defined($dbl_area)) {
-# *always* uyse a fontset to write something on screen
-# my ($pix, $width, $height) = create_pix_text($darea_title, _("welcome"), "#255#255#255",
-# undef, #Gtk::Gdk::Font->fontset_load( _("-*-helvetica-medium-r-normal-*-*-190-*-*-p-*-iso8859-1,*-r-*")),
-# max($dx-336, 0), $dy, 0, 1, $pixmap_back, 110, 55, 0, 0);
$dbl_area = new Gtk::Gdk::Pixmap($darea_title->window, $dx, $dy);
fill_tiled($darea_title, $dbl_area, $pixmap_back, 110, 55, $dx, $dy);
$dbl_area->draw_pixmap($darea_title->style->bg_gc('normal'),
$pixmap_icon, 0, 0, 0, 0, 325, 55);
-# my $y_pos = int( (55-$height)/2/5 )*5 + 15;
-# $dbl_area->draw_pixmap($darea_title->style->bg_gc('normal'),
-# $pix, 0, 0, 336, $y_pos, $width, $height);
}
$darea_title->window->draw_pixmap($darea_title->style->bg_gc('normal'),
$dbl_area, $dim[0], $dim[1], $dim[0], $dim[1], $dim[2], $dim[3]);
@@ -383,14 +416,9 @@ $darea_title->signal_connect( expose_event => sub {
my ($pixmap_back_right, undef) = gtkcreate_png('mcc-core-back');
-my ($pix_splash_map, undef) = gtkcreate_png('mcc-splash');
+#my ($pix_splash_map, undef) = gtkcreate_png('mcc-splash');
my $pix_dbl;
$notebook_global->append_page(my $darea1 = new Gtk::DrawingArea);#my $fixed_about = new Gtk::Fixed);
-#$fixed_about->put(my $darea1 = new Gtk::DrawingArea, 0, 0);
-#$fixed_about->signal_connect( realize => sub { $fixed_about->window->set_back_pixmap($pixmap_back, 0); $darea1->set_usize($fixed_about->allocation->[2], $fixed_about->allocation->[3]) });
-#}); #right, 0) });
-# $fixed_about->signal_connect( configure_event => sub { print "CONFIGURE\n"; });
-#$darea1->set_usize(540, 460);
$darea1->signal_connect( size_allocate => sub { $pix_dbl = undef });
$darea1->signal_connect( expose_event => sub {
my ($dx, $dy) = ($darea1->allocation->[2], $darea1->allocation->[3]);
@@ -398,8 +426,6 @@ $darea1->signal_connect( expose_event => sub {
$pix_dbl = new Gtk::Gdk::Pixmap($darea1->window, $dx, $dy);
fill_tiled($darea1, $pix_dbl, $pixmap_back_right, 540, 460, $dx, $dy);
-# $pix_dbl->draw_pixmap($darea1->style->white_gc, $pix_splash_map,
-# 0, 0, ($dx-540)/2, ($dy-460)/2, 540, 460);
my $style = new Gtk::Style;
my $style_dflt = new Gtk::Style;
$style->font(Gtk::Gdk::Font->fontset_load(_("-urw-helvetica-medium-r-normal-*-*-190-*-*-p-*-iso8859-1,*-r-*")));
@@ -430,31 +456,22 @@ $darea1->signal_connect( expose_event => sub {
0, 0, $dx, $dy);
0;
});
-#$fixed_about->signal_connect( expose_event => sub {
-# $darea1->set_usize($fixed_about->allocation->[2], $fixed_about->allocation->[3]);
-# undef $pix_dbl;
-# $darea1->draw(undef);
-# } );
-#my $timeout_about = Gtk->timeout_add(100, sub { $fixed_about->set_usize($scrolled_about->allocation->[2] - 22, 0); 0; });
my $cursor = new Gtk::Gdk::Cursor 15;
foreach (@tree) {
my $w = gtkicons_labels_widget($_->[2], $window_global, "#0#0#0", $style_dflt->font,
#"-urw-times-bold-r-normal-*-*-100-*-*-p-*-iso8859-1"),
- $pixmap_back_right, 540, 460, 55, 50, 50, 50, 50, 50, $exec_hash);
+ $pixmap_back_right, 540, 460, 55, 50, 50, 50, 50, 50, \&compute_exec_string, $exec_hash);
$notebook_global->append_page($w);
}
$window_global->show_all;
$emb_box->hide;
$window_global->realize;
-$window_global->hide;
-#$exp_socket->realize;
-#my $logdrake_string = "/usr/sbin/logdrake --embedded " . $socket->window->XWINDOW . " " . $$;
-my @pid_launched;
my %tree_launched;
+$window_global->hide;
Gtk->main_iteration while Gtk->events_pending;
$notebook_global->signal_connect( switch_page => sub {
my (undef, $tab_widget, $tab_number) = @_;
@@ -471,59 +488,27 @@ my @anim;
($anim[$_]->[0], $anim[$_]->[1]) = gtkcreate_png("$png_path/anim_" . ($_ + 1) . ".png") foreach (0..9);
$SIG{USR1} = sub {
-# ${$tree_launched{$_}->[1]}->deselect() foreach (keys %tree_launched);
- $notebook_global->set_page(0);
-# $scrolled_global->set_usize(180, 0);
+ print "hmmm\n";
+ clean_socket();
+ $notebook_global->show;
}; # 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;
my $global_time_tag;
my $lock_time_tag;
my $global_socket;
-$SIG{USR2} = sub { Gtk->timeout_remove($lock_time_tag);
- $$global_vbox->hide; Gtk->timeout_remove($global_time_tag); $$global_socket->show;
- ${$tree_launched{$_}->[1]} and ${$tree_launched{$_}->[1]}->set_sensitive(1) foreach (keys %tree_launched);
- my $a = $notebook_global->get_current_page;
- $notebook_global->set_page(0);
- $notebook_global->set_page($a);
- };
-
-
-#$darea_title->window->set_back_pixmap($pixmap_back, 0);
-#Gtk->main_iteration while Gtk->events_pending;
-#$darea_title->signal_emit("configure_event", undef);
-#$darea_title->signal_emit("expose_event", undef);
-#$window_global->signal_emit("configure_event", undef);
-#$window_global->signal_emit("expose_event", undef);
-#$window_global->signal_emit("unmap_event", undef);
-#$darea_title->signal_emit("visibility_notify_event", undef);
-#$window_global->signal_emit("visibility_notify_event", undef);
-#Gtk::Gdk->flush;
-
-#$darea_title->signal_emit("resize_event", undef);
-#gtkmove($window_global, 50, 50);
-#gtkresize($window_global, 500, 500);
-#$scrolled_about->set_usize(50, 50);
-#$fixed_title->set_usize(450, 55),
-Gtk->main;
-
-
-
-#-------------------------- new control-center ---------------
-sub icon_label_box {
- my ($label_text, $png_filename) = @_;
- my $box = new Gtk::HBox(0, 0);
- $box->pack_start(new Gtk::Pixmap(gtkcreate_png($png_filename)), 0, 0, 3);
- $box->pack_start(new Gtk::Label($label_text), 0, 0, 3);
- $box->border_width(2);
- $box;
-}
-
-
-
-
+ $SIG{USR2} = sub {
+ print " USR2 \n";
+# Gtk->timeout_remove($lock_time_tag);
+# $$global_vbox->hide; Gtk->timeout_remove($global_time_tag); $$global_socket->show;
+# ${$tree_launched{$_}->[1]} and ${$tree_launched{$_}->[1]}->set_sensitive(1) foreach (keys %tree_launched);
+# my $a = $notebook_global->get_current_page;
+# $notebook_global->set_page(0);
+# $notebook_global->set_page($a);
+ };
+Gtk->main;
#-------------------------------------------------------------
@@ -547,152 +532,11 @@ sub icon_label_box {
}
}
-#-------------------------------------------------------------
-# plug & tree sub
-#-------------------------------------------------------------
-
-# sub st {
-# return (@tree_parent - $_[0]);
-# }
-
-sub exec_treeitem {
- my ($label, $exec_string, $available) = @_;
-# $scrolled_global->set_usize($label eq _("Software Manager") ? 1 : 180, 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 been found.\nTry to install it.", $exec_string)), 1, 0, 0);
- $vbox->show_all;
- $notebook_global->append_page($vbox, "");
- $nb_pages++;
- $tree_launched{$label}->[0]=$nb_pages;
- $notebook_global->set_page($nb_pages);
- return;
- }
- if (!$tree_launched{$label}->[0]) {
-# (member($label, keys(%xapp))) ? xplug($label) : gtkplug($label,$exec_string);
- } else {
- $notebook_global->set_page($tree_launched{$label}->[0]);
- }
-}
-
-sub gtkplug {
- my ($label, $exec_string) =@_;
- my $a;
- if($label eq _("Software Manager")) {
- $a = $exec_string;
- } else {
- my $vbox = new Gtk::VBox(0, 0);
- $vbox->show;
- my $vbox2 = new Gtk::VBox(0, 0);
- $vbox2->show;
- $global_vbox=\$vbox2;
- $vbox->pack_start($vbox2,1,0,0);
- my $label_ = new Gtk::Label (_("Please wait while loading ..."));
- $vbox2->pack_start( $label_, 0, 0, 0);
- $label_->show;
- my $hbox = new Gtk::HBox(0, 0);
- $hbox->show;
- $vbox2->pack_start($hbox,0,0,0);
- my $darea1= new Gtk::DrawingArea();
- $darea1->size(350,12);
- $darea1->set_usize(340,12);
-# $frame0 = new Gtk::Frame;
-# $frame0->add($darea1);
-# $frame0->show;
- $darea1->show;
-# $frame0->set_shadow_type('etched_out');
-# $hbox->pack_start($frame0,1,0,0);
- my $socket = new Gtk::Socket;
- $global_socket = \$socket;
- $vbox->pack_start($socket, 1, 1, 0);
- $notebook_global->append_page($vbox, "");
- $nb_pages++;
- $tree_launched{$label}->[0]=$nb_pages;
- $notebook_global->set_page($nb_pages);
- $tree_launched{$_}->[0] or ${$tree_launched{$_}->[1]} and ${$tree_launched{$_}->[1]}->set_sensitive(0) foreach (keys %tree_launched);
- my $anim_nb=0;
- $global_time_tag = Gtk->timeout_add(100, sub {
- $darea1->window->draw_pixmap
- ($darea1->style->white_gc,
- $anim[$anim_nb]->[0], 0, 0,
- ($darea1->allocation->[2]-340)/2, ($darea1->allocation->[3]-15)/2,
- 350, 13);
- $anim_nb++;
- $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 '%s'\nSee if it's installed", $exec_string)); $darea1->hide;
- });
-
- $socket->realize;
- #$label->destroy;
- $a = $exec_string . " --embedded " . $socket->window->XWINDOW . " " . $$;
- }
- my $pid;
- unless ($pid = fork) {
- splash_warning(_("cannot fork: %s", $~)) unless defined $pid;
- exec("$a");
- }
- $pid_launched[$nb_pages-1] = $pid unless $label eq _("Software Manager");
-}
-
-sub xplug {
-# my ($label) =@_;
- my $socket = new Gtk::Socket;
- $notebook_global->append_page($socket, new Gtk::Label(""));
- $nb_pages++;
- $tree_launched{$_[0]}->[0]=$nb_pages;
- $notebook_global->set_page($nb_pages);
- $socket->realize;
-# $socket->steal(launch_xapp($xapp{$_[0]}));
- $socket->show_all();
- $notebook_global->set_page($nb_pages);
-}
-
-sub launch_xapp {
-# my ($exec, $grep, $num) = @_;
- my $b = "xwininfo -root -tree -int | grep '" . $_[0]->[1] . "'";
- my @before = split ('\n', `$b`);
- my $pid;
- unless ($pid = fork) {
- print $pid ."\n";
- splash_warning(_("cannot fork: %s", $~)) unless defined $pid;
- exec($_[0]->[0]);
- }
- $pid_launched[$nb_pages-1] = $pid;
- my $res = 0;
- while (!$res) {
- my @after = split ('\n', `$b`);
- while (@after ne ($_[0]->[2]+@before)) {
- @after = split ('\n', `$b`);
- }
- my $i = 0;
- my $c;
- foreach (@after) {
- $c = $after[$i] if !member($after[$i], @before);
- $i++;
- }
- $c =~ /\s*([0-9]*)\s*/;
- $res=$1;
- }
- $res;
-}
#-------------------------------------------------------------
# sub
#-------------------------------------------------------------
-# sub gtkcreate_png {
-# my ($f) = @_;
-# my $im = Gtk::Gdk::ImlibImage->load_image($f) or die "gtkcreate_png: missing png file $f";
-# $im->render($im->rgb_width, $im->rgb_height);
-# ($im->move_image(), $im->move_mask);
-# }
-
sub quit_global {
foreach(@pid_launched) {
kill 'TERM', $_ if (defined $_);
@@ -704,7 +548,6 @@ sub quit_global {
Gtk->exit(0);
}
-
sub splash_warning {
my ($label) = @_;
my $win_about = new Gtk::Dialog();
@@ -726,60 +569,6 @@ sub splash_warning {
}
-
-sub create_tree_item {
- my ($parent_tree, $label, $pixmap, $tree_depth_max) =@_;
-
- my $expanded=0;
- my ($treeitem, $treebox, $new_subtree);
- $treeitem = new Gtk::TreeItem();
- $treebox = xpm_label_box($window_global,$pixmap,$label, !$tree_depth_max);
- $treeitem->add($treebox);
- if ($tree_depth_max == 0) {
- $tree_launched{$label}->[1]=\$treeitem;
-# $treeitem->signal_connect(select => sub { exec_treeitem($label, $tree_exec{$label}, -e $tree_exec{$label} ) });
- } else {
- $treeitem->signal_connect(button_press_event => sub { $expanded ? $treeitem->collapse : $treeitem->expand; $expanded = !$expanded });
-# $treeitem->signal_connect(select => sub { $treeitem_old and $$treeitem_old->collapse(); $treeitem->expand(); $treeitem_old=\$treeitem;
-# $expanded=1; });
- }
- $parent_tree->append($treeitem);
- $treeitem->show_all();
-
- if ($tree_depth_max) {
- $tree_depth_max--;
- $new_subtree= new Gtk::Tree();
- $treeitem->set_subtree($new_subtree);
- $new_subtree->ref();
-# unshift(@treeitem_sub, $new_subtree);
- }
-}
-
-sub xpm_label_box {
- my ($parent, $xpm_filename, $label_text, $is_last) = @_;
- # Create box for xpm and label
- my $box = new Gtk::HBox( 0, 0 );
- my $box2;
- if ($is_last) {
- $box2 = new Gtk::HBox( 0, 0 );
- $box2->set_usize(20, 0);
- $box->pack_start($box2, 0, 0, 0);
- }
- # Get the style of the button to get the background color.
- my $style = $parent->get_style()->bg('normal');
- # Now on to the xpm stuff
- my ($pixmap, $mask) = gtkcreate_png($xpm_filename);
- my $pixmapwid = new Gtk::Pixmap($pixmap, $mask);
- # Create a label for the button
- my $label = new Gtk::Label($label_text);
- # Pack the pixmap and label into the box
- $box->pack_start($pixmapwid, 0, 0, 3);
- $box->pack_start($label, 0, 0, 3);
- $box->border_width(2);
- return ($box);
-}
-
-
#-------------------------------------------------------------
# menu related functions
#-------------------------------------------------------------