ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/Util.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/Util.pm (file contents):
Revision 1.3 by root, Fri Apr 7 16:30:23 2006 UTC vs.
Revision 1.4 by elmex, Fri Apr 7 16:36:44 2006 UTC

40 $cfg->{$key} = $ent->get_text; 40 $cfg->{$key} = $ent->get_text;
41 }); 41 });
42} 42}
43 43
44sub run_config_dialog { 44sub run_config_dialog {
45 Gtk2->init; 45 my (%events) = @_;
46 46
47 my $w = Gtk2::Window->new; 47 my $w = Gtk2::Window->new;
48 48
49 my @cfg = ( 49 my @cfg = (
50 [qw/Width width/], 50 [qw/Width width/],
51 [qw/Height height/], 51 [qw/Height height/],
52 [qw/Host host/],
53 [qw/Port port/],
54 [qw/Username user/],
55 [qw/Password password/],
52 ); 56 );
53 57
54 my $cfg = {}; 58 my $cfg = {};
55 59
56 $w->add (my $vb = Gtk2::VBox->new); 60 $w->add (my $vb = Gtk2::VBox->new);
66 $cb->signal_connect (clicked => sub { 70 $cb->signal_connect (clicked => sub {
67 for (keys %$cfg) { 71 for (keys %$cfg) {
68 $::CFG->{$_} = $cfg->{$_} 72 $::CFG->{$_} = $cfg->{$_}
69 if $_ ne '_i'; 73 if $_ ne '_i';
70 } 74 }
71 $w->destroy 75 });
76 $hb->pack_start (my $cb = Gtk2::Button->new ("login"), 1, 1, 5);
77 $cb->signal_connect (clicked => sub {
78 for (keys %$cfg) {
79 $::CFG->{$_} = $cfg->{$_}
80 if $_ ne '_i';
81 }
82 my $cb = $events{login} || sub {};
83 $cb->($::CFG->{user}, $::CFG->{password});
84 });
85 $hb->pack_start (my $cb = Gtk2::Button->new ("logout"), 1, 1, 5);
86 $cb->signal_connect (clicked => sub {
87 my $cb = $events{login} || sub {};
88 $cb->();
72 }); 89 });
73 90
74 $w->show_all; 91 $w->show_all;
75 92
76 $w->signal_connect (destroy => sub { Gtk2->main_quit }); 93 $w->signal_connect (destroy => sub { Gtk2->main_quit });

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines