Remove the dropdown memu implementation from MiniBrowser. 85/13485/3
authorJoone Hur <joone.hur@intel.com>
Fri, 6 Dec 2013 22:34:40 +0000 (14:34 -0800)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Wed, 11 Dec 2013 00:47:25 +0000 (16:47 -0800)
ENABLE_TIZEN_WEBKIT2_POPUP_INTERNAL was enabled by default for IVI:
https://review.tizen.org/gerrit/#/c/12953

Therefore, the dropdown memu implementation is removed from MiniBrowser.

Change-Id: I13196d04d7477549cce3ae2f57b7ca8ac01fb16b

Tools/MiniBrowser/efl/main.c

index 4ec3e26..2452fa3 100755 (executable)
@@ -25,7 +25,6 @@
 #include <Elementary.h>
 #include <Evas.h>
 #include <vconf.h>
-#include <ewk_popup_menu_item.h>
 
 static const int DEFAULT_WIDTH = 800;
 static const int DEFAULT_HEIGHT = 600;
@@ -47,22 +46,12 @@ static Eina_Bool frame_flattening_enabled = EINA_FALSE;
 static Eina_Bool fullscreen_enabled = EINA_FALSE;
 static Eina_Bool toolbar_enabled = EINA_TRUE;
 
-static Ewk_View_Smart_Class *miniBrowserViewSmartClass()
-{
-    static Ewk_View_Smart_Class ewkViewClass = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("MiniBrowser_View");
-    return &ewkViewClass;
-}
-
 typedef struct _Browser_Window {
     Evas_Object *window;
     Evas_Object *webview;
     Evas_Object *url_bar;
     Evas_Object *back_button;
     Evas_Object *forward_button;
- struct {
-        Evas_Object *elm_menu;
-        unsigned int selected_index;
-    } popup;
 } Browser_Window;
 
 static const Ecore_Getopt options = {
@@ -112,22 +101,6 @@ static Browser_Window *browser_window_find(Evas_Object *window)
     return NULL;
 }
 
-static Browser_Window *window_find_with_webview(Evas_Object *webview)
-{
-    Eina_List *l;
-    void *data;
-
-    if (!webview)
-        return NULL;
-
-    EINA_LIST_FOREACH(windows, l, data) {
-        Browser_Window *window = (Browser_Window *)data;
-        if (window->webview == webview)
-            return window;
-    }
-    return NULL;
-}
-
 static void window_free(Browser_Window *window)
 {
     evas_object_del(window->webview);
@@ -423,94 +396,6 @@ on_window_deletion(void *user_data, Evas_Object *window, void *event_info)
 {
     window_close(browser_window_find(window));
 }
-static void
-on_popup_menu_discarded(void *user_data, Evas_Object *obj, void *event_info)
-{
-    // The user clicked outside the menu to discard it.
-    info("Popup menu was discarded.");
-    Browser_Window *window = (Browser_Window *)user_data;
-
-    // This is workaround code in order to make the popup show again.
-    ewk_view_popup_menu_select(window->webview, window->popup.selected_index);
-
-    ewk_view_popup_menu_close(window->webview);
-}
-
-static void
-on_popup_menu_item_clicked(void *user_data, Evas_Object *obj, void *event_info)
-{
-    Browser_Window *window = (Browser_Window *)user_data;
-    Elm_Object_Item *item = (Elm_Object_Item *)event_info;
-
-    info("Selected popup menu index: %u", elm_menu_item_index_get(item));
-    window->popup.selected_index = elm_menu_item_index_get(item);
-    ewk_view_popup_menu_select(window->webview, window->popup.selected_index);
-    ewk_view_popup_menu_close(window->webview);
-}
-
-static void
-popup_menu_populate(Evas_Object *elm_menu, Eina_List* ewk_items, void *user_data)
-{
-    void *data;
-
-    const Eina_List *l;
-    EINA_LIST_FOREACH(ewk_items, l, data) {
-        Ewk_Popup_Menu_Item *ewk_item = (Ewk_Popup_Menu_Item *)data;
-        switch (ewk_popup_menu_item_type_get(ewk_item)) {
-        case EWK_POPUP_MENU_SEPARATOR:
-            elm_menu_item_separator_add(elm_menu, NULL);
-            break;
-        case EWK_POPUP_MENU_ITEM:
-            if (ewk_popup_menu_item_is_label_get(ewk_item)) {
-                Elm_Object_Item *item = elm_menu_item_add(elm_menu, NULL, NULL, ewk_popup_menu_item_text_get(ewk_item), NULL, NULL);
-                elm_object_item_disabled_set(item, EINA_TRUE);
-            } else {
-                Elm_Object_Item *item = elm_menu_item_add(elm_menu, NULL, NULL, ewk_popup_menu_item_text_get(ewk_item), on_popup_menu_item_clicked, user_data);
-                const char *tooltip_text = ewk_popup_menu_item_tooltip_get(ewk_item);
-                if (tooltip_text && tooltip_text[0] != '\0')
-                    elm_object_item_tooltip_text_set(item, tooltip_text);
-                elm_object_item_disabled_set(item, !ewk_popup_menu_item_enabled_get(ewk_item));
-                elm_menu_item_selected_set(item, ewk_popup_menu_item_selected_get(ewk_item));
-            }
-            break;
-        default:
-            info("Unrecognized popup menu item type!");
-            break;
-        }
-    }
-}
-
-static Eina_Bool
-on_popup_menu_show(Ewk_View_Smart_Data *smartData, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* items, int selectedIndex)
-{
-    Browser_Window *window = window_find_with_webview(smartData->self);
-
-    if (window->popup.elm_menu)
-        evas_object_del(window->popup.elm_menu);
-
-    window->popup.elm_menu = elm_menu_add(window->window);
-    evas_object_smart_callback_add(window->popup.elm_menu, "clicked", on_popup_menu_discarded, window);
-    popup_menu_populate(window->popup.elm_menu, items, window);
-
-    info("Showing popup menu at (%d, %d)", rect.x, rect.y);
-    elm_menu_move(window->popup.elm_menu, rect.x, rect.y);
-    evas_object_show(window->popup.elm_menu);
-
-    return EINA_TRUE;
-}
-
-static Eina_Bool
-on_popup_menu_hide(Ewk_View_Smart_Data *smartData)
-{
-    Browser_Window *window = window_find_with_webview(smartData->self);
-
-    if (!window->popup.elm_menu)
-        return EINA_FALSE;
-
-    elm_menu_close(window->popup.elm_menu);
-
-    return EINA_TRUE;
-}
 
 static Evas_Object *
 create_toolbar_button(Evas_Object *window, const char *icon_name)
@@ -612,14 +497,9 @@ static Browser_Window *window_create(const char *url)
         evas_object_show(home_button);
     }
 
-    Ewk_View_Smart_Class *ewkViewClass = miniBrowserViewSmartClass();
-    ewkViewClass->popup_menu_show = on_popup_menu_show;
-    ewkViewClass->popup_menu_hide = on_popup_menu_hide;
-
     /* Create webview */
     Evas *evas = evas_object_evas_get(app_data->window);
-    Evas_Smart* smart = evas_smart_class_new(&ewkViewClass->sc);
-    app_data->webview = ewk_view_smart_add(evas, smart, ewk_context_default_get());
+    app_data->webview = ewk_view_add(evas);
     ewk_view_theme_set(app_data->webview, THEME_DIR "/default.edj");
 
     /* set a file containing certificates for recognized SSL Certificate Authorities */
@@ -689,8 +569,6 @@ elm_main(int argc, char *argv[])
     if (!ewk_init())
         return EXIT_FAILURE;
 
-    ewk_view_smart_class_set(miniBrowserViewSmartClass());
-
     ecore_app_args_set(argc, (const char **) argv);
     args = ecore_getopt_parse(&options, values, argc, argv);