summaryrefslogtreecommitdiff
path: root/gtk/tools/gtk-builder-tool-validate.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-02-07 12:24:49 -0500
committerMatthias Clasen <mclasen@redhat.com>2019-02-08 00:09:44 -0500
commit72b6644223af1f6ea2bc270204563433e28cf854 (patch)
treeec7bc2cca78ef525c2519c175a4c104c5cd3d167 /gtk/tools/gtk-builder-tool-validate.c
parent1fb3febacc293da9d36321c31aa4c099f59ace15 (diff)
downloadgtk+-72b6644223af1f6ea2bc270204563433e28cf854.tar.gz
builder tool: Operate on multiple files
There is no strong reason to disallow this, when the --replace option is used.
Diffstat (limited to 'gtk/tools/gtk-builder-tool-validate.c')
-rw-r--r--gtk/tools/gtk-builder-tool-validate.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/gtk/tools/gtk-builder-tool-validate.c b/gtk/tools/gtk-builder-tool-validate.c
index 33ee6ff22b..a64bb2d3e1 100644
--- a/gtk/tools/gtk-builder-tool-validate.c
+++ b/gtk/tools/gtk-builder-tool-validate.c
@@ -119,17 +119,14 @@ parse_template_error (const gchar *message,
return TRUE;
}
-void
-do_validate (int *argc, char ***argv)
+static gboolean
+validate_file (const char *filename)
{
GtkBuilder *builder;
GError *error = NULL;
gint ret;
gchar *class_name = NULL;
gchar *parent_name = NULL;
- const gchar *filename;
-
- filename = (*argv)[1];
builder = gtk_builder_new ();
ret = gtk_builder_add_from_file (builder, filename, &error);
@@ -144,9 +141,24 @@ do_validate (int *argc, char ***argv)
}
else
{
- g_printerr ("%s\n", error->message);
- exit (1);
+ g_printerr ("%s: %s\n", filename, error->message);
+ return FALSE;
}
}
+
+ return TRUE;
}
+void
+do_validate (int *argc, char ***argv)
+{
+ int i;
+
+ for (i = 1; i < *argc; i++)
+ {
+ if (!validate_file ((*argv)[i]))
+ exit (1);
+ }
+
+ return;
+}