… | |
… | |
145 | |
145 | |
146 | $self; |
146 | $self; |
147 | } |
147 | } |
148 | |
148 | |
149 | sub configure { |
149 | sub configure { |
150 | my ($self, $user, $rules) = @_; |
150 | my ($self, $app, $user, $rules) = @_; |
151 | |
151 | |
152 | if ($self->{name}->get_text ne $user->as_string) { |
152 | if ($self->{name}->get_text ne $user->as_string) { |
153 | $self->{name}->set_text ($user->as_string); |
153 | $self->{name}->set_text ($user->as_string); |
154 | |
154 | |
155 | $self->{imagebox}->remove ($_) for $self->{imagebox}->get_children; |
155 | $self->{imagebox}->remove ($_) for $self->{imagebox}->get_children; |
156 | $self->{imagebox}->add (gtk::image_from_data undef); |
156 | $self->{imagebox}->add (gtk::image_from_data undef); |
157 | $self->{imagebox}->show_all; |
157 | $self->{imagebox}->show_all; |
158 | |
158 | |
159 | if ($user->has_pic) { |
159 | if ($user->has_pic) { |
160 | # the big picture... |
160 | # the big picture... |
161 | appwin::userpic ($user->{name}, sub { |
161 | $app->userpic ($user->{name}, sub { |
162 | return unless $self->{imagebox}; |
162 | return unless $self->{imagebox}; |
|
|
163 | |
163 | if ($_[0]) { |
164 | if ($_[0]) { |
164 | $self->{imagebox}->remove ($_) for $self->{imagebox}->get_children; |
165 | $self->{imagebox}->remove ($_) for $self->{imagebox}->get_children; |
165 | $self->{imagebox}->add (gtk::image_from_data $_[0]); |
166 | $self->{imagebox}->add (gtk::image_from_data $_[0]); |
166 | $self->{imagebox}->show_all; |
167 | $self->{imagebox}->show_all; |
167 | } |
168 | } |
… | |
… | |
479 | } |
480 | } |
480 | |
481 | |
481 | sub event_update_rules { |
482 | sub event_update_rules { |
482 | my ($self, $rules) = @_; |
483 | my ($self, $rules) = @_; |
483 | |
484 | |
484 | $self->{userpanel}[$_]->configure ($self->{user}[$_], $rules) |
485 | $self->{userpanel}[$_]->configure ($self->{app}, $self->{user}[$_], $rules) |
485 | for BLACK, WHITE; |
486 | for BLACK, WHITE; |
486 | |
487 | |
487 | sound::play 3, "gamestart"; |
488 | sound::play 3, "gamestart"; |
488 | |
489 | |
489 | my $text = "\n<header>Game Rules</header>"; |
490 | my $text = "\n<header>Game Rules</header>"; |
… | |
… | |
539 | sub destroy { |
540 | sub destroy { |
540 | my ($self) = @_; |
541 | my ($self) = @_; |
541 | $self->{userpanel}[$_] && (delete $self->{userpanel}[$_])->destroy |
542 | $self->{userpanel}[$_] && (delete $self->{userpanel}[$_])->destroy |
542 | for BLACK, WHITE; |
543 | for BLACK, WHITE; |
543 | $self->SUPER::destroy; |
544 | $self->SUPER::destroy; |
544 | delete $appwin::gamelist->{game}{$self->{channel}}; |
545 | delete $self->{app}{gamelist}{game}{$self->{channel}}; |
545 | } |
546 | } |
546 | |
547 | |
547 | 1; |
548 | 1; |
548 | |
549 | |