Adapt updatetitle()

Now always show loading progress, still print mouse over link uri before
page uri. Process simplyfied because we use const strings.
This commit is contained in:
Quentin Rameau 2015-11-20 16:59:15 +01:00
parent b5096b1c8f
commit e6cefa584e
1 changed files with 12 additions and 14 deletions

26
surf.c
View File

@ -1414,29 +1414,27 @@ getpagestats(Client *c)
void void
updatetitle(Client *c) updatetitle(Client *c)
{ {
char *t; char *title;
if (showindicators) { if (showindicators) {
gettogglestats(c); gettogglestats(c);
getpagestats(c); getpagestats(c);
if (c->linkhover) { if (c->progress != 100) {
t = g_strdup_printf("%s:%s | %s", togglestats, pagestats, title = g_strdup_printf("[%i%%] %s:%s | %s",
c->linkhover); c->progress, togglestats, pagestats,
} else if (c->progress != 100) { c->targeturi ? c->targeturi : c->title);
t = g_strdup_printf("[%i%%] %s:%s | %s", c->progress,
togglestats, pagestats,
c->title == NULL ? "" : c->title);
} else { } else {
t = g_strdup_printf("%s:%s | %s", togglestats, pagestats, title = g_strdup_printf("%s:%s | %s",
c->title == NULL ? "" : c->title); togglestats, pagestats,
c->targeturi ? c->targeturi : c->title);
} }
gtk_window_set_title(GTK_WINDOW(c->win), t); gtk_window_set_title(GTK_WINDOW(c->win), title);
g_free(t); g_free(title);
} else { } else {
gtk_window_set_title(GTK_WINDOW(c->win), (c->title == NULL) ? gtk_window_set_title(GTK_WINDOW(c->win), c->title ?
"" : c->title); c->title : "");
} }
} }