I'm into a problem with a GTK+ C application. I have a container that, when starting the application, contains a button. During the running an user interation must cause this widget to contain more of them.
I need to write a function that removes all the "old" inner buttons, then adds all the ones from a list and finally refresh the view. This is what I'm writing but some parts are missing (TODOs)
void refresh_sequence_panel()
{
GSList* iterator = NULL;
GtkWidget* button;
// TODO: Here the container must be empty
// Now add all the buttons
for (iterator = steps; iterator; iterator = iterator->next) {
button = gtk_button_new_from_stock(GTK_STOCK_ADD);
gtk_widget_set_size_request(button, SEQ_BUTTON_W, SEQ_BUTTON_H);
gtk_box_pack_start(GTK_BOX(sequence_panel), button, FALSE, FALSE, 5);
handler_id = g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(seq_popup), GTK_BOX(sequence_panel));
}
// TODO: Now refresh the view, so I can see the changes...
}
Hope that someone can help, thanks!
One-liner:
gtk_container_foreach (GTK_CONTAINER (container), (void*) gtk_widget_destroy, NULL);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With