summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-10-02 18:30:05 +0000
committerOlivier Blin <oblin@mandriva.com>2008-10-02 18:30:05 +0000
commit3723e9f74b377fb861443d7fb47add8091744afe (patch)
treebef43d01b4260cc063858823a921d0b797277e1a
parent7c858fc73a6d872400710ef9ab61a0a4e4384a3e (diff)
downloaddrakx-net-3723e9f74b377fb861443d7fb47add8091744afe.tar
drakx-net-3723e9f74b377fb861443d7fb47add8091744afe.tar.gz
drakx-net-3723e9f74b377fb861443d7fb47add8091744afe.tar.bz2
drakx-net-3723e9f74b377fb861443d7fb47add8091744afe.tar.xz
drakx-net-3723e9f74b377fb861443d7fb47add8091744afe.zip
correctly initialize monitor object in draknetcenter/drakroam/net_applet so that it can be reused later
-rwxr-xr-xbin/draknetcenter2
-rwxr-xr-xbin/drakroam2
-rwxr-xr-xbin/net_applet9
3 files changed, 8 insertions, 5 deletions
diff --git a/bin/draknetcenter b/bin/draknetcenter
index b822550..b2f8d14 100755
--- a/bin/draknetcenter
+++ b/bin/draknetcenter
@@ -11,6 +11,7 @@ BEGIN { unshift @::textdomains, 'drakx-net' }
use standalone;
use network::network;
+use network::monitor;
use network::netcenter;
use dbus_object;
@@ -19,5 +20,6 @@ my $net = {};
network::network::read_net_conf($net);
my $dbus;
eval { $dbus = dbus_object::system_bus() };
+eval { $net->{monitor} = network::monitor->new($dbus) } if $dbus;
network::netcenter::main($in, $net, $dbus);
diff --git a/bin/drakroam b/bin/drakroam
index 6f56c82..0c6c400 100755
--- a/bin/drakroam
+++ b/bin/drakroam
@@ -14,6 +14,7 @@ BEGIN { unshift @::textdomains, 'drakx-net' }
use standalone;
use common;
use network::drakroam;
+use network::monitor;
my %args = map { if_(/^--(\w+)=(.*)$/ && member($1, qw(ap interface)), $1 => $2) } @ARGV;
@@ -22,5 +23,6 @@ my $net = {};
network::network::read_net_conf($net);
my $dbus;
eval { $dbus = dbus_object::system_bus() };
+eval { $net->{monitor} = network::monitor->new($dbus) } if $dbus;
network::drakroam::main($in, $net, $dbus, $args{interface}, $args{ap});
diff --git a/bin/net_applet b/bin/net_applet
index 4c91f32..d20f5ed 100755
--- a/bin/net_applet
+++ b/bin/net_applet
@@ -173,9 +173,8 @@ my %actions = (
$icon = Gtk2::StatusIcon->new;
-my ($monitor);
eval { $dbus = dbus_object::system_bus() } if !defined($global_settings{NET_APPLET_DBUS}) || text2bool($global_settings{NET_APPLET_DBUS});
-eval { $monitor = network::monitor->new($dbus) } if $dbus;
+eval { $net->{monitor} = network::monitor->new($dbus) } if $dbus;
eval {
require network::net_applet::ifw;
network::net_applet::ifw::create();
@@ -256,8 +255,8 @@ sub generate_wireless_menuitem {
0, $menuitem->{security} = Gtk2::Image->new,
));
$menuitem->{activate} = $menuitem->{widget}->signal_connect('activate' => sub {
- if ($monitor && exists $wnet->{id}) {
- eval { $monitor->select_network($wnet->{id}) };
+ if ($net->{monitor} && exists $wnet->{id}) {
+ eval { $net->{monitor}->select_network($wnet->{id}) };
$@ and err_dialog(N("Interactive Firewall"), N("Unable to contact daemon"));
} else {
run_drakroam($wnet->{ap});
@@ -280,7 +279,7 @@ sub update_wireless_item {
}
sub checkWireless() {
$wireless_device or return;
- my ($networks) = network::monitor::list_wireless($monitor);
+ my ($networks) = network::monitor::list_wireless($net->{monitor});
my $force_applet_update;
foreach (keys %$networks) {
exists $wireless_networks{$_} or $force_applet_update = 1;