From 0962b3b8025c988b8141f84a91d3ac9ffe5672f7 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Tue, 26 Feb 2008 17:34:44 +0000 Subject: factorize settings write in write_settings() (adds additional modules_conf write in some cases) --- lib/network/connection_manager.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/network/connection_manager.pm b/lib/network/connection_manager.pm index 00a2383..a6cf643 100644 --- a/lib/network/connection_manager.pm +++ b/lib/network/connection_manager.pm @@ -88,6 +88,14 @@ sub load_settings { $cmanager->{connection}->guess_control_settings; } +sub write_settings { + my ($cmanager) = @_; + + my $modules_conf = modules::any_conf->read; + $cmanager->{connection}->write_settings($cmanager->{net}, $modules_conf); + $modules_conf->write; +} + sub configure_connection { my ($cmanager) = @_; @@ -142,9 +150,7 @@ sub configure_connection { $cmanager->{connection}->install_packages($cmanager->{in}) if $cmanager->{connection}->can('install_packages'); $cmanager->{connection}->unload_connection if $cmanager->{connection}->can('unload_connection'); - my $modules_conf = modules::any_conf->read; - $cmanager->{connection}->write_settings($cmanager->{net}, $modules_conf); - $modules_conf->write; + write_settings($cmanager); 1; } @@ -165,7 +171,7 @@ sub start_connection { #- settings have to be rewritten only if they are impacted by choices from the main window if ($cmanager->{connection}->can('get_networks')) { load_settings($cmanager); - $cmanager->{connection}->write_settings($cmanager->{net}); + write_settings($cmanager); } $cmanager->{connection}->prepare_connection if $cmanager->{connection}->can('prepare_connection'); $cmanager->{connection}->disconnect; -- cgit v1.2.1