To call a non-static class function/method, you need to convey to GTK a pointer to the instance of the class.
I am not familiar with GTK, so I am not sure how to do this. From this webpage, it appears that the GTK-function you are attempting to use has a signature as follows:
Code:
#define g_signal_connect (instance, detailed_signal, c_handler, data)
P.S. Upon doing a little more research, it would seem that you need to pass your object's instance as the 'data' parameter, instead of NULL, as you are passing now. The callback function needs to be declared as static. Once inside it, use the 'data' parameter as the instance to your object.
Code:
class MyClass
{
public:
MyClass()
{
g_signal_connect(G_OBJECT(this->savebutton), "clicked", G_CALLBACK(&this->doSaveCallback), this);
}
static void doSaveCallback(GstElement* element, GstPad* pad, MyClass* data)
{
data->doSave();
}
private:
void doSave()
{
...
}
};
Bookmarks