From 2ea30ab741b8b4876bdce2e8dc0772b07cbdcf88 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Orsini Date: Wed, 23 Apr 2014 11:09:18 +0200 Subject: [PATCH] use status bar widget --- src/glade/prss.glade | 62 +++++++++++++++++++++------------------------------- src/main.c | 4 ++-- src/webbrowser.c | 12 ++++++---- src/webbrowser.h | 2 +- 4 files changed, 36 insertions(+), 44 deletions(-) diff --git a/src/glade/prss.glade b/src/glade/prss.glade index 692364e..6a54197 100644 --- a/src/glade/prss.glade +++ b/src/glade/prss.glade @@ -573,52 +573,23 @@ - + True - False - vertical - - - True - True - in - - - - - - True - True - 0 - - + True + in - - True - False - False - start - end - 4 - 4 - True - 0.040000000000000001 - 1 - - - False - True - end - 1 - + True True - 3 + 1 + + + True @@ -638,6 +609,23 @@ 2 + + + True + False + 10 + 10 + 6 + 6 + vertical + 2 + + + False + True + 3 + + diff --git a/src/main.c b/src/main.c index d9182d3..0717ce9 100644 --- a/src/main.c +++ b/src/main.c @@ -604,8 +604,8 @@ 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"))); + webbrowser_init(GTK_STATUSBAR(gtk_builder_get_object + (builder, "statusbar"))); gtk_container_add(GTK_CONTAINER(panh), web_get_widget()); diff --git a/src/webbrowser.c b/src/webbrowser.c index ebbfce1..4f77fed 100644 --- a/src/webbrowser.c +++ b/src/webbrowser.c @@ -22,7 +22,7 @@ #include "webbrowser.h" static WebKitWebView *view; -static GtkLabel *w_status; +static GtkStatusbar *w_status; static gboolean new_window_requested_cbk(WebKitWebView *view, WebKitWebFrame *frame, @@ -42,10 +42,14 @@ static void hovering_over_link_cbk(WebKitWebView *web_view, gchar *uri, gpointer user_data) { + guint id; + + id = gtk_statusbar_get_context_id(w_status, "info"); + if (uri) - gtk_label_set_label(w_status, uri); + gtk_statusbar_push(w_status, id, uri); else - gtk_label_set_label(w_status, ""); + gtk_statusbar_pop(w_status, id); } GtkWidget *web_get_widget() @@ -70,7 +74,7 @@ void web_load(const char *str) webkit_web_view_load_string(view, str, NULL, "UTF-8", "file://"); } -void webbrowser_init(GtkLabel *status) +void webbrowser_init(GtkStatusbar *status) { w_status = status; } diff --git a/src/webbrowser.h b/src/webbrowser.h index ae3e21d..f81f14b 100644 --- a/src/webbrowser.h +++ b/src/webbrowser.h @@ -23,5 +23,5 @@ GtkWidget *web_get_widget(); void web_load(const char *); -void webbrowser_init(GtkLabel *); +void webbrowser_init(GtkStatusbar *); #endif -- 2.7.4