Making the empty title possible.

This commit is contained in:
Christoph Lohmann 2014-02-05 21:14:16 +01:00
parent b7435badc2
commit 361da0b3c4
1 changed files with 15 additions and 9 deletions

24
surf.c
View File

@ -707,6 +707,9 @@ newclient(void) {
if(!(c = calloc(1, sizeof(Client)))) if(!(c = calloc(1, sizeof(Client))))
die("Cannot malloc!\n"); die("Cannot malloc!\n");
c->title = NULL;
c->progress = 100;
/* Window */ /* Window */
if(embed) { if(embed) {
c->win = gtk_plug_new(embed); c->win = gtk_plug_new(embed);
@ -890,9 +893,6 @@ newclient(void) {
if(hidebackground) if(hidebackground)
webkit_web_view_set_transparent(c->view, TRUE); webkit_web_view_set_transparent(c->view, TRUE);
c->title = "";
c->progress = 100;
updatetitle(c);
c->next = clients; c->next = clients;
clients = c; clients = c;
@ -1337,16 +1337,18 @@ updatetitle(Client *c) {
pagestat, c->linkhover); pagestat, c->linkhover);
} else if(c->progress != 100) { } else if(c->progress != 100) {
t = g_strdup_printf("[%i%%] %s:%s | %s", c->progress, t = g_strdup_printf("[%i%%] %s:%s | %s", c->progress,
togglestat, pagestat, c->title); togglestat, pagestat,
(c->title == NULL)? "" : c->title);
} else { } else {
t = g_strdup_printf("%s:%s | %s", togglestat, pagestat, t = g_strdup_printf("%s:%s | %s", togglestat, pagestat,
c->title); (c->title == NULL)? "" : c->title);
} }
gtk_window_set_title(GTK_WINDOW(c->win), t); gtk_window_set_title(GTK_WINDOW(c->win), t);
g_free(t); g_free(t);
} else { } else {
gtk_window_set_title(GTK_WINDOW(c->win), c->title); gtk_window_set_title(GTK_WINDOW(c->win),
(c->title == NULL)? "" : c->title);
} }
} }
@ -1390,6 +1392,7 @@ zoom(Client *c, const Arg *arg) {
int int
main(int argc, char *argv[]) { main(int argc, char *argv[]) {
Arg arg; Arg arg;
Client *c;
memset(&arg, 0, sizeof(arg)); memset(&arg, 0, sizeof(arg));
@ -1462,7 +1465,7 @@ main(int argc, char *argv[]) {
useragent = EARGF(usage()); useragent = EARGF(usage());
break; break;
case 'v': case 'v':
die("surf-"VERSION", ©2009-2012 surf engineers, " die("surf-"VERSION", ©2009-2014 surf engineers, "
"see LICENSE for details\n"); "see LICENSE for details\n");
case 'x': case 'x':
showxid = TRUE; showxid = TRUE;
@ -1477,9 +1480,12 @@ main(int argc, char *argv[]) {
arg.v = argv[0]; arg.v = argv[0];
setup(); setup();
newclient(); c = newclient();
if(arg.v) if(arg.v) {
loaduri(clients, &arg); loaduri(clients, &arg);
} else {
updatetitle(c);
}
gtk_main(); gtk_main();
cleanup(); cleanup();