[gtk+] gtk-builder-tool: Some refactoring
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gtk-builder-tool: Some refactoring
- Date: Sat, 2 May 2015 21:39:39 +0000 (UTC)
commit 4f115ad9401e2902582a4daa83544c6877643dfc
Author: Matthias Clasen <mclasen redhat com>
Date: Sat May 2 14:41:02 2015 -0400
gtk-builder-tool: Some refactoring
Break out similar code into separate functions.
gtk/gtk-builder-tool.c | 53 +++++++++++++++++++++++++++++-------------------
1 files changed, 32 insertions(+), 21 deletions(-)
---
diff --git a/gtk/gtk-builder-tool.c b/gtk/gtk-builder-tool.c
index 2b2009c..b7a2a4b 100644
--- a/gtk/gtk-builder-tool.c
+++ b/gtk/gtk-builder-tool.c
@@ -163,6 +163,34 @@ needs_explicit_setting (MyParserData *data,
}
static void
+maybe_start_packing (MyParserData *data)
+{
+ if (data->packing)
+ {
+ if (!data->packing_started)
+ {
+ g_print ("%*s<packing>\n", data->indent, "");
+ data->indent += 2;
+ data->packing_started = TRUE;
+ }
+ }
+}
+
+static void
+maybe_start_cell_packing (MyParserData *data)
+{
+ if (data->cell_packing)
+ {
+ if (!data->cell_packing_started)
+ {
+ g_print ("%*s<cell-packing>\n", data->indent, "");
+ data->indent += 2;
+ data->cell_packing_started = TRUE;
+ }
+ }
+}
+
+static void
maybe_start_child (MyParserData *data)
{
if (data->in_child > 0)
@@ -213,32 +241,15 @@ maybe_emit_property (MyParserData *data)
}
}
- if (data->packing)
- {
- if (!data->packing_started)
- {
- g_print ("%*s<packing>\n", data->indent, "");
- data->indent += 2;
- data->packing_started = TRUE;
- }
- }
-
- if (data->cell_packing)
- {
- if (!data->cell_packing_started)
- {
- g_print ("%*s<cell-packing>\n", data->indent, "");
- data->indent += 2;
- data->cell_packing_started = TRUE;
- }
- }
+ maybe_start_packing (data);
+ maybe_start_cell_packing (data);
g_print ("%*s<property", data->indent, "");
for (i = 0; data->attribute_names[i]; i++)
{
if (!translatable &&
- (strcmp (data->attributes_name[i], "comments") == 0 ||
- strcmp (data->attributes_name[i], "context") == 0))
+ (strcmp (data->attribute_names[i], "comments") == 0 ||
+ strcmp (data->attribute_names[i], "context") == 0))
continue;
escaped = g_markup_escape_text (data->attribute_values[i], -1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]