summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2005-07-13 03:52:02 +0000
committerOlivier Blin <oblin@mandriva.org>2005-07-13 03:52:02 +0000
commitb9e901898d192a173ef9f2a529160c2dcdbb9c0e (patch)
tree406b036194aa796df0914de1e5ff289bc6c6a96e
parent1aecf8a341541259100fd8e953933028f53ec88b (diff)
downloaddrakx-b9e901898d192a173ef9f2a529160c2dcdbb9c0e.tar
drakx-b9e901898d192a173ef9f2a529160c2dcdbb9c0e.tar.gz
drakx-b9e901898d192a173ef9f2a529160c2dcdbb9c0e.tar.bz2
drakx-b9e901898d192a173ef9f2a529160c2dcdbb9c0e.tar.xz
drakx-b9e901898d192a173ef9f2a529160c2dcdbb9c0e.zip
first draft of wireless support
-rw-r--r--perl-install/standalone/net_applet32
1 files changed, 32 insertions, 0 deletions
diff --git a/perl-install/standalone/net_applet b/perl-install/standalone/net_applet
index 14ba43e6f..da696e64b 100644
--- a/perl-install/standalone/net_applet
+++ b/perl-install/standalone/net_applet
@@ -11,6 +11,7 @@ use network::tools;
use mygtk2 qw(gtknew);
use network::activefw;
+use network::monitor;
use Gtk2::TrayIcon;
@@ -31,6 +32,11 @@ my $net = {};
my $watched_interface;
my $dbus = dbus_object::system_bus();
+my $monitor = network::monitor->new($dbus);
+
+my $keyring_pixbuf = Gtk2::Gdk::Pixbuf->new_from_file("/usr/share/pixmaps/keyring-small.png"); #- provided by usermode, required by drakxtools
+my %link_level_pixbufs = map { $_ => Gtk2::Gdk::Pixbuf->new_from_file("wifi-$_.png") } qw(20 40 60 80 100);
+my %wireless_networks;
$SIG{HUP} = sub {
print "received SIGHUP, reloading network configuration\n";
@@ -156,7 +162,30 @@ sub netMonitor() {
system("/usr/sbin/net_monitor&");
checkNetwork();
}
+sub checkWireless() {
+ my $networks = $monitor->list_wireless;
+ foreach (keys %$networks) {
+ my $new = !exists $wireless_networks{$_};
+ my $net = $wireless_networks{$_} ||= {};
+ if ($new) {
+ $net->{image} = Gtk2::Image->new;
+ $net->{menuitem} = Gtk2::MenuItem->new;
+ $net->{menuitem}->add(gtkshow(gtkpack_(Gtk2::HBox->new,
+ 1, gtkset_alignment($net->{ssid_label} = Gtk2::Label->new, 0, 0),
+ 0, $net->{keyring_image} = Gtk2::Image->new_from_pixbuf($keyring_pixbuf),
+ 0, $net->{level_image} = Gtk2::Image->new)));
+ undef $current_state; #- force menu redraw
+ }
+ put_in_hash($net, $networks->{$_});
+ my $approx_level = 20+int($net->{level}/20)*20;
+ $net->{ssid_label}->set_text($net->{ssid} || "[$_]");
+ $net->{keyring_image}->visible(defined $net->{flags});
+ $net->{level_image}->set_from_pixbuf($link_level_pixbufs{$approx_level});
+ }
+ $wireless_networks{$_}{menuitem}->visible(exists $networks->{$_}) foreach keys %wireless_networks;
+}
sub checkNetwork() {
+ checkWireless();
my ($gw_intf, $_is_up, $gw_address) = $watched_interface ?
($watched_interface, network::tools::get_interface_status($watched_interface)) :
network::tools::get_internet_connection($net);
@@ -209,6 +238,9 @@ sub setState {
}
}
$menu->append(gtkshow(Gtk2::SeparatorMenuItem->new));
+ $menu->append($_->{menuitem}) foreach values %wireless_networks;
+ $menu->append(gtkshow(Gtk2::SeparatorMenuItem->new));
+
if ($enable_activefw) {
$menu->append($interactive_cb = gtkshow(gtksignal_connect(gtkset_active(Gtk2::CheckMenuItem->new_with_label(N("Interactive intrusion detection")),
$activefw->get_interactive),