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
This commit is contained in:
parent
c813765430
commit
f4d02bd9c1
@ -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:
|
* gtk_cell_area_apply_attributes:
|
||||||
* @area: a #GtkCellArea
|
* @area: a #GtkCellArea
|
||||||
|
@ -388,6 +388,11 @@ GDK_AVAILABLE_IN_ALL
|
|||||||
void gtk_cell_area_attribute_disconnect (GtkCellArea *area,
|
void gtk_cell_area_attribute_disconnect (GtkCellArea *area,
|
||||||
GtkCellRenderer *renderer,
|
GtkCellRenderer *renderer,
|
||||||
const gchar *attribute);
|
const gchar *attribute);
|
||||||
|
GDK_AVAILABLE_IN_3_14
|
||||||
|
gint gtk_cell_area_attribute_get_column (GtkCellArea *area,
|
||||||
|
GtkCellRenderer *renderer,
|
||||||
|
const gchar *attribute);
|
||||||
|
|
||||||
|
|
||||||
/* Cell Properties */
|
/* Cell Properties */
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
Loading…
Reference in New Issue
Block a user