GtkBuilder: improved parsing error report for invalid properties and signals.
Added GTK_BUILDER_ERROR_INVALID_PROPERTY and GTK_BUILDER_ERROR_INVALID_SIGNAL error codes ObjectInfo: Use a GType instead of a char * for the class name. PropertyInfo: Use a GParamSpec instead of a char * for the property name. SignalInfo: Use signal id and detail quark instead of a detailed signal name string. This not only save us a few malloc in each case but lets us simplify the code and report unknown properties and signals as a parsing error instead of just printing a warning.
This commit is contained in:
@ -131,6 +131,20 @@ test_parser (void)
|
||||
GTK_BUILDER_ERROR_DUPLICATE_ID));
|
||||
g_error_free (error);
|
||||
|
||||
error = NULL;
|
||||
gtk_builder_add_from_string (builder, "<interface><object class=\"GtkButton\" id=\"a\"><property name=\"deafbeef\"></property></object></interface>", -1, &error);
|
||||
g_assert (g_error_matches (error,
|
||||
GTK_BUILDER_ERROR,
|
||||
GTK_BUILDER_ERROR_INVALID_PROPERTY));
|
||||
g_error_free (error);
|
||||
|
||||
error = NULL;
|
||||
gtk_builder_add_from_string (builder, "<interface><object class=\"GtkButton\" id=\"a\"><signal name=\"deafbeef\" handler=\"gtk_true\"/></object></interface>", -1, &error);
|
||||
g_assert (g_error_matches (error,
|
||||
GTK_BUILDER_ERROR,
|
||||
GTK_BUILDER_ERROR_INVALID_SIGNAL));
|
||||
g_error_free (error);
|
||||
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user