Add an option to disable the indicators.

This commit is contained in:
Christoph Lohmann 2013-04-14 14:26:44 +02:00
parent a383964c95
commit 083ea8ecde
2 changed files with 26 additions and 19 deletions

View file

@ -9,6 +9,7 @@ static time_t sessiontime = 3600;
static char *cafile = "/etc/ssl/certs/ca-certificates.crt"; static char *cafile = "/etc/ssl/certs/ca-certificates.crt";
static char *strictssl = FALSE; /* Refuse untrusted SSL connections */ static char *strictssl = FALSE; /* Refuse untrusted SSL connections */
static Bool kioskmode = FALSE; /* Ignore shortcuts */ static Bool kioskmode = FALSE; /* Ignore shortcuts */
static Bool showindicators = TRUE; /* Show indicators in window title */
static guint defaultfontsize = 12; static guint defaultfontsize = 12;

30
surf.c
View file

@ -158,7 +158,7 @@ static void titlechange(WebKitWebView *v, WebKitWebFrame *frame,
static void toggle(Client *c, const Arg *arg); static void toggle(Client *c, const Arg *arg);
static void togglescrollbars(Client *c, const Arg *arg); static void togglescrollbars(Client *c, const Arg *arg);
static void togglestyle(Client *c, const Arg *arg); static void togglestyle(Client *c, const Arg *arg);
static void update(Client *c); static void updatetitle(Client *c);
static void updatewinid(Client *c); static void updatewinid(Client *c);
static void usage(void); static void usage(void);
static void windowobjectcleared(GtkWidget *w, WebKitWebFrame *frame, static void windowobjectcleared(GtkWidget *w, WebKitWebFrame *frame,
@ -559,7 +559,7 @@ linkhover(WebKitWebView *v, const char* t, const char* l, Client *c) {
free(c->linkhover); free(c->linkhover);
c->linkhover = NULL; c->linkhover = NULL;
} }
update(c); updatetitle(c);
} }
static void static void
@ -585,7 +585,7 @@ loadstatuschange(WebKitWebView *view, GParamSpec *pspec, Client *c) {
break; break;
case WEBKIT_LOAD_FINISHED: case WEBKIT_LOAD_FINISHED:
c->progress = 100; c->progress = 100;
update(c); updatetitle(c);
break; break;
default: default:
break; break;
@ -620,7 +620,7 @@ loaduri(Client *c, const Arg *arg) {
c->progress = 0; c->progress = 0;
c->title = copystr(&c->title, u); c->title = copystr(&c->title, u);
g_free(u); g_free(u);
update(c); updatetitle(c);
} }
} }
@ -924,7 +924,7 @@ processx(GdkXEvent *e, GdkEvent *event, gpointer d) {
static void static void
progresschange(WebKitWebView *view, GParamSpec *pspec, Client *c) { progresschange(WebKitWebView *view, GParamSpec *pspec, Client *c) {
c->progress = webkit_web_view_get_progress(c->view) * 100; c->progress = webkit_web_view_get_progress(c->view) * 100;
update(c); updatetitle(c);
} }
static void static void
@ -1072,7 +1072,7 @@ stop(Client *c, const Arg *arg) {
static void static void
titlechange(WebKitWebView *v, WebKitWebFrame *f, const char *t, Client *c) { titlechange(WebKitWebView *v, WebKitWebFrame *f, const char *t, Client *c) {
c->title = copystr(&c->title, t); c->title = copystr(&c->title, t);
update(c); updatetitle(c);
} }
static void static void
@ -1137,7 +1137,7 @@ togglestyle(Client *c, const Arg *arg) {
uri = uri[0] ? g_strdup("") : g_strconcat("file://", stylefile, NULL); uri = uri[0] ? g_strdup("") : g_strconcat("file://", stylefile, NULL);
g_object_set(G_OBJECT(settings), "user-stylesheet-uri", uri, NULL); g_object_set(G_OBJECT(settings), "user-stylesheet-uri", uri, NULL);
update(c); updatetitle(c);
} }
static void static void
@ -1181,23 +1181,29 @@ getpagestat(Client *c) {
} }
static void static void
update(Client *c) { updatetitle(Client *c) {
char *t; char *t;
if(showindicators) {
gettogglestat(c); gettogglestat(c);
getpagestat(c); getpagestat(c);
if(c->linkhover) { if(c->linkhover) {
t = g_strdup_printf("%s:%s | %s", togglestat, pagestat, c->linkhover); t = g_strdup_printf("%s:%s | %s", togglestat,
pagestat, c->linkhover);
} else if(c->progress != 100) { } else if(c->progress != 100) {
t = g_strdup_printf("[%i%%] %s:%s | %s", c->progress, togglestat, t = g_strdup_printf("[%i%%] %s:%s | %s", c->progress,
pagestat, c->title); togglestat, pagestat, c->title);
} else { } else {
t = g_strdup_printf("%s:%s | %s", togglestat, pagestat, c->title); t = g_strdup_printf("%s:%s | %s", togglestat, pagestat,
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 {
gtk_window_set_title(GTK_WINDOW(c->win), c->title);
}
} }
static void static void