diff options
Diffstat (limited to 'control-center3')
-rwxr-xr-x | control-center3 | 69 |
1 files changed, 29 insertions, 40 deletions
diff --git a/control-center3 b/control-center3 index 651dcc3a..833b0183 100755 --- a/control-center3 +++ b/control-center3 @@ -29,6 +29,7 @@ init Gtk; use Data::Dumper; my $false = 0; +my $true = 1; my $_xbindir = "/usr/X11R6/bin"; my $_bindir = "/usr/bin"; @@ -65,7 +66,7 @@ my @item_factory_entries = ( 'type' => '<Item>' }, ["/_Help", undef, 0, "<Branch>"], - ["/Help/_Mandrake Control Center", undef, 2], + [ "/Help/_Mandrake Control Center", undef, 2], ["/Help/_Report Bug", undef, 3 ], ["/Help/_About", undef, 4 ] ); @@ -179,23 +180,24 @@ map { create_tree_item($tree, $_->[0] , "$xpm_path_l/$_->[1]",1); } (['Boot', 'logo.xpm'] , ['Hardware', 'logo.xpm'] , ['User and Groups','logo.xpm'], ['Network & Internet','logo.xpm'] , ['Menu Customization','logo.xpm'] , ['Font Management','logo.xpm']); - -map { - create_tree_item($treeitem_sub[int($_->[2])],$_->[0], "$xpm_path/$_->[1]",0); -} (['Boot Loader','item.xpm',5] , ['Boot Disk', 'item.xpm',5] , ['Boot Logo', 'item.xpm',5], - ['XFDrake','item.xpm',4] , ['Harddrake','item.xpm',4] , ['Mousedrake', 'item.xpm',4] , ['Printerdrake','item.xpm',4] , ['Keyboarddrake', 'item.xpm',4], - ['Userdrake','item.xpm',3] , - ['Draknet' , 'item.xpm',2] , ['Drakgw','item.xpm',2], - ['Menudrake' , 'item.xpm',1] , - ['Drakfont', 'item.xpm', 0]); - -%tree_exec = ("Boot Loader" => "./cest_ton_boot", "Boot Disk" => "$_xbindir/drakfloppy", + + map { + create_tree_item($treeitem_sub[int($_->[2])],$_->[0], "$xpm_path/$_->[1]",0); + } (['Boot Loader','item.xpm',5] , ['Boot Disk', 'item.xpm',5] , ['Boot Logo', 'item.xpm',5], + ['XFDrake','item.xpm',4] , ['Harddrake','item.xpm',4] , ['Mousedrake', 'item.xpm',4] , ['Printerdrake','item.xpm',4] , ['Keyboarddrake', 'item.xpm',4], + ['Userdrake','item.xpm',3] , + ['Draknet' , 'item.xpm',2] , ['Drakgw','item.xpm',2], + ['Menudrake' , 'item.xpm',1] , + ['Drakfont', 'item.xpm', 0]); + +%tree_exec = ("Boot Loader" => " ../bootlookdrake/bootlookdrake", "Boot Disk" => "$_xbindir/drakfloppy", "Boot Logo" => "$_xbindir/DrakeLogo" , "XFDrake" => "$_sbindir/XFdrake --expert" , "Harddrake" => "$_bindir/harddrake-auth" , "Mousedrake" => "$_sbindir/mousedrake" , "Printerdrake" => "$_sbindir/printerdrake" , "Keyboarddrake" => "$_sbindir/keyboarddrake" , "Userdrake" => "$_bindir/userdrake" , "Draknet" => "$_sbindir/draknet" , "Drakgw" => "$_sbindir/drakgw" , "Menudrake" => "$_bindir/menudrake" , "Drakfont" => "$_xbindir/drakfont" ); + my @pid_launched; %tree_launched = ("Boot Loader" => -1, "Boot Disk" => -1, "Boot Logo" => -1 , "XFDrake" => -1 , @@ -213,12 +215,12 @@ $window_global->show_all; print "num : " . $notebook_global->page_num($fixed1) . "\n"; -#$notebook_global->set_page(0); $SIG{USR1} = sub { $notebook_global->set_page(0); }; # embedded applications will send me that signal in order to "hide" them Gtk->main; -sub quit_global { +sub quit_global +{ print "Cleaning...\n"; foreach (@pid_launched) { print "$_\n"; @@ -226,13 +228,13 @@ sub quit_global { kill TERM, @pid_launched; Gtk->exit(0); } - -sub about_mdk_cc() + +sub about_mdk_cc { my $window_about = new Gtk::Dialog(); $window_about->set_position(1); my $button = new Gtk::Button("Close"); - $button->signal_connect_object("clicked",$window_about => destroy); + $button->signal_connect_object("clicked",$window_about => 'destroy'); $window_about->action_area->pack_start($button,$true,$true,0); my $label = new Gtk::Label( "Mandrake Control Center 1.0 \n Copyright (C) 2001 Mandrakesoft SA\n" ); @@ -247,7 +249,7 @@ sub about_mdk_cc() $window_about->set_modal(1); } -sub help_mandrake_cc () +sub help_mandrake_cc { my $docdir="/usr/share/doc"; my $browser="netscape"; @@ -256,23 +258,18 @@ sub help_mandrake_cc () } -sub bug_report() +sub bug_report { my $bug_url="https://qa.mandrakesoft.com/dimension"; my $browser="netscape"; system("$browser -geometry 600x800+10+10 -no-about-splash $bug_url &"); - } -sub create_tree_item() +sub create_tree_item { my ($parent_tree, $label, $pixmap, $tree_depth_max) =@_; - my ( - $treeitem, - $treebox, - $new_subtree, - ); + my ($treeitem, $treebox, $new_subtree); $treeitem = new Gtk::TreeItem(); $treebox = xpm_label_box($window_global,$pixmap,$label); @@ -304,7 +301,7 @@ sub xpm_label_box my $style = $parent->get_style()->bg( 'normal' ); # Now on to the xpm stuff - my ($pixmap, $mask ) = Gtk::Gdk::Pixmap->create_from_xpm($parent->window, $style, $xpm_filename ); + my ($pixmap, $mask) = Gtk::Gdk::Pixmap->create_from_xpm($parent->window, $style, $xpm_filename ); my $pixmapwid = new Gtk::Pixmap( $pixmap, $mask ); # Create a label for the button @@ -321,7 +318,8 @@ sub xpm_label_box return ( $box ); } -sub exec_treeitem { +sub exec_treeitem +{ my ($label, $exec_string) = @_; #exec_treeitem($tree_exec{$label},1);}); if ($exec_string) { @@ -335,11 +333,7 @@ sub exec_treeitem { print ("The XID of the sockets window n° is [" . $socket->window->XWINDOW . "]\nMy PID is [" . $$ . "]\n"); my $a = $exec_string . " --embedded " . $socket->window->XWINDOW . " " . $$; print "$a\n"; - if (my $pid = fork()) { - $pid_launched[$nb_pages]=$pid; - } else { - exec ($a) or print STDERR "couldn't exec $a: $!"; - } + (my $pid = fork()) ? $pid_launched[$nb_pages] = $pid : exec ($a) or print STDERR "couldn't exec $a: $!"; $nb_pages++; $tree_launched{$label}=$nb_pages; $notebook_global->set_page($nb_pages); @@ -366,7 +360,6 @@ sub create_item_factory { my ($accel_group, $item_factory, $box1, $label, $box2); my ($separator, $button, $dummy); - $item_factory_window = new Gtk::Window('toplevel'); signal_connect $item_factory_window destroy => \&destroy_window, \$item_factory_window; signal_connect $item_factory_window "delete-event" => \&destroy_window, \$item_factory_window; @@ -406,11 +399,7 @@ sub create_item_factory { $box2->pack_start($button, 1, 1, 0); $button->can_default(1); $button->grab_default; - - } - if (!visible $item_factory_window) { - show_all $item_factory_window; - } else { - destroy $item_factory_window; } + + (!visible $item_factory_window) ? show_all $item_factory_window : destroy $item_factory_window; } |