Hi,
I seem to have a similar problem to this case:
c - char* in a gpointer sends a string in a strange encoding - Stack Overflow
I made recent_title a global variable as explained in the link. But I still get gibberish message. Parts of code:
gtk/xboard.h
gtk/xboard.cCode:extern GtkRecentInfo *recents_ptr[RECENTS_COUNT+1]; extern gchar recent_title[20];
gtk/xoptions.cCode:GtkRecentInfo *recents_ptr[RECENTS_COUNT+1]; gchar recent_title[20]; [...] void show_message_dialog(const gchar * const message) { GtkWidget* dialog = gtk_message_dialog_new (GTK_WINDOW(mainwindow), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "Message: %s", message); /* Destroy the dialog when the user responds to it (e.g. clicks a button) */ g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog); gtk_widget_show_all (dialog); return; } void show_message_dialog_event(GtkWidget*label_1,gpointer message) { show_message_dialog(message); return; }
What can I do ?Code:[...] produce_recent_items(); for(i=0; i<RECENTS_COUNT && recents_ptr[i] ; i++) { GtkRecentInfo *recent_wid=recents_ptr[i]; g_stpcpy(recent_title,"TTT3_\n"); show_message_dialog(recent_title); // Works OK const gchar *fn; fn=gtk_recent_info_get_uri(recent_wid); //show_message_dialog(fn); // TODO broken g_signal_connect(G_OBJECT(recent_wid),"activate" ,G_CALLBACK(show_message_dialog_event),(gpointer)recent_title);// recent_title shows gibberish }

