From c1e8c50b6a23a462fe650105b8460100d847dbb9 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 26 May 2009 16:11:08 +0200 Subject: Print a warning when a key binding is overwritten Signed-off-by: Uli Schlachter --- uzbl.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index ba6655a..1a71f33 100644 --- a/uzbl.c +++ b/uzbl.c @@ -2019,6 +2019,8 @@ add_binding (const gchar *key, const gchar *act) { printf ("Binding %-10s : %s\n", key, act); action = new_action(parts[0], parts[1]); + if (g_hash_table_remove (uzbl.bindings, key)) + g_warning ("Overwriting existing binding for \"%s\"", key); g_hash_table_replace(uzbl.bindings, g_strdup(key), action); g_strfreev(parts); } -- cgit v1.2.3 From fecb218597b3ef6129c4cfa51d9894a9170fcba0 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 26 May 2009 16:17:10 +0200 Subject: Fix all compiler warnings about invalid casts Signed-off-by: Uli Schlachter --- uzbl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index 1a71f33..02a3dd0 100644 --- a/uzbl.c +++ b/uzbl.c @@ -842,7 +842,7 @@ expand_template(const char *template, gboolean escape_markup) { token = g_scanner_get_next_token(uzbl.scan); if(token == G_TOKEN_SYMBOL) { - sym = (int)g_scanner_cur_value(uzbl.scan).v_symbol; + sym = GPOINTER_TO_INT(g_scanner_cur_value(uzbl.scan).v_symbol); switch(sym) { case SYM_URI: if(escape_markup) { @@ -1181,7 +1181,7 @@ get_var_value(gchar *name) { if(c->type == TYPE_STR) printf("VAR: %s VALUE: %s\n", name, (char *)*c->ptr); else if(c->type == TYPE_INT) - printf("VAR: %s VALUE: %d\n", name, (int)*c->ptr); + printf("VAR: %s VALUE: %p\n", name, *c->ptr); } return TRUE; } @@ -1438,7 +1438,7 @@ set_var_value(gchar *name, gchar *val) { g_free(*c->ptr); *c->ptr = g_strdup(val); } else if(c->type == TYPE_INT) { - int *ip = (int *)c->ptr; + int *ip = (int *) c->ptr; *ip = (int)strtoul(val, &endp, 10); } -- cgit v1.2.3 From 16987b4c01df41cb85c7a9ecfc06c571110efacc Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 26 May 2009 18:05:27 +0200 Subject: Allow tabs as delimiters in 'set' commands Signed-off-by: Uli Schlachter --- uzbl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index 02a3dd0..5a96d2b 100644 --- a/uzbl.c +++ b/uzbl.c @@ -1163,7 +1163,7 @@ static void setup_regex() { uzbl.comm.get_regex = g_regex_new("^[Gg][a-zA-Z]*\\s+([^ \\n]+)$", G_REGEX_OPTIMIZE, 0, NULL); - uzbl.comm.set_regex = g_regex_new("^[Ss][a-zA-Z]*\\s+([^ ]+)\\s*=\\s*([^\\n].*)$", + uzbl.comm.set_regex = g_regex_new("^[Ss][a-zA-Z]*\\s+([^ \\t]+)\\s*=\\s*([^\\n].*)$", G_REGEX_OPTIMIZE, 0, NULL); uzbl.comm.bind_regex = g_regex_new("^[Bb][a-zA-Z]*\\s+?(.*[^ ])\\s*?=\\s*([a-z][^\\n].+)$", G_REGEX_UNGREEDY|G_REGEX_OPTIMIZE, 0, NULL); -- cgit v1.2.3 From 7d736c38eb82399aee003ce1602a72da8a56d22c Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 26 May 2009 18:35:42 +0200 Subject: Fix downloads This adds mime-type-policy-decision-requested callback which simply downloads everything which can't be displayed. Without this, nothing is ever downloaded. Google lead me to this: http://gitorious.org/qtwebkit/qtwebkit/commit/1f30e169cd379ac8917040e4734e11d8283bab5d https://bugs.webkit.org/show_bug.cgi?id=25987 Signed-off-by: Uli Schlachter --- uzbl.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index 5a96d2b..6a6f77f 100644 --- a/uzbl.c +++ b/uzbl.c @@ -348,6 +348,23 @@ new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequ return (FALSE); } +static gboolean +mime_policy_cb(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, gchar *mime_type, WebKitWebPolicyDecision *policy_decision, gpointer user_data) { + (void) frame; + (void) request; + (void) user_data; + + /* If we can display it, let's display it... */ + if (webkit_web_view_can_show_mime_type (web_view, mime_type)) { + webkit_web_policy_decision_use (policy_decision); + return TRUE; + } + + /* ...everything we can't displayed is downloaded */ + webkit_web_policy_decision_download (policy_decision); + return TRUE; +} + WebKitWebView* create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data) { (void) web_view; @@ -1948,6 +1965,7 @@ create_browser () { g_signal_connect (G_OBJECT (g->web_view), "new-window-policy-decision-requested", G_CALLBACK (new_window_cb), g->web_view); g_signal_connect (G_OBJECT (g->web_view), "download-requested", G_CALLBACK (download_cb), g->web_view); g_signal_connect (G_OBJECT (g->web_view), "create-web-view", G_CALLBACK (create_web_view_cb), g->web_view); + g_signal_connect (G_OBJECT (g->web_view), "mime-type-policy-decision-requested", G_CALLBACK (mime_policy_cb), g->web_view); return scrolled_window; } -- cgit v1.2.3