inspector: Add cell areas into the tree

This commit is contained in:
Matthias Clasen 2014-05-09 22:28:45 -04:00
parent 9467c56b94
commit 2af94dff1c

View File

@ -186,6 +186,7 @@ typedef struct
{ {
GtkInspectorWidgetTree *wt; GtkInspectorWidgetTree *wt;
GtkTreeIter *iter; GtkTreeIter *iter;
GObject *parent;
} FindAllData; } FindAllData;
static void static void
@ -196,6 +197,18 @@ on_container_forall (GtkWidget *widget,
gtk_inspector_widget_tree_append_object (d->wt, G_OBJECT (widget), d->iter, NULL); gtk_inspector_widget_tree_append_object (d->wt, G_OBJECT (widget), d->iter, NULL);
} }
static gboolean
cell_callback (GtkCellRenderer *renderer,
gpointer data)
{
FindAllData *d = data;
g_object_set_data (G_OBJECT (renderer), "gtk-inspector-cell-area", d->parent);
gtk_inspector_widget_tree_append_object (d->wt, G_OBJECT (renderer), d->iter, NULL);
return FALSE;
}
void void
gtk_inspector_widget_tree_append_object (GtkInspectorWidgetTree *wt, gtk_inspector_widget_tree_append_object (GtkInspectorWidgetTree *wt,
GObject *object, GObject *object,
@ -276,6 +289,7 @@ gtk_inspector_widget_tree_append_object (GtkInspectorWidgetTree *wt,
data.wt = wt; data.wt = wt;
data.iter = &iter; data.iter = &iter;
data.parent = object;
gtk_container_forall (GTK_CONTAINER (object), on_container_forall, &data); gtk_container_forall (GTK_CONTAINER (object), on_container_forall, &data);
} }
@ -293,21 +307,22 @@ gtk_inspector_widget_tree_append_object (GtkInspectorWidgetTree *wt,
} }
} }
if (GTK_IS_CELL_LAYOUT (object)) if (GTK_IS_CELL_AREA (object))
{
FindAllData data;
data.wt = wt;
data.iter = &iter;
data.parent = object;
gtk_cell_area_foreach (GTK_CELL_AREA (object), cell_callback, &data);
}
else if (GTK_IS_CELL_LAYOUT (object))
{ {
GList *cells, *l;
GObject *cell;
GtkCellArea *area; GtkCellArea *area;
area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (object)); area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (object));
cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (object)); gtk_inspector_widget_tree_append_object (wt, G_OBJECT (area), &iter, NULL);
for (l = cells; l; l = l->next)
{
cell = l->data;
g_object_set_data (cell, "gtk-inspector-cell-area", area);
gtk_inspector_widget_tree_append_object (wt, cell, &iter, NULL);
}
g_list_free (cells);
} }
} }