title: member function as callback function to g_signal_connect
body: <p>I have created a simple class for creating gtk main window.</p>
  
  <p>I want to know what is correct way to pass class member function as an argument to G_CALLBACK function?</p>
  
  <p>Why </p>
  
  <blockquote>
    <p>g_signal_connect(button, "clicked", G_CALLBACK(&amp;MainWindow:
    nButtonClicked), NULL);</p>
  </blockquote>
  
  <p>is bad?</p>
  
  <pre><code>#include &lt;gtk/gtk.h&gt;
  
  class MainWindow {
  public:
      MainWindow();
      ~MainWindow();
      void onButtonClicked(GtkWidget* button, gpointer* data);
      void showWindow();
  
  private:
      GtkWidget* window;
      GtkWidget* button;
  };
  MainWindow::MainWindow()
  {
      window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
      g_signal_connect(window, "delete_event", G_CALLBACK(gtk_main_quit), NULL);
  
      button = gtk_button_new_with_label("click here");
      g_signal_connect(button, "clicked", G_CALLBACK(&amp;MainWindow: nButtonClicked), NULL);
  
      gtk_container_add(GTK_CONTAINER(window), button);
  }
  
  MainWindow::~MainWindow()
  {
  }
  
  void MainWindow::onButtonClicked(GtkWidget* button, gpointer* data)
  {
      g_printerr("button clicked\n");
  }
  
  void MainWindow::ShowWindow() {
      gtk_widget_show_all(window);
  }
  
  int main(int argc, char* argv[]) {
      gtk_init(&amp;argc, &amp;argv);
  
      MainWindow mainWindow;
      mainWindow.showWindow();
  
      gtk_main();
      return 0;
  }
  </code></pre>