diff options
author | portix <portix@gmx.net> | 2011-03-23 13:56:11 +0100 |
---|---|---|
committer | portix <portix@gmx.net> | 2011-03-23 13:56:11 +0100 |
commit | abccef8e803ce063569c5ca74412b536e4cffb88 (patch) | |
tree | e0f4c94824f46708cc7588a5d9b8a5b16e05f657 /src/plugins.c | |
parent | 9dbaf7c933bdbf77be8c9322a0f6484e31955ab5 (diff) | |
download | dwb-abccef8e803ce063569c5ca74412b536e4cffb88.zip |
New plugin blocker
Diffstat (limited to 'src/plugins.c')
-rw-r--r-- | src/plugins.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/plugins.c b/src/plugins.c new file mode 100644 index 00000000..60efb87d --- /dev/null +++ b/src/plugins.c @@ -0,0 +1,28 @@ +#include "dwb.h" + +static void +dwb_plugins_get_embed_values(char *key, char *value, GString **gl) { + g_string_append_printf(*gl, " %s=\"%s\" ", key, value); +} + +GtkWidget * +dwb_plugins_create_cb(WebKitWebView *wv, char *mimetype, char *uri, GHashTable *param, GList *gl) { + GtkWidget *ret = NULL; + if (!strcmp(mimetype, "application/x-shockwave-flash")) { + GString *string = g_string_new(NULL); + g_hash_table_foreach(param, (GHFunc)dwb_plugins_get_embed_values, &string); + char *id = g_hash_table_lookup(param, "id"); + char *command = g_strdup_printf("DwbPlugin.remove('%s', '%s')", id, string->str); + g_string_free(string, true); + char *value; + dwb_execute_script(wv, command, &value); + g_free(command); + if (value && !strcmp(value, "__dwb__blocked__")) { + g_free(value); + } + else { + ret = gtk_event_box_new(); + } + } + return ret; +} |