[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed Feb 26 15:42:35 UTC 2020
vcl/unx/gtk3/gtk3gtkinst.cxx | 34 ++++++++++++++++++++++++++++------
1 file changed, 28 insertions(+), 6 deletions(-)
New commits:
commit 9b17ad5b54b684e58eb488f2ab586e694c65e1ef
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Feb 26 11:57:04 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Feb 26 16:42:01 2020 +0100
get the real last row, not the last toplevel row
Change-Id: I7de72c383f11187ec706cd6971ff0431d04db72f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89539
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 1e93792e7778..ad19e1d762f0 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -9051,6 +9051,33 @@ private:
return true;
}
+ void last_child(GtkTreeModel* pModel, GtkTreeIter* result, GtkTreeIter* pParent, int nChildren)
+ {
+ gtk_tree_model_iter_nth_child(pModel, result, pParent, nChildren - 1);
+ nChildren = gtk_tree_model_iter_n_children(pModel, result);
+ if (nChildren)
+ {
+ GtkTreeIter newparent(*result);
+ last_child(pModel, result, &newparent, nChildren);
+ }
+ }
+
+ GtkTreePath* get_path_of_last_entry(GtkTreeModel *pModel)
+ {
+ GtkTreePath *lastpath;
+ // find the last entry in the model for comparison
+ int nChildren = gtk_tree_model_iter_n_children(pModel, nullptr);
+ if (!nChildren)
+ lastpath = gtk_tree_path_new_from_indices(0, -1);
+ else
+ {
+ GtkTreeIter iter;
+ last_child(pModel, &iter, nullptr, nChildren);
+ lastpath = gtk_tree_model_get_path(pModel, &iter);
+ }
+ return lastpath;
+ }
+
public:
GtkInstanceTreeView(GtkTreeView* pTreeView, GtkInstanceBuilder* pBuilder, bool bTakeOwnership)
: GtkInstanceContainer(GTK_CONTAINER(pTreeView), pBuilder, bTakeOwnership)
@@ -10381,12 +10408,7 @@ public:
// find the last entry in the model for comparison
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
- int nChildren = gtk_tree_model_iter_n_children(pModel, nullptr);
- GtkTreePath *lastpath;
- if (nChildren)
- lastpath = gtk_tree_path_new_from_indices(nChildren - 1, -1);
- else
- lastpath = gtk_tree_path_new_from_indices(0, -1);
+ GtkTreePath *lastpath = get_path_of_last_entry(pModel);
if (!ret)
{
More information about the Libreoffice-commits
mailing list