From: JinYong Park Date: Wed, 9 Nov 2016 08:15:22 +0000 (+0900) Subject: popup: check theme compatibility more precise X-Git-Tag: submit/tizen/20170102.091821~127 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d7e1d5b71353bd2c6d6ba1036fe64bc4b56c4903;p=platform%2Fupstream%2Felementary.git popup: check theme compatibility more precise Change-Id: I0d69fef35d85bef53d4818c7fc578adb3a52db58 Signed-off-by: Jinyong Park --- diff --git a/src/lib/elc_popup.c b/src/lib/elc_popup.c index f0dbefff7..5029fc3ec 100644 --- a/src/lib/elc_popup.c +++ b/src/lib/elc_popup.c @@ -31,6 +31,10 @@ static const char SIG_TIMEOUT[] = "timeout"; static const char SIG_ITEM_FOCUSED[] = "item,focused"; static const char SIG_ITEM_UNFOCUSED[] = "item,unfocused"; +//TIZEN_ONLY(20161109): check theme compatibility more precise +static const char STYLE_PRIORITY[4][15] = { "%s", "popup/%s", "default", "popup/default" }; +// + static const Evas_Smart_Cb_Description _smart_callbacks[] = { {SIG_BLOCK_CLICKED, ""}, {SIG_TIMEOUT, ""}, @@ -482,6 +486,9 @@ _elm_popup_elm_widget_theme_apply(Eo *obj, Elm_Popup_Data *sd) Elm_Popup_Item_Data *it; Eina_List *elist; char buf[1024], style[1024]; + //TIZEN_ONLY(20161109): check theme compatibility more precise + int i; + // _mirrored_set(obj, elm_widget_mirrored_get(obj)); @@ -492,7 +499,6 @@ _elm_popup_elm_widget_theme_apply(Eo *obj, Elm_Popup_Data *sd) { Elm_Theme_Apply ret; const char *obj_style = elm_widget_style_get(obj); - sd->style_postfix = EINA_FALSE; if (obj_style && !strcmp(obj_style, "default")) ret = elm_widget_style_set(sd->notify, "popup"); @@ -500,10 +506,9 @@ _elm_popup_elm_widget_theme_apply(Eo *obj, Elm_Popup_Data *sd) ret = elm_widget_style_set(sd->notify, obj_style); if (ret != ELM_THEME_APPLY_SUCCESS) - { - elm_widget_style_set(sd->notify, style); - sd->style_postfix = EINA_TRUE; - } + if (elm_widget_style_set(sd->notify, style) != ELM_THEME_APPLY_SUCCESS) + if (elm_widget_style_set(sd->notify, "popup") != ELM_THEME_APPLY_SUCCESS) + elm_widget_style_set(sd->notify, "popup/default"); } /* END */ @@ -518,8 +523,14 @@ _elm_popup_elm_widget_theme_apply(Eo *obj, Elm_Popup_Data *sd) if (!elm_layout_theme_set(sd->action_area, "popup", buf, style)) CRI("Failed to set layout!"); */ - snprintf(buf, sizeof(buf), "buttons%i%s", sd->last_button_number, (sd->style_postfix ? "/popup" : "")); - if (!elm_layout_theme_set(sd->action_area, "popup", buf, elm_widget_style_get(obj))) + snprintf(buf, sizeof(buf), "buttons%i", sd->last_button_number); + for (i = 0; i < 4; i++) + { + snprintf(style, sizeof(style), STYLE_PRIORITY[i], elm_widget_style_get(obj)); + if (_elm_layout_theme_set_internal(sd->action_area, "popup", buf, style) == ELM_THEME_APPLY_SUCCESS) + break; + } + if (i == 4) CRI("Failed to set layout!"); /* END */ } @@ -527,8 +538,15 @@ _elm_popup_elm_widget_theme_apply(Eo *obj, Elm_Popup_Data *sd) if (!elm_layout_theme_set(sd->content_area, "popup", "content", style)) CRI("Failed to set layout!"); */ - if (!elm_layout_theme_set(sd->content_area, "popup", (sd->style_postfix ? "content/popup" : "content"), elm_widget_style_get(obj))) + for (i = 0; i < 4; i++) + { + snprintf(style, sizeof(style), STYLE_PRIORITY[i], elm_widget_style_get(obj)); + if (_elm_layout_theme_set_internal(sd->content_area, "popup", "content", style) == ELM_THEME_APPLY_SUCCESS) + break; + } + if (i == 4) CRI("Failed to set layout!"); + snprintf(style, sizeof(style), "popup/%s", elm_widget_style_get(obj)); /* END */ if (sd->text_content_obj) // TIZEN_ONLY(20160704): fix label theme problem @@ -878,8 +896,16 @@ _button_remove(Evas_Object *obj, if (!elm_layout_theme_set(sd->action_area, "popup", buf, style)) CRI("Failed to set layout!"); */ - snprintf(buf, sizeof(buf), "buttons%i%s", sd->last_button_number, (sd->style_postfix ? "/popup" : "")); - if (!elm_layout_theme_set(sd->action_area, "popup", buf, elm_widget_style_get(obj))) + char style[1024]; + + snprintf(buf, sizeof(buf), "buttons%i", sd->last_button_number); + for (i = 0 ; i < 4; i++) + { + snprintf(style, sizeof(style), STYLE_PRIORITY[i], elm_widget_style_get(obj)); + if (_elm_layout_theme_set_internal(sd->action_area, "popup", buf, style) == ELM_THEME_APPLY_SUCCESS) + break; + } + if (i == 4) CRI("Failed to set layout!"); /* END */ } @@ -1508,11 +1534,7 @@ _action_button_set(Evas_Object *obj, Evas_Object *btn, unsigned int idx) { - /* TIZEN_ONLY(20160707): remove unused variable char buf[128], style[1024]; - */ - char buf[128]; - // unsigned int i; ELM_POPUP_DATA_GET(obj, sd); @@ -1568,8 +1590,14 @@ _action_button_set(Evas_Object *obj, if (!elm_layout_theme_set(sd->action_area, "popup", buf, style)) CRI("Failed to set layout!"); */ - snprintf(buf, sizeof(buf), "buttons%i%s", sd->last_button_number, (sd->style_postfix ? "/popup" : "")); - if (!elm_layout_theme_set(sd->action_area, "popup", buf, elm_widget_style_get(obj))) + snprintf(buf, sizeof(buf), "buttons%i", sd->last_button_number); + for (i = 0; i < 4; i++) + { + snprintf(style, sizeof(style), STYLE_PRIORITY[i], elm_widget_style_get(obj)); + if (_elm_layout_theme_set_internal(sd->action_area, "popup", buf, style) == ELM_THEME_APPLY_SUCCESS) + break; + } + if (i == 4) CRI("Failed to set layout!"); /* END */ @@ -1891,6 +1919,9 @@ EOLIAN static void _elm_popup_evas_object_smart_add(Eo *obj, Elm_Popup_Data *priv) { char style[1024]; + //TIZEN_ONLY(20161109): check theme compatibility more precise + int i; + // eo_do_super(obj, MY_CLASS, evas_obj_smart_add()); elm_widget_sub_object_parent_add(obj); @@ -1922,7 +1953,6 @@ _elm_popup_evas_object_smart_add(Eo *obj, Elm_Popup_Data *priv) { Elm_Theme_Apply ret; const char *obj_style = elm_widget_style_get(obj); - priv->style_postfix = EINA_FALSE; if (obj_style && !strcmp(obj_style, "default")) ret = elm_widget_style_set(priv->notify, "popup"); @@ -1930,10 +1960,9 @@ _elm_popup_evas_object_smart_add(Eo *obj, Elm_Popup_Data *priv) ret = elm_widget_style_set(priv->notify, obj_style); if (ret != ELM_THEME_APPLY_SUCCESS) - { - elm_widget_style_set(priv->notify, style); - priv->style_postfix = EINA_TRUE; - } + if (elm_widget_style_set(priv->notify, style) != ELM_THEME_APPLY_SUCCESS) + if (elm_widget_style_set(priv->notify, "popup") != ELM_THEME_APPLY_SUCCESS) + elm_widget_style_set(priv->notify, "popup/default"); } /* END */ @@ -1991,7 +2020,13 @@ _elm_popup_evas_object_smart_add(Eo *obj, Elm_Popup_Data *priv) (priv->content_area, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _size_hints_changed_cb, priv->main_layout); */ - if (!elm_layout_theme_set(priv->content_area, "popup", (priv->style_postfix ? "content/popup" : "content"), elm_widget_style_get(obj))) + for (i = 0 ; i < 4; i++) + { + snprintf(style, sizeof(style), STYLE_PRIORITY[i], elm_widget_style_get(obj)); + if (_elm_layout_theme_set_internal(priv->content_area, "popup", "content", style) == ELM_THEME_APPLY_SUCCESS) + break; + } + if (i == 4) CRI("Failed to set layout!"); else //TIZEN_ONLY(2016-06-23): fix popup align and size problem diff --git a/src/lib/elm_widget_popup.h b/src/lib/elm_widget_popup.h index a35fece02..2bac0daa3 100644 --- a/src/lib/elm_widget_popup.h +++ b/src/lib/elm_widget_popup.h @@ -66,9 +66,6 @@ struct _Elm_Popup_Data //TIZEN_ONLY(20160624): add a allow eval flag not to call another sizing eval during sizing eval Eina_Bool allow_eval : 1; // - //TIZEN_ONLY(20160630): add postfix to support backward compatability - Eina_Bool style_postfix; - // //TIZEN_ONLY(20161107): Supprot scrollable content //FIXME: genlist only now, it should be changed to support other scrollable.