Commit 9e926f9a authored by Benjamin Otte's avatar Benjamin Otte

examples: Check for error when loading file

People playing with those examples tend to mess up things, so it's
really really unhelpful if we don't do error checking.
parent 5a0759bc
......@@ -14,12 +14,18 @@ main (int argc,
GtkBuilder *builder;
GObject *window;
GObject *button;
GError *error = NULL;
gtk_init (&argc, &argv);
/* Construct a GtkBuilder instance and load our UI description */
builder = gtk_builder_new ();
gtk_builder_add_from_file (builder, "builder.ui", NULL);
if (gtk_builder_add_from_file (builder, "builder.ui", &error) == 0)
g_printerr ("Error loading file: %s\n", error->message);
g_clear_error (&error);
return 1;
/* Connect signal handlers to the constructed widgets. */
window = gtk_builder_get_object (builder, "window");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment