From f12d31760b4945f8b4978e7d629bb036a626beba Mon Sep 17 00:00:00 2001 From: Jean-Philippe Orsini Date: Wed, 23 Apr 2014 10:46:01 +0200 Subject: [PATCH] added status bar containing the target url --- src/glade/prss.glade | 42 +++++++++++++++++++++++++++++++++++++----- src/main.c | 3 +++ src/webbrowser.c | 22 +++++++++++++++++++++- src/webbrowser.h | 6 ++++-- 4 files changed, 65 insertions(+), 8 deletions(-) diff --git a/src/glade/prss.glade b/src/glade/prss.glade index a4d03a5..692364e 100644 --- a/src/glade/prss.glade +++ b/src/glade/prss.glade @@ -573,18 +573,50 @@ - + True - True - in + False + vertical - + + True + True + in + + + + + + True + True + 0 + + + + + True + False + False + start + end + 4 + 4 + True + 0.040000000000000001 + 1 + + + False + True + end + 1 + True True - 1 + 3 diff --git a/src/main.c b/src/main.c index e7d17d0..d9182d3 100644 --- a/src/main.c +++ b/src/main.c @@ -604,6 +604,9 @@ int main(int argc, char **argv) panh = GTK_WIDGET(gtk_builder_get_object(builder, "webkit_window")); + webbrowser_init(GTK_LABEL(gtk_builder_get_object(builder, + "browser_status"))); + gtk_container_add(GTK_CONTAINER(panh), web_get_widget()); g_object_unref(G_OBJECT(builder)); diff --git a/src/webbrowser.c b/src/webbrowser.c index 9204f57..ebbfce1 100644 --- a/src/webbrowser.c +++ b/src/webbrowser.c @@ -22,6 +22,7 @@ #include "webbrowser.h" static WebKitWebView *view; +static GtkLabel *w_status; static gboolean new_window_requested_cbk(WebKitWebView *view, WebKitWebFrame *frame, @@ -36,6 +37,17 @@ 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) +{ + if (uri) + gtk_label_set_label(w_status, uri); + else + gtk_label_set_label(w_status, ""); +} + GtkWidget *web_get_widget() { if (!view) { @@ -44,7 +56,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 +69,8 @@ void web_load(const char *str) { webkit_web_view_load_string(view, str, NULL, "UTF-8", "file://"); } + +void webbrowser_init(GtkLabel *status) +{ + w_status = status; +} diff --git a/src/webbrowser.h b/src/webbrowser.h index 5bf0b83..ae3e21d 100644 --- a/src/webbrowser.h +++ b/src/webbrowser.h @@ -17,9 +17,11 @@ * 02110-1301 USA */ #ifndef _PRSS_WEBBROWSER_H_ -#define _PHTTP_H_ +#define _PRSS_WEBBROWSER_H_ + +#include GtkWidget *web_get_widget(); void web_load(const char *); - +void webbrowser_init(GtkLabel *); #endif -- 2.7.4