viking

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

commit 2c802477a86474a06f4a8a7b34e5856238fc2815
parent c8d0126aba11f4a3c2ea6940eb53708a3b428f4e
Author: Kyle Milz <kmilz@ucalgary.ca>
Date:   Wed,  3 Oct 2012 13:07:05 -0600

history: add flag to enable/disable on per url basis

Diffstat:
Msrc/callbacks.c | 18++++++------------
Msrc/commands.c | 8+++++---
Msrc/main.c | 2+-
Msrc/utilities.c | 5+++--
Msrc/viking.h | 1-
Msrc/viking_state.geneet | 1+
6 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/src/callbacks.c b/src/callbacks.c @@ -252,28 +252,22 @@ webview_load_finished_cb(void *data, Evas_Object *obj, void *event_info) update_state(wd); + // printf("logging item to history.\n"); Hist_Item *item; - // Buffer_Data *bd = data; App_Data *ad = wd->app; - // Evas_Object *frame = event_info; const char *title = ewk_view_title_get(bd->view); - - if (!bd->history_enabled) - return; - - // printf("logging item to history.\n"); - const char *url = ewk_view_uri_get(bd->view); - if ((item = hist_items_get(ad->history, url))) { + item = hist_items_get(ad->history, url); + + if (item && hist_item_enabled_get(item)) { hist_item_visit_count_set(item, hist_item_visit_count_get(item) + 1); hist_item_last_visit_set(item, ecore_time_unix_get()); hist_item_title_set(item, title); } - else { - hist_items_add(ad->history, url, hist_item_new(title, url, 1, ecore_time_unix_get())); + else if (!item && config_enable_history_get(ad->config)) { + hist_items_add(ad->history, url, hist_item_new(EINA_TRUE, title, url, 1, ecore_time_unix_get())); } - // userscript_hooks_end(elm_web_uri_get(td->web)); /* diff --git a/src/commands.c b/src/commands.c @@ -1442,12 +1442,14 @@ toggle_history(const Arg *arg, void *data) { Window_Data *ad = data; Buffer_Data *bd = ad->cur_buf; + Hist_Item *item = hist_items_get(ad->app->history, ewk_view_uri_get(bd->view)); + Eina_Bool *enab = hist_item_enabled_get(item); - if (bd->history_enabled) { - bd->history_enabled = EINA_FALSE; + if (enab) { + hist_item_enabled_set(item, EINA_FALSE); update_url(ewk_view_uri_get(bd->view), data); } else { - bd->history_enabled = EINA_TRUE; + hist_item_enabled_set(item, EINA_TRUE); update_url(ewk_view_uri_get(bd->view), data); } diff --git a/src/main.c b/src/main.c @@ -278,7 +278,7 @@ setup_config(App_Data *ad, int argc, char **argv) enable_plugins, EINA_FALSE /* enable_private_mode */, enable_touch_interface, - EINA_TRUE, + EINA_TRUE, /* global history */ DEFAULT_URL /* home_page */, NULL /* proxy */, EINA_TRUE /* restore_state */, diff --git a/src/utilities.c b/src/utilities.c @@ -1111,7 +1111,6 @@ buffer_add(const Arg *arg, Window_Data *wd) td->buf_number = wd->buf_total; td->inspector_enabled = EINA_FALSE; td->proxy_enabled = EINA_FALSE; - td->history_enabled = EINA_TRUE; td->cookies_enabled = EINA_FALSE; td->view = ewk_view_add_with_context(evas_object_evas_get(wd->win), wd->app->ewk_context); ewk_view_theme_set(td->view, "/usr/share/ewebkit-0/themes/default.edj"); @@ -1431,7 +1430,9 @@ status_flags(void *data) strcat(flags, "["); strcat(flags, bd->proxy_enabled ? "P" : " "); strcat(flags, bd->inspector_enabled ? "I" : " "); - strcat(flags, bd->history_enabled ? "H" : " "); + // strcat(flags, bd->history_enabled ? "H" : " "); + Hist_Item *item = hist_items_get(bd->window->app, ewk_view_uri_get(bd->view)); + strcat(flags, (item && hist_item_enabled_get(item)) ? "H" : " "); strcat(flags, bd->cookies_enabled ? "C" : " "); end = strdup_printf("] %2i ", bd->buf_number); strcat(flags, end); diff --git a/src/viking.h b/src/viking.h @@ -271,7 +271,6 @@ struct _Buffer_Data Evas_Object *web_inspector; Eina_Bool proxy_enabled; - Eina_Bool history_enabled; Eina_Bool cookies_enabled; Window_Data *window; diff --git a/src/viking_state.geneet b/src/viking_state.geneet @@ -20,6 +20,7 @@ Config { } Hist_Item { + enabled : uchar; title : str default "Untitled"; url : str default "about:blank"; visit_count : uint;