diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2003-01-02 12:19:52 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2003-01-02 12:19:52 +0000 |
commit | 37b6c4bbe4a43416fa55b30173ab556bc10d18de (patch) | |
tree | 88d0bce49beaec3e08b669fc1269907729b86763 | |
parent | 7c1f7767aaead0630bd17ef954171cbc84954d1c (diff) | |
download | control-center-37b6c4bbe4a43416fa55b30173ab556bc10d18de.tar control-center-37b6c4bbe4a43416fa55b30173ab556bc10d18de.tar.gz control-center-37b6c4bbe4a43416fa55b30173ab556bc10d18de.tar.bz2 control-center-37b6c4bbe4a43416fa55b30173ab556bc10d18de.tar.xz control-center-37b6c4bbe4a43416fa55b30173ab556bc10d18de.zip |
- add missing wizards (firewall, nfs, server)
- better and simpler wizards managment
- if current theme hasn't a gtk ressource file to handle backgrounds,
then we default on the default theme one
- fix waitpid usage and really do non blocking zombies reaping
- fix and restore tools embedding
- only pass --summary to wizards
- enforce gtk+2 logic on sockets behavior
- begin to write tools description
-rwxr-xr-x | control-center | 158 |
1 files changed, 76 insertions, 82 deletions
diff --git a/control-center b/control-center index 06ac22a2..02c769f7 100755 --- a/control-center +++ b/control-center @@ -23,7 +23,7 @@ my $xbindir = "/usr/X11R6/bin"; my $bindir = "/usr/bin"; my $sbindir = "/usr/sbin"; -my $mcc_dir = "/usr/share/mcc"; +my $mcc_dir = "/usr/share/mcc"; my $themes_dir = "$mcc_dir/themes/"; my $wizdir = "/usr/share/wizards"; @@ -61,6 +61,7 @@ add_icon_path("$themes_dir/$theme/"); add_icon_path("$themes_dir/default") if $theme ne 'default'; # fall back if theme miss some icons my $rc = "$themes_dir/$theme/gtkrc"; +$rc = "$themes_dir/default/gtkrc" if ! -r $rc && $theme ne 'default'; Gtk2::Rc->parse($rc) if -r $rc; #------------------------------------------------------------- @@ -104,63 +105,39 @@ my $exec_hash = "Connection Sharing" => [ "drakgw", "$sbindir/drakgw", 1, N("Connection Sharing: dummy description") ], "Connection" => [ "drakconnect", "$sbindir/drakconnect", 1, N("Connection: dummy description") ], # little workaround to avoid drakconf freeze -# "Console" => [ "rxvt", "$xbindir/rxvt", -1, N("dummy description") ], - "Console" => [ "rxvt", [ "$xbindir/rxvt", "rxvt", 1 ], 0, N("Console: dummy description") ], +# "Console" => [ "rxvt", "$xbindir/rxvt", -1, "" ], + "Console" => [ "rxvt", [ "$xbindir/rxvt", "rxvt", 1 ], 0, N("The Console will help you to solve issues") ], "Date & Time" => [ "clock", "$sbindir/clock.pl", 1, N("Date & Time: dummy description") ], - "Firewall" => [ "drakfirewall", "$sbindir/drakfirewall", 1, N("Firewall: dummy description") ], + "Firewall" => [ "drakfirewall", "$sbindir/drakfirewall", 1, N("drakfirewall configures a personal firewall (look at MNF for a powerful dedicated firewall solution)") ], "Fonts" => [ "drakfont", "$sbindir/drakfont", 1, N("Fonts: dummy description") ], "Graphical server configuration" => [ "XFdrake", "$sbindir/XFdrake", 1, N("Graphical server configuration: dummy description") ], - "Hard Drives" => [ "diskdrake", "$sbindir/diskdrake --hd", 1, N("Hard Drives: dummy description") ], - "Hardware List" => [ "harddrake", "$sbindir/harddrake2", 1, N("Hardware List: dummy description") ], - "Install Software" => [ "rpmdrake", "$sbindir/rpmdrake", -1, N("Install Software: dummy description") ], + "Hard Drives" => [ "diskdrake", "$sbindir/diskdrake --hd", 1, N("DiskDrake enable to alter hard disks partitionning scheme and to resize partitions") ], + "Hardware List" => [ "harddrake", "$sbindir/harddrake2", 1, N("Harddrake enable to list and configure the hardware") ], + "Install Software" => [ "rpmdrake", "$sbindir/rpmdrake", -1, N("Install Software: RpmDrake enable to install software packages") ], "Keyboard" => [ "keyboarddrake", "$sbindir/keyboarddrake", 1, N("Keyboard: dummy description") ], - "Logs" => [ "logdrake", "$sbindir/logdrake", 1, N("Logs: dummy description") ], - "Mandrake Update" => [ "rpmdrake", "$sbindir/MandrakeUpdate", -1, N("Mandrake Update: dummy description") ], + "Logs" => [ "logdrake", "$sbindir/logdrake", 1, N("Logdrake enable to search in system logs") ], + "Mandrake Update" => [ "rpmdrake", "$sbindir/MandrakeUpdate", -1, N("Mandrake Update will enable you to update your system pacakges") ], "Menus" => [ "menudrake", "$sbindir/menus_launcher.pl", 1, N("Menus: dummy description"), "$bindir/menudrake" ], "Monitor" => [ "XFdrake", "$sbindir/XFdrake monitor", 1, N("Monitor: dummy description") ], - "Mouse" => [ "mousedrake", "$sbindir/mousedrake", 1, N("Mouse: dummy description") ], + "Mouse" => [ "mousedrake", "$sbindir/mousedrake", 1, N("MouseDrake enable to configure the mouse") ], "NFS mount points" => [ "diskdrake", "$sbindir/diskdrake --nfs", 1, N("NFS mount points: dummy description") ], - "Partition Sharing" => [ "diskdrake", "$sbindir/diskdrake --fileshare", 1, N("Partition Sharing: dummy description") ], + "Partition Sharing" => [ "diskdrake", "$sbindir/diskdrake --fileshare", 1, N("Partition Sharing enable to allow users to share some of their directories, allowing users to simply click on \"Share\" in konqueror and nautilus") ], "Printer" => [ "printerdrake", "$sbindir/printerdrake", 1, N("Printer: dummy description"), "$sbindir/printerdrake" ], - "Programs scheduling" => [ "drakcronat", "/usr/X11R6/bin/drakcronat", 1, N("Programs scheduling: dummy description") ], + "Programs scheduling" => [ "drakcronat", "/usr/X11R6/bin/drakcronat", 1, N("DrakCronAt enable to schedule Programs execution through crond and atd daemons") ], "Proxy Configuration" => [ "drakproxy", "$sbindir/drakproxy", 1, N("Proxy Configuration: dummy description") ], - "Remove Software" => [ "rpmdrake", "$sbindir/rpmdrake-remove", -1, N("Remove Software: dummy description") ], + "Remove Software" => [ "rpmdrake", "$sbindir/rpmdrake-remove", -1, N("Remove Software: RpmDrake enable to remove software packages") ], "Resolution" => [ "XFdrake", "$sbindir/XFdrake resolution", 1, N("Resolution: dummy description") ], "Samba mount points" => [ "diskdrake", "$sbindir/diskdrake --smb", 1, N("Samba mount points: dummy description") ], "Scanner" => [ "scannerdrake", "$sbindir/scannerdrake", 1, N("Scanner: dummy description") ], - "Security Level" => [ "draksec", "$sbindir/draksec", 1, N("Security Level: dummy description") ], + "Security Level" => [ "draksec", "$sbindir/draksec", 1, N("DrakSec enable to shrewdly configure the system Security Level") ], "Security Permissions" => [ "drakperm", "$sbindir/drakperm", 1, N("Security Permissions: dummy description") ], "Services" => [ "drakxservices", "$sbindir/drakxservices", 1, N("Services: dummy description") ], - "Software Sources Manager" => [ "rpmdrake", "$sbindir/edit-urpm-sources.pl", -1, N("Software Sources Manager: dummy description") ], + "Software Sources Manager" => [ "rpmdrake", "$sbindir/edit-urpm-sources.pl", -1, N("The Software Sources Manager enable to configure packages sources") ], "TV Cards" => [ "drakxtv", "$sbindir/drakxtv", 1, N("TV Cards: dummy description") ], - "Users" => [ "userdrake", "$bindir/userdrake", 1, N("Users: dummy description") ], + "Users" => [ "userdrake", "$bindir/userdrake", 1, N("Userdrake help in managing system's users") ], "WebDAV mount points" => [ "diskdrake", "$sbindir/diskdrake --dav", 1, N("WebDAV mount points: dummy description") ], - - "DHCP" => [ "DHCP wizard", "drakwizard $wizdir/dhcp_wizard/dhcp.wiz", -1, N("DHCP wizard: dummy description") ], - "DNS Client" => [ "Client wizard", "drakwizard $wizdir/client_wizard/client.wiz", -1, N("DNS Client wizard: dummy description") ], - "DNS" => [ "DNS wizard", "drakwizard $wizdir/dns_wizard/dns.wiz", -1, N("DNS wizard: dummy description") ], - "FTP" => [ "FTP wizard", "drakwizard $wizdir/ftp_wizard/ftp.wiz", -1, N("FTP wizard: dummy description") ], - "News" => [ "News wizard", "drakwizard $wizdir/news_wizard/news.wiz", -1, N("News wizard: dummy description") ], - "Postfix" => [ "Postfix wizard", "drakwizard $wizdir/postfix_wizard/postfix.wiz", -1, N("Postfix wizard: dummy description") ], - "Proxy" => [ "Squid wizard", "drakwizard $wizdir/proxy_wizard/proxy.wiz", -1, N("Proxy wizard: dummy description") ], - "Samba" => [ "Samba wizard", "drakwizard $wizdir/samba_wizard/samba.wiz", -1, N("Samba wizard: dummy description") ], - "Time" => [ "Time wizard", "drakwizard $wizdir/time_wizard/time.wiz", -1, N("Time wizard: dummy description") ], - "Web" => [ "Web wizard", "drakwizard $wizdir/web_wizard/web.wiz", -1, N("Web wizard: dummy description") ], }; -# { name => [ label, icon core ] } -my %wizard = ("client" => [ N("DNS Client"), 'server-mdk' ], - "dhcp" => [ N("DHCP"), 'server-mdk' ], - "dns" => [ N("DNS"), 'server-mdk' ], - "ftp" => [ N("FTP"), 'ftp-mdk' ], - "news" => [ N("News"), 'news-mdk' ], - "postfix" => [ N("Postfix"), 'postfix-mdk' ], - "proxy" => [ N("Proxy"), 'web-mdk' ], - "samba" => [ N("Samba"), 'diskdrake_samba' ], - "time" => [ N("Time"), 'time-mdk' ], - "web" => [ N("Web"), 'web-mdk' ], - ); - # [ [ class_label, class icon name, [ [ program_label, program icon name ] ... ] ] ] my @tree = ([ N("Boot"), 'boot-mdk', @@ -198,11 +175,11 @@ my @tree = foreach (detect_devices::cdroms()) { my $type = detect_devices::isBurner($_) ? 'burner' : detect_devices::isDvdDrive($_) ? 'DVD' : 'cdrom'; push @{$cdroms_by_type{$type}}, $_; - } ([ 'cdrom', N("CD-ROM"), sub { @{$cdroms_by_type{cdrom} || []} }, N("CD-ROM drive: dummy description") ], - [ 'dvd', N("DVD"), sub { @{$cdroms_by_type{DVD} || []} }, N("DVD drive: dummy description") ], - [ 'cdwriter', N("CD Burner"), sub { @{$cdroms_by_type{burner} || []} }, N("CD/DVD burner: dummy description") ], - [ 'floppy', N("Floppy"), \&detect_devices::floppies, N("Floppy drive: dummy description") ], - [ 'zip', N("Zip"), \&detect_devices::zips, N("ZIP drive: dummy description") ], + } ([ 'cdrom', N("CD-ROM"), sub { @{$cdroms_by_type{cdrom} || []} }, N("CD-ROM drive: mount point configuration") ], + [ 'dvd', N("DVD"), sub { @{$cdroms_by_type{DVD} || []} }, N("DVD drive: mount point configuration") ], + [ 'cdwriter', N("CD Burner"), sub { @{$cdroms_by_type{burner} || []} }, N("CD/DVD burner: mount point configuration") ], + [ 'floppy', N("Floppy"), \&detect_devices::floppies, N("Floppy drive: mount point configuration") ], + [ 'zip', N("Zip"), \&detect_devices::zips, N("ZIP drive: mount point configuration") ], ), }), [ "NFS mount points", 'diskdrake_nfs', ], @@ -252,12 +229,35 @@ my @tree = [ N("Server Configuration"), 'wizard-mdk', [ (map { - if_(-e '/usr/share/wizards/'.$_.'_wizard/'.$_.'.wiz', $wizard{$_}) - } keys %wizard) + my ($id, $wizard, $icon, $description) = @$_; + my $path = "/usr/share/wizards/".$wizard."_wizard/"."$wizard".".wiz"; + if (-e $path) { + $exec_hash->{$id} = [ "drakwizard", "$sbindir/drakwizard $path", -1, $description ]; + [ $id, $icon ]; + } else { + (); + } + } (# [ id, wizard file name, icon, description ] + [ "DHCP wizard", "dhcp", 'server-mdk', N("The DHCP wizard will help you configuring the DHCP services of your server") ], + [ "DNS Client wizard", "client", 'server-mdk', N("The DNS Client wizard will help you in adding a new client in your local DNS") ], + [ "DNS wizard", "dns", 'server-mdk', N("The DNS wizard will help you configuring the DNS services of your server. This configuration will provide a local DNS service for local computers names, with non-local requests forwarded to an outside DNS.") ], + [ "Firewall wizard", "firewall", 'server-mdk', N("The Firewall wizard will help you configuring your server firewall that will protects your internal network from unauthorized accesses from the Internet") ], #NEW + [ "FTP wizard", "ftp", 'ftp-mdk', N("The FTP wizard will help you configuring the FTP Server for your network") ], + [ "News wizard", "news", 'news-mdk', N("The News wizard will help you configuring the Internet News services for your network") ], + [ "NFS wizard", "nfs", 'news-mdk', N("The NFS wizard will help you configuring the NFS Server for your network") ], #NEW + [ "Postfix wizard", "postfix", 'postfix-mdk', N("The Postfix wizard will help you configuring the Internet Mail services for your network") ], + [ "Squid wizard", "proxy", 'web-mdk', N("The Proxy wizard will help you configuring a web caching proxy server") ], + [ "Samba wizard", "samba", 'diskdrake_samba', N("The Samba wizard will help you configuring your server to behave as a file and print server for workstations running non-Linux systems") ], + [ "Server wizard", "server", 'diskdrake_samba', N("The Server wizard will help you configuring the basic networking services of your server") ], #NEW + [ "Time wizard", "time", 'time-mdk', N("The Time wizard will help you to set the time of your server synchronized with an external time server") ], + [ "Web wizard", "web", 'web-mdk', N("The Web wizard will help you configuring the Web Server for your network") ] + ) + ) ] ]), ); + #------------------------------------------------------------- # let build the GUI @@ -291,7 +291,6 @@ my ($menu, $factory) = create_factory_menu($window_global, callback => sub { $expert_wizard = $expert_wizard_check_box->active } }, ), - if_(all($themes_dir) > 1, { path => N("/_Themes"), type => '<Branch>' }, (map { @@ -369,7 +368,7 @@ my $summary = Gtk2::Fixed->new; $summary->set_has_window(1); $notebook_global->append_page(gtksignal_connect($summary, realize => sub { set_back_pixbuf($summary, gtkcreate_pixbuf("mcc-splash")) })); -use POSIX qw(:sys_utsname_h :math_h); +use POSIX qw(:sys_utsname_h :math_h sys_wait_h); my (undef, $nodename, $release, undef, $machine) = POSIX::uname(); $summary->put(gtkmodify_font(Gtk2::Label->new(N("Welcome to the Mandrake Control Center")), Gtk2::Pango::FontDescription->from_string('15')), @@ -436,6 +435,7 @@ foreach (@tree) { unless ($dbl_area_left[$curr_state]) { my $extra = $curr_state == 1 ? $scale : 0; my $window = $darea_left->window; +# return unless $window; my $lspacing = $lspacing[$curr_state]; $dbl_area_left[$curr_state] = Gtk2::Gdk::Pixmap->new($window, $d_width, $d_height, $window->get_depth); my $gc = $darea_left->style->fg_gc('normal'); @@ -448,7 +448,7 @@ foreach (@tree) { $darea_left->modify_font($fonts[$curr_state]); (undef, undef, $lines, $widths, $heights) = get_text_coord($text, $darea_left, $d_width-$txt_offset, $d_height, 0, 0, 0, 0); - my $offset = $heights->[0]/2 if listlength(@$lines) > 1; # multi line texts are offsetted + my $offset = listlength(@$lines) > 1 ? $heights->[0]/2 : 0; # multi line texts are offsetted mapn { # $_ = "<markup><span foreground=\"blue\">$_</span></markup>" if $curr_state == 1; # we need Gtk2::Pango::Layout->set_markup to render in blue in highlighted state @@ -494,39 +494,31 @@ foreach (@tree) { # Create right notebook pages : - my $fixed = Gtk2::Fixed->new; - $fixed->set_has_window(1); - $fixed = gtksignal_connect( - gtkput($fixed, - create_packtable({ col_spacings => $spacing, row_spacings => $spacing }, - group_by2(map { - my ($label, $tag) = @$_; - my $text = $exec_hash->{$label}[3]; - die "$label 's icon is missing" unless $exec_hash->{$label}; - my $event_box = gtkadd(Gtk2::EventBox->new(), my $icon = gtkcreate_img($tag)); - $event_box->set_events([ 'enter_notify_mask', 'leave_notify_mask', 'button_press_mask', 'button_release_mask' ]); - # FIXME: do ->set_pixbuf() on {enter,leave}_events - $event_box->signal_connect(realize => sub { $event_box->window->set_cursor($cursor_hand) }); - $event_box->signal_connect(button_release_event => sub { compute_exec_string($tag, @{$exec_hash->{$label}}) }); - - # FIXME : resize sig: ->foreach; set_size_request - - gtkpack(Gtk2::HBox->new(0, 0), - $event_box, - gtkset_size_request(gtktext_insert(Gtk2::TextView->new, [ [ $text, {'background_set' => 0, 'background_stipple_set' => 0 } ] ]), ($global_width-$d_width-$icon->get_pixbuf->get_width-$spacing*4-5)/2, -1) -# gtkset_size_request(Gtk2::Label->new($text), ($global_width-$d_width-$icon->get_width-95)/2, -1) - ); - } @$subtree)), - 0, $spacing), - realize => sub { set_back_pixbuf($fixed, $right_back_pixbuf) }); - - $notebook_global->append_page(my $w_ret = gtkhide(create_scrolled_window($fixed, undef, 'none'))); + my $tbl = create_packtable({ col_spacings => $spacing, row_spacings => $spacing, homogeneous => 1 }, + group_by2(map { + my ($label, $tag) = @$_; + my $text = $exec_hash->{$label}[3]; + die "$label 's icon is missing" unless $exec_hash->{$label}; + my $event_box = gtkadd(Gtk2::EventBox->new(), my $icon = gtkcreate_img($tag)); + $event_box->set_events([ 'enter_notify_mask', 'leave_notify_mask', 'button_press_mask', 'button_release_mask' ]); + # FIXME: do ->set_pixbuf() on {enter,leave}_events + $event_box->signal_connect(realize => sub { $event_box->window->set_cursor($cursor_hand) }); + $event_box->signal_connect(button_release_event => sub { compute_exec_string($tag, @{$exec_hash->{$label}}) }); + + # FIXME : resize sig: ->foreach; set_size_request + my $hbox_spacing = 10; + gtkpack_(Gtk2::HBox->new(0, $hbox_spacing), + 0, $event_box, + 1, gtktext_insert(Gtk2::TextView->new, [ [ $text, {'background_set' => 0, 'background_stipple_set' => 0 } ] ]) + ); + } @$subtree)); + + $notebook_global->append_page(my $w_ret = create_scrolled_window($tbl, undef, 'none')); # $w_ret->vscrollbar->set_size_request(19, undef); } $notebook_global->set_size_request(-1, $index * 60); - my ($exp_frame, $emb_socket); sub update_exp { @@ -552,7 +544,7 @@ eval { }; print STDERR "BUG with LANGUAGE $ENV{LANGUAGE}\n" if $@; -create_hidden_socket_if_needed(); +hide_socket_and_clean(); # default left background $fixed_left->set_has_window(1); @@ -588,7 +580,7 @@ $SIG{USR1} = \&sig_usr1; $SIG{USR2} = \&sig_usr2; $SIG{TERM} = \&quit_global; $SIG{CHLD} = \&sig_child; -$SIG{CONT} = sub { Gtk2->main }; +#$SIG{CONT} = sub { Gtk2->main }; $window_splash->destroy; undef $window_splash; @@ -599,7 +591,7 @@ eval { Gtk2->main } while 1; sub sig_child { # reap zombies my $kid; - do { $kid = waitpid(-1, 'WNOHANG') } until $kid > 0; + do { $kid = waitpid(-1, POSIX::WNOHANG) } until $kid > 0; return unless $left_locked; kill('USR1', $$); splash_warning(N("This program was abnomarly exited")); @@ -643,7 +635,7 @@ sub fork_ { sub compute_exec_string { my ($icon, $log_exp, $exec, $gtkplug, undef, $alternate) = @_; #($_[0], @{$_[1]}); - $exec .= " --summary" if $expert_wizard; + $exec .= " --summary" if $expert_wizard && $exec =~ /drakwizard/; if ($embedded) { if ($gtkplug != -1) { # not explicitely not embedded $notebook_global->hide; @@ -674,6 +666,7 @@ sub compute_exec_string { } else { # not embedded fork_($gtkplug == 0 ? $exec->[0] : $alternate || $exec); } +#FIXME # if ($embedded && $gtkplug != -1) { # foreach (@darea_left_list) { # $_->->window->set_cursor($cursor_hand); @@ -730,6 +723,7 @@ sub clean_socket { map { if__($_, kill 'TERM', $_) } @pid_launched; @pid_launched = (); $emb_socket and $emb_socket->destroy; # should not happen since our child should have cause the socket to be destroyes when it exited + undef $emb_socket; } sub create_hidden_socket_if_needed { |