[gtk+] treeview: filter out invisible columns in get_path_for_child()
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] treeview: filter out invisible columns in get_path_for_child()
- Date: Tue, 27 Mar 2012 16:39:26 +0000 (UTC)
commit 52bd5f2f1fcd48a47363a72d86a2859692cca417
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Mar 26 16:14:08 2012 -0400
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
gtk/gtktreeview.c | 24 +++++++++++++++---------
1 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 7bca6a3..b9b90ab 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -8509,21 +8509,27 @@ 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;
- GtkRegionFlags flags = 0;
- if (!gtk_tree_view_column_get_visible (column))
- continue;
+ 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;
n_col++;
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]