File: Net.pm

package info (click to toggle)
libcircle-be-perl 0.173320-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 388 kB
  • sloc: perl: 6,042; makefile: 2; sh: 1
file content (49 lines) | stat: -rw-r--r-- 1,046 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#  You may distribute under the terms of the GNU General Public License
#
#  (C) Paul Evans, 2017 -- leonerd@leonerd.org.uk

package Circle::Net;

use strict;
use warnings;

use base qw( Tangence::Object Circle::WindowItem );

our $VERSION = '0.173320';

sub set_network_status
{
   my $self = shift;
   my ( $status ) = @_;

   $self->{status} = $status;

   my $text = $self->get_prop_tag;
   $text .= "[$self->{status}]" if length $self->{status};

   $self->{widget_netname}->set_prop_text( $text ) if $self->{widget_netname};
}

sub get_widget_netname
{
   my $self = shift;

   return $self->{widget_netname} ||= do {
      my $registry = $self->{registry};

      my $widget = $registry->construct(
         "Circle::Widget::Label",
         classes => [qw( netname )],
      );
      $self->watch_property( "tag",
         on_updated => sub {
            my $text = $_[1];
            $text .= "[$self->{status}]" if length $self->{status};
            $widget->set_prop_text( $text );
         }
      );
      $widget;
   };
}

0x55AA;