diff options
author | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2010-11-02 18:01:03 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2010-11-02 18:01:03 +0900 |
commit | 832c123fd27e0439343699673ad865e86065b22d (patch) | |
tree | 4fc676a1adac4b838af0cb4308c8e61e56da5ecb /gtk/gtkcellarea.c | |
parent | 73e45cef9d3cbc9435af8a89956ca5b17f6df6b2 (diff) | |
download | gtk+-832c123fd27e0439343699673ad865e86065b22d.tar.gz |
Extended gtk_cell_area_apply_attributes() to account for expander/expanded cells
The state of expanded cells must come from the view, since these states
can vary across views accessing the same model (also "finished up" the
applying of attributes code).
Diffstat (limited to 'gtk/gtkcellarea.c')
-rw-r--r-- | gtk/gtkcellarea.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/gtk/gtkcellarea.c b/gtk/gtkcellarea.c index e77c2280ce..634ff4906c 100644 --- a/gtk/gtkcellarea.c +++ b/gtk/gtkcellarea.c @@ -117,6 +117,8 @@ typedef struct { GtkCellArea *area; GtkTreeModel *model; GtkTreeIter *iter; + gboolean is_expander; + gboolean is_expanded; } AttributeData; struct _GtkCellAreaPrivate @@ -926,6 +928,22 @@ apply_cell_attributes (GtkCellRenderer *renderer, CellAttribute *attribute; GSList *list; GValue value = { 0, }; + gboolean is_expander; + gboolean is_expanded; + + g_object_freeze_notify (G_OBJECT (renderer)); + + /* Whether a row expands or is presently expanded can only be + * provided by the view (as these states can vary across views + * accessing the same model). + */ + g_object_get (renderer, "is-expander", &is_expander, NULL); + if (is_expander != data->is_expander) + g_object_set (renderer, "is-expander", data->is_expander, NULL); + + g_object_get (renderer, "is-expanded", &is_expanded, NULL); + if (is_expanded != data->is_expanded) + g_object_set (renderer, "is-expanded", data->is_expanded, NULL); /* Apply the attributes directly to the renderer */ for (list = info->attributes; list; list = list->next) @@ -942,12 +960,16 @@ apply_cell_attributes (GtkCellRenderer *renderer, if (info->func) info->func (GTK_CELL_LAYOUT (data->area), renderer, data->model, data->iter, info->data); + + g_object_thaw_notify (G_OBJECT (renderer)); } void gtk_cell_area_apply_attributes (GtkCellArea *area, GtkTreeModel *tree_model, - GtkTreeIter *iter) + GtkTreeIter *iter, + gboolean is_expander, + gboolean is_expanded) { GtkCellAreaPrivate *priv; AttributeData data; @@ -958,6 +980,13 @@ gtk_cell_area_apply_attributes (GtkCellArea *area, priv = area->priv; + /* Feed in data needed to apply to every renderer */ + data.area = area; + data.model = tree_model; + data.iter = iter; + data.is_expander = is_expander; + data.is_expanded = is_expanded; + /* Go over any cells that have attributes or custom GtkCellLayoutDataFuncs and * apply the data from the treemodel */ g_hash_table_foreach (priv->cell_info, (GHFunc)apply_cell_attributes, &data); |