summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/drakids4
-rwxr-xr-xbin/net_applet7
-rw-r--r--lib/network/ifw.pm8
-rw-r--r--lib/network/net_applet/ifw.pm17
4 files changed, 24 insertions, 12 deletions
diff --git a/bin/drakids b/bin/drakids
index dcaa1b2..4a223a9 100644
--- a/bin/drakids
+++ b/bin/drakids
@@ -45,7 +45,8 @@ my $w = ugtk2->new($title);
my $ifw;
eval {
- $ifw = network::ifw->new(dbus_object::system_bus(), sub {
+ my $bus = dbus_object::system_bus();
+ network::ifw::init($bus, sub {
my ($_con, $msg) = @_;
my $member = $msg->get_member;
if ($member eq 'Attack') {
@@ -62,6 +63,7 @@ eval {
$w->{window}->present;
}
});
+ $ifw = network::ifw->new($bus);
};
if ($@) {
diff --git a/bin/net_applet b/bin/net_applet
index 9fe641b..d62e302 100755
--- a/bin/net_applet
+++ b/bin/net_applet
@@ -193,11 +193,10 @@ $icon = Gtk2::StatusIcon->new;
eval { $dbus = dbus_object::system_bus() } if !defined($global_settings{NET_APPLET_DBUS}) || text2bool($global_settings{NET_APPLET_DBUS});
eval { $net->{monitor} = network::monitor->new($dbus) } if $dbus;
-eval {
+if ($dbus) {
require network::net_applet::ifw;
- network::net_applet::ifw::create();
-} if $dbus;
-
+ network::net_applet::ifw::init();
+}
if ($dbus) {
$dbus->{connection}->add_filter(sub {
my ($_con, $msg) = @_;
diff --git a/lib/network/ifw.pm b/lib/network/ifw.pm
index e418d92..1c7996d 100644
--- a/lib/network/ifw.pm
+++ b/lib/network/ifw.pm
@@ -5,13 +5,15 @@ use common;
our @ISA = qw(dbus_object);
-sub new {
- my ($type, $bus, $filter) = @_;
-
+sub init {
+ my ($bus, $filter) = @_;
my $con = $bus->{connection};
$con->add_filter($filter);
$con->add_match("type='signal',interface='com.mandriva.monitoring.ifw'");
+}
+sub new {
+ my ($type, $bus) = @_;
require dbus_object;
my $o = dbus_object::new($type,
$bus,
diff --git a/lib/network/net_applet/ifw.pm b/lib/network/net_applet/ifw.pm
index f7fd326..22fc432 100644
--- a/lib/network/net_applet/ifw.pm
+++ b/lib/network/net_applet/ifw.pm
@@ -5,8 +5,8 @@ use network::ifw;
use ugtk2 qw(:create :helpers :wrappers :dialogs);
use mygtk2 qw(gtknew gtkset);
-sub create() {
- $network::net_applet::ifw = network::ifw->new($network::net_applet::dbus, sub {
+sub init() {
+ network::ifw::init($network::net_applet::dbus, sub {
my ($_con, $msg) = @_;
my $member = $msg->get_member;
if ($member eq 'Attack') {
@@ -14,12 +14,21 @@ sub create() {
} elsif ($member eq 'Listen') {
handle_ifw_listen($msg->get_args_list);
} elsif ($member eq 'Init') {
- $network::net_applet::ifw->attach_object;
- main::checkNetworkForce();
+ create();
} elsif ($member eq 'AlertAck') {
$network::net_applet::ifw_alert = 0;
}
});
+ create();
+}
+
+sub create() {
+ if ($network::net_applet::ifw) {
+ $network::net_applet::ifw->attach_object;
+ main::checkNetworkForce();
+ } else {
+ $network::net_applet::ifw = eval { network::ifw->new($network::net_applet::dbus) };
+ }
}
sub enable_ifw_alert() {