summaryrefslogtreecommitdiffstats
path: root/lib/network/connection_manager.pm
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-05-28 12:58:43 +0000
committerOlivier Blin <oblin@mandriva.com>2008-05-28 12:58:43 +0000
commitc8ce404ab436e913e5ed78ff54706b6c90cbffb8 (patch)
treeaa9cb8cdb0b26b02174136d72a7e939f32048e9b /lib/network/connection_manager.pm
parent197d0726845097104132ed12576270fbb8f4c1d8 (diff)
downloaddrakx-net-c8ce404ab436e913e5ed78ff54706b6c90cbffb8.tar
drakx-net-c8ce404ab436e913e5ed78ff54706b6c90cbffb8.tar.gz
drakx-net-c8ce404ab436e913e5ed78ff54706b6c90cbffb8.tar.bz2
drakx-net-c8ce404ab436e913e5ed78ff54706b6c90cbffb8.tar.xz
drakx-net-c8ce404ab436e913e5ed78ff54706b6c90cbffb8.zip
do not use a networks list when there is only one network (cellular cards)
Diffstat (limited to 'lib/network/connection_manager.pm')
-rw-r--r--lib/network/connection_manager.pm33
1 files changed, 24 insertions, 9 deletions
diff --git a/lib/network/connection_manager.pm b/lib/network/connection_manager.pm
index 124a423..f8e6c6b 100644
--- a/lib/network/connection_manager.pm
+++ b/lib/network/connection_manager.pm
@@ -249,6 +249,11 @@ sub toggle_connection {
sub create_networks_list {
my ($cmanager) = @_;
+ if ($cmanager->{gui}{show_unique_network}) {
+ $cmanager->{gui}{networks_list} = gtknew('HBox', spacing => 20);
+ return;
+ }
+
$cmanager->{gui}{networks_list} = Gtk2::SimpleList->new(
"AP" => "hidden",
'' => "pixbuf",
@@ -312,17 +317,27 @@ sub update_networks {
my $connected_pixbuf = $network->{current} ? $connected ? $cmanager->{gui}{pixbufs}{state}{connected} : $cmanager->{gui}{pixbufs}{state}{refresh} : undef;
my $network_name = !$network->{essid} && exists $cmanager->{net}{wireless}{$ap} && $cmanager->{net}{wireless}{$ap}{WIRELESS_ESSID} || $network->{name};
my $strength_pixbuf = network::signal_strength::get_strength_icon($network);
- push @{$cmanager->{gui}{networks_list}{data}}, [
- $ap || $network->{name},
- $connected_pixbuf,
- $network_name,
- $strength_pixbuf,
- $cmanager->{gui}{pixbufs}{encryption}{$network->{flags} =~ /WPA/i ? 'strong' : $network->{flags} =~ /WEP/i ? 'weak' : 'open'},
- $network->{mode},
- ];
+
+ if ($cmanager->{gui}{show_unique_network}) {
+ gtkset($cmanager->{gui}{networks_list}, children => [
+ 0, Gtk2::Image->new_from_pixbuf($connected_pixbuf),
+ 1, $network_name,
+ 0, Gtk2::Image->new_from_pixbuf($strength_pixbuf),
+ ]);
+ $cmanager->{connection}{network} = $network_name;
+ } else {
+ push @{$cmanager->{gui}{networks_list}{data}}, [
+ $ap || $network->{name},
+ $connected_pixbuf,
+ $network_name,
+ $strength_pixbuf,
+ $cmanager->{gui}{pixbufs}{encryption}{$network->{flags} =~ /WPA/i ? 'strong' : $network->{flags} =~ /WEP/i ? 'weak' : 'open'},
+ $network->{mode},
+ ];
+ }
}
- if ($cmanager->{connection}{network}) {
+ if ($cmanager->{connection}{network} && !$cmanager->{gui}{show_unique_network}) {
my $index = eval { find_index { $_->[0] eq $cmanager->{connection}{network} } @{$cmanager->{gui}{networks_list}{data}} };
$cmanager->{gui}{networks_list}->select($index) if defined $index;
}