Re: [dev] [surf] is there a way to disable images?

From: Moritz Wilhelmy <n0nsense_AT_n0nsense.xinutec.org>
Date: Mon, 28 Sep 2009 02:25:23 +0200

Cool, thanks.
I made a toggle-function, just like toggleflash. I just asked because I don't know
all the names of webkit-settings. Thanks for the function.

void
toggleimages(Client *c, const Arg *arg)
{
    static int images = 0;
    WebKitWebSettings *settings;
    settings = webkit_web_view_get_settings(c->view);
    images = !images;
    g_object_set(G_OBJECT(settings), "auto-load-images", images, NULL);
}

void
toggleflash(Client *c, const Arg *arg)
{
    static int flash = 0;
    WebKitWebSettings *settings;
    settings = webkit_web_view_get_settings(c->view);
    flash = !flash;
    g_object_set(G_OBJECT(settings), "enable-plugins", flash, NULL);
}

Regards,
Moritz

On Sun, Sep 27, 2009 at 05:34:21PM -0500, hailukah wrote:
> Here you go. Patch your config.h with this. MODKEY-Shift-i will
> disable images auto loading. This function can be modified with just
> about anything from
> http://webkitgtk.org/reference/webkitgtk-WebKitWebSettings.html
>

> --- config.def.h 2009-09-11 02:40:39.000000000 -0500
> +++ config.h 2009-09-27 17:27:45.000000000 -0500
> @@ -1,6 +1,9 @@
> /* modifier 0 means no modifier */
> static gchar *progress = "#FF0000";
> static gchar *progress_trust = "#00FF00";
> +
> +static void hideimages(Client *c, const Arg *arg);
> +
> #define MODKEY GDK_CONTROL_MASK
> static Key keys[] = {
> /* modifier keyval function arg Focus */
> @@ -28,5 +31,12 @@ static Key keys[] = {
> { GDK_SHIFT_MASK, GDK_Return, searchtext, { .b = FALSE }, SEARCHBAR },
> { 0, GDK_Return, loaduri, { .v = NULL }, URLBAR },
> { 0, GDK_Return, hideurl, { 0 }, URLBAR },
> + { MODKEY|GDK_SHIFT_MASK,GDK_i, hideimages, { 0 }, ALWAYS },
> };
>
> +void
> +hideimages(Client *c, const Arg *arg) {
> + WebKitWebSettings *settings;
> + settings = webkit_web_view_get_settings(c->view);
> + g_object_set(G_OBJECT(settings), "auto-load-images", 0, NULL);
> +}
> \ No newline at end of file
Received on Mon Sep 28 2009 - 00:25:23 UTC

This archive was generated by hypermail 2.2.0 : Mon Sep 28 2009 - 00:36:01 UTC