summaryrefslogtreecommitdiff
path: root/gtk/gtkcellarea.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2014-05-08 14:06:03 -0400
committerMatthias Clasen <mclasen@redhat.com>2014-05-08 14:09:04 -0400
commitf4d02bd9c18516e3ef4b32bae072e37822bdcd5e (patch)
tree36e82cf11b6e96d15ff132190185b0d234e12a0d /gtk/gtkcellarea.c
parentc813765430c7fa69d9fe44ecb414532e44e723b0 (diff)
downloadgtk+-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.c40
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