summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2007-09-19 22:33:30 +0000
committerOlivier Blin <oblin@mandriva.com>2007-09-19 22:33:30 +0000
commita4dccd8bed1783e7bf2f09bb382f26bb756fd931 (patch)
tree30d9430667ade98679808bf89b11137c5872fbd3
parentcac63e3f3c271eb24d31d0c943378899f275733f (diff)
downloaddrakx-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-xbin/draknetcenter4
-rwxr-xr-xlib/network/netcenter.pm18
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" {