X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=surf.c;h=390eaf0b8d7e99502ab298c7f3a442cfbd678064;hb=244dfd3231d989909566727b9e20d10cdff88a20;hp=3b291b548507c528d6265a54d2d9d9aaea6746e2;hpb=4ce3808684c5ea5d14eab0c3e24119784d2ae255;p=surf.git diff --git a/surf.c b/surf.c index 3b291b5..390eaf0 100644 --- a/surf.c +++ b/surf.c @@ -453,8 +453,7 @@ void linkhover(WebKitWebView *v, const char* t, const char* l, Client *c) { if(l) { c->linkhover = copystr(&c->linkhover, l); - } - else if(c->linkhover) { + } else if(c->linkhover) { free(c->linkhover); c->linkhover = NULL; } @@ -504,8 +503,7 @@ loaduri(Client *c, const Arg *arg) { /* prevents endless loop */ if(c->uri && strcmp(u, c->uri) == 0) { reload(c, &a); - } - else { + } else { webkit_web_view_load_uri(c->view, u); c->progress = 0; c->title = copystr(&c->title, u); @@ -905,6 +903,7 @@ update(Client *c) { gtk_widget_hide_all(c->indicator); t = g_strdup(c->title); } + gtk_window_set_title(GTK_WINDOW(c->win), t); g_free(t); } @@ -919,7 +918,7 @@ void usage(void) { fputs("surf - simple browser\n", stderr); die("usage: surf [-c cookiefile] [-e xid] [-i] [-p] [-r scriptfile]" - " [-s] [-t stylefile] [-v] [-x] [uri]\n"); + " [-s] [-t stylefile] [-u useragent] [-v] [-x] [uri]\n"); } void @@ -944,6 +943,8 @@ int main(int argc, char *argv[]) { Arg arg; + memset(&arg, 0, sizeof(arg)); + /* command line args */ ARGBEGIN { case 'c': @@ -967,6 +968,9 @@ main(int argc, char *argv[]) { case 't': stylefile = EARGF(usage()); break; + case 'u': + useragent = EARGF(usage()); + break; case 'x': showxid = TRUE; break; @@ -982,6 +986,7 @@ main(int argc, char *argv[]) { newclient(); if(arg.v) loaduri(clients, &arg); + gtk_main(); cleanup();