I have a few child widgets that I’m trying to have the visibility be toggle-able using GObject properties. Something like this would show the tray icons, and hide the launcher and user icon:
However, this apparently does not work when using a GtkBuilder file.The strangest thing that I found with this in testing is that the icons toggle just fine in the Glade UI builder application. The class is called ExpidusWidgetsPanel` and the code for it is on the ExpidusOS Shell GitHub, which I have linked, and is under src/widgets/panel.c. The widget builds partly from a Glade file, that might affect the outcome of the result but I don’t think so.
GitHub: shorturl.at/aqBC6 (Note that I had to shorten it since Discourse seems to be a bit weird with anti-spam)
Shouldn’t your g_object_set() call be null-finished? (I’m not really knowledgeable in Gtk in C.)
Also, I think GtkBuilder inits properties at the object construct stage, so you probably should use one of the G_PARAM_CONSTRUCT or G_PARAM_CONSTRUCT_ONLY flags.
That g_object_set is just an example of how I intended the visibility to be toggled. The widgets are meant to be shown/hidden at any time. Did you look at my code on GitHub to see what could be the issue?
GtkBuilder constructs objects with all the properties it can; G_PARAM_CONSTRUCT and G_PARAM_CONSTRUCT_ONLY have no bearing on the properties being set: if it’s in the XML, it’ll be applied.
Additionally, template children are available as soon as gtk_widget_init_template() is called, which means by the time set_property() is called, every template child is available.
I mean the children; tray, user, and launcher. Those widgets are still visible even though they are set as hidden here: github .com /ExpidusOS/shell/blob/master/src/greeter/greeter.glade#L30-L32
I set the visibility in code here: github .com /ExpidusOS/shell/blob/master/src/widgets/panel.c#L59-L76
No warnings at runtime, I get the object here: github .com /ExpidusOS/shell/blob/master/src/greeter/main.c#L94
Since there are no warnings, I’m assuming “gtk_widget_set_visible” is working.
Do you set the no-show-all property on those widgets? I see some calls to gtk_widget_show_all() in the code (but not sure it’s on a parent of those widgets or not).
I don’t think so because the other widgets are working just fine and in Glade, the UI builder program, allows me to hide and show the elements through the ExpdusWidgetsPanel properties.