vcl/unx/gtk3/gtk3gtkinst.cxx |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 36f57d5aebe448701ffe3bbc529f29d2112dec94
Author:     Caolán McNamara <[email protected]>
AuthorDate: Thu Jun 4 11:08:20 2020 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Fri Jun 5 09:37:19 2020 +0200

    document the mapping to CellRenderers
    
    and clarify that g-lo-CellIndex is the index from the external pov
    
    Change-Id: Id747acaeabab50755188732637a72c1fce8a97dc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95519
    Tested-by: Caolán McNamara <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 396ed5b71645..1d4fa5ae530f 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -9809,6 +9809,11 @@ public:
         , 
m_pVAdjustment(gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(pTreeView)))
         , m_pChangeEvent(nullptr)
     {
+        /* The outside concept of a column maps to a gtk CellRenderer, rather 
than
+           a TreeViewColumn. If the first TreeViewColumn has two 
CellRenderers, and
+           the first CellRenderer is an image, that CellRenderer is considered 
to
+           be index -1.
+        */
         m_pColumns = gtk_tree_view_get_columns(m_pTreeView);
         int nIndex(0);
         int nViewColumn(0);
@@ -9820,7 +9825,6 @@ public:
             for (GList* pRenderer = g_list_first(pRenderers); pRenderer; 
pRenderer = g_list_next(pRenderer))
             {
                 GtkCellRenderer* pCellRenderer = 
GTK_CELL_RENDERER(pRenderer->data);
-                g_object_set_data(G_OBJECT(pCellRenderer), "g-lo-CellIndex", 
reinterpret_cast<gpointer>(nIndex));
                 if (GTK_IS_CELL_RENDERER_TEXT(pCellRenderer))
                 {
                     if (m_nTextCol == -1)
@@ -9850,6 +9854,8 @@ public:
                     else if (m_nImageCol == -1)
                         m_nImageCol = nIndex;
                 }
+                int nExternalIndex = to_external_model(nIndex);
+                g_object_set_data(G_OBJECT(pCellRenderer), "g-lo-CellIndex", 
reinterpret_cast<gpointer>(nExternalIndex));
                 ++nIndex;
             }
             g_list_free(pRenderers);
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to