Fix printf formats for size_t and goffset arguments.
[claws.git] / src / plugins / fancy / fancy_viewer.c
index a10f6bca1e601c37a0a6fcf9a664c71266c42fa0..a6eddb2f5e8802d9964d45eda56a0ce17c230a07 100644 (file)
@@ -457,7 +457,7 @@ static void resource_request_starting_cb(WebKitWebView              *view,
                webkit_network_request_set_uri(request, "about:blank");
        }
        else
-               debug_print("Starting request of %zu %s\n", strlen(uri), uri);
+               debug_print("Starting request of %"G_GSIZE_FORMAT" %s\n", strlen(uri), uri);
 }
 
 static gboolean fancy_text_search(MimeViewer *_viewer, gboolean backward,
@@ -902,17 +902,30 @@ static gboolean press_button_cb (WebKitWebView *view, GdkEvent *ev,
                FancyViewer *viewer)
 {
        gint type = 0;
+       gchar *link = NULL;
+
        WebKitHitTestResult *result =
                webkit_web_view_get_hit_test_result(view, (GdkEventButton *)ev);
 
        g_object_get(G_OBJECT(result),
                        "context", &type,
-                       "x", &viewer->click_x, "y", &viewer->click_y,
+                       "x", &viewer->click_x,
+                       "y", &viewer->click_y,
+                       "link-uri", &link,
                        NULL);
 
        if (type & WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION)
                return FALSE;
 
+       if (viewer->cur_link) {
+               g_free(viewer->cur_link);
+               viewer->cur_link = NULL;
+       }
+       if (link != NULL) {
+               debug_print("press on %s\n", link);
+               viewer->cur_link = link; /* g_context returned a newly-allocated string */
+       }
+
        viewer->doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(viewer->view));
        viewer->window = webkit_dom_document_get_default_view (viewer->doc);
        viewer->selection = webkit_dom_dom_window_get_selection (viewer->window);