[gtk+/native-layout] Changed private api to allow setting a column dirty without resetting the width (used when only the
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/native-layout] Changed private api to allow setting a column dirty without resetting the width (used when only the
- Date: Sun, 27 Jun 2010 22:38:36 +0000 (UTC)
commit deab62c29e8d9d8a7fec556659d4cd82dcb6a3b2
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sun Jun 27 18:35:54 2010 -0400
Changed private api to allow setting a column dirty without resetting the width
(used when only the height is known to be dirty).
gtk/gtktreeprivate.h | 1 +
gtk/gtktreeviewcolumn.c | 34 ++++++++++++++++++++--------------
2 files changed, 21 insertions(+), 14 deletions(-)
---
diff --git a/gtk/gtktreeprivate.h b/gtk/gtktreeprivate.h
index e3af22e..11b02e5 100644
--- a/gtk/gtktreeprivate.h
+++ b/gtk/gtktreeprivate.h
@@ -464,6 +464,7 @@ void _gtk_tree_view_column_cell_draw_focus (GtkTreeViewColumn *tree_column,
const GdkRectangle *expose_area,
guint flags);
void _gtk_tree_view_column_cell_set_dirty (GtkTreeViewColumn *tree_column,
+ gboolean recalculate_width,
gboolean install_handler);
void _gtk_tree_view_column_get_neighbor_sizes (GtkTreeViewColumn *column,
GtkCellRenderer *cell,
diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c
index 70a4591..e4d57c6 100644
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@ -731,7 +731,7 @@ gtk_tree_view_column_cell_layout_add_attribute (GtkCellLayout *cell_layout,
info->attributes = g_slist_prepend (info->attributes, g_strdup (attribute));
if (tree_column->tree_view)
- _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE);
+ _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE, TRUE);
}
static void
@@ -763,7 +763,7 @@ gtk_tree_view_column_cell_layout_set_cell_data_func (GtkCellLayout *cell
info->destroy = destroy;
if (column->tree_view)
- _gtk_tree_view_column_cell_set_dirty (column, TRUE);
+ _gtk_tree_view_column_cell_set_dirty (column, TRUE, TRUE);
}
static void
@@ -826,7 +826,7 @@ gtk_tree_view_column_clear_attributes_by_info (GtkTreeViewColumn *tree_column,
info->attributes = NULL;
if (tree_column->tree_view)
- _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE);
+ _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE, TRUE);
}
/* Helper functions
@@ -1735,7 +1735,7 @@ gtk_tree_view_column_set_spacing (GtkTreeViewColumn *tree_column,
tree_column->spacing = spacing;
if (tree_column->tree_view)
- _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE);
+ _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE, TRUE);
}
/**
@@ -1777,7 +1777,7 @@ gtk_tree_view_column_set_visible (GtkTreeViewColumn *tree_column,
tree_column->visible = visible;
if (tree_column->visible)
- _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE);
+ _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE, TRUE);
gtk_tree_view_column_update_button (tree_column);
g_object_notify (G_OBJECT (tree_column), "visible");
@@ -3483,6 +3483,7 @@ gtk_tree_view_column_focus_cell (GtkTreeViewColumn *tree_column,
void
_gtk_tree_view_column_cell_set_dirty (GtkTreeViewColumn *tree_column,
+ gboolean recalculate_width,
gboolean install_handler)
{
GList *list;
@@ -3490,16 +3491,20 @@ _gtk_tree_view_column_cell_set_dirty (GtkTreeViewColumn *tree_column,
priv = GTK_TREE_VIEW_COLUMN_GET_PRIVATE (tree_column);
- for (list = tree_column->cell_list; list; list = list->next)
- {
- GtkTreeViewColumnCellInfo *info = (GtkTreeViewColumnCellInfo *) list->data;
+ tree_column->dirty = TRUE;
- info->requested_width = 0;
- info->natural_width = 0;
+ if (recalculate_width)
+ {
+ for (list = tree_column->cell_list; list; list = list->next)
+ {
+ GtkTreeViewColumnCellInfo *info = (GtkTreeViewColumnCellInfo *) list->data;
+
+ info->requested_width = 0;
+ info->natural_width = 0;
+ }
+ tree_column->requested_width = -1;
+ priv->natural_width = -1;
}
- tree_column->dirty = TRUE;
- tree_column->requested_width = -1;
- priv->natural_width = -1;
if (tree_column->tree_view &&
gtk_widget_get_realized (tree_column->tree_view))
@@ -3512,6 +3517,7 @@ _gtk_tree_view_column_cell_set_dirty (GtkTreeViewColumn *tree_column,
}
}
+
void
_gtk_tree_view_column_start_editing (GtkTreeViewColumn *tree_column,
GtkCellEditable *cell_editable)
@@ -3644,7 +3650,7 @@ gtk_tree_view_column_queue_resize (GtkTreeViewColumn *tree_column)
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
if (tree_column->tree_view)
- _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE);
+ _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE, TRUE);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]