Show history indicator '[+-]' in statusbar.
authorDaniel Carl <danielcarl@gmx.de>
Tue, 22 Oct 2013 18:54:24 +0000 (20:54 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Tue, 22 Oct 2013 19:02:17 +0000 (21:02 +0200)
src/config.def.h
src/main.c

index 3cd5876..6b65997 100644 (file)
@@ -27,6 +27,8 @@
 #define FEATURE_NO_SCROLLBARS
 #define FEATURE_TITLE_IN_COMPLETION
 #define FEATURE_QUEUE
+/* should the history indicator [+-] be shown in status bar after url */
+#define FEATURE_HISTORY_INDICATOR
 
 
 /* time in seconds after that message will be removed from inputbox if the
index 6d49db6..72f205d 100644 (file)
@@ -311,7 +311,25 @@ void vb_update_input_style(void)
 
 void vb_update_urlbar(const char *uri)
 {
-    gtk_label_set_text(GTK_LABEL(vb.gui.statusbar.left), uri);
+    Gui *gui = &vb.gui;
+#ifdef FEATURE_HISTORY_INDICATOR
+    gboolean back, fwd;
+    char *str;
+
+    back = webkit_web_view_can_go_back(gui->webview);
+    fwd  = webkit_web_view_can_go_forward(gui->webview);
+
+    /* show history indicator only if there is something to show */
+    if (back || fwd) {
+        str = g_strdup_printf("%s [%s]", uri, back ? (fwd ? "+-" : "+") : "-");
+        gtk_label_set_text(GTK_LABEL(gui->statusbar.left), str);
+        g_free(str);
+    } else {
+        gtk_label_set_text(GTK_LABEL(gui->statusbar.left), uri);
+    }
+#else
+    gtk_label_set_text(GTK_LABEL(gui->statusbar.left), uri);
+#endif
 }
 
 void vb_quit(void)