1

我正在使用 WebKitGtk2 开发一个 Web 应用程序,我需要将“window-object-cleared”信号与 WebKitWebFrame 一起使用。当我编译它时,我得到了一个错误:

main.cc:11:1: error: ‘WebKitFrame’ does not name a type

编译:

c++ main.cc -w `pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0` -o m

对此进行了检查并尝试使用 WebKitFrame 代替,但同样的事情发生了。

这是我的代码

    GtkWidget *main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_default_size(GTK_WINDOW(main_window), 800, 600);
    WebKitWebView *webView = WEBKIT_WEB_VIEW(webkit_web_view_new());

  
    gtk_container_add(GTK_CONTAINER(main_window), GTK_WIDGET(webView));
    g_signal_connect(main_window, "destroy", G_CALLBACK(destroyWindowCb), NULL);
    g_signal_connect(webView, "window-object-cleared", G_CALLBACK(woCleared), main_window);

回调函数

void
woCleared (WebKitWebView  *web_view,
               WebKitWebFrame *frame,       /* this line error*/
               gpointer        context,
               gpointer        window_object,
               gpointer        user_data){
      
   // my code

}

我是 webkitgtk 的新手。

4

0 回答 0