summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-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 },