reinitialize application



I have a main.c like this:

int
main (int argc, char *argv[])
{
  GtkWidget *window1;
  window1 = create_window1 ();
  gtk_widget_show (window1);

  gtk_main ();
  return 0;
}

and I have some callbacks in callbacks.c which modify some labels. now I
want to create a button "clear" which deletes all user inputs and lets
you start all over. so the simplest thing is probably to reinitialize
the window and is widgets, right?

unfortunately this doesn't work (in callbacks.c):

void
on_button4_clicked                     (GtkButton       *button,
                                        gpointer         user_data)
{
 GtkWidget * window1 = gtk_widget_get_toplevel(GTK_WIDGET(button));
 gtk_widget_queue_draw(lookup_widget(window1, "window1"));
}

what am I doing wrong? or are there any better ways of doing this?
I also tried doing a gtk_main_quit() followed by a gtk_main() but this
didn't work either.

cheers,
Andreas




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]