I have a function that I want to hide on pressing a button. I’ve read that I can define multiple callbacks on a signal and they will be called in the same order as defined. So I wanted to execute two functions on button press and I wanted one of them to hide window that contains this button. I tried to do it like this:
g_signal_connect(btn_confirm, "clicked", G_CALLBACK(function_that_does_stuff), NULL);
g_signal_connect(btn_confirm, "clicked", G_CALLBACK(kill_window), add_conn_win);
...
void kill_window ( GtkWidget* wdgt, GtkWidget* win )
{
gtk_widget_hide_all(win);
}
But this isn’t working. Window’s still there. Can someone tell me how to do that?
First things first, see what the documentation says about gtk_widget_hide_all():
Instead you should use gtk_widget_hide (). The specification says that it
As a comment said, make sure your callbacks are being triggered. Then try
gtk_widget_hide (win);I think that should do the work, let me know if it helps!