The Entries
array is local to your activate()
function; you cannot use it inside the print_text()
callback.
If you want to set up an array of entries and use it inside a callback, you’ll have to allocate it, like:
GtkEntry **entries = g_new (GtkEntry*, 2);
entries[0] = GTK_ENTRY (EntryIn);
entries[1] = GTK_ENTRY (EntryOut);
Or you can use one of the array containers inside GLib, like GPtrArray
:
GPtrArray *entries = g_ptr_array_new ();
g_ptr_array_add (entries, EntryIn);
g_ptr_array_add (entries, EntryOut);
and then either use the pdata
field to access the entry, or the convenience g_ptr_array_index()
macro:
GPtrArray *entries = user_data;
GtkEntry *entryIn = entries->pdata[0]; // or g_ptr_array_index (entries, 0)
GtkEntry *entryOut = entries->pdata[1]; // or g_ptr_array_index (entries, 1)