summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rwxr-xr-xbin/net_applet21
2 files changed, 12 insertions, 12 deletions
diff --git a/NEWS b/NEWS
index eb6f5f7..243b399 100644
--- a/NEWS
+++ b/NEWS
@@ -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');