summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-02-25 13:53:19 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-02-25 13:53:19 +0000
commit5c2f5a41677dbf39da2bc49c4d80db957cf4acf5 (patch)
treefdc9366da69b7e8c00ca11fb3b800a6ab3aba146 /perl-install
parent816f58d65b8b71979c32c1bac0e76c671861ccb7 (diff)
downloaddrakx-5c2f5a41677dbf39da2bc49c4d80db957cf4acf5.tar
drakx-5c2f5a41677dbf39da2bc49c4d80db957cf4acf5.tar.gz
drakx-5c2f5a41677dbf39da2bc49c4d80db957cf4acf5.tar.bz2
drakx-5c2f5a41677dbf39da2bc49c4d80db957cf4acf5.tar.xz
drakx-5c2f5a41677dbf39da2bc49c4d80db957cf4acf5.zip
- factorize code into harddrake::data::set_removable_configurator()
- really do not offer to configure module for removable devices - do not put zip drives in unknown devices class - reuse Yes|No translations in harddrake::ui
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/harddrake/data.pm9
-rwxr-xr-xperl-install/standalone/harddrake213
2 files changed, 16 insertions, 6 deletions
diff --git a/perl-install/harddrake/data.pm b/perl-install/harddrake/data.pm
index defa91c98..b3ff53efc 100644
--- a/perl-install/harddrake/data.pm
+++ b/perl-install/harddrake/data.pm
@@ -12,7 +12,7 @@ my @devices = detect_devices::probeall(1);
# Update me each time you handle one more devices class (aka configurator)
sub unknown {
- grep { $_->{media_type} !~ /BRIDGE|class\|Mouse|DISPLAY|Hub|MEMORY_RAM|MULTIMEDIA_(VIDEO|AUDIO|OTHER)|NETWORK|Printer|SERIAL_(USB|SMBUS)|STORAGE_(IDE|OTHER|SCSI)|tape/ && $_->{driver} !~ /^(scanner|usbvision)$|Mouse:USB|class\|Mouse|www.linmodems.org|nvnet/ && $_->{type} ne 'network' } @devices;
+ grep { $_->{media_type} !~ /BRIDGE|class\|Mouse|DISPLAY|Hub|MEMORY_RAM|MULTIMEDIA_(VIDEO|AUDIO|OTHER)|NETWORK|Printer|SERIAL_(USB|SMBUS)|STORAGE_(IDE|OTHER|SCSI)|tape/ && $_->{driver} !~ /^(scanner|usbvision)$|Mouse:USB|class\|Mouse|Removable:zip|www.linmodems.org|nvnet/ && $_->{type} ne 'network' } @devices;
}
@@ -22,6 +22,13 @@ sub unknown {
# FIXME: add translated items
+sub set_removable_configurator {
+ my ($class, $device, $configurator) = @_;
+ if ($class =~ /FLOPPY|ZIP|DVDROM|CDROM|BURNER/) {
+ $$configurator = "/usr/sbin/diskdrake --removable=$device->{device}";
+ }
+}
+
our @tree =
(
[ "FLOPPY", , N("Floppy"), "floppy.png", "", \&detect_devices::floppies, 0 ],
diff --git a/perl-install/standalone/harddrake2 b/perl-install/standalone/harddrake2
index ae6a0060c..2727b5fb4 100755
--- a/perl-install/standalone/harddrake2
+++ b/perl-install/standalone/harddrake2
@@ -194,7 +194,11 @@ my $selection = gtksignal_connect($tree->get_selection(), 'changed' => sub {
# this ensures proper displaying of names like /dev/fd0 (otherwise it gets 'dev/fd0/').
# it must come *after* the space, as the space must follow the colon following the direction of writting.
if_($fields{$_}[0], [ $fields{$_}[0] . ": \x{200e}", { 'foreground' => 'royalblue3', 'weight' => Gtk2::Pango->WEIGHT_BOLD } ],
- [ ($_ && $current_device->{$_} =~ /^(unknown)/ ? N("unknown") : $_ && $current_device->{$_} =~ /^(Unknown)/ ? N("Unknown") : $current_device->{$_}) . "\n\n", { 'foreground' => ($_ eq 'driver' && $current_device->{$_} =~ /^(unknown|Bad:|Removable:)/ ? 'indian red' : 'black') } ])
+ [ ($_ && $current_device->{$_} =~ /^(unknown)/ ? N("unknown") :
+ $_ && $current_device->{$_} =~ /^(Unknown)/ ? N("Unknown") :
+ $_ && $current_device->{$_} eq 'yes' ? N("Yes") :
+ $_ && $current_device->{$_} eq 'no' ? N("No") :
+ $current_device->{$_}) . "\n\n", { 'foreground' => ($_ eq 'driver' && $current_device->{$_} =~ /^unknown|^Bad:/ ? 'indian red' : 'black') } ])
} sort keys %$current_device ]);
foreach (keys %$current_device) {
@@ -202,7 +206,7 @@ my $selection = gtksignal_connect($tree->get_selection(), 'changed' => sub {
};
# if we've valid driver, let's offer to configure it, else hide buttons
- show_hide(defined($current_device->{driver}) && $current_device->{driver} !~ /^(unknown|Bad|Card|Hsf|.*\|.*)/, $module_cfg_button);
+ show_hide(defined($current_device->{driver}) && $current_device->{driver} !~ /^unknown|^Bad|^Card|^Hsf|^Removable:|\|/, $module_cfg_button);
$current_configurator = $configurators{$id};
show_hide(-x first(split /\s+/, $current_configurator), $config_button); # strip arguments for -x test
@@ -252,9 +256,8 @@ foreach (@harddrake::data::tree) {
my $i = $_;
$_->{bus_location} = join ':', map { sprintf("%lx", $i->{$_}) } qw(bus id);
}
- if ($Ident =~ /FLOPPY|ZIP|DVDROM|CDROM|BURNER/) {
- $configurator = "/usr/sbin/diskdrake --removable=$_->{device}";
- } elsif ($Ident eq "AUDIO") {
+ harddrake::data::set_removable_configurator($Ident, $_, \$configurator);
+ if ($Ident eq "AUDIO") {
require harddrake::sound;
my $alter = harddrake::sound::get_alternative($_->{driver});
$_->{alternative_drivers} = join(':', @$alter) if $alter->[0] ne 'unknown';