Ejemplo n.º 1
0
static void
aboutURISchemeRequestCallback(WebKitURISchemeRequest *request, gpointer userData)
{
    GInputStream *stream;
    gsize streamLength;
    const gchar *path;
    gchar *contents;
    GError *error;

    path = webkit_uri_scheme_request_get_path(request);
    if (!g_strcmp0(path, "minibrowser")) {
        contents = g_strdup_printf("<html><body><h1>WebKitGTK+ MiniBrowser</h1><p>The WebKit2 test browser of the GTK+ port.</p><p>WebKit version: %d.%d.%d</p></body></html>",
            webkit_get_major_version(),
            webkit_get_minor_version(),
            webkit_get_micro_version());
        streamLength = strlen(contents);
        stream = g_memory_input_stream_new_from_data(contents, streamLength, g_free);

        webkit_uri_scheme_request_finish(request, stream, streamLength, "text/html");
        g_object_unref(stream);
    } else {
        error = g_error_new(MINI_BROWSER_ERROR, MINI_BROWSER_ERROR_INVALID_ABOUT_PATH, "Invalid about:%s page.", path);
        webkit_uri_scheme_request_finish_error(request, error);
        g_error_free(error);
    }
}
Ejemplo n.º 2
0
JNIEXPORT void JNICALL Java_org_gnome_webKit_WebView_initNewWindowSignal
(JNIEnv *env, jobject thisObj, jlong thisPtr)
{
  g_printf("Using Webkit version %d.%d.%d\n", webkit_get_major_version(), webkit_get_minor_version(), webkit_get_micro_version());
  g_printf("Connecting new window signal\n");
  WebKitWebView* thisWnd = (WebKitWebView*)thisPtr;
 

  g_signal_connect(G_OBJECT(thisWnd), "create", G_CALLBACK(createWebView), 0);
  g_printf("Connected to create-web-view signal\n");
  fflush(stdout);
}