diff options
author | Pierre Ossman <ossman@cendio.se> | 2024-09-06 16:30:02 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2024-09-06 16:30:02 +0200 |
commit | af29133e1d0b97e1e3699224920043b8195be577 (patch) | |
tree | a83ab3941bae2ea299fd3f9bba430dad1f1b393b | |
parent | a19219e0ebeed5701fa8e0bee41d2529ffb7d966 (diff) | |
download | tigervnc-af29133e1d0b97e1e3699224920043b8195be577.tar.gz tigervnc-af29133e1d0b97e1e3699224920043b8195be577.zip |
Move recent server to top of history
It's easier for the user if the most recently used entries are at the
top.
-rw-r--r-- | vncviewer/ServerDialog.cxx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/vncviewer/ServerDialog.cxx b/vncviewer/ServerDialog.cxx index c5db8e1a..d1d4bdf8 100644 --- a/vncviewer/ServerDialog.cxx +++ b/vncviewer/ServerDialog.cxx @@ -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"), |