summaryrefslogtreecommitdiffstats
path: root/perl-install/network
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2005-07-13 03:48:39 +0000
committerOlivier Blin <oblin@mandriva.org>2005-07-13 03:48:39 +0000
commitbea81cf1e33daca67dc01afcdf1956b445ae47c1 (patch)
tree5a2d9a335d73a1b7468ec10bca49773d3ac97d1b /perl-install/network
parentcddf386defea9fcb3900b7b46337b4cc96df6668 (diff)
downloaddrakx-bea81cf1e33daca67dc01afcdf1956b445ae47c1.tar
drakx-bea81cf1e33daca67dc01afcdf1956b445ae47c1.tar.gz
drakx-bea81cf1e33daca67dc01afcdf1956b445ae47c1.tar.bz2
drakx-bea81cf1e33daca67dc01afcdf1956b445ae47c1.tar.xz
drakx-bea81cf1e33daca67dc01afcdf1956b445ae47c1.zip
use dbus_object;
Diffstat (limited to 'perl-install/network')
-rw-r--r--perl-install/network/activefw.pm67
1 files changed, 12 insertions, 55 deletions
diff --git a/perl-install/network/activefw.pm b/perl-install/network/activefw.pm
index 99a9d8db8..2a949379d 100644
--- a/perl-install/network/activefw.pm
+++ b/perl-install/network/activefw.pm
@@ -1,69 +1,26 @@
package network::activefw;
-use Gtk2::Helper;
+use dbus_object;
use Socket;
+our @ISA = qw(dbus_object);
+
sub new {
- my ($type, $filter) = @_;
+ my ($type, $bus, $filter) = @_;
- require Net::DBus;
- my $bus = Net::DBus->system;
my $con = $bus->{connection};
-
$con->add_filter($filter);
- $con->add_match("type='signal',interface='com.mandriva.activefirewall'");
-
- set_DBus_watch($con);
- $con->dispatch;
-
- my $o = bless { bus => $bus }, $type;
- $o->find_daemon;
-
+ $con->add_match("type='signal',interface='com.mandriva.monitoring.activefirewall'");
+
+ my $o = dbus_object::new($type,
+ $bus,
+ "com.mandriva.monitoring",
+ "/com/mandriva/monitoring/activefirewall",
+ "com.mandriva.monitoring.activefirewall");
+ dbus_object::set_gtk2_watch($o);
$o;
}
-sub find_daemon {
- my ($o) = @_;
- my $service = $o->{bus}->get_service("com.mandriva.activefirewall.daemon");
- $o->{daemon} = $service->get_object("/com/mandriva/activefirewall", "com.mandriva.activefirewall.daemon");
-}
-
-sub set_DBus_watch {
- my ($con) = @_;
- $con->set_watch_callbacks(sub {
- my ($con, $watch) = @_;
- my $flags = $watch->get_flags;
- require Net::DBus::Binding::Watch;
- if ($flags & &Net::DBus::Binding::Watch::READABLE) {
- Gtk2::Helper->add_watch($watch->get_fileno, 'in', sub {
- $watch->handle(&Net::DBus::Binding::Watch::READABLE);
- $con->dispatch;
- 1;
- });
- }
- #- do nothing for WRITABLE watch, we dispatch when needed
- }, undef, undef); #- do nothing when watch is disabled or toggled yet
-}
-
-sub dispatch {
- my ($o) = @_;
- $o->{bus}{connection}->dispatch;
-}
-
-sub call_method {
- my ($o, $method, @args) = @_;
- my @ret;
- eval {
- @ret = $o->{daemon}->$method(@args);
- };
- if ($@) {
- print "($method) exception: $@\n";
- $o->dispatch;
- return;
- }
- @ret;
-}
-
sub blacklist {
my ($o, $seq, $blacklist) = @_;
$o->call_method('Blacklist',