summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2005-01-12 12:27:32 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2005-01-12 12:27:32 +0000
commit25a17711dcea8dc77fc04d075cf426c4f1c2e0e6 (patch)
tree5a994917b80d8b2374f1dc08576beae793f301ef
parentea2e4e28f480bb0225e33c18f866b9ccbdd9f06d (diff)
downloadcontrol-center-25a17711dcea8dc77fc04d075cf426c4f1c2e0e6.tar
control-center-25a17711dcea8dc77fc04d075cf426c4f1c2e0e6.tar.gz
control-center-25a17711dcea8dc77fc04d075cf426c4f1c2e0e6.tar.bz2
control-center-25a17711dcea8dc77fc04d075cf426c4f1c2e0e6.tar.xz
control-center-25a17711dcea8dc77fc04d075cf426c4f1c2e0e6.zip
- make a real hash of the main data structure (more readable code)
- rename it by the way so that its name is more understandable
-rwxr-xr-xcontrol-center26
1 files changed, 13 insertions, 13 deletions
diff --git a/control-center b/control-center
index e921ffe6..74b48a3a 100755
--- a/control-center
+++ b/control-center
@@ -122,8 +122,8 @@ my $isRfbDrake = -e "/usr/X11R6/bin/rfbdrake";
# { key => { log_exp, binary, embedded?, description ] }
# embedded meaning: -1 => not embedded, 0 => external x11 app, 1 => proper embedding
-my $exec_hash =
- {
+my %programs =
+ (
"Authentication" =>
{
binary => "$sbindir/drakauth",
@@ -588,7 +588,7 @@ my $exec_hash =
icon => 'webdav-mdk',
},
- };
+ );
# [ [ class_label, class icon name, [ [ program_label, program icon name ] ... ] ] ]
my @tree =
@@ -623,7 +623,7 @@ my @tree =
my ($type, $name, $scan, $text) = @$_;
map_index {
my $full_name = $name . ($::i ? $::i + 1 : '');
- $exec_hash->{$full_name} =
+ $programs{$full_name} =
{
binary => "$sbindir/diskdrake --removable=$_->{device}",
embedded => 1,
@@ -701,7 +701,7 @@ my @tree =
[
(map {
my ($id, $wizard, $icon, $description) = @$_;
- $exec_hash->{$id} =
+ $programs{$id} =
{
binary => "$sbindir/drakwizard $wizard",
embedded => 1,
@@ -735,7 +735,7 @@ my @tree =
if_($isWebAdmin,
(map {
my ($id, $icon, $op, $description) = @$_;
- $exec_hash->{$id} =
+ $programs{$id} =
{
binary => "$bindir/mdkwebadmin.pl $op",
embedded => -1,
@@ -1053,7 +1053,7 @@ foreach (@tree) {
my @subtree;
foreach my $stuff (@$subtree) {
- my $exec = first(split /\s+/, $exec_hash->{$stuff}->{binary});
+ my $exec = first(split /\s+/, $programs{$stuff}->{binary});
# do not complain about missing entries in move:
if (-x $exec) {
push @subtree, $stuff;
@@ -1085,13 +1085,13 @@ foreach (@tree) {
my $tbl = create_packtable({ col_spacings => $spacing, row_spacings => $spacing, homogeneous => 1, mcc => 1 },
group_by3(map {
my $label = $_;
- my ($icon, $text) = @{$exec_hash->{$label}}{qw(icon description)};
- die "$label 's icon is missing" if !$exec_hash->{$label} && $::testing;
+ my ($icon, $text) = @{$programs{$label}}{qw(icon description)};
+ die "$label 's icon is missing" if !$programs{$label} && $::testing;
my $event_box;
$tool_callbacks{$label} = sub {
# needed for --start-with parameter:
$event_box->realize;
- compute_exec_string($label, $event_box, $icon, $text, $exec_hash->{$label});
+ compute_exec_string($label, $event_box, $icon, $text, $programs{$label});
};
$event_box = Gtk2::WebIcon->new($text, $icon,
{
@@ -1124,9 +1124,9 @@ my %icons = (
);
# manage tools not present in MCC (localedrake, drakauth, ...):
-foreach my $label (difference2([ keys %$exec_hash ], [ keys %tool_callbacks ])) {
- my $text = $exec_hash->{$label}->{description};
- $tool_callbacks{$label} = sub { compute_exec_string($label, undef, $icons{$label} || 'wizard-mdk', $text, $exec_hash->{$label}) };
+foreach my $label (difference2([ keys %programs ], [ keys %tool_callbacks ])) {
+ my $text = $programs{$label}->{description};
+ $tool_callbacks{$label} = sub { compute_exec_string($label, undef, $icons{$label} || 'wizard-mdk', $text, $programs{$label}) };
$tool_feedback{$label} = sub { };
}