summaryrefslogtreecommitdiffstats
path: root/bin/net_applet
diff options
context:
space:
mode:
Diffstat (limited to 'bin/net_applet')
-rwxr-xr-xbin/net_applet21
1 files changed, 9 insertions, 12 deletions
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');