mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 21:51:08 +00:00
treeview: filter out invisible columns in get_path_for_child()
Since we check for !list->next (and !list->prev for RTL) to set the GTK_REGION_LAST flag, we have to filter out invisible columns before looping; if we don't do that we might end up assigning GTK_REGION_LAST to an invisible column. https://bugzilla.gnome.org/show_bug.cgi?id=672937
This commit is contained in:
parent
c1a7da05a4
commit
52bd5f2f1f
@ -8509,22 +8509,28 @@ gtk_tree_view_get_path_for_child (GtkContainer *container,
|
||||
GtkTreeView *tree_view = GTK_TREE_VIEW (container);
|
||||
GtkWidgetPath *path;
|
||||
gboolean rtl;
|
||||
GList *list;
|
||||
GList *list, *visible_columns = NULL;
|
||||
gint n_col = 0;
|
||||
|
||||
path = GTK_CONTAINER_CLASS (gtk_tree_view_parent_class)->get_path_for_child (container, child);
|
||||
rtl = (gtk_widget_get_direction (GTK_WIDGET (container)) == GTK_TEXT_DIR_RTL);
|
||||
|
||||
for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
|
||||
list;
|
||||
list = (rtl ? list->prev : list->next))
|
||||
for (list = tree_view->priv->columns; list; list = list->next)
|
||||
{
|
||||
GtkTreeViewColumn *column = list->data;
|
||||
|
||||
if (gtk_tree_view_column_get_visible (column))
|
||||
visible_columns = g_list_prepend (visible_columns, column);
|
||||
}
|
||||
|
||||
if (!rtl)
|
||||
visible_columns = g_list_reverse (visible_columns);
|
||||
|
||||
for (list = visible_columns; list != NULL; list = list->next)
|
||||
{
|
||||
GtkTreeViewColumn *column = list->data;
|
||||
GtkRegionFlags flags = 0;
|
||||
|
||||
if (!gtk_tree_view_column_get_visible (column))
|
||||
continue;
|
||||
|
||||
n_col++;
|
||||
|
||||
if (gtk_tree_view_column_get_widget (column) != child &&
|
||||
@ -8539,13 +8545,13 @@ gtk_tree_view_get_path_for_child (GtkContainer *container,
|
||||
if (n_col == 1)
|
||||
flags |= GTK_REGION_FIRST;
|
||||
|
||||
if ((rtl && !list->prev) ||
|
||||
(!rtl && !list->next))
|
||||
if (!list->next)
|
||||
flags |= GTK_REGION_LAST;
|
||||
|
||||
gtk_widget_path_iter_add_region (path, -1, GTK_STYLE_REGION_COLUMN_HEADER, flags);
|
||||
break;
|
||||
}
|
||||
g_list_free (visible_columns);
|
||||
|
||||
gtk_widget_path_append_for_widget (path, child);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user