Importing the generic toggle patch of stanio@cs.tu-berlin.de. Thanks!

This commit is contained in:
Christoph Lohmann
2012-11-15 14:52:22 +01:00
parent 244dfd3231
commit a283fa4bc9
2 changed files with 19 additions and 0 deletions
+15
View File
@@ -126,6 +126,7 @@ static void spawn(Client *c, const Arg *arg);
static void eval(Client *c, const Arg *arg);
static void stop(Client *c, const Arg *arg);
static void titlechange(WebKitWebView *v, WebKitWebFrame* frame, const char* title, Client *c);
static void toggle(Client *c, const Arg *arg);
static void update(Client *c);
static void updatewinid(Client *c);
static void usage(void);
@@ -889,6 +890,20 @@ titlechange(WebKitWebView *v, WebKitWebFrame *f, const char *t, Client *c) {
update(c);
}
void
toggle(Client *c, const Arg *arg) {
WebKitWebSettings *settings;
char *name = (char *)arg->v;
gboolean value;
Arg a = { .b = FALSE };
settings = webkit_web_view_get_settings(c->view);
g_object_get(G_OBJECT(settings), name, &value, NULL);
g_object_set(G_OBJECT(settings), name, !value, NULL);
reload(c,&a);
}
void
update(Client *c) {
char *t;