Re: [E-devel] [PATCH] eve cookies file support and cookie policy configuration

2010-11-19 Thread Leandro Pereira
On Tue, Nov 16, 2010 at 11:28 AM, Marco Trevisan (Treviño)
 wrote:
>
> These small patches allow a better cookie handling in eve.
>

Applied with minor tweaks.

Thanks,
  Leandro

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


[E-devel] [PATCH] eve cookies file support and cookie policy configuration

2010-11-16 Thread Treviño
These small patches allow a better cookie handling in eve.

The first patch (eve-EWebKit-cookies-file-support-added.patch) sets the
"cookies.txt" file in which eve should store cookies for keeping them
throught sessions..

The policy configuration patches allow to set a configuration parameter
for choosing the cookie accept policies. I've made two versions since
one (the first) always considers the cookie_parameter as an
Ewk_Cookie_Policy (which causes an extra #include), while the second
always manage it as an int. Choose the one you prefer :).

Ah, I've put the "Cookie Policy" configuration menu under the "Tweaks"
section and not the "Privacy" one... I thought it was more "techy" than
privacy-related, but I could move it there...

Bye. 
From 2b38f42904626861c932b795d8610c79af093d9c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20(Trevi=C3=B1o)?= 
Date: Tue, 16 Nov 2010 14:07:43 +0100
Subject: [PATCH] eve: EWebKit cookies file support added

This allows to keep the saved cookies throught the eve's sessions
---
 src/bin/main.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/bin/main.c b/src/bin/main.c
index 01e654b..d3d6d8a 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -699,6 +699,9 @@ elm_main(int argc, char **argv)
basename++;
dirlen++;
 
+   eina_strlcpy(basename, "cookies.txt", sizeof(path) - dirlen);
+   ewk_cookies_file_set(path);
+
eina_strlcpy(basename, "config.eet", sizeof(path) - dirlen);
config = config_load(path);
if (!config)
-- 
1.7.1

From 225efa21fcb2303308da6f3e8b43d22600ae14f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20(Trevi=C3=B1o)?= 
Date: Tue, 16 Nov 2010 14:09:28 +0100
Subject: [PATCH] eve: added cookies policy configuration options

This flag allows to set the cookie policies that eve should respect
---
 src/bin/chrome.c|   19 +++
 src/bin/eve_state.c |   18 +-
 src/bin/eve_state.h |5 -
 src/bin/main.c  |3 ++-
 4 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/src/bin/chrome.c b/src/bin/chrome.c
index 39524c2..ffa1196 100644
--- a/src/bin/chrome.c
+++ b/src/bin/chrome.c
@@ -97,6 +97,7 @@ typedef enum {
EVE_CONFIG_FRAME_FLATTENING,
EVE_CONFIG_TEXT_ONLY_ZOOM,
EVE_CONFIG_MINIMUM_FONT_SIZE,
+   EVE_CONFIG_COOKIE_POLICY,
EVE_CONFIG_LAST
 } Eve_Config;
 
@@ -298,6 +299,18 @@ static More_Menu_Item more_menu_config[] =
{ NULL, NULL }
  }
}}, NULL, ITEM_FLAG_ARROW | ITEM_FLAG_SELECTABLE },
+ { ITEM_TYPE_CONFIG, "Cookie Policy",
+   (More_Menu_Config[]) {{
+ .type = CONFIG_TYPE_LIST_INT,
+ .conf = EVE_CONFIG_COOKIE_POLICY,
+ .conf_get = config_cookie_policy_get,
+ .conf_set = config_cookie_policy_set,
+ .data = (More_Menu_Config_List_Int[]) {
+   { "No 3rd party Accept", EWK_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY, EINA_TRUE },
+   { "Always Accept", EWK_COOKIE_JAR_ACCEPT_ALWAYS, EINA_FALSE },
+   { "Never Accept", EWK_COOKIE_JAR_ACCEPT_NEVER, EINA_FALSE }
+ }
+   }}, NULL, ITEM_FLAG_ARROW | ITEM_FLAG_SELECTABLE },
  { ITEM_TYPE_LAST, NULL, NULL, NULL, ITEM_FLAG_NONE },
  }, NULL, ITEM_FLAG_ARROW },
{ ITEM_TYPE_SEPARATOR, NULL, NULL, NULL, ITEM_FLAG_NONE },
@@ -1284,6 +1297,7 @@ chrome_config_apply(Evas_Object *chrome)
ewk_view_zoom_text_only_set(view, config_text_only_zoom_get(config));
ewk_view_setting_enable_frame_flattening_set(view, config_frame_flattening_get(config));
ewk_view_setting_font_minimum_size_set(view, config_minimum_font_size_get(config));
+   ewk_cookies_policy_set(config_cookie_policy_get(config));
 }
 
 static void
@@ -1373,6 +1387,11 @@ conf_updated(More_Menu_Config *mmc, void *new_value)
  }
  break;
   }
+   case EVE_CONFIG_COOKIE_POLICY:
+  {
+ ewk_cookies_policy_set((*(Ewk_Cookie_Policy *)new_value));
+ break;
+  }
}
 
 #undef SET_PREF_TO_ALL_VIEWS
diff --git a/src/bin/eve_state.c b/src/bin/eve_state.c
index 137e02b..29eaee8 100644
--- a/src/bin/eve_state.c
+++ b/src/bin/eve_state.c
@@ -26,6 +26,7 @@ struct _Config {
 unsigned char text_only_zoom;
 int minimum_font_size;
 const char *__eet_filename;
+Ewk_Cookie_Policy cookie_policy;
 };
 
 struct _Hist_Item {
@@ -111,6 +112,7 @@ _config_init(void)
 EET_DATA_DESCRIPTOR_ADD_BASIC(_config_descriptor, Config, "frame_flattening", frame_flattening, EET_T_UCHAR);
 EET_DATA_DESCRIPTOR_ADD_BASIC(_config_descriptor, Config, "text_only_zoom", text_only_zoom, EET_T_UCHAR);
 EET_DATA_DESCRIPTOR_ADD_BASIC(_config_descriptor, Config, "minimum_font_size", minimum_font_size, EET_T_INT);
+EET_DATA_DESCRIPTOR_ADD_BASIC(_config_descriptor, Config, "cookie_policy", cookie_policy, EET_T_INT);
 }
 
 static inline void
@@ -122,7 +124,7 @@ _config_shutdown(void)
 }
 
 Config *
-config_new(unsigned char allow_