diff options
author | Olivier Blin <oblin@mandriva.com> | 2007-10-05 13:26:24 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2007-10-05 13:26:24 +0000 |
commit | e7f83e4b1a218c74e017dbc4ab9b67e5cf1fcd38 (patch) | |
tree | f00016e7f048454af6b37b431d8544c14991e0e3 /lib | |
parent | 8afe1e8ab22fd3d4e153fd0dd9d5df4dc07022a6 (diff) | |
download | drakx-net-e7f83e4b1a218c74e017dbc4ab9b67e5cf1fcd38.tar drakx-net-e7f83e4b1a218c74e017dbc4ab9b67e5cf1fcd38.tar.gz drakx-net-e7f83e4b1a218c74e017dbc4ab9b67e5cf1fcd38.tar.bz2 drakx-net-e7f83e4b1a218c74e017dbc4ab9b67e5cf1fcd38.tar.xz drakx-net-e7f83e4b1a218c74e017dbc4ab9b67e5cf1fcd38.zip |
drakroam: use same sort function than draknetcenter
Diffstat (limited to 'lib')
-rw-r--r-- | lib/network/connection_manager.pm | 11 | ||||
-rwxr-xr-x | lib/network/netcenter.pm | 9 |
2 files changed, 9 insertions, 11 deletions
diff --git a/lib/network/connection_manager.pm b/lib/network/connection_manager.pm index cd9de78..a7bac80 100644 --- a/lib/network/connection_manager.pm +++ b/lib/network/connection_manager.pm @@ -216,6 +216,14 @@ sub select_network { update_on_status_change($droam); } +sub filter_networks { + my ($connection) = @_; + $_->{configured} = $connection->network_is_configured($_) foreach values %{$connection->{networks}}; + sort { + $b->{configured} <=> $a->{configured} || $b->{signal_strength} <=> $a->{signal_strength} || $a->{name} cmp $b->{name}; + } values %{$connection->{networks}}; +} + sub update_networks { my ($cmanager) = @_; @{$cmanager->{gui}{networks_list}{data}} = (); @@ -231,8 +239,7 @@ sub update_networks { my $interface = $cmanager->{connection}->get_interface; my $connected = exists $routes->{$interface}{network}; - my @networks = values %{$cmanager->{connection}{networks}}; - $cmanager->{filter_networks} and @networks = $cmanager->{filter_networks}(@networks); + my @networks = filter_networks($cmanager->{connection}); foreach my $network (@networks) { my $ap = $network->{ap}; push @{$cmanager->{gui}{networks_list}{data}}, [ diff --git a/lib/network/netcenter.pm b/lib/network/netcenter.pm index 94204ad..737ed95 100755 --- a/lib/network/netcenter.pm +++ b/lib/network/netcenter.pm @@ -11,14 +11,6 @@ use ugtk2 qw(:create :helpers :wrappers); use network::connection; use network::connection_manager; -sub filter_networks { - my ($connection) = @_; - $_->{configured} = $connection->network_is_configured($_) foreach values %{$connection->{networks}}; - my @networks = sort { - $b->{configured} <=> $a->{configured} || $b->{signal_strength} <=> $a->{signal_strength} || $a->{name} cmp $b->{name}; - } values %{$connection->{networks}}; -} - sub build_cmanager { my ($in, $net, $w, $pixbufs, $connection) = @_; @@ -27,7 +19,6 @@ sub build_cmanager { $cmanager->{gui}{show_networks} = $connection->can('get_networks') && !$connection->network_scan_is_slow; if ($cmanager->{gui}{show_networks}) { network::connection_manager::create_networks_list($cmanager); - $cmanager->{filter_networks} = sub { filter_networks($connection) }; network::connection_manager::update_networks($cmanager); } $cmanager; |