Re: libseed-list Exposing GObjects in a Webview JS context



After wasting so much time, I found out you don't need to install latest
version of Webkit. For anybody who tries to run the test program for
this patch and gets the GLib-ERROR error, you have to add code to
initialise threading. The code is as follows (only the main () function
needs amending): 


int main(int argc, char **argv)
{

  if( !g_thread_supported() )
  {
    g_thread_init(NULL);
    gdk_threads_init();       
    printf("g_thread supported\n");
  }
  else
  {
    printf("g_thread NOT supported\n");
  }

  gtk_init(&argc, &argv);

  GtkWidget *web_view = webkit_web_view_new ();
  g_signal_connect(G_OBJECT(web_view), "window-object-cleared", 
                                G_CALLBACK(window_object_cleared),
NULL);

  GtkWidget* window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window), "Webview + Seed demo");

  g_signal_connect (G_OBJECT (window), "destroy",
                      G_CALLBACK (destroy), NULL);
  g_signal_connect (G_OBJECT(window), "delete_event", 
                   G_CALLBACK(delete_event), NULL);
  gtk_container_add (GTK_CONTAINER(window), web_view);
  gtk_widget_show_all (window);
  
  gchar* uri =  "file://./test.html";
  webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), uri);
  
  gtk_main();
  return 0;
}

It's been one of those weeks!!!





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]