blob: 4dd17aa6a3eae2658acb3d66c8965671394e447e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
package network::signal_strength;
use lib qw(/usr/lib/libDrakX); # helps perl_checker
use common;
use ugtk3;
my %pixbufs;
sub get_strength_icon {
my ($network) = @_;
my $approx = 20 + min(80, int($network->{signal_strength}/20)*20);
my $file_name = 'wifi-' . sprintf('%03d', $approx);
$pixbufs{$approx} ||= ugtk3::gtkcreate_pixbuf($file_name);
return wantarray ? ($pixbufs{$approx}, $file_name) : $pixbufs{$approx};
}
1;
|