… | |
… | |
291 | for COLOUR_WHITE, COLOUR_BLACK; |
291 | for COLOUR_WHITE, COLOUR_BLACK; |
292 | |
292 | |
293 | $vbox->pack_start ((my $buttonbox = new Gtk2::HButtonBox), 0, 1, 0); |
293 | $vbox->pack_start ((my $buttonbox = new Gtk2::HButtonBox), 0, 1, 0); |
294 | |
294 | |
295 | $buttonbox->add ($self->{button_pass} = |
295 | $buttonbox->add ($self->{button_pass} = |
296 | Gtk2::Button->Glib::Object::new (label => "Pass", visible => 0)); |
296 | Gtk2::Button->Glib::Object::new (label => "Pass", visible => 0, no_show_all => 1)); |
297 | $self->{button_pass}->signal_connect (clicked => sub { |
297 | $self->{button_pass}->signal_connect (clicked => sub { |
298 | $self->{board_click}->(255, 255) if $self->{board_click}; |
298 | $self->{board_click}->(255, 255) if $self->{board_click}; |
299 | }); |
299 | }); |
300 | eval { $self->{button_pass}->set (no_show_all => 1) }; # workaround for gtk+-2.2 |
|
|
301 | $buttonbox->add ($self->{button_undo} = |
300 | $buttonbox->add ($self->{button_undo} = |
302 | Gtk2::Button->Glib::Object::new (label => "Undo", visible => 0)); |
301 | Gtk2::Button->Glib::Object::new (label => "Undo", visible => 0, no_show_all => 1)); |
303 | $self->{button_undo}->signal_connect (clicked => sub { |
302 | $self->{button_undo}->signal_connect (clicked => sub { |
304 | $self->send (req_undo => channel => $self->{channel}); |
303 | $self->send (req_undo => channel => $self->{channel}); |
305 | }); |
304 | }); |
306 | eval { $self->{button_undo}->set (no_show_all => 1) }; # workaround for gtk+-2.2 |
|
|
307 | $buttonbox->add ($self->{button_resign} = |
305 | $buttonbox->add ($self->{button_resign} = |
308 | Gtk2::Button->Glib::Object::new (label => "Resign", visible => 0)); |
306 | Gtk2::Button->Glib::Object::new (label => "Resign", visible => 0, no_show_all => 1)); |
309 | $self->{button_resign}->signal_connect (clicked => sub { |
307 | $self->{button_resign}->signal_connect (clicked => sub { |
310 | $self->send (resign_game => channel => $self->{channel}, player => $self->{colour}); |
308 | $self->send (resign_game => channel => $self->{channel}, player => $self->{colour}); |
311 | }); |
309 | }); |
312 | eval { $self->{button_resign}->set (no_show_all => 1) }; # workaround for gtk+-2.2 |
|
|
313 | |
310 | |
314 | $vbox->pack_start (($self->{chat} = new chat), 1, 1, 0); |
311 | $vbox->pack_start (($self->{chat} = new chat), 1, 1, 0); |
|
|
312 | |
|
|
313 | $self->{chat}->signal_connect (tag_event => sub { |
|
|
314 | my (undef, $tag, $event, $content) = @_; |
|
|
315 | |
|
|
316 | if ($tag eq "user" && $event->type eq "button-release") { |
|
|
317 | if ($event->button == 1) { |
|
|
318 | $content =~ /^(\S+)/; |
|
|
319 | $self->{app}->open_user ($1); |
|
|
320 | } |
|
|
321 | } |
|
|
322 | }); |
315 | |
323 | |
316 | $self->set_channel ($self->{channel}); |
324 | $self->set_channel ($self->{channel}); |
317 | |
325 | |
318 | $self->show_all; |
326 | $self->show_all; |
319 | |
327 | |
… | |
… | |
385 | |
393 | |
386 | sub draw_users { |
394 | sub draw_users { |
387 | my ($self, $inlay) = @_; |
395 | my ($self, $inlay) = @_; |
388 | |
396 | |
389 | for (sort keys %{$self->{users}}) { |
397 | for (sort keys %{$self->{users}}) { |
390 | $inlay->append_text (" <user>" . $self->{users}{$_}->as_string . "</user>"); |
398 | $inlay->append_text ("\t<user>" . $self->{users}{$_}->as_string . "</user>"); |
391 | } |
399 | } |
392 | } |
400 | } |
393 | |
401 | |
394 | sub event_update_users { |
402 | sub event_update_users { |
395 | my ($self, $add, $update, $remove) = @_; |
403 | my ($self, $add, $update, $remove) = @_; |