As I am aware, I can subscribe to Gtk.Box signal "add child":
box.connect("add", self.__add_to_switch_list)
which will be called when I add child by box.add(child)
, and it's working.
But how I would do the same with box.pack_start()
method?
There is no way.
"add"
is only emitted when you call GtkContainer.add().
The first handler of this signal is subclass' method. For example, GtkBox does this :
/* gtk_box_class init: */
container_class->add = gtk_box_add;
...
static void
gtk_box_add (GtkContainer *container,
GtkWidget *widget)
{
GtkBoxPrivate *priv = GTK_BOX (container)->priv;
gtk_box_pack_start (GTK_BOX (container), widget,
priv->default_expand,
TRUE,
0);
}