summaryrefslogtreecommitdiffstats
path: root/lib/network/connection_manager.pm
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2009-02-25 16:00:32 +0000
committerOlivier Blin <oblin@mandriva.com>2009-02-25 16:00:32 +0000
commitbf76817d1333bbe66954fd59191a723d0f233409 (patch)
treec725e9c7d45574dbcd6f5f6891cf8e86de0fad42 /lib/network/connection_manager.pm
parent104603cc30d01e510c0d74685fa5a6c50342298d (diff)
downloaddrakx-net-bf76817d1333bbe66954fd59191a723d0f233409.tar
drakx-net-bf76817d1333bbe66954fd59191a723d0f233409.tar.gz
drakx-net-bf76817d1333bbe66954fd59191a723d0f233409.tar.bz2
drakx-net-bf76817d1333bbe66954fd59191a723d0f233409.tar.xz
drakx-net-bf76817d1333bbe66954fd59191a723d0f233409.zip
move dbus helpers in network::connection_manager
Diffstat (limited to 'lib/network/connection_manager.pm')
-rw-r--r--lib/network/connection_manager.pm27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/network/connection_manager.pm b/lib/network/connection_manager.pm
index 05f345e..3ebbe83 100644
--- a/lib/network/connection_manager.pm
+++ b/lib/network/connection_manager.pm
@@ -425,4 +425,31 @@ sub update_on_status_change {
}
}
+sub _get_network_event_message {
+ my ($connections, $member, @args) = @_;
+ #- FIXME: the hostname.d script and s2u use a different D-Bus interface
+ if ($member eq 'hostname') {
+ my ($hostname) = @args;
+ N("Hostname changed to \"%s\"", $hostname);
+ } elsif ($member eq 'status') {
+ my ($status, $interface) = @args;
+ my $event_connection = find { $_->get_interface eq $interface } @$connections;
+ $event_connection && $event_connection->get_status_message($status);
+ }
+}
+
+sub setup_dbus_handlers {
+ my ($cmanagers, $connections, $on_network_event, $dbus) = @_;
+ #- FIXME: use network::monitor?
+ $dbus->{connection}->add_filter(sub {
+ my ($_con, $msg) = @_;
+ my $member = $msg->get_member;
+ my $message = get_network_event_message($droam, $member, $msg->get_args_list) or return;
+ $droam->{on_network_event}($message) if $droam->{on_network_event};
+ $droam->update_networks if $member eq 'status';
+ });
+ $dbus->{connection}->add_match("type='signal',interface='com.mandriva.network'");
+ dbus_object::set_gtk2_watch_helper($dbus);
+}
+
1;