diff options
-rw-r--r-- | NEWS | 3 | ||||
-rwxr-xr-x | bin/net_applet | 21 |
2 files changed, 12 insertions, 12 deletions
@@ -1,3 +1,6 @@ +- net_applet: + o make sure the status icon exists before trying to display it (mga#20425) + 2.28 - draksambashare: o fix bogus hint about drakwizard (mga#8112) diff --git a/bin/net_applet b/bin/net_applet index 76e46f3..1a0d369 100755 --- a/bin/net_applet +++ b/bin/net_applet @@ -52,10 +52,8 @@ our %wireless_networks; our %pixbufs = ( - state => { map { $_ => gtknew('Pixbuf', file => $_) } map { $_, $_ . "_big" } qw(connected disconnected unconfigured connecting) }, - encryption => { map { - $_ => gtknew('Pixbuf', file => "encryption-$_-24"); - } qw(open weak strong) }, + state => { map { $_ => gtknew('Pixbuf', file => $_ . '_big') } qw(connected disconnected unconfigured connecting) }, + encryption => { map { $_ => gtknew('Pixbuf', file => "encryption-$_-24") } qw(open weak strong) }, ); sub get_current_network() { @@ -63,22 +61,21 @@ sub get_current_network() { } sub get_state_pixbuf { - my $img; - my $wnet = $current_state eq 'connected' && get_current_network(); - if ($wnet) { + if (my $wnet = $current_state eq 'connected' && get_current_network()) { return network::signal_strength::get_strength_icon($wnet); } else { - # By default, use the big image, and fall back to the small one if it does not exist. - return $pixbufs{state}{"${current_state}_big"} || $pixbufs{state}{$current_state}; + return $pixbufs{state}{$current_state}; } } sub update_tray_icon() { if (!$ifw_alert) { - my @args = $is_plasma ? qw(STATUS_NOTIFIER_ICON) : (); - push @args, get_state_pixbuf(); - $icon->set_from_pixbuf(@args); + if (my $pixbuf = get_state_pixbuf()) { + my @args = $is_plasma ? qw(STATUS_NOTIFIER_ICON) : (); + push @args, $pixbuf; + $icon->set_from_pixbuf(@args); + } } elsif ($is_plasma) { $icon->set_from_icon_name('STATUS_NOTIFIER_ICON', 'dialog-warning'); |