summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcontrol-center60
1 files changed, 29 insertions, 31 deletions
diff --git a/control-center b/control-center
index 4ac2301c..807f06e8 100755
--- a/control-center
+++ b/control-center
@@ -53,7 +53,8 @@ $h{THEME} ||= 'default';
$h{EMBEDDED} ||= bool2text(1);
$h{LOGS} ||= bool2text($class{CLASS} eq 'expert' ? 1 : 0);
$h{EXPERT_WIZARD} ||= 0;
-my ($embedded, $show_logs, $expert_wizard) = (text2bool($h{EMBEDDED}), text2bool($h{LOGS}), text2bool($h{EXPERT_WIZARD}));
+my %option_values;
+@option_values{qw(embedded_mode show_log wiz_expert)} = (text2bool($h{EMBEDDED}), text2bool($h{LOGS}), text2bool($h{EXPERT_WIZARD}));
my $theme = $h{THEME};
$theme = $1 if "@ARGV" =~ /--theme (\w+)/;
-d "$themes_dir/$theme" or $theme = 'default';
@@ -100,7 +101,7 @@ $::isRpmDrake = -e "/usr/sbin/rpmdrake";
my $exec_hash =
{
"Auto Install" => [ "drakautoinst", "$sbindir/drakautoinst", 1, N("DrakAutoInst helps you produce an Auto Install floppy") ],
- "Backups" => [ "drakbackup", "$sbindir/drakbackup", 1, N("DrakBackup help in configuring Backups") ],
+ "Backups" => [ "drakbackup", "$sbindir/drakbackup", 1, N("DrakBackup helps you configure backups") ],
"Boot Config" => [ "drakboot", "$sbindir/drakboot", 1, N("DrakBoot helps you set up how your system boots") ],
"Boot Disk" => [ "drakfloppy", "$sbindir/drakfloppy", 1, N("DrakFloppy helps you produce your own boot floppy") ],
"Connection Sharing" => [ "drakgw", "$sbindir/drakgw", 1, N("DrakGw helps you share your Internet connection") ],
@@ -109,7 +110,7 @@ my $exec_hash =
"Console" => [ "rxvt", "$xbindir/rxvt", -1, N("Open a console") ], #The Console will help you to solve issues
# "Console" => [ "rxvt", [ "$xbindir/rxvt", "rxvt", 1 ], 0, N("Open a console") ], #The Console will help you to solve issues
"Date & Time" => [ "clock", "$sbindir/clock.pl", 1, N("Set date and time") ],
- "Display Manager chooser" => [ "drakedm", "$sbindir/drakedm", 1, N("Display manager chooser") ],
+ "Display Manager chooser" => [ "drakedm", "$sbindir/drakedm", 1, N("Choose the display manager") ],
"Firewall" => [ "drakfirewall", "$sbindir/drakfirewall", 1, N("DrakFirewall helps you set up a personal firewall") ],
"Fonts" => [ "drakfont", "$sbindir/drakfont", 1, N("DrakFont helps you add and remove fonts, including Windows fonts") ],
"Graphical server configuration" => [ "XFdrake", "$sbindir/XFdrake", 1, N("XFdrake helps you set up the graphical server") ],
@@ -123,7 +124,7 @@ my $exec_hash =
"Monitor" => [ "XFdrake", "$sbindir/XFdrake monitor", 1, N("Configure your monitor") ],
"Mouse" => [ "mousedrake", "$sbindir/mousedrake", 1, N("MouseDrake helps you set up your mouse") ],
"NFS mount points" => [ "diskdrake", "$sbindir/diskdrake --nfs", 1, N("Set NFS mount points") ],
- "Partition Sharing" => [ "diskdrake", "$sbindir/diskdrake --fileshare", 1, N("Partition Sharing enables to allow users to share some of their directories, allowing users to simply click on \"Share\" in Konqueror and Nautilus") ],
+ "Partition Sharing" => [ "diskdrake", "$sbindir/diskdrake --fileshare", 1, N("Set up sharing of your hard disk partitions") ],
"Printer" => [ "printerdrake", "$sbindir/printerdrake", 1, N("PrinterDrake helps you set up your printer, job queues ...."), "$sbindir/printerdrake" ],
"Programs scheduling" => [ "drakcronat", "/usr/X11R6/bin/drakcronat", 1, N("DrakCronAt helps you run programs or scripts at certain times") ], #DrakCronAt enables to schedule Programs execution through crond and atd daemons
"Proxy Configuration" => [ "drakproxy", "$sbindir/drakproxy", 1, N("DrakProxy helps you set up proxy servers") ], #for files and web browsing
@@ -270,7 +271,7 @@ my @tree =
my ($global_width, $global_height) = (720, 523);
-my ($timeout, $show_log_check_box, $embedded_check_box, $expert_wizard_check_box, $exp_frame, $emb_socket);
+my ($timeout, %check_boxes, $exp_frame, $emb_socket);
my $window_global = gtkset_size_request(Gtk2::Window->new('toplevel'), $global_width, $global_height);
@@ -289,16 +290,16 @@ my ($menu, $factory) = create_factory_menu($window_global,
{ path => N("/_Options"), type => '<Branch>' },
{ path => join('', @{$options{show_log}}), type => '<CheckItem>',
callback => sub {
- $show_logs = $show_log_check_box->active;
+ $option_values{show_log} = $check_boxes{show_log}->active;
update_exp();
}
},
{ path => join('', @{$options{embedded_mode}}), type => '<ToggleItem>',
- callback => sub { $embedded = $embedded_check_box->active }
+ callback => sub { $option_values{embedded} = $check_boxes{embedded_mode}->active }
},
if_($::isWiz,
{ path => join('', @{$options{wiz_expert}}), type => '<ToggleItem>',
- callback => sub { $expert_wizard = $expert_wizard_check_box->active }
+ callback => sub { $option_values{expert_wizard} = $check_boxes{wiz_expert}->active }
},
),
if_(all($themes_dir) > 1,
@@ -326,9 +327,10 @@ my ($menu, $factory) = create_factory_menu($window_global,
{ path => N("/_Help").N("/_About..."), callback => \&about_mdk_cc }
));
-$show_log_check_box = $factory->get_widget("<main>" . strip_first_underscore(@{$options{show_log}}));
-$embedded_check_box = $factory->get_widget("<main>" . strip_first_underscore(@{$options{embedded_mode}}));
-$expert_wizard_check_box = $factory->get_widget("<main>" . strip_first_underscore(@{$options{wiz_expert}})) if $::isWiz;
+%check_boxes = map {
+ $_ => $factory->get_widget("<main>" . join '', map { s/([^_]*)_(.*)/$1$2/; $_ } @{$options{$_}})
+} ("embedded_mode", "show_log", if_($::isWiz, "wiz_expert"));
+
gtkadd($window_global,
gtkpack_(Gtk2::VBox->new(0, 0),
@@ -573,12 +575,12 @@ $notebook_global->set_size_request(-1, $index * 60);
$emb_frame->set_size_request(-1, $index * 50);
-foreach ([ $show_log_check_box, $show_logs ], [ $embedded_check_box, $embedded ], if_($::isWiz, [ $expert_wizard_check_box, $expert_wizard ])) {
- my ($widget, $value) = @$_;
+foreach (keys %check_boxes) {
+ my $widget = $check_boxes{$_};
if (defined $widget) {
- $widget->set_active($value);
+ $widget->set_active($option_values{$_});
} else {
- print STDERR "BUG with LANGUAGE $ENV{LANGUAGE}\n";
+ print STDERR "BUG with LANGUAGE $ENV{LANGUAGE}\n";
}
};
@@ -667,7 +669,7 @@ sub create_hidden_socket_if_needed {
sub update_exp {
return if $still_in_splash_screen || $pending_app;
- if ($show_logs) {
+ if ($option_values{show_log}) {
$w_exp->show_all;
} else {
$w_exp->hide;
@@ -706,7 +708,7 @@ sub fork_ {
my $pid = fork();
if (defined $pid) {
!$pid and do { exec($prog) or POSIX::_exit(1) }; # immediate exit, else forked gtk+ object destructors will badly catch up parent mcc
- push @$pid_table, $pid if $embedded;
+ push @$pid_table, $pid if $option_values{embedded};
} else {
splash_warning(N("cannot fork: %s", "$!"));
child_just_exited();
@@ -720,8 +722,8 @@ sub compute_exec_string {
splash_warning(N("cannot fork and exec \"%s\" since it is not executable", $exec));
return;
}
- $exec .= " --summary" if $expert_wizard && $exec_ =~ /drakwizard/;
- if ($embedded && $gtkplug != -1) { # globally embedded and not "explicitely not embedded"
+ $exec .= " --summary" if $option_values{expert_wizard} && $exec_ =~ /drakwizard/;
+ if ($option_values{embedded} && $gtkplug != -1) { # globally embedded and not "explicitely not embedded"
$notebook_global->hide;
create_hidden_socket_if_needed();
$emb_frame->show;
@@ -749,13 +751,13 @@ sub compute_exec_string {
}
} else { # not embedded
# fix #3415 when $gtkplug eq -1
- my $old = $embedded;
- $embedded = 0;
+ my $old = $option_values{embedded};
+ $option_values{embedded} = 0;
fork_($gtkplug == 0 ? $exec_->[0] : $alternate || $exec);
- $embedded = $old;
+ $option_values{embedded} = $old;
}
#FIXME
-# if ($embedded && $gtkplug != -1) {
+# if ($option_values{embedded} && $gtkplug != -1) {
# foreach (@darea_left_list) {
# $_->->window->set_cursor($cursor_hand);
# if ($_->{state} != 0) {
@@ -765,7 +767,7 @@ sub compute_exec_string {
# }
# }
# (re)start logdrake if needed
- if ($show_logs && $freeze_log) { #FIXME && !$exp_socket
+ if ($option_values{show_log} && $freeze_log) { #FIXME && !$exp_socket
my $exp_socket;
gtkshow(gtkadd($exp_frame, $exp_socket = Gtk2::Socket->new));
$w_exp->show;
@@ -813,9 +815,9 @@ sub quit_global {
&kill_children();
&kill_logdrake();
setVarsInSh($conffile, {
- EMBEDDED => bool2text($embedded),
- LOGS => bool2text($show_logs),
- EXPERT_WIZARD => bool2text($expert_wizard),
+ EMBEDDED => bool2text($option_values{embedded}),
+ LOGS => bool2text($option_values{show_log}),
+ EXPERT_WIZARD => bool2text($option_values{expert_wizard}),
THEME => $theme,
});
gtkset_mousecursor_normal();
@@ -933,9 +935,6 @@ sub set_page {
}
-sub strip_first_underscore {
- join '', map { s/([^_]*)_(.*)/$1$2/; $_ } @_;
-}
#-------------------------------------------------------------
# mcc specific graphic functions:
@@ -963,7 +962,6 @@ sub render_shiner {
$new_pixbuf;
}
-
sub scale {
my ($pixbuf, $gain) = @_;
my ($width, $height) = ($pixbuf->get_height, $pixbuf->get_width);