I've been doing a lot of gtk stuff lately and it is hard to debug. Presuming that CCP is a real struct and not a struct*, I don't see anything wrong with your set-up, altho I would include a cast with g_signal_connect (so the last argument is (gpointer*)©ing).
What you could try is a slightly different struct containing two char pointers to make sure you have all the syntax working:
Code:
#include <gtk/gtk.h>
typedef struct {
char *this;
char *that;
} example;
void callback_func (GtkWidget *ignored, example *test) {
printf("%s and %s\n",test->this, test->that);
}
int main(int argc, char *argv[]) {
char this[]="this", that[]="that";
example test;
GtkWidget *window, *button;
test.this=this;
test.that=that;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (gtk_main_quit), NULL);
g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit), NULL);
button = gtk_button_new_with_label("click here");
gtk_container_add(GTK_CONTAINER(window),button);
g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (callback_func), (gpointer*)&test);
gtk_widget_show_all(window);
gtk_main ();
return 0;
}
Since that all works, then trying writing callbacks passing your struct, but which only uses one of the elements, to see if it isn't something related to that.
If you include statements like this on every other line in the callback:
Code:
g_print("callback() line1, myvar=%d\n",myvar); fflush(stdout);
You should be able to get a good idea of where something is going wrong. It is tedious, but you cannot debug gtk stuff in a normal degbugger very effectively, so it might be your only choice.
There is also gtkforums