summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-05-18 19:52:13 +0000
committerOlivier Blin <oblin@mandriva.com>2008-05-18 19:52:13 +0000
commit8e185cf17268b0b35f0345c18e98b7f2768cd7e3 (patch)
tree745eee691f5d0b27199cb1cce9ff967d6c810fe3
parent6fc6dba9b140c06cf66e94581fa9bec84c61b941 (diff)
downloaddrakx-net-8e185cf17268b0b35f0345c18e98b7f2768cd7e3.tar
drakx-net-8e185cf17268b0b35f0345c18e98b7f2768cd7e3.tar.gz
drakx-net-8e185cf17268b0b35f0345c18e98b7f2768cd7e3.tar.bz2
drakx-net-8e185cf17268b0b35f0345c18e98b7f2768cd7e3.tar.xz
drakx-net-8e185cf17268b0b35f0345c18e98b7f2768cd7e3.zip
move provider settings guess in connection object
-rw-r--r--lib/network/connection.pm9
-rw-r--r--lib/network/netconnect.pm8
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/network/connection.pm b/lib/network/connection.pm
index 8851e92..6efbe1b 100644
--- a/lib/network/connection.pm
+++ b/lib/network/connection.pm
@@ -158,6 +158,15 @@ sub get_access_settings_label { N("Access settings") }
sub get_address_settings_label { N("Address settings") }
#- check that $self->can('get_providers') first
+sub guess_provider_settings {
+ my ($self) = @_;
+ require lang;
+ my @providers_data = $self->get_providers;
+ my $locale_country = lang::c2name(ref($::o) && $::o->{locale}{country} || lang::read()->{country});
+ my $separator = $providers_data[1];
+ $self->{provider_name} = find { /^\Q$locale_country$separator\E/ } sort(keys %{$providers_data[0]});
+}
+
sub set_provider {
my ($self) = @_;
if ($self->{provider_name} ne N("Unlisted - edit manually")) {
diff --git a/lib/network/netconnect.pm b/lib/network/netconnect.pm
index 7b46d28..189d5a1 100644
--- a/lib/network/netconnect.pm
+++ b/lib/network/netconnect.pm
@@ -51,7 +51,7 @@ sub real_main {
my ($net, $in, $modules_conf) = @_;
#- network configuration should have been already read in $net at this point
my $mouse = $::o->{mouse} || {};
- my (@connections_list, $connection, $provider_settings, @providers_data, $protocol_settings, $access_settings, $control_settings);
+ my (@connections_list, $connection, $provider_settings, $protocol_settings, $access_settings, $control_settings);
my $connection_compat;
my ($hardware_settings, $network_access_settings, $address_settings, $hostname_settings);
my ($modem, $modem_name, $modem_dyn_dns, $modem_dyn_ip);
@@ -195,11 +195,7 @@ sub real_main {
select_provider => {
pre => sub {
$provider_settings = $connection->get_provider_settings;
- @providers_data = $connection->get_providers;
- require lang;
- my $locale_country = lang::c2name(ref($::o) && $::o->{locale}{country} || lang::read()->{country});
- my $separator = $providers_data[1];
- $connection->{provider_name} = find { /^\Q$locale_country$separator\E/ } sort(keys %{$providers_data[0]});
+ $connection->guess_provider_settings;
},
name => sub { $net->{type}->get_type_name . "\n\n" . N("Please select your provider:") },
data => sub { $provider_settings },