commit: df054a6cac79d19a27e677ae92f5879d1e675790
parent: e5ca3b1e8bd68d3199d2874fbc505ee58b83f244
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sun, 10 Mar 2019 16:58:41 +0100
badwolf.c: limit characters in tabs
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/badwolf.c b/badwolf.c
@@ -98,12 +98,19 @@ WebViewCb_notify__title(WebKitWebView *webView, GParamSpec *pspec, gpointer user
const gchar *title;
struct Client *browser = (struct Client *)user_data;
+#define BADWOLF_TAB_MAXCHARS 16
+
title = webkit_web_view_get_title(browser->webView);
if(title == NULL) title = webkit_web_view_get_uri(browser->webView);
if(title == NULL) title = "BadWolf";
+ if(strlen(title) > BADWOLF_TAB_MAXCHARS)
+ {
+ title = g_strndup(title, BADWOLF_TAB_MAXCHARS);
+ }
+
gtk_notebook_set_tab_label_text(GTK_NOTEBOOK(browser->window->notebook), browser->box, title);
return TRUE;