Commit f4d02bd9 authored by Matthias Clasen's avatar Matthias Clasen

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
parent c8137654
......@@ -2318,6 +2318,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
......
......@@ -388,6 +388,11 @@ GDK_AVAILABLE_IN_ALL
void gtk_cell_area_attribute_disconnect (GtkCellArea *area,
GtkCellRenderer *renderer,
const gchar *attribute);
GDK_AVAILABLE_IN_3_14
gint gtk_cell_area_attribute_get_column (GtkCellArea *area,
GtkCellRenderer *renderer,
const gchar *attribute);
/* Cell Properties */
GDK_AVAILABLE_IN_ALL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment