mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-20 02:10:12 +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);
|
GtkTreeView *tree_view = GTK_TREE_VIEW (container);
|
||||||
GtkWidgetPath *path;
|
GtkWidgetPath *path;
|
||||||
gboolean rtl;
|
gboolean rtl;
|
||||||
GList *list;
|
GList *list, *visible_columns = NULL;
|
||||||
gint n_col = 0;
|
gint n_col = 0;
|
||||||
|
|
||||||
path = GTK_CONTAINER_CLASS (gtk_tree_view_parent_class)->get_path_for_child (container, child);
|
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);
|
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));
|
for (list = tree_view->priv->columns; list; list = list->next)
|
||||||
list;
|
{
|
||||||
list = (rtl ? list->prev : 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;
|
GtkTreeViewColumn *column = list->data;
|
||||||
GtkRegionFlags flags = 0;
|
GtkRegionFlags flags = 0;
|
||||||
|
|
||||||
if (!gtk_tree_view_column_get_visible (column))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
n_col++;
|
n_col++;
|
||||||
|
|
||||||
if (gtk_tree_view_column_get_widget (column) != child &&
|
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)
|
if (n_col == 1)
|
||||||
flags |= GTK_REGION_FIRST;
|
flags |= GTK_REGION_FIRST;
|
||||||
|
|
||||||
if ((rtl && !list->prev) ||
|
if (!list->next)
|
||||||
(!rtl && !list->next))
|
|
||||||
flags |= GTK_REGION_LAST;
|
flags |= GTK_REGION_LAST;
|
||||||
|
|
||||||
gtk_widget_path_iter_add_region (path, -1, GTK_STYLE_REGION_COLUMN_HEADER, flags);
|
gtk_widget_path_iter_add_region (path, -1, GTK_STYLE_REGION_COLUMN_HEADER, flags);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
g_list_free (visible_columns);
|
||||||
|
|
||||||
gtk_widget_path_append_for_widget (path, child);
|
gtk_widget_path_append_for_widget (path, child);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user