From 1dad7e3e021871d2e7103877900aaafd2795eacf Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Tue, 8 Aug 2017 17:53:55 +0900 Subject: [PATCH] widget: Move signal functions to internal only elm_widget APIs are internal only, even if they may be EAPI. The EAPI here is for modules. I believe this API is only required for layout objects, so simply should remain in the layout class. Then you can do efl_isa() and call the functions or accept error messages if you want to be more careless. Ref T5363 --- src/lib/elementary/elm_widget.c | 101 ++++++++++++++++++++------------------- src/lib/elementary/elm_widget.eo | 25 ---------- 2 files changed, 52 insertions(+), 74 deletions(-) diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c index d895b59..6554b4a 100644 --- a/src/lib/elementary/elm_widget.c +++ b/src/lib/elementary/elm_widget.c @@ -3133,53 +3133,6 @@ _elm_widget_parent_highlight_set(Eo *obj, Elm_Widget_Smart_Data *sd, Eina_Bool h } EOLIAN static void -_elm_widget_signal_emit(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED, const char *emission, const char *source) -{ - if (evas_object_smart_type_check(obj, "elm_layout")) - elm_layout_signal_emit(obj, emission, source); - else if (evas_object_smart_type_check(obj, "elm_icon")) - { - WRN("Deprecated function. This functionality on icon objects" - " will be dropped on a next release."); - _elm_icon_signal_emit(obj, emission, source); - } -} - -EOLIAN static void -_elm_widget_signal_callback_add(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED, const char *emission, const char *source, Edje_Signal_Cb func, void *data) -{ - EINA_SAFETY_ON_NULL_RETURN(func); - - if (evas_object_smart_type_check(obj, "elm_layout")) - elm_layout_signal_callback_add(obj, emission, source, func, data); - else if (evas_object_smart_type_check(obj, "elm_icon")) - { - WRN("Deprecated function. This functionality on icon objects" - " will be dropped on a next release."); - - _elm_icon_signal_callback_add(obj, emission, source, func, data); - } -} - -EOLIAN static void* -_elm_widget_signal_callback_del(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED, const char *emission, const char *source, Edje_Signal_Cb func) -{ - void *data = NULL; - - if (evas_object_smart_type_check(obj, "elm_layout")) - data = elm_layout_signal_callback_del(obj, emission, source, func); - else if (evas_object_smart_type_check(obj, "elm_icon")) - { - WRN("Deprecated function. This functionality on icon objects" - " will be dropped on a next release."); - - data = _elm_icon_signal_callback_del(obj, emission, source, func); - } - - return data; -} - -EOLIAN static void _elm_widget_focus_set(Eo *obj, Elm_Widget_Smart_Data *sd, Eina_Bool focus) { if (!sd->focused) @@ -4123,7 +4076,7 @@ _elm_widget_theme_object_set(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *ed { char buf[128]; snprintf(buf, sizeof(buf), "elm,state,orient,%d", sd->orient_mode); - elm_obj_widget_signal_emit(obj, buf, "elm"); + elm_widget_signal_emit(obj, buf, "elm"); } return ret; @@ -4702,7 +4655,7 @@ _elm_widget_orientation_set(Eo *obj, Elm_Widget_Smart_Data *sd, int orient_mode) { char buf[128]; snprintf(buf, sizeof(buf), "elm,state,orient,%d", orient_mode); - elm_obj_widget_signal_emit(obj, buf, "elm"); + elm_widget_signal_emit(obj, buf, "elm"); } } @@ -6587,6 +6540,56 @@ elm_widget_content_part_unset(Evas_Object *obj, return efl_content_unset(efl_part(obj, part)); } +EAPI void +elm_widget_signal_emit(Eo *obj, const char *emission, const char *source) +{ + ELM_WIDGET_CHECK(obj); + if (evas_object_smart_type_check(obj, "elm_layout")) + elm_layout_signal_emit(obj, emission, source); + else if (evas_object_smart_type_check(obj, "elm_icon")) + { + WRN("Deprecated function. This functionality on icon objects" + " will be dropped on a next release."); + _elm_icon_signal_emit(obj, emission, source); + } +} + +EAPI void +elm_widget_signal_callback_add(Eo *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data) +{ + ELM_WIDGET_CHECK(obj); + EINA_SAFETY_ON_NULL_RETURN(func); + if (evas_object_smart_type_check(obj, "elm_layout")) + elm_layout_signal_callback_add(obj, emission, source, func, data); + else if (evas_object_smart_type_check(obj, "elm_icon")) + { + WRN("Deprecated function. This functionality on icon objects" + " will be dropped on a next release."); + + _elm_icon_signal_callback_add(obj, emission, source, func, data); + } +} + +EAPI void * +elm_widget_signal_callback_del(Eo *obj, const char *emission, const char *source, Edje_Signal_Cb func) +{ + void *data = NULL; + + ELM_WIDGET_CHECK(obj) NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL); + if (evas_object_smart_type_check(obj, "elm_layout")) + data = elm_layout_signal_callback_del(obj, emission, source, func); + else if (evas_object_smart_type_check(obj, "elm_icon")) + { + WRN("Deprecated function. This functionality on icon objects" + " will be dropped on a next release."); + + data = _elm_icon_signal_callback_del(obj, emission, source, func); + } + + return data; +} + /* Internal EO APIs and hidden overrides */ diff --git a/src/lib/elementary/elm_widget.eo b/src/lib/elementary/elm_widget.eo index a9867c8..cb7e25b 100644 --- a/src/lib/elementary/elm_widget.eo +++ b/src/lib/elementary/elm_widget.eo @@ -534,15 +534,6 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible, } return: bool; [[$true on success, $false otherwise]] } - signal_callback_add { - [[Add signal callback]] - params { - @in emission: string; [[Signal emission]] - @in source: string; [[Signal source]] - @in func: Edje.Signal_Cb; [[Signal callback]] - @in data: void_ptr; [[Data pointer]] - } - } focus_next_manager_is { [['Virtual' function which checks if handling of passing focus to sub-objects is supported by widget.]] return: bool; [[$true on success, $false otherwise]] @@ -693,22 +684,6 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible, @out weight: double; [[Weight]] } } - signal_callback_del { - [[Delete signal callback]] - return: void_ptr; [[Handle to deleted callback]] - params { - @in emission: string; [[Signal emission]] - @in source: string; [[Signal source]] - @in func: Edje.Signal_Cb; [[Callback function]] - } - } - signal_emit { - [[Emit signal on widget]] - params { - @in emission: string; [[Signal string]] - @in source: string; [[Signal source]] - } - } disable { [['Virtual' function on the widget being disabled.]] return: bool; [[$true on success, $false otherwise]] -- 2.7.4