--- deliantra/Deliantra-Client/DC/Util.pm 2006/04/07 16:30:23 1.3 +++ deliantra/Deliantra-Client/DC/Util.pm 2006/04/07 16:36:44 1.4 @@ -42,13 +42,17 @@ } sub run_config_dialog { - Gtk2->init; + my (%events) = @_; my $w = Gtk2::Window->new; my @cfg = ( - [qw/Width width/], - [qw/Height height/], + [qw/Width width/], + [qw/Height height/], + [qw/Host host/], + [qw/Port port/], + [qw/Username user/], + [qw/Password password/], ); my $cfg = {}; @@ -68,7 +72,20 @@ $::CFG->{$_} = $cfg->{$_} if $_ ne '_i'; } - $w->destroy + }); + $hb->pack_start (my $cb = Gtk2::Button->new ("login"), 1, 1, 5); + $cb->signal_connect (clicked => sub { + for (keys %$cfg) { + $::CFG->{$_} = $cfg->{$_} + if $_ ne '_i'; + } + my $cb = $events{login} || sub {}; + $cb->($::CFG->{user}, $::CFG->{password}); + }); + $hb->pack_start (my $cb = Gtk2::Button->new ("logout"), 1, 1, 5); + $cb->signal_connect (clicked => sub { + my $cb = $events{login} || sub {}; + $cb->(); }); $w->show_all;