Fix conflicts: Map, Hover, Hoversel, Menu, Web
[framework/uifw/elementary.git] / src / lib / elm_web.c
index 46169df..1c84db9 100644 (file)
@@ -138,29 +138,47 @@ static const Evas_Smart_Cb_Description _elm_web_callback_names[] = {
    { NULL, NULL }
 };
 
-static void
-_theme_hook(Evas_Object *obj)
-{
 #ifdef HAVE_ELEMENTARY_WEB
-   Elm_Theme *theme = elm_object_theme_get(obj);
-   Widget_Data *wd = elm_widget_data_get(obj);
-   const Eina_List *themes, *l;
+static char *
+_webkit_theme_find(const Eina_List *list)
+{
+   const Eina_List *l;
    const char *th;
-   char *view_theme = NULL;
 
-   themes = elm_theme_list_get(theme);
-   EINA_LIST_FOREACH(themes, l, th)
+   EINA_LIST_FOREACH(list, l, th)
      {
         char *path = elm_theme_list_item_path_get(th, NULL);
         if (!path) continue;
         if (edje_file_group_exists(path, "webkit/base"))
-          {
-             view_theme = path;
-             break;
-          }
+          return path;
         free(path);
      }
 
+   return NULL;
+}
+#endif
+
+static void
+_theme_hook(Evas_Object *obj)
+{
+#ifdef HAVE_ELEMENTARY_WEB
+   Elm_Theme *theme = elm_object_theme_get(obj);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   const Eina_List *themes;
+   char *view_theme = NULL;
+
+   themes = elm_theme_overlay_list_get(theme);
+   view_theme = _webkit_theme_find(themes);
+   if (view_theme) goto set;
+
+   themes = elm_theme_list_get(theme);
+   view_theme = _webkit_theme_find(themes);
+   if (view_theme) goto set;
+
+   themes = elm_theme_extension_list_get(theme);
+   view_theme = _webkit_theme_find(themes);
+
+set:
    if (view_theme)
      {
         ewk_view_theme_set(wd->ewk_view, view_theme);
@@ -856,14 +874,14 @@ static void
 _popup_item_selected(void *data, Evas_Object *obj, void *event_info __UNUSED__)
 {
    Evas_Object *view = data;
-   Elm_List_Item *it = elm_list_selected_item_get(obj);
+   Elm_Object_Item *list_it = elm_list_selected_item_get(obj);
    const Eina_List *itr, *list = elm_list_items_get(obj);
    void *d;
    int i = 0;
 
    EINA_LIST_FOREACH(list, itr, d)
    {
-      if (d == it)
+      if (d == list_it)
          break;
 
       i++;
@@ -900,16 +918,16 @@ _ewk_view_popup_create_cb(void *data, Evas_Object *obj, void *event_info)
      return;
 
    notify = elm_notify_add(obj);
-   elm_notify_repeat_events_set(notify, EINA_FALSE);
+   elm_notify_allow_events_set(notify, EINA_FALSE);
    elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM);
 
    list = elm_list_add(obj);
-   elm_list_always_select_mode_set(list, EINA_TRUE);
+   elm_list_select_mode_set(data, ELM_OBJECT_SELECT_MODE_ALWAYS);
    elm_list_bounce_set(list, EINA_FALSE, EINA_FALSE);
    elm_list_mode_set(list, ELM_LIST_EXPAND);
    evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
-   elm_notify_content_set(notify, list);
+   elm_object_content_set(notify, list);
    evas_object_show(list);
 
    EINA_LIST_FOREACH(m->items, itr, it)
@@ -1203,6 +1221,32 @@ elm_web_console_message_hook_set(Evas_Object *obj, Elm_Web_Console_Message func,
 #endif
 }
 
+EAPI void 
+elm_web_useragent_set(Evas_Object *obj, const char *user_agent)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+#ifdef HAVE_ELEMENTARY_WEB
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   ewk_view_setting_user_agent_set(wd->ewk_view, user_agent);
+#else
+   (void)user_agent;
+#endif
+}
+
+EAPI const char* 
+elm_web_useragent_get(const Evas_Object *obj)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+#ifdef HAVE_ELEMENTARY_WEB
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return NULL;
+   return ewk_view_setting_user_agent_get(wd->ewk_view);
+#else
+   return NULL;
+#endif
+}
+
 EAPI Eina_Bool
 elm_web_tab_propagate_get(const Evas_Object *obj)
 {
@@ -1506,9 +1550,15 @@ elm_web_navigate(Evas_Object *obj, int steps)
 #endif
 }
 
-EAPI Eina_Bool
+EINA_DEPRECATED EAPI Eina_Bool
 elm_web_back_possible(Evas_Object *obj)
 {
+   return elm_web_back_possible_get(obj);
+}
+
+EAPI Eina_Bool
+elm_web_back_possible_get(Evas_Object *obj)
+{
    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
 #ifdef HAVE_ELEMENTARY_WEB
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -1519,9 +1569,15 @@ elm_web_back_possible(Evas_Object *obj)
 #endif
 }
 
-EAPI Eina_Bool
+EINA_DEPRECATED EAPI Eina_Bool
 elm_web_forward_possible(Evas_Object *obj)
 {
+   return elm_web_forward_possible_get(obj);
+}
+
+EAPI Eina_Bool
+elm_web_forward_possible_get(Evas_Object *obj)
+{
    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
 #ifdef HAVE_ELEMENTARY_WEB
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -1533,7 +1589,7 @@ elm_web_forward_possible(Evas_Object *obj)
 }
 
 EAPI Eina_Bool
-elm_web_navigate_possible(Evas_Object *obj, int steps)
+elm_web_navigate_possible_get(Evas_Object *obj, int steps)
 {
    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
 #ifdef HAVE_ELEMENTARY_WEB
@@ -1546,9 +1602,15 @@ elm_web_navigate_possible(Evas_Object *obj, int steps)
 #endif
 }
 
-EAPI Eina_Bool
+EINA_DEPRECATED EAPI Eina_Bool
 elm_web_history_enable_get(const Evas_Object *obj)
 {
+   return elm_web_history_enabled_get(obj);
+}
+
+EAPI Eina_Bool
+elm_web_history_enabled_get(const Evas_Object *obj)
+{
    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
 #ifdef HAVE_ELEMENTARY_WEB
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -1559,9 +1621,15 @@ elm_web_history_enable_get(const Evas_Object *obj)
 #endif
 }
 
-EAPI void
+EINA_DEPRECATED EAPI void
 elm_web_history_enable_set(Evas_Object *obj, Eina_Bool enable)
 {
+   elm_web_history_enabled_set(obj, enable);
+}
+
+EAPI void
+elm_web_history_enabled_set(Evas_Object *obj, Eina_Bool enable)
+{
    ELM_CHECK_WIDTYPE(obj, widtype);
 #ifdef HAVE_ELEMENTARY_WEB
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -1803,15 +1871,53 @@ elm_web_window_features_unref(Elm_Web_Window_Features *wf)
 #endif
 }
 
-EAPI void
-elm_web_window_features_bool_property_get(const Elm_Web_Window_Features *wf, Eina_Bool *toolbar_visible, Eina_Bool *statusbar_visible, Eina_Bool *scrollbars_visible, Eina_Bool *menubar_visible, Eina_Bool *locationbar_visible, Eina_Bool *fullscreen)
+EAPI Eina_Bool
+elm_web_window_features_property_get(const Elm_Web_Window_Features *wf, Elm_Web_Window_Feature_Flag flag)
 {
 #ifdef HAVE_ELEMENTARY_WEB
+   Eina_Bool toolbar_visible, statusbar_visible;
+   Eina_Bool scrollbars_visible, menubar_visible;
+   Eina_Bool locationbar_visible, fullscreen;
+
    ewk_window_features_bool_property_get((const Ewk_Window_Features *)wf,
-                                         toolbar_visible, statusbar_visible,
-                                         scrollbars_visible, menubar_visible,
-                                         locationbar_visible, fullscreen);
+                                         &toolbar_visible, &statusbar_visible,
+                                         &scrollbars_visible, &menubar_visible,
+                                         &locationbar_visible, &fullscreen);
+
+   //TODO : Improve ewk API usage to get one value.
+   //
+   switch(flag)
+     {
+        case ELM_WEB_WINDOW_FEATURE_TOOLBAR:
+            return toolbar_visible;
+            break;
+        case ELM_WEB_WINDOW_FEATURE_STATUSBAR:
+            return statusbar_visible;
+            break;
+        case ELM_WEB_WINDOW_FEATURE_SCROLLBARS:
+            return scrollbars_visible;
+            break;
+        case ELM_WEB_WINDOW_FEATURE_MENUBAR:
+            return menubar_visible;
+            break;
+        case ELM_WEB_WINDOW_FEATURE_LOCATIONBAR:
+            return locationbar_visible;
+            break;
+        case ELM_WEB_WINDOW_FEATURE_FULLSCREEN:
+            return fullscreen;
+            break;
+     }
 #else
+
+   if (!wf) return EINA_FALSE;
+   if (flag==ELM_WEB_WINDOW_FEATURE_TOOLBAR)
+     {
+        //TODO Handle unused variable warnings when
+        //ewk is not installed.
+     }
+
+   /* What to do with these ?
+    
    (void)wf;
    (void)toolbar_visible;
    (void)statusbar_visible;
@@ -1819,21 +1925,32 @@ elm_web_window_features_bool_property_get(const Elm_Web_Window_Features *wf, Ein
    (void)menubar_visible;
    (void)locationbar_visible;
    (void)fullscreen;
+
+   */
+
 #endif
+   return EINA_FALSE;
 }
 
 EAPI void
-elm_web_window_features_int_property_get(const Elm_Web_Window_Features *wf, int *x, int *y, int *w, int *h)
+elm_web_window_features_region_get(const Elm_Web_Window_Features *wf, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
 {
 #ifdef HAVE_ELEMENTARY_WEB
    ewk_window_features_int_property_get((const Ewk_Window_Features *)wf,
                                         x, y, w, h);
 #else
+
+   if (!wf || !x || !y || !w || !h) return;
+   /* What to do with these ?
+    
    (void)wf;
    (void)x;
    (void)y;
    (void)w;
    (void)h;
+
+   */
+
 #endif
 }