Some day I will learn to rebase without fucking up
authorsachiel <sachiel@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 29 Sep 2011 21:45:27 +0000 (21:45 +0000)
committersachiel <sachiel@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 29 Sep 2011 21:45:27 +0000 (21:45 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@63687 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/test_web.c
src/lib/elm_web.c

index ebbf297..f7441a1 100644 (file)
@@ -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);
      }
 }
 
index 312d7ed..3f0c2aa 100644 (file)
@@ -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;