From 3df6b290a01ca987e009c4be0f749e409cf9623c Mon Sep 17 00:00:00 2001 From: sachiel Date: Thu, 29 Sep 2011 21:45:27 +0000 Subject: [PATCH] Some day I will learn to rebase without fucking up git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@63687 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/bin/test_web.c | 8 ++++++++ src/lib/elm_web.c | 13 ++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/bin/test_web.c b/src/bin/test_web.c index ebbf297..f7441a1 100644 --- a/src/bin/test_web.c +++ b/src/bin/test_web.c @@ -227,6 +227,12 @@ _file_selector_hook(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Eina_Boo } static void +_console_message_hook(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *message, unsigned int line_number, const char *source_id) +{ + printf("CONSOLE: %s:%d:%s\n", source_id, line_number, message); +} + +static void _js_popup_hooks_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { Web_Test *wt = data; @@ -239,6 +245,7 @@ _js_popup_hooks_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __ elm_web_dialog_prompt_hook_set(wt->web, _prompt_hook, NULL); elm_web_dialog_file_selector_hook_set(wt->web, _file_selector_hook, NULL); + elm_web_console_message_hook_set(wt->web, _console_message_hook, NULL); } else { @@ -246,6 +253,7 @@ _js_popup_hooks_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __ elm_web_dialog_confirm_hook_set(wt->web, NULL, NULL); elm_web_dialog_prompt_hook_set(wt->web, NULL, NULL); elm_web_dialog_file_selector_hook_set(wt->web, NULL, NULL); + elm_web_console_message_hook_set(wt->web, NULL, NULL); } } diff --git a/src/lib/elm_web.c b/src/lib/elm_web.c index 312d7ed..3f0c2aa 100644 --- a/src/lib/elm_web.c +++ b/src/lib/elm_web.c @@ -647,6 +647,17 @@ _view_smart_run_open_panel(Ewk_View_Smart_Data *esd, Evas_Object *frame __UNUSED return response; } +static void +_view_smart_add_console_message(Ewk_View_Smart_Data *esd, const char *message, unsigned int line_number, const char *source_id) +{ + Evas_Object *obj = evas_object_smart_parent_get(esd->self); + Widget_Data *wd = elm_widget_data_get(obj); + + if (wd->hook.console_message) + wd->hook.console_message(wd->hook.console_message_data, obj, message, + line_number, source_id); +} + static Eina_Bool _view_smart_focus_can_cycle(Ewk_View_Smart_Data *sd, Ewk_Focus_Direction direction) { @@ -708,7 +719,7 @@ _view_add(Evas_Object *parent) api.mouse_down = _view_smart_mouse_down; api.mouse_up = _view_smart_mouse_up; api.mouse_move = _view_smart_mouse_move; - //api.add_console_message = _view_smart_add_console_message; + api.add_console_message = _view_smart_add_console_message; api.window_create = _view_smart_window_create; api.window_close = _view_smart_window_close; api.run_javascript_alert = _view_smart_run_javascript_alert; -- 2.7.4