summaryrefslogtreecommitdiff
path: root/src/lib/elementary
diff options
context:
space:
mode:
authorSungtaek Hong <sth253.hong@samsung.com>2017-11-01 10:15:48 -0700
committerCedric BAIL <cedric@osg.samsung.com>2017-11-01 10:34:45 -0700
commit5f7710f561dd91b7d417a10e65b9f767e1d11da0 (patch)
treef2832469b1c2b19092ae01580ed21ca186f23648 /src/lib/elementary
parent0a25543ed565a0aec1038aac6da535e745636ccc (diff)
efl_ui_radio: remove some legacy code
Summary: This uses constructor/destructor instead of group_add/group_del. Note: finalize can't be used for theme loading as any action done inside efl_add(...) would be lost (eg. part text set). Test Plan: 1) run elementary_test -to radio Reviewers: jpeg, woohyun, cedric Subscribers: akanad Differential Revision: https://phab.enlightenment.org/D5404 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/lib/elementary')
-rw-r--r--src/lib/elementary/efl_ui_check.c1
-rw-r--r--src/lib/elementary/efl_ui_radio.c56
-rw-r--r--src/lib/elementary/efl_ui_radio.eo1
3 files changed, 23 insertions, 35 deletions
diff --git a/src/lib/elementary/efl_ui_check.c b/src/lib/elementary/efl_ui_check.c
index 0cce3e3951..6a23310d92 100644
--- a/src/lib/elementary/efl_ui_check.c
+++ b/src/lib/elementary/efl_ui_check.c
@@ -323,7 +323,6 @@ _efl_ui_check_efl_object_constructor(Eo *obj, Efl_Ui_Check_Data *pd EINA_UNUSED)
323 obj = efl_constructor(efl_super(obj, MY_CLASS)); 323 obj = efl_constructor(efl_super(obj, MY_CLASS));
324 efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY); 324 efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
325 evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks); 325 evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
326 elm_widget_sub_object_parent_add(obj);
327 326
328 if (!elm_layout_theme_set(obj, "check", "base", elm_widget_style_get(obj))) 327 if (!elm_layout_theme_set(obj, "check", "base", elm_widget_style_get(obj)))
329 CRI("Failed to set layout!"); 328 CRI("Failed to set layout!");
diff --git a/src/lib/elementary/efl_ui_radio.c b/src/lib/elementary/efl_ui_radio.c
index da7521ac5d..c2edeb7b21 100644
--- a/src/lib/elementary/efl_ui_radio.c
+++ b/src/lib/elementary/efl_ui_radio.c
@@ -26,7 +26,7 @@ static const Elm_Layout_Part_Alias_Description _text_aliases[] =
26 26
27static const char SIG_CHANGED[] = "changed"; 27static const char SIG_CHANGED[] = "changed";
28static const Evas_Smart_Cb_Description _smart_callbacks[] = { 28static const Evas_Smart_Cb_Description _smart_callbacks[] = {
29 {SIG_CHANGED, ""}, 29 {SIG_CHANGED, ""}, /**< handled by efl_ui_check */
30 {SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */ 30 {SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */
31 {SIG_WIDGET_ACCESS_CHANGED, ""}, /**< handled by elm_widget */ 31 {SIG_WIDGET_ACCESS_CHANGED, ""}, /**< handled by elm_widget */
32 {SIG_LAYOUT_FOCUSED, ""}, /**< handled by elm_layout */ 32 {SIG_LAYOUT_FOCUSED, ""}, /**< handled by elm_layout */
@@ -202,61 +202,50 @@ _access_state_cb(void *data EINA_UNUSED, Evas_Object *obj)
202 return strdup(E_("State: Off")); 202 return strdup(E_("State: Off"));
203} 203}
204 204
205EOLIAN static void 205EAPI Evas_Object *
206_efl_ui_radio_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Radio_Data *priv) 206elm_radio_add(Evas_Object *parent)
207{ 207{
208 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 208 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
209 return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added));
210}
209 211
210 efl_canvas_group_add(efl_super(obj, EFL_UI_CHECK_CLASS)); 212EOLIAN static Eo *
211 elm_widget_sub_object_parent_add(obj); 213_efl_ui_radio_efl_object_constructor(Eo *obj, Efl_Ui_Radio_Data *pd)
214{
215 obj = efl_constructor(efl_super(obj, MY_CLASS));
216 efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
217 evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
212 218
213 if (!elm_layout_theme_set(obj, "radio", "base", elm_widget_style_get(obj))) 219 if (!elm_layout_theme_set(obj, "radio", "base", elm_widget_style_get(obj)))
214 CRI("Failed to set layout!"); 220 CRI("Failed to set layout!");
215 221
222 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
216 elm_layout_signal_callback_add 223 elm_layout_signal_callback_add
217 (obj, "elm,action,radio,toggle", "*", _radio_on_cb, obj); 224 (obj, "elm,action,radio,toggle", "*", _radio_on_cb, obj);
218 225
219 priv->group = calloc(1, sizeof(Group)); 226 pd->group = calloc(1, sizeof(Group));
220 priv->group->radios = eina_list_append(priv->group->radios, obj); 227 pd->group->radios = eina_list_append(pd->group->radios, obj);
221
222 elm_widget_can_focus_set(obj, EINA_TRUE);
223 228
224 elm_layout_sizing_eval(obj); 229 elm_layout_sizing_eval(obj);
225 230
226 _elm_access_object_register(obj, wd->resize_obj); 231 efl_access_role_set(obj, EFL_ACCESS_ROLE_RADIO_BUTTON);
227 _elm_access_text_set 232 _elm_access_text_set
228 (_elm_access_info_get(obj), ELM_ACCESS_TYPE, E_("Radio")); 233 (_elm_access_info_get(obj), ELM_ACCESS_TYPE, E_("Radio"));
229 _elm_access_callback_set 234 _elm_access_callback_set
230 (_elm_access_info_get(obj), ELM_ACCESS_INFO, _access_info_cb, obj); 235 (_elm_access_info_get(obj), ELM_ACCESS_INFO, _access_info_cb, obj);
231 _elm_access_callback_set 236 _elm_access_callback_set
232 (_elm_access_info_get(obj), ELM_ACCESS_STATE, _access_state_cb, obj); 237 (_elm_access_info_get(obj), ELM_ACCESS_STATE, _access_state_cb, obj);
233}
234 238
235EOLIAN static void 239 return obj;
236_efl_ui_radio_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Radio_Data *sd)
237{
238 sd->group->radios = eina_list_remove(sd->group->radios, obj);
239 if (!sd->group->radios) free(sd->group);
240
241 efl_canvas_group_del(efl_super(obj, EFL_UI_CHECK_CLASS));
242}
243
244EAPI Evas_Object *
245elm_radio_add(Evas_Object *parent)
246{
247 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
248 return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added));
249} 240}
250 241
251EOLIAN static Eo * 242EOLIAN static void
252_efl_ui_radio_efl_object_constructor(Eo *obj, Efl_Ui_Radio_Data *_pd EINA_UNUSED) 243_efl_ui_radio_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *pd)
253{ 244{
254 obj = efl_constructor(efl_super(obj, MY_CLASS)); 245 pd->group->radios = eina_list_remove(pd->group->radios, obj);
255 efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY); 246 if (!pd->group->radios) free(pd->group);
256 evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
257 efl_access_role_set(obj, EFL_ACCESS_ROLE_RADIO_BUTTON);
258 247
259 return obj; 248 efl_destructor(efl_super(obj, MY_CLASS));
260} 249}
261 250
262EOLIAN static void 251EOLIAN static void
@@ -392,7 +381,6 @@ ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_radio, Efl_Ui_Radio_Data)
392ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) 381ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX)
393 382
394#define EFL_UI_RADIO_EXTRA_OPS \ 383#define EFL_UI_RADIO_EXTRA_OPS \
395 EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_radio), \
396 ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX) 384 ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX)
397 385
398#include "efl_ui_radio.eo.c" 386#include "efl_ui_radio.eo.c"
diff --git a/src/lib/elementary/efl_ui_radio.eo b/src/lib/elementary/efl_ui_radio.eo
index 397c1fba25..d3a3bfd35a 100644
--- a/src/lib/elementary/efl_ui_radio.eo
+++ b/src/lib/elementary/efl_ui_radio.eo
@@ -77,6 +77,7 @@ class Efl.Ui.Radio (Efl.Ui.Check, Elm.Interface.Atspi_Widget_Action)
77 implements { 77 implements {
78 class.constructor; 78 class.constructor;
79 Efl.Object.constructor; 79 Efl.Object.constructor;
80 Efl.Object.destructor;
80 Elm.Widget.theme_apply; 81 Elm.Widget.theme_apply;
81 Elm.Widget.on_access_activate; 82 Elm.Widget.on_access_activate;
82 Elm.Widget.widget_event; 83 Elm.Widget.widget_event;