ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/kgsueme/kgsueme/room.pl
(Generate patch)

Comparing kgsueme/kgsueme/room.pl (file contents):
Revision 1.26 by root, Mon May 31 18:18:26 2004 UTC vs.
Revision 1.32 by elmex, Tue Jun 8 17:58:48 2004 UTC

7use Glib::Object::Subclass 7use Glib::Object::Subclass
8 Gtk2::Frame; 8 Gtk2::Frame;
9 9
10sub new { 10sub new {
11 my ($self, %arg) = @_; 11 my ($self, %arg) = @_;
12
12 $self = $self->Glib::Object::new; 13 $self = $self->Glib::Object::new;
13 $self->{$_} = delete $arg{$_} for keys %arg; 14 $self->{$_} = delete $arg{$_} for keys %arg;
14 15
15 $self->signal_connect (destroy => sub { 16 $self->signal_connect (destroy => sub {
16 delete $::config->{rooms}{$self->{channel}}; 17 delete $::config->{rooms}{$self->{channel}};
22 23
23 $self->listen ($self->{conn}, qw(msg_room:)); 24 $self->listen ($self->{conn}, qw(msg_room:));
24 25
25 $self->signal_connect (delete_event => sub { $self->part; 1 }); 26 $self->signal_connect (delete_event => sub { $self->part; 1 });
26 27
27 $self->add (my $hbox = new Gtk2::HBox); 28 $self->add (my $vbox = new Gtk2::VBox);
28 29
29 $hbox->pack_start ((my $vbox = new Gtk2::VBox), 1, 1, 0); 30 $vbox->pack_start((my $hbox = new Gtk2::HBox), 0, 1, 0);
31
32 $hbox->pack_start ((my $button = new_with_label Gtk2::Button "Leave"), 0, 1, 0);
33 $button->signal_connect (clicked => sub { $self->part });
30 34
31 $vbox->add ($self->{chat} = new chat); 35 $hbox->pack_start ((my $button = new_with_label Gtk2::Button "New Game"), 0, 1, 0);
36 $button->signal_connect (clicked => sub { $self->new_game });
32 37
38 $vbox->pack_start ((my $hpane = new Gtk2::HPaned), 1, 1, 0);
39 gtk::state $hpane, "room::hpane", undef, position => 500;
40
41 $hpane->pack1 (($self->{chat} = new chat app => $self->{app}), 1, 0);
42
33 $self->{chat}->signal_connect(command => sub { 43 $self->{chat}->signal_connect (command => sub {
34 my ($chat, $cmd, $arg) = @_; 44 my ($chat, $cmd, $arg) = @_;
35 $self->{app}->do_command ($chat, $cmd, $arg, userlist => $self->{userlist}, room => $self); 45 $self->{app}->do_command ($chat, $cmd, $arg, userlist => $self->{userlist}, room => $self);
36 }); 46 });
37 47
38 $hbox->pack_start ((my $vbox = new Gtk2::VBox), 0, 1, 0); 48 $hpane->pack2 ((my $sw = new Gtk2::ScrolledWindow), 1, 0);
39 49
40 $vbox->pack_start ((my $button = new_with_label Gtk2::Button "Leave"), 0, 1, 0);
41 $button->signal_connect (clicked => sub { $self->part });
42
43 $vbox->pack_start ((my $button = new_with_label Gtk2::Button "New Game"), 0, 1, 0);
44 $button->signal_connect (clicked => sub { $self->new_game });
45
46 $vbox->pack_start ((my $sw = new Gtk2::ScrolledWindow), 1, 1, 0);
47 $sw->set_policy("automatic", "always"); 50 $sw->set_policy ("automatic", "always");
48 51
49 $sw->add ($self->{userlist} = new userlist); 52 $sw->add ($self->{userlist} = new userlist);
50 53
51 $self; 54 $self;
52} 55}
53 56
54sub FINALIZE_INSTANCE { print "FIN room\n" } # never called MEMLEAK #d#TODO# 57sub FINALIZE_INSTANCE { print "FIN room\n" } # never called MEMLEAK #d#TODO#
55 58
56sub part { 59sub part {
57 my ($self) = @_; 60 my ($self) = @_;
61
62 $self->hide;
58 $self->SUPER::part; 63 $self->SUPER::part;
59
60 $self->hide_all;
61} 64}
62 65
63sub inject_msg_room { 66sub inject_msg_room {
64 my ($self, $msg) = @_; 67 my ($self, $msg) = @_;
65 68
66 # secret typoe ;-) 69 # secret typoe ;-)
67 $self->{chat}->append_text ("\n<header><user>" . (util::toxml $msg->{name}) 70 $self->{chat}->append_text ("\n<user>" . (util::toxml $msg->{name})
68 . "</user>: </header>" . (util::toxml $msg->{message})); 71 . "</user>: " . (util::toxml $msg->{message}));
69} 72}
70 73
71sub event_update_users { 74sub event_update_users {
72 my ($self, $add, $update, $remove) = @_; 75 my ($self, $add, $update, $remove) = @_;
73 76

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines