summaryrefslogtreecommitdiff
path: root/gtk/gtk-builder-tool.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2015-05-02 12:13:35 -0400
committerMatthias Clasen <mclasen@redhat.com>2015-05-02 17:39:05 -0400
commit060c4f9c6626172e03ae384f817849504584dbd4 (patch)
tree8e5bc7d63fd23ff66aab5f53ee537db59b2c71ca /gtk/gtk-builder-tool.c
parent712b7bd9f502dbdfa158507127a6e269a154551b (diff)
downloadgtk+-060c4f9c6626172e03ae384f817849504584dbd4.tar.gz
gtk-builder-tool: Handle cell properties
These were causing 'unknown property' warnings before.
Diffstat (limited to 'gtk/gtk-builder-tool.c')
-rw-r--r--gtk/gtk-builder-tool.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/gtk/gtk-builder-tool.c b/gtk/gtk-builder-tool.c
index 1ddcec5dfb..5c1a3ec60a 100644
--- a/gtk/gtk-builder-tool.c
+++ b/gtk/gtk-builder-tool.c
@@ -30,6 +30,8 @@ typedef struct {
GList *classes;
gboolean packing;
gboolean packing_started;
+ gboolean cell_packing;
+ gboolean cell_packing_started;
gchar **attribute_names;
gchar **attribute_values;
GString *value;
@@ -65,6 +67,15 @@ value_is_default (MyParserData *data,
g_strdelimit (canonical_name, "_", '-');
if (data->packing)
pspec = gtk_container_class_find_child_property (class, canonical_name);
+ else if (data->cell_packing)
+ {
+ GObjectClass *cell_class;
+
+ /* We're just assuming that the cell layout is using a GtkCellAreaBox. */
+ cell_class = g_type_class_ref (GTK_TYPE_CELL_AREA_BOX);
+ pspec = gtk_cell_area_class_find_cell_property (GTK_CELL_AREA_CLASS (cell_class), canonical_name);
+ g_type_class_unref (cell_class);
+ }
else
pspec = g_object_class_find_property (class, canonical_name);
g_free (canonical_name);
@@ -74,6 +85,8 @@ value_is_default (MyParserData *data,
{
if (data->packing)
g_printerr (_("Packing property %s::%s not found\n"), class_name, property_name);
+ else if (data->cell_packing)
+ g_printerr (_("Cell property %s::%s not found\n"), class_name, property_name);
else
g_printerr (_("Property %s::%s not found\n"), class_name, property_name);
return FALSE;
@@ -179,6 +192,16 @@ maybe_emit_property (MyParserData *data)
}
}
+ if (data->cell_packing)
+ {
+ if (!data->cell_packing_started)
+ {
+ g_print ("%*s<packing>\n", data->indent, "");
+ data->indent += 2;
+ data->cell_packing_started = TRUE;
+ }
+ }
+
bound = FALSE;
g_print ("%*s<property", data->indent, "");
@@ -283,6 +306,13 @@ start_element (GMarkupParseContext *context,
return;
}
+ else if (strcmp (element_name, "cell-packing") == 0)
+ {
+ data->cell_packing = TRUE;
+ data->cell_packing_started = FALSE;
+
+ return;
+ }
else if (strcmp (element_name, "attribute") == 0)
{
/* attribute in label has no content */
@@ -350,6 +380,12 @@ end_element (GMarkupParseContext *context,
if (!data->packing_started)
return;
}
+ else if (strcmp (element_name, "cell-packing") == 0)
+ {
+ data->cell_packing = FALSE;
+ if (!data->cell_packing_started)
+ return;
+ }
else if (data->value != 0)
{
gchar *escaped;
@@ -439,6 +475,8 @@ do_simplify (const gchar *filename)
data.value = NULL;
data.packing = FALSE;
data.packing_started = FALSE;
+ data.cell_packing = FALSE;
+ data.cell_packing_started = FALSE;
data.unclosed_starttag = FALSE;
data.indent = 0;