diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-04-20 02:04:25 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-04-20 02:04:25 +0300 |
commit | 848b3f022dac89ac5d2ac932759f5b2f30a090e4 (patch) | |
tree | 35a0522018c99a7c83c71c86d90c2c02ffb72331 /src/gui | |
parent | 1554c23122a682e9d35e5dafd24f72d709eebf59 (diff) | |
download | manaverse-848b3f022dac89ac5d2ac932759f5b2f30a090e4.tar.gz manaverse-848b3f022dac89ac5d2ac932759f5b2f30a090e4.tar.bz2 manaverse-848b3f022dac89ac5d2ac932759f5b2f30a090e4.tar.xz manaverse-848b3f022dac89ac5d2ac932759f5b2f30a090e4.zip |
Always select first server in servers list.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/serverdialog.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index cde56875f..fa23c95f3 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -300,13 +300,14 @@ ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir): loadWindowState(); - mServersList->setSelected(0); // Do this after for the Delete button setVisible(true); mConnectButton->requestFocus(); loadServers(true); + mServersList->setSelected(0); // Do this after for the Delete button + if (needUpdateServers()) downloadServerList(); } @@ -330,6 +331,10 @@ void ServerDialog::action(const gcn::ActionEvent &event) if (Client::getState() == STATE_CONNECT_SERVER) return; + int index = mServersList->getSelected(); + if (index < 0) + return; + if (mDownload) mDownload->cancel(); @@ -337,10 +342,6 @@ void ServerDialog::action(const gcn::ActionEvent &event) mConnectButton->setEnabled(false); mLoadButton->setEnabled(false); - int index = mServersList->getSelected(); - if (index < 0) - return; - ServerInfo server = mServers.at(index); mServerInfo->hostname = server.hostname; mServerInfo->port = server.port; @@ -598,6 +599,8 @@ void ServerDialog::loadServers(bool addNew) if (!found && addNew) mServers.push_back(server); } + if (mServersList->getSelected() < 0) + mServersList->setSelected(0); } void ServerDialog::loadCustomServers() |