summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk3/gtk3gtkinst.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-07 09:06:01 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-09-07 11:55:51 +0200
commit64db723b2047cf566b652c11c94d9d589df0b930 (patch)
tree2f246531f1e2ec61dac6ea5344deab25a2546a1d /vcl/unx/gtk3/gtk3gtkinst.cxx
parent54cbe9458033f50d9f608b1462d65e8514cbb636 (diff)
Related: tdf#136455 use insert_vector for bulk insert
and insert backwards which is a little faster Change-Id: Ie72d08bb6e869b2d8fe86ae5526706d051233939 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102151 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx/gtk3/gtk3gtkinst.cxx')
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx15
1 files changed, 13 insertions, 2 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 5230dcf92a88..8a15f98530d7 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -14551,14 +14551,25 @@ public:
virtual void insert_vector(const std::vector<weld::ComboBoxEntry>& rItems, bool bKeepExisting) override
{
freeze();
+
+ int nInsertionPoint;
if (!bKeepExisting)
+ {
clear();
+ nInsertionPoint = 0;
+ }
+ else
+ nInsertionPoint = get_count();
+
GtkTreeIter iter;
- for (const auto& rItem : rItems)
+ // tdf#125241 inserting backwards is faster
+ for (auto aI = rItems.rbegin(); aI != rItems.rend(); ++aI)
{
- insert_row(GTK_LIST_STORE(m_pTreeModel), iter, -1, rItem.sId.isEmpty() ? nullptr : &rItem.sId,
+ const auto& rItem = *aI;
+ insert_row(GTK_LIST_STORE(m_pTreeModel), iter, nInsertionPoint, rItem.sId.isEmpty() ? nullptr : &rItem.sId,
rItem.sString, rItem.sImage.isEmpty() ? nullptr : &rItem.sImage, nullptr);
}
+
thaw();
}