… | |
… | |
13 | use Glib::Object::Subclass Gtk2::VBox; |
13 | use Glib::Object::Subclass Gtk2::VBox; |
14 | |
14 | |
15 | sub INIT_INSTANCE { |
15 | sub INIT_INSTANCE { |
16 | my ($self) = @_; |
16 | my ($self) = @_; |
17 | |
17 | |
18 | my $sl = Gtk2::SimpleList->new ('Attr' => 'text', 'Value' => 'text'); |
18 | my $sl = $self->{sl} = Gtk2::SimpleList->new ('Attr' => 'text', 'Value' => 'text'); |
19 | |
19 | |
20 | my $test = { health => 12, foo => "fewger" }; |
|
|
21 | |
|
|
22 | @{$sl->{data}} = map { [$_, $test->{$_}] } keys %$test; |
|
|
23 | $sl->set_column_editable (1, 1); |
20 | $sl->set_column_editable (1, 1); |
24 | |
21 | |
25 | $self->pack_start ($sl, 1, 1, 0); |
22 | $self->pack_start ($sl, 1, 1, 0); |
|
|
23 | } |
|
|
24 | |
|
|
25 | sub set_arch { |
|
|
26 | my ($self, $arch) = @_; |
|
|
27 | |
|
|
28 | @{$self->{sl}->{data}} = |
|
|
29 | sort { $a->[0] cmp $b->[0] } |
|
|
30 | map { my $c = $arch->{$_}; |
|
|
31 | if (ref $c eq 'ARRAY') { |
|
|
32 | [$_, join (',', map { $_->{_name} } @$c)]; |
|
|
33 | } else { |
|
|
34 | [$_, $c]; |
|
|
35 | } |
|
|
36 | } keys %$arch; |
26 | } |
37 | } |
27 | |
38 | |
28 | |
39 | |
29 | =head1 AUTHOR |
40 | =head1 AUTHOR |
30 | |
41 | |