diff options
author | Matthias Clasen <mclasen@redhat.com> | 2014-05-08 14:06:03 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2014-05-08 14:09:04 -0400 |
commit | f4d02bd9c18516e3ef4b32bae072e37822bdcd5e (patch) | |
tree | 36e82cf11b6e96d15ff132190185b0d234e12a0d /gtk/gtkcellarea.c | |
parent | c813765430c7fa69d9fe44ecb414532e44e723b0 (diff) | |
download | gtk+-f4d02bd9c18516e3ef4b32bae072e37822bdcd5e.tar.gz |
GtkCellArea: allow finding attributes at runtime
This will allow e.g. GtkInspector to display attribute mappings.
http://bugzilla.gnome.org/show_bug.cgi?id=729817
Diffstat (limited to 'gtk/gtkcellarea.c')
-rw-r--r-- | gtk/gtkcellarea.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/gtk/gtkcellarea.c b/gtk/gtkcellarea.c index 09d7654d85..b27ad07c08 100644 --- a/gtk/gtkcellarea.c +++ b/gtk/gtkcellarea.c @@ -2319,6 +2319,46 @@ gtk_cell_area_attribute_disconnect (GtkCellArea *area, } /** + * gtk_cell_area_attribute_get_column: + * @cell_layout: a #GtkCellLayout + * @cell: a #GtkCellRenderer + * @attribute: an attribute on the renderer + * + * Returns the model column that an attribute has been mapped to, + * or -1 if the attribute is not mapped. + * + * Returns: the model column, or -1 + * + * Since: 3.14 + */ +gint +gtk_cell_area_attribute_get_column (GtkCellArea *area, + GtkCellRenderer *renderer, + const gchar *attribute) +{ + GtkCellAreaPrivate *priv; + CellInfo *info; + CellAttribute *cell_attribute; + GSList *node; + + priv = area->priv; + info = g_hash_table_lookup (priv->cell_info, renderer); + + if (info) + { + node = g_slist_find_custom (info->attributes, attribute, + (GCompareFunc)cell_attribute_find); + if (node) + { + cell_attribute = node->data; + return cell_attribute->column; + } + } + + return -1; +} + +/** * gtk_cell_area_apply_attributes: * @area: a #GtkCellArea * @tree_model: the #GtkTreeModel to pull values from |