I am again at the same position, when I had the question What is the correct way to use g_signal_connect() in C++ for dynamic unity quicklists?
There I was informed that the signature for my static method was incorrect and that I had to add a guint argument in front of the others. Now I have the same problem but for the function called for the "scroll-event" signal that I want to make on to my indicator.
More specifically:
//connecting indicator with the scroll-event and altogether with the function indicator_scrolled
g_signal_connect(G_OBJECT(appindicator), "scroll-event", G_CALLBACK(&indicator_scrolled), (gpointer)this);
This is the function indicator_scrolled:
gboolean indicator_scrolled(GtkStatusIcon *status_icon, GdkEventScroll *event, gpointer data){
cout << "The indicator was scrolled\n";
MainWindow* m = (MainWindow*)data;
m->action_on_scroll();
}
I can see the "Indicator was scrolled" message but then the program crashed. Adding a guint argument in front of the others didn't solved the problem.
So, what is the correct signature for this function so as to make it work? How can I find what is the correct signature each time so as to avoid this kind of questions? (At the other question user George Edison talked about valgrind
but he did not clarify)
Please do not advice that AppIndicators are not the correct way to go with Ubuntu+Qt, please see question Make sniqt recognize all tray abilities (or create a working indicator in Qt)
Edit: After tests I coincidentally found that a guint argument needs to be placed between the GtkStatusIcon and GdkEventScroll arguments. But I would really want to know a way to find out what is the correct function signature.