--- deliantra/Deliantra-Client/bin/cfplus 2006/06/01 03:42:58 1.39 +++ deliantra/Deliantra-Client/bin/cfplus 2006/06/02 02:12:04 1.40 @@ -83,6 +83,7 @@ our $METASERVER; our $LOGIN_BUTTON; our $QUIT_DIALOG; +our $HOST_ENTRY; our $SERVER_SETUP; our $FLOORBOX; @@ -630,21 +631,9 @@ for keys %tbl; } -sub metaserver_dialog { - my $dialog = new CFClient::UI::FancyFrame - title => "Server List", - child => (my $vbox = new CFClient::UI::VBox); - - $vbox->add ($dialog->{table} = new CFClient::UI::Table); - - $dialog -} - my $METASERVER_ATIME; sub update_metaserver { - my ($HOST) = @_; - return if $METASERVER_ATIME > time; $METASERVER_ATIME = time + 60; @@ -706,7 +695,8 @@ $table->add (0, $y, new CFClient::UI::VBox children => [ (new CFClient::UI::Button text => "Use", on_activate => sub { - $HOST->set_text ($CFG->{host} = $host); + $HOST_ENTRY->set_text ($CFG->{host} = $host); + $METASERVER->toggle_visibility; }), (new CFClient::UI::Empty expand => 1), ]); @@ -719,6 +709,22 @@ }); } +sub metaserver_dialog { + my $dialog = new CFClient::UI::FancyFrame + title => "Server List", + x => 'center', + y => 'center', + child => (my $vbox = new CFClient::UI::VBox), + on_visibility_change => sub { + update_metaserver if $_[1]; + }, + ; + + $vbox->add ($dialog->{table} = new CFClient::UI::Table); + + $dialog +} + sub server_setup { my $dialog = $SERVER_SETUP = new CFClient::UI::FancyFrame x => "center", @@ -735,7 +741,7 @@ $table->add (1, 2, my $vbox = new CFClient::UI::VBox); $vbox->add ( - my $HOST = new CFClient::UI::Entry + $HOST_ENTRY = new CFClient::UI::Entry expand => 1, text => $CFG->{host}, tooltip => "The hostname or ip address of the Crossfire(+) server to connect to", @@ -747,14 +753,12 @@ $METASERVER = metaserver_dialog; - $vbox->add (new CFClient::UI::Flopper - expand => 1, - text => "Server List", - other => $METASERVER, + $vbox->add (new CFClient::UI::Button + expand => 1, + text => "Server List", + other => $METASERVER, tooltip => "Show a list of available crossfire servers", - on_open => sub { - update_metaserver $HOST; - } + on_activate => sub { $METASERVER->toggle_visibility }, ); }