ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/gde/GCE/AttrEdit.pm
(Generate patch)

Comparing deliantra/gde/GCE/AttrEdit.pm (file contents):
Revision 1.1 by elmex, Sun Feb 5 13:26:36 2006 UTC vs.
Revision 1.2 by elmex, Tue Feb 7 14:28:23 2006 UTC

13use Glib::Object::Subclass Gtk2::VBox; 13use Glib::Object::Subclass Gtk2::VBox;
14 14
15sub INIT_INSTANCE { 15sub 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
25sub 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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines