Re: reinitialize application



Hi,

       gtk_init( &argc, &argv);     /* you do have this somewhere
right? */

sorry, I forgot to post a bit of my main.c. so here's the complete one:


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

  gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE,
                      argc, argv,
                      GNOME_PARAM_APP_DATADIR, PACKAGE_DATA_DIR,
                      NULL);

  window1 = create_window1 ();
  gtk_widget_show (window1);

  gtk_main ();
  return 0;
}


The more standard way is to clear the program variables and set
null/zero/etc into the user input fields.  You can do this in a
callback routine.  I'm assuming you are using and entry_field or other
like widget for user input.

yes I do:

callbacks.c:

static gboolean
update                                 (gpointer         user_data)
{

 GtkButton *button;
 button = GTK_BUTTON(user_data);

 GtkWidget * label = lookup_widget(GTK_WIDGET(button), "label1");

 gchar* message;
 message = g_strdup_printf(" %.0f seconds to go",countdown);
 gtk_label_set_text(GTK_LABEL(label),message);
 g_free (message);
  
}

I'm getting the input for this routine from a different callback
routine:


void
on_button1_clicked                     (GtkButton       *button,
                                        gpointer         user_data)
{

GtkWidget * entry1  = lookup_widget(GTK_WIDGET(button), "entry1");
GtkWidget * entry2 = lookup_widget(GTK_WIDGET(button), "entry2");
gdouble minutes = g_strtod(gtk_entry_get_text(GTK_ENTRY(entry1)),NULL);
gdouble seconds = g_strtod(gtk_entry_get_text(GTK_ENTRY(entry2)),NULL);
countdown  = (minutes * 60) + seconds;
 
}

so what I'm looking after is a way to clear all those entry fields any
other variables which might have changed during the running program. 
so just reinitialize the app :)

andreas




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