I notice that g_param_value_validate *is* being called, and does return
FALSE, but it's not setting an error; it appears to g_logs a warning
and eventually aborts. Is there any way to make that validation check
non-fatal, so I can handle the error nicely?
Also, this behavior seems contradictory to the GObject documentation on
properties: "the GValue is validated by g_param_value_validate [...] As
such, the g_object_set_property function will return with an error."
g_object_set_property returns void and does not accept a GError. _______________________________________________
gtk-list mailing list
[hidden email] https://mail.gnome.org/mailman/listinfo/gtk-list
Re: GObject property validation during object construction
My understanding is that the private string gets setup in my_object_class_init(). Then in my_object_init() you can initialize it to a default value. After that, you can set a new string value using a property set accessor function that can validate the string and/or you can use CSS for a string value.
Worked on a couple of gauge widgets which the setup might be helpful. The adjustable_gauge_main() test programs validate some color strings from a GtkEntry. If the string isn't validated a simple warning is issued but the current or default value isn't changed.
They are in the adjustable gauge folders with the test programs for them. Also there is a Penrose folder with an object that uses CSS. That came from the GTK+ C++ or gtkmm tutorial which has a lot of great info.