From 392fce916fec902cfd14be5cfc64a8e99f0698d0 Mon Sep 17 00:00:00 2001 From: YeongJong Lee Date: Mon, 4 Jun 2018 17:48:06 +0900 Subject: [PATCH] elementary: fix wrong signal emission Summary: When _icon_signal_emit is called, "icon" part always exist. so, it only make "visible" signal. this fixes that issue Test Plan: elm_object_content_unset(button); elm_object_content_unset(radio); elm_object_content_unset(check); elm_object_content_unset(progressbar); Reviewers: Jaehyun_Cho Reviewed By: Jaehyun_Cho Subscribers: cedric, #committers, zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6241 --- src/lib/elementary/efl_ui_button.c | 12 ++++++------ src/lib/elementary/efl_ui_check.c | 12 ++++++------ src/lib/elementary/efl_ui_progressbar.c | 12 ++++++------ src/lib/elementary/efl_ui_radio.c | 12 ++++++------ 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/lib/elementary/efl_ui_button.c b/src/lib/elementary/efl_ui_button.c index 3a51f94..2f4dd35 100644 --- a/src/lib/elementary/efl_ui_button.c +++ b/src/lib/elementary/efl_ui_button.c @@ -436,13 +436,12 @@ _efl_ui_button_legacy_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED) * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we * can changed the theme API */ static void -_icon_signal_emit(Evas_Object *obj) +_icon_signal_emit(Evas_Object *obj, Eina_Bool vis) { char buf[64]; if (!elm_widget_resize_object_get(obj)) return; - snprintf(buf, sizeof(buf), "elm,state,icon,%s", - elm_layout_content_get(obj, "icon") ? "visible" : "hidden"); + snprintf(buf, sizeof(buf), "elm,state,icon,%s", vis ? "visible" : "hidden"); elm_layout_signal_emit(obj, buf, "elm"); edje_object_message_signal_process(elm_layout_edje_get(obj)); @@ -459,7 +458,7 @@ _efl_ui_button_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED) int_ret = efl_ui_widget_theme_apply(efl_super(obj, EFL_UI_BUTTON_LEGACY_CLASS)); if (!int_ret) return EFL_UI_THEME_APPLY_FAILED; - _icon_signal_emit(obj); + _icon_signal_emit(obj, !!elm_layout_content_get(obj, "icon")); #ifdef TIZEN_VECTOR_UX tizen_vg_button_set(obj); @@ -479,7 +478,7 @@ _efl_ui_button_legacy_efl_ui_widget_widget_sub_object_del(Eo *obj, void *_pd EIN int_ret = elm_widget_sub_object_del(efl_super(obj, EFL_UI_BUTTON_LEGACY_CLASS), sobj); if (!int_ret) return EINA_FALSE; - _icon_signal_emit(obj); + _icon_signal_emit(obj, EINA_FALSE); return EINA_TRUE; } @@ -495,7 +494,8 @@ _efl_ui_button_legacy_content_set(Eo *obj, void *_pd EINA_UNUSED, const char *pa int_ret = efl_content_set(efl_part(efl_super(obj, EFL_UI_BUTTON_LEGACY_CLASS), part), content); if (!int_ret) return EINA_FALSE; - _icon_signal_emit(obj); + if (content) + _icon_signal_emit(obj, EINA_TRUE); return EINA_TRUE; } diff --git a/src/lib/elementary/efl_ui_check.c b/src/lib/elementary/efl_ui_check.c index f53bc53..a136edd 100644 --- a/src/lib/elementary/efl_ui_check.c +++ b/src/lib/elementary/efl_ui_check.c @@ -480,14 +480,13 @@ _efl_ui_check_legacy_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED) * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we * can changed the theme API */ static void -_icon_signal_emit(Evas_Object *obj) +_icon_signal_emit(Evas_Object *obj, Eina_Bool vis) { ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); char buf[64]; if (!elm_widget_resize_object_get(obj)) return; - snprintf(buf, sizeof(buf), "elm,state,icon,%s", - elm_layout_content_get(obj, "icon") ? "visible" : "hidden"); + snprintf(buf, sizeof(buf), "elm,state,icon,%s", vis ? "visible" : "hidden"); elm_layout_signal_emit(obj, buf, "elm"); edje_object_message_signal_process(wd->resize_obj); @@ -506,7 +505,7 @@ _efl_ui_check_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED) int_ret = efl_ui_widget_theme_apply(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS)); if (!int_ret) return EFL_UI_THEME_APPLY_FAILED; - _icon_signal_emit(obj); + _icon_signal_emit(obj, !!elm_layout_content_get(obj, "icon")); return int_ret; } @@ -522,7 +521,7 @@ _efl_ui_check_legacy_efl_ui_widget_widget_sub_object_del(Eo *obj, void *_pd EINA int_ret = elm_widget_sub_object_del(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS), sobj); if (!int_ret) return EINA_FALSE; - _icon_signal_emit(obj); + _icon_signal_emit(obj, EINA_FALSE); return EINA_TRUE; } @@ -538,7 +537,8 @@ _efl_ui_check_legacy_content_set(Eo *obj, void *_pd EINA_UNUSED, const char *par int_ret = efl_content_set(efl_part(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS), part), content); if (!int_ret) return EINA_FALSE; - _icon_signal_emit(obj); + if (content) + _icon_signal_emit(obj, EINA_TRUE); return EINA_TRUE; } diff --git a/src/lib/elementary/efl_ui_progressbar.c b/src/lib/elementary/efl_ui_progressbar.c index 4a5dfbe..6bc95ab 100644 --- a/src/lib/elementary/efl_ui_progressbar.c +++ b/src/lib/elementary/efl_ui_progressbar.c @@ -839,13 +839,12 @@ _efl_ui_progressbar_legacy_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED) * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we * can changed the theme API */ static void -_icon_signal_emit(Evas_Object *obj) +_icon_signal_emit(Evas_Object *obj, Eina_Bool vis) { char buf[64]; if (!elm_widget_resize_object_get(obj)) return; - snprintf(buf, sizeof(buf), "elm,state,icon,%s", - elm_layout_content_get(obj, "icon") ? "visible" : "hidden"); + snprintf(buf, sizeof(buf), "elm,state,icon,%s", vis ? "visible" : "hidden"); elm_layout_signal_emit(obj, buf, "elm"); edje_object_message_signal_process(elm_layout_edje_get(obj)); @@ -862,7 +861,7 @@ _efl_ui_progressbar_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNU int_ret = efl_ui_widget_theme_apply(efl_super(obj, EFL_UI_PROGRESSBAR_LEGACY_CLASS)); if (!int_ret) return EFL_UI_THEME_APPLY_FAILED; - _icon_signal_emit(obj); + _icon_signal_emit(obj, !!elm_layout_content_get(obj, "icon")); return int_ret; } @@ -878,7 +877,7 @@ _efl_ui_progressbar_legacy_efl_ui_widget_widget_sub_object_del(Eo *obj, void *_p int_ret = elm_widget_sub_object_del(efl_super(obj, EFL_UI_PROGRESSBAR_LEGACY_CLASS), sobj); if (!int_ret) return EINA_FALSE; - _icon_signal_emit(obj); + _icon_signal_emit(obj, EINA_FALSE); return EINA_TRUE; } @@ -894,7 +893,8 @@ _efl_ui_progressbar_legacy_content_set(Eo *obj, void *_pd EINA_UNUSED, const cha int_ret = efl_content_set(efl_part(efl_super(obj, EFL_UI_PROGRESSBAR_LEGACY_CLASS), part), content); if (!int_ret) return EINA_FALSE; - _icon_signal_emit(obj); + if (content) + _icon_signal_emit(obj, EINA_TRUE); return EINA_TRUE; } diff --git a/src/lib/elementary/efl_ui_radio.c b/src/lib/elementary/efl_ui_radio.c index 2bc40c0..45b7bcf 100644 --- a/src/lib/elementary/efl_ui_radio.c +++ b/src/lib/elementary/efl_ui_radio.c @@ -399,15 +399,14 @@ _efl_ui_radio_legacy_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED) * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we * can changed the theme API */ static void -_icon_signal_emit(Evas_Object *obj) +_icon_signal_emit(Evas_Object *obj, Eina_Bool vis) { char buf[63]; Eo *edje; edje = elm_widget_resize_object_get(obj); if (!edje) return; - snprintf(buf, sizeof(buf), "elm,state,icon,%s", - elm_layout_content_get(obj, "icon") ? "visible" : "hidden"); + snprintf(buf, sizeof(buf), "elm,state,icon,%s", vis ? "visible" : "hidden"); elm_layout_signal_emit(obj, buf, "elm"); edje_object_message_signal_process(edje); @@ -424,7 +423,7 @@ _efl_ui_radio_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED) /* FIXME: replicated from elm_layout just because radio's icon * spot is elm.swallow.content, not elm.swallow.icon. Fix that * whenever we can changed the theme API */ - _icon_signal_emit(obj); + _icon_signal_emit(obj, !!elm_layout_content_get(obj, "icon")); return int_ret; } @@ -440,7 +439,7 @@ _efl_ui_radio_legacy_efl_ui_widget_widget_sub_object_del(Eo *obj, void *_pd EINA int_ret = elm_widget_sub_object_del(efl_super(obj, EFL_UI_RADIO_LEGACY_CLASS), sobj); if (!int_ret) return EINA_FALSE; - _icon_signal_emit(obj); + _icon_signal_emit(obj, EINA_FALSE); return EINA_TRUE; } @@ -456,7 +455,8 @@ _efl_ui_radio_legacy_content_set(Eo *obj, void *_pd EINA_UNUSED, const char *par int_ret = efl_content_set(efl_part(efl_super(obj, EFL_UI_RADIO_LEGACY_CLASS), part), content); if (!int_ret) return EINA_FALSE; - _icon_signal_emit(obj); + if (content) + _icon_signal_emit(obj, EINA_TRUE); return EINA_TRUE; } -- 2.7.4