summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-11-17 11:36:09 +0000
committerOlivier Blin <oblin@mandriva.com>2008-11-17 11:36:09 +0000
commit9649a403ad0cc1bbac39b114ec3dd7326246ff0a (patch)
tree8665a39493f7136e3f38011c5e1be94004722ce6 /lib
parent1806a3d07d9fa95ef6f213eec06f5339164b6717 (diff)
downloaddrakx-net-9649a403ad0cc1bbac39b114ec3dd7326246ff0a.tar
drakx-net-9649a403ad0cc1bbac39b114ec3dd7326246ff0a.tar.gz
drakx-net-9649a403ad0cc1bbac39b114ec3dd7326246ff0a.tar.bz2
drakx-net-9649a403ad0cc1bbac39b114ec3dd7326246ff0a.tar.xz
drakx-net-9649a403ad0cc1bbac39b114ec3dd7326246ff0a.zip
show/hide connections on hotplug events
Diffstat (limited to 'lib')
-rwxr-xr-xlib/network/netcenter.pm25
1 files changed, 22 insertions, 3 deletions
diff --git a/lib/network/netcenter.pm b/lib/network/netcenter.pm
index 72cdcd0..8a0a41a 100755
--- a/lib/network/netcenter.pm
+++ b/lib/network/netcenter.pm
@@ -165,10 +165,29 @@ sub main {
$dbus->{connection}->add_filter(sub {
my ($_con, $msg) = @_;
if ($msg->get_member eq 'status') {
- my ($_status, $interface) = $msg->get_args_list;
+ my ($status, $interface) = $msg->get_args_list;
print "got connection status event: $status $interface\n";
- my $cmanager = find { $_->{connection}->get_interface eq $interface } @cmanagers
- or return;
+ my $cmanager = find { $_->{connection}->get_interface eq $interface } @cmanagers;
+ if ($status eq "add") {
+ if (!$cmanager) {
+ detect_devices::probeall_update_cache();
+ my $connection = find { $_->get_interface eq $interface } get_connections()
+ or return;
+ $cmanager = build_cmanager($in, $net, $w, $pixbufs, $connection);
+ push @connections, $connection;
+ push @cmanagers, $cmanager;
+ my $box = build_cmanager_box($cmanager, @connections == 0);
+ $managers_box ->add($box);
+ $box->show_all;
+ }
+ $cmanager->{parent_box}->show;
+ return;
+ }
+ $cmanager or return;
+ if ($status eq "remove") {
+ $cmanager->{parent_box}->hide;
+ return;
+ }
#- FIXME: factorize in update_on_status_change() and check why update_networks() calls update_on_status_change()
if ($cmanager->{connection}->can('get_networks') && !$cmanager->{connection}->network_scan_is_slow) {
$cmanager->update_networks;