From 8d822c0e23f55e61169c267b9a2616e309264ded Mon Sep 17 00:00:00 2001 From: Marco Peereboom Date: Sun, 26 Dec 2010 22:55:39 +0000 Subject: add source view toggle --- xxxterm.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'xxxterm.c') diff --git a/xxxterm.c b/xxxterm.c index 34a17e0..aa00df4 100644 --- a/xxxterm.c +++ b/xxxterm.c @@ -28,7 +28,6 @@ * autocompletion on various inputs * create privacy browsing * - encrypted local data - * add js whitelist */ #include @@ -1078,6 +1077,21 @@ toggle_js(struct tab *t, struct karg *args) return (0); } +int +toggle_src(struct tab *t, struct karg *args) +{ + gboolean mode; + + if (t == NULL) + return (0); + + mode = webkit_web_view_get_view_source_mode(t->wv); + webkit_web_view_set_view_source_mode(t->wv, !mode); + webkit_web_view_reload(t->wv); + + return (0); +} + int focus(struct tab *t, struct karg *args) { @@ -2243,6 +2257,7 @@ struct key { { GDK_SHIFT_MASK, 0, GDK_colon, command, {.i = ':'} }, { GDK_CONTROL_MASK, 0, GDK_q, quit, {0} }, { GDK_CONTROL_MASK, 0, GDK_j, toggle_js, {0} }, + { GDK_CONTROL_MASK, 0, GDK_s, toggle_src, {0} }, /* search */ { 0, 0, GDK_n, search, {.i = XT_SEARCH_NEXT} }, -- cgit 1.4.1-2-gfad0