popup: check theme compatibility more precise
authorJinYong Park <j4939.park@samsung.com>
Wed, 9 Nov 2016 08:15:22 +0000 (17:15 +0900)
committerTaehyub Kim <taehyub.kim@samsung.com>
Tue, 29 Nov 2016 12:32:36 +0000 (21:32 +0900)
Change-Id: I0d69fef35d85bef53d4818c7fc578adb3a52db58
Signed-off-by: Jinyong Park <j4939.park@samsung.com>
src/lib/elc_popup.c
src/lib/elm_widget_popup.h

index f0dbefff74d46541479050fa801a813f57192de2..5029fc3ec89b44d894c2ea7728b9f167466cdc69 100644 (file)
@@ -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
index a35fece0288301cb410807e1359c38466f35b990..2bac0daa3ab5bdc838db40864b92ffda9d404ebd 100644 (file)
@@ -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.