diff options
author | Olivier Blin <oblin@mandriva.com> | 2008-02-26 17:19:04 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2008-02-26 17:19:04 +0000 |
commit | 516e0d2259aca872209899734ed9bdae91aca614 (patch) | |
tree | 04fe1826275c8b8d33d96296ca213794871b278f /lib/network | |
parent | cbf57e19c27e80e462c6fd78d0332fe79722d53d (diff) | |
download | drakx-net-516e0d2259aca872209899734ed9bdae91aca614.tar drakx-net-516e0d2259aca872209899734ed9bdae91aca614.tar.gz drakx-net-516e0d2259aca872209899734ed9bdae91aca614.tar.bz2 drakx-net-516e0d2259aca872209899734ed9bdae91aca614.tar.xz drakx-net-516e0d2259aca872209899734ed9bdae91aca614.zip |
move setup check code in check_setup
Diffstat (limited to 'lib/network')
-rw-r--r-- | lib/network/connection_manager.pm | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/network/connection_manager.pm b/lib/network/connection_manager.pm index c8e8b74..a705c61 100644 --- a/lib/network/connection_manager.pm +++ b/lib/network/connection_manager.pm @@ -33,6 +33,15 @@ sub create { { in => $in, net => $net, gui => { w => $w, pixbufs => $pixbufs } }; } +sub check_setup { + my ($cmanager) = @_; + $cmanager->{connection}{passed_setup} = + (!$cmanager->{connection}->can("check_device") || + $cmanager->{connection}->check_device) + if !defined $cmanager->{connection}{passed_setup}; + $cmanager->{connection}{passed_setup}; +} + sub setup_connection { my ($cmanager) = @_; @@ -80,7 +89,7 @@ sub load_settings { sub configure_connection { my ($cmanager) = @_; - if (!$cmanager->{connection}{passed_setup}) { + if (!check_setup($cmanager)) { setup_connection($cmanager); update_on_status_change($cmanager); return; @@ -251,7 +260,6 @@ sub update_networks { my $wait = $cmanager->{connection}->network_scan_is_slow && $cmanager->{in}->wait_message('', N("Scanning for networks...")); $cmanager->{connection}{networks} = $cmanager->{connection}->get_networks; undef $wait; - $cmanager->{connection}{network} ||= find { $cmanager->{connection}{networks}{$_}{current} } keys %{$cmanager->{connection}{networks}}; my $routes = network::tools::get_routes(); @@ -306,10 +314,7 @@ sub update_on_status_change { my $may_have_network = !$cmanager->{connection}->can('get_networks') || $cmanager->{connection}{network}; - $cmanager->{connection}{passed_setup} = - !$cmanager->{connection}->can("check_device") || - $cmanager->{connection}->check_device; - $allow_configure = $may_have_network || !$cmanager->{connection}{passed_setup}; + $allow_configure = $may_have_network || !check_setup($cmanager); } $cmanager->{gui}{buttons}{configure}->set_sensitive($allow_configure) |