summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2005-01-12 12:26:44 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2005-01-12 12:26:44 +0000
commitd488f42bb89836f65cb19c64d920382209ed7e7b (patch)
tree3ec168089ed6ab9ea2936de933ac0ad6ea2e4798
parentd704dcb471b9e321b26be34a965a1522a70ee893 (diff)
downloadcontrol-center-d488f42bb89836f65cb19c64d920382209ed7e7b.tar
control-center-d488f42bb89836f65cb19c64d920382209ed7e7b.tar.gz
control-center-d488f42bb89836f65cb19c64d920382209ed7e7b.tar.bz2
control-center-d488f42bb89836f65cb19c64d920382209ed7e7b.tar.xz
control-center-d488f42bb89836f65cb19c64d920382209ed7e7b.zip
new data structure:
- replace arrays with hash (aka replace named parameters instead by array indices) - remove useless field
-rwxr-xr-xcontrol-center517
1 files changed, 446 insertions, 71 deletions
diff --git a/control-center b/control-center
index 097616e2..c04c3194 100755
--- a/control-center
+++ b/control-center
@@ -120,69 +120,426 @@ my $isParkRpmDrake = -e "/usr/sbin/park-rpmdrake";
my $isWebAdmin = -e "/usr/bin/mdkwebadmin";
my $isRfbDrake = -e "/usr/X11R6/bin/rfbdrake";
-# { key => [ log_exp, binary, gtkplug?, description ] }
-# gtkplug meaning: -1 => not embedded, 0 => external x11 app, 1 => proper embedding
+# { key => { log_exp, binary, embedded?, description ] }
+# embedded meaning: -1 => not embedded, 0 => external x11 app, 1 => proper embedding
my $exec_hash =
-{
- "Authentication" => [ "drakauth", "$sbindir/drakauth", 1,
- #-PO: this message is already translated in drakx domain from which MCC will searchs it:
- N("Authentication") ],
- "Auto Install" => [ "drakautoinst", "$sbindir/drakautoinst", 1, N("Auto Install floppy") ],
- "Auto login Config" => [ "drakboot", "$sbindir/drakboot", 1, N("Autologin") ],
- "Backups" => [ "drakbackup", "$sbindir/drakbackup", 1, N("Backups") ],
- "Boot Config" => [ "drakboot", "$sbindir/drakboot --boot", 1, N("Boot loader") ],
- "Boot Theme" => [ "drakboot", "$sbindir/drakboot --splash", 1, N("Boot theme") ],
- "Boot Disk" => [ "drakfloppy", "$sbindir/drakfloppy", 1, N("Boot floppy") ],
- "Connection Sharing" => [ "drakgw", "$sbindir/drakgw", 1, N("Internet connection sharing") ],
- "Add Connection" => [ "drakconnect", "$sbindir/drakconnect --wizard", 1, N("New connection") ],
- "Manage Connection" => [ "drakconnect", "$sbindir/drakconnect --skip-wizard", 1, N("Manage connections") ],
- "Monitor Connection" => [ "net_monitor", "$sbindir/net_monitor", 1, N("Monitor connections") ],
- "Configure Internet" => [ "drakconnect", "$sbindir/drakconnect --internet", 1, N("Internet access") ],
- # little workaround to avoid drakconf freeze
- "Console" => [ "drakconsole", "$sbindir/drakconsole", 1, N("Console") ], #The Console will help you to solve issues
- "Date & Time" => [ "clock", "$sbindir/clock.pl", 1, N("Date and time") ],
- "Display Manager chooser" => [ "drakedm", "$sbindir/drakedm", 1, N("Display manager") ],
- "Fax" => [ "drakfax", "$sbindir/drakfax_server", 1, N("Fax") ],
- "Firewall" => [ "drakfirewall", "$sbindir/drakfirewall", 1, N("Firewall") ],
- "Fonts" => [ "drakfont", "$sbindir/drakfont", 1, N("Fonts") ],
- "Graphical server configuration" => [ "XFdrake", "$sbindir/XFdrake", 1, N("Graphical server") ],
- "Hard Drives" => [ "diskdrake", "$sbindir/diskdrake --hd", 1, N("Partitions") ],
- "Hardware List" => [ "harddrake", "$sbindir/harddrake2", 1, N("Hardware") ],
- "Install Software" => [ "rpmdrake", "$sbindir/rpmdrake", 1, N("Install") ],
- "Installed Softwares" => [ "rpmdrake", "$sbindir/rpmdrake-remove", 1, N("Installed Softwares") ],
- "Keyboard" => [ "keyboarddrake", "$sbindir/keyboarddrake", 1, N("Keyboard") ],
- "Kolab" => [ "kolab", "$sbindir/kolab", 1, N("Kolab") ],
- "Localization" => [ "localedrake", "$bindir/localedrake", 1,
- #-PO: this message is already translated in drakx domain from which MCC will searchs it:
- N("Language") . " - " .
- #-PO: this message is already translated in drakx domain from which MCC will searchs it:
- N("Country / Region") ],
- "Logs" => [ "logdrake", "$sbindir/logdrake", 1, N("Logs") ],
- "Manage park" => [ "rpmdrake", "$sbindir/park-rpmdrake", 1, N("Manage computer group") ],
- "Mandrake Update" => [ "rpmdrake", "$sbindir/MandrakeUpdate", 1, N("Updates") ],
- "Menus" => [ "menudrake", "$bindir/menudrake", -1, N("Menus") ],
- "Monitor" => [ "XFdrake", "$sbindir/XFdrake monitor", 1, N("Monitor") ],
- "Mouse" => [ "mousedrake", "$sbindir/mousedrake", 1, N("Mouse") ],
- "NFS mount points" => [ "diskdrake", "$sbindir/diskdrake --nfs", 1, N("NFS mount points") ],
- "Partition Sharing" => [ "diskdrake", "$sbindir/diskdrake --fileshare", 1, N("Local disk sharing") ],
- "Printer" => [ "printerdrake", "$sbindir/printerdrake", -1, N("Printers") ],
- "Programs scheduling" => [ "drakcronat", "/usr/X11R6/bin/drakcronat", 1, N("Scheduled tasks") ], #DrakCronAt enables to schedule Programs execution through crond and atd daemons
- "Proxy Configuration" => [ "drakproxy", "$sbindir/drakproxy", 1, N("Proxy") ], #for files and web browsing
- "Remote Control" => [ "rfbdrake", "$xbindir/rfbdrake", 1, N("Remote Control (Linux/Unix, Windows)") ],
- "Remove Interface" => [ "drakconnect", "$sbindir/drakconnect --del", 1, N("Remove a connection") ],
- "Remove Software" => [ "rpmdrake", "$sbindir/rpmdrake-remove", 1, N("Remove") ],
- "Resolution" => [ "XFdrake", "$sbindir/XFdrake resolution", 1, N("Screen resolution") ],
- "Samba mount points" => [ "diskdrake", "$sbindir/diskdrake --smb", 1, N("Samba mount points") ],
- "Scanner" => [ "scannerdrake", "$sbindir/scannerdrake", 1, N("Scanners") ],
- "Security Level" => [ "draksec", "$sbindir/draksec", 1, N("Level and checks") ],
- "Security Permissions" => [ "drakperm", "$sbindir/drakperm", 1, N("Permissions") ],
- "Services" => [ "drakxservices", "$sbindir/drakxservices", 1, N("Services") ],
- "Software Media Manager" => [ "rpmdrake", "$sbindir/edit-urpm-sources.pl", 1, N("Media Manager") ],
- "TV Cards" => [ "drakxtv", "$sbindir/drakxtv", 1, N("TV card") ],
- "UPS" => [ "drakups", "$sbindir/drakups --wizard", 1, N("UPS") ],
- "Users" => [ "userdrake", "$bindir/userdrake", -1, N("Users and groups") ], # too big
- "WebDAV mount points" => [ "diskdrake", "$sbindir/diskdrake --dav", 1, N("WebDAV mount points") ],
-};
+ {
+ "Authentication" =>
+ {
+ binary => "$sbindir/drakauth",
+ embedded => 1,
+ description =>
+ #-PO: this message is already translated in drakx domain from which MCC will searchs it:
+ N("Authentication"),
+ },
+
+
+ "Auto Install" =>
+ {
+ binary => "$sbindir/drakautoinst",
+ embedded => 1,
+ description => N("Auto Install floppy"),
+ },
+
+
+ "Auto login Config" =>
+ {
+ binary => "$sbindir/drakboot",
+ embedded => 1,
+ description => N("Autologin"),
+ },
+
+
+ "Backups" =>
+ {
+ binary => "$sbindir/drakbackup",
+ embedded => 1,
+ description => N("Backups"),
+ },
+
+
+ "Boot Config" =>
+ {
+ binary => "$sbindir/drakboot --boot",
+ embedded => 1,
+ description => N("Boot loader"),
+ },
+
+
+ "Boot Theme" =>
+ {
+ binary => "$sbindir/drakboot --splash",
+ embedded => 1,
+ description => N("Boot theme"),
+ },
+
+
+ "Boot Disk" =>
+ {
+ binary => "$sbindir/drakfloppy",
+ embedded => 1,
+ description => N("Boot floppy"),
+ },
+
+
+ "Connection Sharing" =>
+ {
+ binary => "$sbindir/drakgw",
+ embedded => 1,
+ description => N("Internet connection sharing"),
+ },
+
+
+ "Add Connection" =>
+ {
+ binary => "$sbindir/drakconnect --wizard",
+ embedded => 1,
+ description => N("New connection"),
+ },
+
+
+ "Configure Internet" =>
+ {
+ binary => "$sbindir/drakconnect --internet",
+ embedded => 1,
+ description => N("Internet access"),
+ },
+
+
+ "Console" =>
+ {
+ binary => "$sbindir/drakconsole",
+ embedded => 1,
+ description => N("Console"),
+ },
+
+
+ "Date & Time" =>
+ {
+ binary => "$sbindir/clock.pl",
+ embedded => 1,
+ description => N("Date and time"),
+ #The Console will help you to solve issues
+ },
+
+
+ "Display Manager chooser" =>
+ {
+ binary => "$sbindir/drakedm",
+ embedded => 1,
+ description => N("Display manager"),
+ },
+
+
+ "Fax" =>
+ {
+ binary => "$sbindir/drakfax_server",
+ embedded => 1,
+ description => N("Fax"),
+ },
+
+
+ "Firewall" =>
+ {
+ binary => "$sbindir/drakfirewall",
+ embedded => 1,
+ description => N("Firewall"),
+ },
+
+
+ "Fonts" =>
+ {
+ binary => "$sbindir/drakfont",
+ embedded => 1,
+ description => N("Fonts"),
+ },
+
+
+ "Graphical server configuration" =>
+ {
+ binary => "$sbindir/XFdrake",
+ embedded => 1,
+ description => N("Graphical server"),
+ },
+
+
+ "Hard Drives" =>
+ {
+ binary => "$sbindir/diskdrake --hd",
+ embedded => 1,
+ description => N("Partitions"),
+ },
+
+
+ "Hardware List" =>
+ {
+ binary => "$sbindir/harddrake2",
+ embedded => 1,
+ description => N("Hardware"),
+ },
+
+
+ "Install Software" =>
+ {
+ binary => "$sbindir/rpmdrake",
+ embedded => 1,
+ description => N("Install"),
+ },
+
+
+ "Installed Softwares" =>
+ {
+ binary => "$sbindir/rpmdrake-remove",
+ embedded => 1,
+ description => N("Installed Softwares"),
+ },
+
+
+ "Keyboard" =>
+ {
+ binary => "$sbindir/keyboarddrake",
+ embedded => 1,
+ description => N("Keyboard"),
+ },
+
+
+ "Kolab" =>
+ {
+ binary => "$sbindir/kolab",
+ embedded => 1,
+ description => N("Kolab"),
+ },
+
+
+ "Localization" =>
+ {
+ binary => "$bindir/localedrake",
+ embedded => 1,
+ description =>
+ #-PO: this message is already translated in drakx domain from which MCC will searchs it:
+ N("Language") . " - " .
+ #-PO: this message is already translated in drakx domain from which MCC will searchs it:
+ N("Country / Region"),
+ },
+
+
+ "Logs" =>
+ {
+ binary => "$sbindir/logdrake",
+ embedded => 1,
+ description => N("Logs"),
+ },
+
+
+ "Manage Connection" =>
+ {
+ binary => "$sbindir/drakconnect --skip-wizard",
+ embedded => 1,
+ description => N("Manage connections"),
+ },
+
+
+ "Manage park" =>
+ {
+ binary => "$sbindir/park-rpmdrake",
+ embedded => 1,
+ description => N("Manage computer group"),
+ },
+
+
+ "Mandrake Update" =>
+ {
+ binary => "$sbindir/MandrakeUpdate",
+ embedded => 1,
+ description => N("Updates"),
+ },
+
+
+ "Menus" =>
+ {
+ binary => "$bindir/menudrake",
+ embedded => -1,
+ description => N("Menus"),
+ },
+
+
+ "Monitor" =>
+ {
+ binary => "$sbindir/XFdrake monitor",
+ embedded => 1,
+ description => N("Monitor"),
+ },
+
+
+ "Monitor Connection" =>
+ {
+ binary => "$sbindir/net_monitor",
+ embedded => 1,
+ description => N("Monitor connections"),
+ },
+
+
+ "Mouse" =>
+ {
+ binary => "$sbindir/mousedrake",
+ embedded => 1,
+ description => N("Mouse"),
+ },
+
+
+ "NFS mount points" =>
+ {
+ binary => "$sbindir/diskdrake --nfs",
+ embedded => 1,
+ description => N("NFS mount points"),
+ },
+
+
+ "Partition Sharing" =>
+ {
+ binary => "$sbindir/diskdrake --fileshare",
+ embedded => 1,
+ description => N("Local disk sharing"),
+ },
+
+
+ "Printer" =>
+ {
+ binary => "$sbindir/printerdrake",
+ embedded => -1,
+ description => N("Printers"),
+ },
+
+
+ "Programs scheduling" =>
+ {
+ binary => "/usr/X11R6/bin/drakcronat",
+ embedded => 1,
+ description => N("Scheduled tasks"),
+ #DrakCronAt enables to schedule Programs execution through crond and atd daemons
+ },
+
+ "Proxy Configuration" =>
+ {
+ binary => "$sbindir/drakproxy",
+ embedded => 1,
+ description => N("Proxy"),
+ #for files and web browsing
+ },
+
+ "Remote Control" =>
+ {
+ binary => "$xbindir/rfbdrake",
+ embedded => 1,
+ description => N("Remote Control (Linux/Unix, Windows)"),
+ },
+
+
+ "Remove Interface" =>
+ {
+ binary => "$sbindir/drakconnect --del",
+ embedded => 1,
+ description => N("Remove a connection"),
+ },
+
+
+ "Remove Software" =>
+ {
+ binary => "$sbindir/rpmdrake-remove",
+ embedded => 1,
+ description => N("Remove"),
+ },
+
+
+ "Resolution" =>
+ {
+ binary => "$sbindir/XFdrake resolution",
+ embedded => 1,
+ description => N("Screen resolution"),
+ },
+
+
+ "Samba mount points" =>
+ {
+ binary => "$sbindir/diskdrake --smb",
+ embedded => 1,
+ description => N("Samba mount points"),
+ },
+
+
+ "Scanner" =>
+ {
+ binary => "$sbindir/scannerdrake",
+ embedded => 1,
+ description => N("Scanners"),
+ },
+
+
+ "Security Level" =>
+ {
+ binary => "$sbindir/draksec",
+ embedded => 1,
+ description => N("Level and checks"),
+ },
+
+
+ "Security Permissions" =>
+ {
+ binary => "$sbindir/drakperm",
+ embedded => 1,
+ description => N("Permissions"),
+ },
+
+
+ "Services" =>
+ {
+ binary => "$sbindir/drakxservices",
+ embedded => 1,
+ description => N("Services"),
+ },
+
+
+ "Software Media Manager" =>
+ {
+ binary => "$sbindir/edit-urpm-sources.pl",
+ embedded => 1,
+ description => N("Media Manager"),
+ },
+
+
+ "TV Cards" =>
+ {
+ binary => "$sbindir/drakxtv",
+ embedded => 1,
+ description => N("TV card"),
+ },
+
+
+ "UPS" =>
+ {
+ binary => "$sbindir/drakups --wizard",
+ embedded => 1,
+ description => N("UPS"),
+ },
+
+
+ "Users" =>
+ {
+ # too big
+ binary => "$bindir/userdrake",
+ embedded => -1,
+ description => N("Users and groups"),
+ },
+
+
+ "WebDAV mount points" =>
+ {
+ binary => "$sbindir/diskdrake --dav",
+ embedded => 1,
+ description => N("WebDAV mount points"),
+ },
+
+ };
# [ [ class_label, class icon name, [ [ program_label, program icon name ] ... ] ] ]
my @tree =
@@ -217,7 +574,12 @@ my @tree =
my ($type, $name, $scan, $text) = @$_;
map_index {
my $full_name = $name . ($::i ? $::i + 1 : '');
- $exec_hash->{$full_name} = [ "diskdrake", "$sbindir/diskdrake --removable=$_->{device}", 1, $text ];
+ $exec_hash->{$full_name} =
+ {
+ binary => "$sbindir/diskdrake --removable=$_->{device}",
+ embedded => 1,
+ description => $text,
+ };
[ $full_name, "diskdrake_$type" ];
} $scan->();
} do {
@@ -290,7 +652,13 @@ my @tree =
[
(map {
my ($id, $wizard, $icon, $description) = @$_;
- $exec_hash->{$id} = [ $id, "$sbindir/drakwizard $wizard", 1, $description ];
+ $exec_hash->{$id} =
+ {
+ binary => "$sbindir/drakwizard $wizard",
+ embedded => 1,
+ description => $description,
+ };
+
[ $id, $icon ];
} (# [ id, wizard file name, icon, description ]
[ "DHCP wizard", "dhcp", 'dhcp_server-mdk', N("Configure DHCP") ],
@@ -317,7 +685,13 @@ my @tree =
if_($isWebAdmin,
(map {
my ($id, $icon, $op, $description) = @$_;
- $exec_hash->{$id} = [ "mdkwebadmin", "$bindir/mdkwebadmin.pl $op", -1, $description ];
+ $exec_hash->{$id} =
+ {
+ binary => "$bindir/mdkwebadmin.pl $op",
+ embedded => -1,
+ description => $description,
+ };
+
[ $id, $icon ];
} (# [ id, wizard file name, icon, description ]
[ "Local Admin", 'local-administration-mdk', '--direct', N("Local administration") ],
@@ -628,7 +1002,7 @@ foreach (@tree) {
my @subtree;
foreach my $stuff (@$subtree) {
- my $exec = first(split /\s+/, $exec_hash->{$stuff->[0]}[1]);
+ my $exec = first(split /\s+/, $exec_hash->{$stuff->[0]}->{binary});
# do not complain about missing entries in move:
if (-x $exec) {
push @subtree, $stuff;
@@ -660,13 +1034,13 @@ foreach (@tree) {
my $tbl = create_packtable({ col_spacings => $spacing, row_spacings => $spacing, homogeneous => 1, mcc => 1 },
group_by3(map {
my ($label, $tag) = @$_;
- my $text = $exec_hash->{$label}[3];
+ my $text = $exec_hash->{$label}->{description};
die "$label 's icon is missing" if !$exec_hash->{$label} && $::testing;
my $event_box;
$tool_callbacks{$label} = sub {
# needed for --start-with parameter:
$event_box->realize;
- compute_exec_string($label, $event_box, $tag, $text, @{$exec_hash->{$label}});
+ compute_exec_string($label, $event_box, $tag, $text, $exec_hash->{$label});
};
$event_box = Gtk2::WebIcon->new($text, $tag,
{
@@ -700,8 +1074,8 @@ 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}[3];
- $tool_callbacks{$label} = sub { compute_exec_string($label, undef, $icons{$label} || 'wizard-mdk', $text, @{$exec_hash->{$label}}) };
+ my $text = $exec_hash->{$label}->{description};
+ $tool_callbacks{$label} = sub { compute_exec_string($label, undef, $icons{$label} || 'wizard-mdk', $text, $exec_hash->{$label}) };
$tool_feedback{$label} = sub { };
}
@@ -886,7 +1260,8 @@ sub fork_ {
}
sub compute_exec_string {
- my ($label, $box, $icon, $text, $_log_exp, $exec, $gtkplug) = @_;
+ my ($label, $box, $icon, $text, $tool) = @_;
+ my ($exec, $gtkplug) = @$tool{qw(binary embedded)};
return if $tool_pids{$label};
if (! -x first(split /\s+/, $exec)) {
splash_warning(N("cannot fork and exec \"%s\" since it is not executable", $exec));