Explanation on signals, properties or methods with the same name in Gtk with vala

Hello everyone,

This has come up a few times now during my vala development with GTK and Libadwaita, signals/methods/properties that have identical names in inheriting classes. For example:

What is the correct way to handle these collisions? E.G. window.destroy.connect does not work as it is mapped already to the method, and using UI template files I stumble upon the same issue.

Thank you all for your time!

1 Like

My take on the visible property is this:

These properties behave very differently and are never available simultaneous.

Setting visible for GtkWidget is more like calling show() as it will trigger a series of init signals i.e. realize → map → show. In a way, it’s part of the life-cycle of a widget.

On the other hand, setting visible for StackPage is more literal. If a StackPage is not visible, then it’s not available. Setting visible here doesn’t emit a signal, as far as I can tell. And it’s not like set_visible_child from GtkStack/AdwViewStack. If you have a AdwViewSwitcherBar/GtkStackSwitcher with multiple StackPage’s, and one is set invisible, then the selection option for that StackPage will not appear at all.

GtkStackPage is not a GtkWidget, so there’s no collision.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.