viking

webkit based web browser for Enlightenment
Log | Files | Refs | LICENSE

commit b69818b7ef8b5eec4f97c6af619f67dc0f0c29e4
parent f0d79a9fe13700efdebb6dcf6b72c69a00fcf77e
Author: Kyle Milz <kmilz@ucalgary.ca>
Date:   Tue, 25 Sep 2012 22:31:10 -0600

add toggle for cookies

Diffstat:
Msrc/commands.c | 20+++++++++++++++++++-
Msrc/commands.h | 1+
Msrc/keymap.h | 3++-
Msrc/main.c | 14+++++++++++---
Msrc/main.h | 1+
5 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/src/commands.c b/src/commands.c @@ -1417,10 +1417,28 @@ toggle_history(const Arg *arg, void *data) if (bd->history_enabled) { bd->history_enabled = EINA_FALSE; - ewk_cookies_policy_set(EWK_COOKIE_JAR_ACCEPT_NEVER); update_url(elm_web_uri_get(bd->web), data); } else { bd->history_enabled = EINA_TRUE; + update_url(elm_web_uri_get(bd->web), data); + } + + return EINA_TRUE; +} + +Eina_Bool +toggle_cookies(const Arg *arg, void *data) +{ + App_Data *ad = data; + Buffer_Data *bd = ad->cur_buf; + + if (bd->cookies_enabled) { + bd->cookies_enabled = EINA_FALSE; + ewk_cookies_policy_set(EWK_COOKIE_JAR_ACCEPT_NEVER); + update_url(elm_web_uri_get(bd->web), data); + } + else { + bd->cookies_enabled = EINA_TRUE; ewk_cookies_policy_set(EWK_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY); update_url(elm_web_uri_get(bd->web), data); } diff --git a/src/commands.h b/src/commands.h @@ -29,6 +29,7 @@ Eina_Bool switch_buffer(const Arg *, void *); Eina_Bool inspector(const Arg *, void *); Eina_Bool proxy(const Arg *, void *); Eina_Bool toggle_history(const Arg *, void *); +Eina_Bool toggle_cookies(const Arg *, void *); // static Eina_Bool fake_key_event(const Arg *, void *); Eina_Bool process_set_line(char *line); diff --git a/src/keymap.h b/src/keymap.h @@ -26,6 +26,7 @@ static Key keys[] = { { 0, 'q', "8", quickmark, { .s = "8" } }, { 0, 'q', "9", quickmark, { .s = "9" } }, { "Control", 0, "h", toggle_history, { 0 } }, + { "Control", 0, "c", toggle_cookies, { 0 } }, { 0, 0, "0", scroll, {ScrollJumpTo | DirectionLeft} }, { 0, 0, "$", scroll, {ScrollJumpTo | DirectionRight} }, { 0, 'g', "g", scroll, {ScrollJumpTo | DirectionTop} }, @@ -64,7 +65,7 @@ static Key keys[] = { { 0, 0, "L", navigate, {NavigationForward} }, { 0, 0, "r", navigate, {NavigationReload} }, { 0, 0, "R", navigate, {NavigationForceReload} }, - { "Control", 0, "c", navigate, {NavigationCancel} }, + { 0, 0, "c", navigate, {NavigationCancel} }, { 0, 0, "plus", zoom, {ZoomIn | ZoomText} }, { 0, 0, "minus", zoom, {ZoomOut | ZoomText} }, diff --git a/src/main.c b/src/main.c @@ -199,7 +199,8 @@ status_flags(void *data) strcat(flags, bd->proxy_enabled ? "P" : " "); strcat(flags, bd->inspector_enabled ? "I" : " "); strcat(flags, bd->history_enabled ? "H" : " "); - end = strdup_printf("] %i ", bd->buf_number); + strcat(flags, bd->cookies_enabled ? "C" : " "); + end = strdup_printf("] %2i ", bd->buf_number); strcat(flags, end); free(end); @@ -342,10 +343,16 @@ buffer_current_set(Buffer_Data *new_buf) ewk_view_web_inspector_show(ad->cur_buf->view); } - update_url(elm_web_uri_get(ad->cur_buf->web), ad); elm_naviframe_item_simple_promote(ad->naviframe, ad->cur_buf->web); if (ad->cur_buf->proxy_enabled) enable_proxy(ad->cur_buf); + + if (new_buf->cookies_enabled) + ewk_cookies_policy_set(EWK_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY); + else + ewk_cookies_policy_set(EWK_COOKIE_JAR_ACCEPT_NEVER); + + update_url(elm_web_uri_get(ad->cur_buf->web), ad); } } @@ -384,6 +391,7 @@ buffer_add(App_Data *ad) td->inspector_enabled = EINA_FALSE; td->proxy_enabled = EINA_FALSE; td->history_enabled = EINA_TRUE; + td->cookies_enabled = EINA_FALSE; td->view = elm_web_webkit_view_get(td->web); ad->buffer_list = eina_list_append(ad->buffer_list, td); @@ -758,7 +766,7 @@ setup_config(App_Data *ad, int argc, char **argv) eina_strlcpy(basename, "cookies.txt", sizeof(path) - dirlen); ewk_cookies_file_set(path); - ewk_cookies_policy_set(EWK_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY); + // ewk_cookies_policy_set(EWK_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY); eina_strlcpy(basename, "config.eet", sizeof(path) - dirlen); config = config_load(path); diff --git a/src/main.h b/src/main.h @@ -71,6 +71,7 @@ struct _Buffer_Data Eina_Bool proxy_enabled; Eina_Bool history_enabled; + Eina_Bool cookies_enabled; }; struct dl {