Skip to content

Commit

Permalink
Move recent server to top of history
Browse files Browse the repository at this point in the history
It's easier for the user if the most recently used entries are at the
top.
  • Loading branch information
CendioOssman committed Sep 6, 2024
1 parent a19219e commit af29133
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions vncviewer/ServerDialog.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,12 @@ void ServerDialog::handleConnect(Fl_Widget* /*widget*/, void *data)
e.str());
}

// avoid duplicates in the history
dialog->serverHistory.remove(servername);
dialog->serverHistory.insert(dialog->serverHistory.begin(), servername);

try {
list<string>::iterator elem = std::find(dialog->serverHistory.begin(), dialog->serverHistory.end(), servername);
// avoid duplicates in the history
if(dialog->serverHistory.end() == elem) {
dialog->serverHistory.insert(dialog->serverHistory.begin(), servername);
dialog->saveServerHistory();
}
dialog->saveServerHistory();
} catch (Exception& e) {
vlog.error("%s", e.str());
fl_alert(_("Unable to save the server history:\n\n%s"),
Expand Down

0 comments on commit af29133

Please sign in to comment.