diff options
author | Olivier Blin <oblin@mandriva.com> | 2007-09-19 22:33:30 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2007-09-19 22:33:30 +0000 |
commit | a4dccd8bed1783e7bf2f09bb382f26bb756fd931 (patch) | |
tree | 30d9430667ade98679808bf89b11137c5872fbd3 | |
parent | cac63e3f3c271eb24d31d0c943378899f275733f (diff) | |
download | drakx-net-a4dccd8bed1783e7bf2f09bb382f26bb756fd931.tar drakx-net-a4dccd8bed1783e7bf2f09bb382f26bb756fd931.tar.gz drakx-net-a4dccd8bed1783e7bf2f09bb382f26bb756fd931.tar.bz2 drakx-net-a4dccd8bed1783e7bf2f09bb382f26bb756fd931.tar.xz drakx-net-a4dccd8bed1783e7bf2f09bb382f26bb756fd931.zip |
update connection status on dbus event
-rwxr-xr-x | bin/draknetcenter | 4 | ||||
-rwxr-xr-x | lib/network/netcenter.pm | 18 |
2 files changed, 20 insertions, 2 deletions
diff --git a/bin/draknetcenter b/bin/draknetcenter index 7da798c..b508da5 100755 --- a/bin/draknetcenter +++ b/bin/draknetcenter @@ -16,5 +16,7 @@ use network::netcenter; my $in = 'interactive'->vnew('su'); my $net = {}; network::network::read_net_conf($net); +my $dbus; +eval { $dbus = dbus_object::system_bus() }; -network::netcenter::main($in, $net); +network::netcenter::main($in, $net, $dbus); diff --git a/lib/network/netcenter.pm b/lib/network/netcenter.pm index 9b0f884..880822c 100755 --- a/lib/network/netcenter.pm +++ b/lib/network/netcenter.pm @@ -35,7 +35,7 @@ sub build_cmanager { } sub main { - my ($in, $net) = @_; + my ($in, $net, $dbus) = @_; my $title = N("Network Center"); my $icon = '/usr/share/mcc/themes/default/drakroam-mdk.png'; @@ -126,6 +126,22 @@ sub main { ]), ); + if ($dbus) { + my $monitor; + eval { $monitor = network::monitor->new($dbus) }; + $dbus->{connection}->add_filter(sub { + my ($_con, $msg) = @_; + if ($msg->get_member eq 'status') { + my ($status, $interface) = $msg->get_args_list; + my $cmanager = find { $_->{connection}->get_interface eq $interface } @cmanagers + or return; + network::connection_manager::update_on_status_change($cmanager); + } + }); + $dbus->{connection}->add_match("type='signal',interface='com.mandriva.network'"); + dbus_object::set_gtk2_watch_helper($dbus); + } + my $base_color = $w->{window}->get_style->base('normal')->to_string; Gtk2::Rc->parse_string(<<END); style "netcenter_bg" { |