Gtk.Widget.set_name not setting the "name" property, get_name not returning it
@mjog
Submitted by Michael Gratton Link to original bug (#764622)
Description
Calling Gtk.Widget.set_name() in Vala does correctly set the widget's "name" property, and calling Gtk.Widget.get_name() does not return it.
For example, running the following:
Gtk.Label = new Gtk.Label("test");
test_label1.set_name("test_label");
stdout.printf("test_label1 name: %s\n", test_label1.get_name());
Gtk.Label test_label2 = new Gtk.Label("test");
test_label2.set_property("name", "test_label");
stdout.printf("test_label2 name: %s\n", test_label2.get_name());
Will print:
test_label1 name: test_label
test_label2 name: (null)
There's some weird interaction with Gtk.Buildable.{set_name,get_name} going on - in the above example test_label1 will have it set and test_label2 will not. So the Gtk.Buildable calls are taking priority somehow?
Explicitly casting the label to a Gtk.Widget before calling set_name() does not seem to help.
This is pretty annoying when using CSS styling because it means you need to use GObject.set_property("name", ...) to set the CSS id of the widget, instead of Gtk.Widget.set_name() as one would expect to work, per the docs.
GTK+ 3.20.2 Vala 0.32.0
Version: 0.32.x