Skip to content

shortcuts etc: Fix wasteful for loops, duplication

shortcuts etc: Fix wasteful for loops, duplication

shortcuts:
* Loop over vectors of strings by const reference: don't needlessly copy
* Split out string-joining to a separate function, and reserve() therein
  (in current draft on `gtk4` branch, I will need this at a second site)
* Only call set_accels_for_action() if did change. Emit signal AFTER it!
* Split out duplicated code → append(vector&, vector&&), clear()s sooner
* Avoid lots of mentions of Glib::ustring in filename code as for GTK4 I
  am probably going to have to replace filenames with std::string a lot…
* Avoid copying strings more, yet again, in passing elements to functors
* Make file `label` ustring, not std, as it gets ustring::compose()d and
  put into the vector of pairs as a ustring, so avoid convert op rndtrip
* get_path_string() to get std::string, instead of get_path→ustr+convert
* Fix weird sorting via Glib::path_get_basename() of "name (label)" text
  – which was resulting in the same outcome, but w/ pointless calls/work
* Remove unnecessary use of get_basename() on string thatʼs already that
* Add missing sort @ doc actions, use 1 vec instead of 3, move to result

action-accel:
* Use iterator-constructor + move_iterators, instead of for/emplace loop
* Replace destructor doing disconnect(), with our auto_connection helper

dialog-container:
* Factor out duplicated code to get_dialog_open_action_name().
* Remove always-nullptr image and branching thereon around 2nd use of it

inkscape-preferences:
* Loop over vectors of strings by const reference: don't needlessly copy
* Move modified, otherwise unused `folders` vectors → tmp in `for` loops
* Add some missing consts to references in other `for` loops
* Remove now-unused iterator above range-based `for` loop
* Replace long-winded chopping to filename, with [std|boost]::filesystem
* Replace long-winded check if get_filenames() returns non-empty vector

startup:
* Loop over map<pair<string>> by const reference: don't needlessly copy

io/file-export-cmd:
* Loop over vectors of strings by const reference: don't needlessly copy
Edited by Daniel Boles

Merge request reports