vcl/unx/gtk3/gtkinst.cxx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
New commits: commit be11a3573a21e83dfb6a473d98bc8ba9bf57057c Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Thu Jul 28 14:41:52 2022 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Tue Aug 9 10:53:11 2022 +0200 vcl: allow editing a column other than the first one in GtkInstanceTreeView This is basically commit fe38553aef2121f358fb58e450ec69314aad851e for the native GTK widgets, so the "Edit Text" button in Insert->Bookmarks dialog works. Change-Id: Ifcd115de60ecee2c4e4c19535ce55156aa84ff79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137563 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 0576c8ac84c2..49ae4676be32 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -14190,6 +14190,12 @@ private: { nCol = to_internal_model(nCol); + // recompute these 2 based on new 1st editable column + m_nTextCol = -1; + m_nTextView = -1; + int nIndex(0); + int nViewColumn(0); + bool isSet(false); for (GList* pEntry = g_list_first(m_pColumns); pEntry; pEntry = g_list_next(pEntry)) { GtkTreeViewColumn* pColumn = GTK_TREE_VIEW_COLUMN(pEntry->data); @@ -14201,10 +14207,27 @@ private: if (reinterpret_cast<sal_IntPtr>(pData) == nCol) { g_object_set(G_OBJECT(pCellRenderer), "editable", bEditable, "editable-set", true, nullptr); + isSet = true; + } + if (GTK_IS_CELL_RENDERER_TEXT(pCellRenderer)) + { + gboolean is_editable(false); + g_object_get(pCellRenderer, "editable", &is_editable, nullptr); + if (is_editable && m_nTextCol == -1) + { + assert(m_nTextView == -1); + m_nTextCol = nIndex; + m_nTextView = nViewColumn; + } + } + if (isSet && m_nTextCol != -1) // both tasks done? + { break; } + ++nIndex; } g_list_free(pRenderers); + ++nViewColumn; } }