Hi,
OK it works, I put below my new function is case someone will fall in the same problem void on_view_profile_toggled (GtkButton *button, gpointer EditEndpointWindow) { GtkWidget *button_label = NULL; GtkWidget *profile_entry = NULL; gchar *attached_data; gchar *profile_name; profile_entry = lookup_widget(EditEndpointWindow, "profile_combo_entry"); profile_name = g_strdup(gtk_entry_get_text((GtkEntry *) profile_entry)); button_label = lookup_widget(EditEndpointWindow, "button_label"); attached_data = gtk_object_get_data(GTK_OBJECT (button), "profile_name"); if(gtk_toggle_button_get_active((GtkToggleButton *) button) == TRUE) { gtk_label_set_text((GtkLabel *) button_label,"View Current"); gtk_entry_set_text((GtkEntry *) profile_entry, "DEFAULT"); gtk_object_set_data_full(GTK_OBJECT (button),"profile_name", profile_name, (GtkDestroyNotify) g_free); } else { gtk_label_set_text((GtkLabel *) button_label,"View Default"); gtk_entry_set_text((GtkEntry *) profile_entry, attached_data); profile_name = g_strdup("DEFAULT"); gtk_object_set_data_full(GTK_OBJECT (button),"profile_name", profile_name, (GtkDestroyNotify) g_free); } } |---------+---------------------------> | | Sven Neumann | | | <[EMAIL PROTECTED]> | | | Sent by: | | | gtk-list-admin@g| | | nome.org | | | | | | | | | 31/07/2002 14:57| | | | |---------+---------------------------> >-------------------------------------------------------------------------------------------------------------------------------| | | | To: [EMAIL PROTECTED] | | cc: [EMAIL PROTECTED] | | Subject: Re: Can't correctly set data to an object (button) | >-------------------------------------------------------------------------------------------------------------------------------| Hi, [EMAIL PROTECTED] writes: > Well I have toggle button to wich I attached a default string ("DEFAULT") > using the gtk_object_set_user_data function. > > In the callback toggle function I reassign this string regarding the state > of the button. > > I pick up the new string from a gtk_entry. you use gtk_entry_get_text() which returns a pointer to the string owned by the GtkEntry. This pointer becomes invalid as soon as the text in the entry changes. You'll want to g_strdup() it and use g_object_set_data_full() with g_free() as destroy notifier. Salut, Sven _______________________________________________ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list _______________________________________________ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list