--- kgsueme/kgsueme/room.pl 2004/05/21 15:32:02 1.18 +++ kgsueme/kgsueme/room.pl 2004/05/29 02:01:43 1.19 @@ -5,14 +5,13 @@ use base KGS::Listener::Room; use Glib::Object::Subclass - Gtk2::Window; + Gtk2::Frame; sub new { my ($self, %arg) = @_; $self = $self->Glib::Object::new; $self->{$_} = delete $arg{$_} for keys %arg; - $self->signal_connect (delete_event => sub { $self->part; 1 }); $self->signal_connect (destroy => sub { delete $::config->{rooms}{$self->{channel}}; delete $self->{app}{room}{$self->{channel}}; @@ -23,16 +22,11 @@ $self->listen ($self->{conn}, qw(msg_room:)); - $self->set_title ("KGS Room $self->{name}"); - gtk::state $self, "room::window", $self->{name}, window_size => [600, 400]; - $self->signal_connect (delete_event => sub { $self->part; 1 }); - $self->add ($self->{hpane} = new Gtk2::HPaned); - $self->{hpane}->set (position_set => 1); - gtk::state $self->{hpane}, "room::hpane", $self->{name}, position => 200; + $self->add (my $hbox = new Gtk2::HBox); - $self->{hpane}->pack1 ((my $vbox = new Gtk2::VBox), 1, 1); + $hbox->pack_start ((my $vbox = new Gtk2::VBox), 1, 1, 0); $vbox->add ($self->{chat} = new chat); @@ -41,7 +35,15 @@ $self->{app}->do_command ($chat, $cmd, $arg, userlist => $self->{userlist}, room => $self); }); - $self->{hpane}->pack2 ((my $sw = new Gtk2::ScrolledWindow), 0, 1); + $hbox->pack_start ((my $vbox = new Gtk2::VBox), 0, 1, 0); + + $vbox->pack_start ((my $button = new_with_label Gtk2::Button "Close"), 0, 1, 0); + $button->signal_connect (clicked => sub { $self->part }); + + $vbox->pack_start ((my $button = new_with_label Gtk2::Button "New Game"), 0, 1, 0); + $button->signal_connect (clicked => sub { $self->new_game }); + + $vbox->pack_start ((my $sw = new Gtk2::ScrolledWindow), 1, 1, 0); $sw->set_policy("automatic", "always"); $sw->add ($self->{userlist} = new userlist); @@ -107,5 +109,12 @@ . "" . (util::toxml $self->{description}) . "\n"); } +sub new_game { + my ($self) = @_; + + $self->{new_game} ||= new game conn => $self->{conn}, app => $self; + $self->{new_game}->show_all; +} + 1;