diff --git a/gtk/gtkcellarea.c b/gtk/gtkcellarea.c index 09d7654d85..b27ad07c08 100644 --- a/gtk/gtkcellarea.c +++ b/gtk/gtkcellarea.c @@ -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 diff --git a/gtk/gtkcellarea.h b/gtk/gtkcellarea.h index eaa63732a7..854e32f148 100644 --- a/gtk/gtkcellarea.h +++ b/gtk/gtkcellarea.h @@ -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