elementary: fix not to call duplicate theme set
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Fri, 5 Apr 2019 04:05:37 +0000 (04:05 +0000)
committerWonki Kim <wonki_.kim@samsung.com>
Mon, 8 Apr 2019 01:50:04 +0000 (10:50 +0900)
Theme is set during finalize in Efl.Ui.Layout_Base.
Therefore, it is not necessary to call theme set function if the widget
inherits Efl.Ui.Layout_Base and its klass is properly set.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D8559

src/lib/elementary/efl_ui_list.c
src/lib/elementary/efl_ui_scroller.c

index 2b2b077..1cb6f10 100644 (file)
@@ -413,6 +413,8 @@ _efl_ui_list_size_hint_changed_cb(void *data, const Efl_Event *ev EINA_UNUSED)
 EOLIAN static Eo *
 _efl_ui_list_efl_object_constructor(Eo *obj, Efl_Ui_List_Data *pd EINA_UNUSED)
 {
+   if (!elm_widget_theme_klass_get(obj))
+     elm_widget_theme_klass_set(obj, "list");
    obj = efl_constructor(efl_super(obj, MY_CLASS));
 
    return obj;
@@ -426,10 +428,6 @@ _efl_ui_list_efl_object_finalize(Eo *obj,
 
    ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
 
-   Eina_Error theme_apply_ret = efl_ui_layout_theme_set(obj, "list", "base", efl_ui_widget_style_get(obj));
-   if (theme_apply_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC)
-     CRI("list(%p) failed to set theme [efl/list:%s]!", obj, efl_ui_widget_style_get(obj) ?: "NULL");
-
    pd->smanager = efl_add(EFL_UI_SCROLL_MANAGER_CLASS, obj);
    efl_ui_mirrored_set(pd->smanager, efl_ui_mirrored_get(obj));
    efl_composite_attach(obj, pd->smanager);
index 44fdb60..a61a828 100644 (file)
@@ -565,6 +565,8 @@ EOLIAN static Eo *
 _efl_ui_scroller_efl_object_constructor(Eo *obj,
                                         Efl_Ui_Scroller_Data *sd EINA_UNUSED)
 {
+   if (!elm_widget_theme_klass_get(obj))
+     elm_widget_theme_klass_set(obj, "scroller");
    obj = efl_constructor(efl_super(obj, MY_CLASS));
 
    return obj;
@@ -578,8 +580,6 @@ _efl_ui_scroller_efl_object_finalize(Eo *obj,
 
    ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
 
-   efl_ui_layout_theme_set(obj, "scroller", "base", efl_ui_widget_style_get(obj));
-
    sd->smanager = efl_add(EFL_UI_SCROLL_MANAGER_CLASS, obj);
    efl_ui_mirrored_set(sd->smanager, efl_ui_mirrored_get(obj));
    efl_composite_attach(obj, sd->smanager);