summaryrefslogtreecommitdiffstats
path: root/lib/network/signal_strength.pm
blob: 0e6910827b1303dd73fd2f968128a4de7ba76464 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package network::signal_strength;

use lib qw(/usr/lib/libDrakX);   # helps perl_checker
use common;
use ugtk2;

my %pixbufs;

sub get_strength_icon {
    my ($network) = @_;
    my $approx = 20 + min(80, int($network->{signal_strength}/20)*20);
    return $pixbufs{$approx} ||= ugtk2::gtkcreate_pixbuf('wifi-' . sprintf('%03d', $approx));
}

1;