diff options
author | Olivier Blin <oblin@mandriva.org> | 2005-08-20 10:22:54 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2005-08-20 10:22:54 +0000 |
commit | 25540361c3aaa7d97a4215437b44743a02f826db (patch) | |
tree | 5ef7db234b7fe0f37363f552aa20fea091a15ec9 /perl-install/standalone | |
parent | 7e37240c1d0fda6cab5537549bd8febfc5110e62 (diff) | |
download | drakx-25540361c3aaa7d97a4215437b44743a02f826db.tar drakx-25540361c3aaa7d97a4215437b44743a02f826db.tar.gz drakx-25540361c3aaa7d97a4215437b44743a02f826db.tar.bz2 drakx-25540361c3aaa7d97a4215437b44743a02f826db.tar.xz drakx-25540361c3aaa7d97a4215437b44743a02f826db.zip |
do not fail to start if messagebus is down
Diffstat (limited to 'perl-install/standalone')
-rw-r--r-- | perl-install/standalone/net_applet | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/perl-install/standalone/net_applet b/perl-install/standalone/net_applet index d4d408f5d..1a6aa67ad 100644 --- a/perl-install/standalone/net_applet +++ b/perl-install/standalone/net_applet @@ -31,10 +31,6 @@ add_icon_path("/usr/share/libDrakX/pixmaps/"); my $net = {}; my $watched_interface; -my $dbus = dbus_object::system_bus(); -my $monitor = network::monitor->new($dbus); -my ($ifw, $interactive_cb, @attacks_queue); - my %pixbufs = ( state => { map { $_ => gtkcreate_pixbuf($_) } qw(connected disconnected) }, @@ -98,6 +94,22 @@ $eventbox->signal_connect(button_press_event => sub { $icon->show_all; +my ($dbus, $monitor, $ifw, $interactive_cb, @attacks_queue); +eval { $dbus = dbus_object::system_bus() }; +eval { $monitor = network::monitor->new($dbus) } if $dbus; +eval { + $ifw = network::ifw->new($dbus, sub { + my ($_con, $msg) = @_; + my $member = $msg->get_member; + if ($member eq 'Attack') { + handle_attack($msg->get_args_list); + } elsif ($member eq 'Init') { + $ifw->attach_object; + checkNetworkForce(); + } + }); +} if $dbus; + $bubble = Gtk2::NotificationBubble->new; $bubble->attach($icon); $bubble->signal_connect(timeout => sub { @@ -110,17 +122,6 @@ $bubble->signal_connect(clicked => sub { ask_attack_verdict($attacks_queue[0]); }); -$ifw = network::ifw->new($dbus, sub { - my ($_con, $msg) = @_; - my $member = $msg->get_member; - if ($member eq 'Attack') { - handle_attack($msg->get_args_list); - } elsif ($member eq 'Init') { - $ifw->attach_object; - checkNetworkForce(); - } -}); - checkNetworkForce(); cronNetwork(); cronUpdate(); @@ -188,7 +189,7 @@ sub update_wireless_item { $net->{menuitem}->signal_handler_unblock($net->{activate}); } sub checkWireless() { - my $networks = $monitor->list_wireless; + my $networks = eval { $monitor->list_wireless }; foreach (keys %$networks) { my $net = $wireless_networks{$_} ||= {}; put_in_hash($net, $networks->{$_}); @@ -266,7 +267,7 @@ sub generate_menu { }; my (@settings); - my $has_wireless = detect_devices::has_wireless(); + my $has_wireless = $monitor && detect_devices::has_wireless(); if ($state_type eq 'connected') { $menu->append($create_item->($_)) foreach qw(downNetwork monitorNetwork monitorAFW); |