X-Git-Url: https://git.wpitchoune.net/gitweb/?p=prss.git;a=blobdiff_plain;f=src%2Fwebbrowser.c;h=bb69e34c2d84583bf391d27143d0c5add306367d;hp=9204f5778eafcfe918da40d9a6668cf84f7682ec;hb=73c15101957f314086cb32afb5af312f1a18ee42;hpb=3b1b6d606bbad81c4dd8b9b50f7f7aa9d56148fa diff --git a/src/webbrowser.c b/src/webbrowser.c index 9204f57..bb69e34 100644 --- a/src/webbrowser.c +++ b/src/webbrowser.c @@ -22,6 +22,7 @@ #include "webbrowser.h" static WebKitWebView *view; +static GtkStatusbar *w_status; static gboolean new_window_requested_cbk(WebKitWebView *view, WebKitWebFrame *frame, @@ -36,6 +37,21 @@ static gboolean new_window_requested_cbk(WebKitWebView *view, return TRUE; } +static void hovering_over_link_cbk(WebKitWebView *web_view, + gchar *title, + gchar *uri, + gpointer user_data) +{ + guint id; + + id = gtk_statusbar_get_context_id(w_status, "info"); + + if (uri) + gtk_statusbar_push(w_status, id, uri); + else + gtk_statusbar_remove_all(w_status, id); +} + GtkWidget *web_get_widget() { if (!view) { @@ -44,7 +60,10 @@ GtkWidget *web_get_widget() "new-window-policy-decision-requested", G_CALLBACK(new_window_requested_cbk), view); - + g_signal_connect(view, + "hovering-over-link", + G_CALLBACK(hovering_over_link_cbk), + NULL); } return GTK_WIDGET(view); @@ -54,3 +73,8 @@ void web_load(const char *str) { webkit_web_view_load_string(view, str, NULL, "UTF-8", "file://"); } + +void webbrowser_init(GtkStatusbar *status) +{ + w_status = status; +}