summaryrefslogtreecommitdiff
path: root/src/lib/elementary
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-05-13 10:02:36 -0400
committerMike Blumenkrantz <zmike@samsung.com>2020-05-13 10:02:36 -0400
commitcf94110b0427def60e1398c6700a26da58db6364 (patch)
tree42c9bf86b48b3905af6931e786eee06394451c2b /src/lib/elementary
parent6a14507edc133f1e51a6123df646162c5831b1f2 (diff)
elm: refactor legacy _icon_signal_emit
Summary: this was duplicated for a number of widgets in slightly different ways, so it can be unified as a private layout function to reduce maintenance costs Reviewers: Hermet, YOhoho, Jaehyun_Cho, jsuya Reviewed By: jsuya Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11818
Diffstat (limited to 'src/lib/elementary')
-rw-r--r--src/lib/elementary/efl_ui_button.c24
-rw-r--r--src/lib/elementary/efl_ui_check.c26
-rw-r--r--src/lib/elementary/efl_ui_layout.c20
-rw-r--r--src/lib/elementary/efl_ui_progressbar.c23
-rw-r--r--src/lib/elementary/efl_ui_radio.c25
-rw-r--r--src/lib/elementary/elm_priv.h1
6 files changed, 33 insertions, 86 deletions
diff --git a/src/lib/elementary/efl_ui_button.c b/src/lib/elementary/efl_ui_button.c
index 8f8e8a664f..d91b874422 100644
--- a/src/lib/elementary/efl_ui_button.c
+++ b/src/lib/elementary/efl_ui_button.c
@@ -397,24 +397,6 @@ _efl_ui_button_legacy_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED)
397/* FIXME: replicated from elm_layout just because button's icon spot 397/* FIXME: replicated from elm_layout just because button's icon spot
398 * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we 398 * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we
399 * can changed the theme API */ 399 * can changed the theme API */
400static void
401_icon_signal_emit(Evas_Object *obj)
402{
403 char buf[64];
404
405 if (!elm_widget_resize_object_get(obj)) return;
406 if (!edje_object_part_exists(obj, "elm.swallow.content")) return;
407 snprintf(buf, sizeof(buf), "elm,state,icon,%s",
408 elm_layout_content_get(obj, "icon") ? "visible" : "hidden");
409
410 elm_layout_signal_emit(obj, buf, "elm");
411 edje_object_message_signal_process(elm_layout_edje_get(obj));
412 efl_canvas_group_change(obj);
413}
414
415/* FIXME: replicated from elm_layout just because button's icon spot
416 * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we
417 * can changed the theme API */
418EOLIAN static Eina_Error 400EOLIAN static Eina_Error
419_efl_ui_button_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED) 401_efl_ui_button_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED)
420{ 402{
@@ -422,7 +404,7 @@ _efl_ui_button_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED)
422 404
423 int_ret = efl_ui_widget_theme_apply(efl_super(obj, EFL_UI_BUTTON_LEGACY_CLASS)); 405 int_ret = efl_ui_widget_theme_apply(efl_super(obj, EFL_UI_BUTTON_LEGACY_CLASS));
424 if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret; 406 if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret;
425 if (efl_finalized_get(obj)) _icon_signal_emit(obj); 407 if (efl_finalized_get(obj)) _elm_layout_legacy_icon_signal_emit(obj);
426 408
427 return int_ret; 409 return int_ret;
428} 410}
@@ -438,7 +420,7 @@ _efl_ui_button_legacy_efl_ui_widget_widget_sub_object_del(Eo *obj, void *_pd EIN
438 int_ret = elm_widget_sub_object_del(efl_super(obj, EFL_UI_BUTTON_LEGACY_CLASS), sobj); 420 int_ret = elm_widget_sub_object_del(efl_super(obj, EFL_UI_BUTTON_LEGACY_CLASS), sobj);
439 if (!int_ret) return EINA_FALSE; 421 if (!int_ret) return EINA_FALSE;
440 422
441 _icon_signal_emit(obj); 423 _elm_layout_legacy_icon_signal_emit(obj);
442 424
443 return EINA_TRUE; 425 return EINA_TRUE;
444} 426}
@@ -454,7 +436,7 @@ _efl_ui_button_legacy_content_set(Eo *obj, void *_pd EINA_UNUSED, const char *pa
454 int_ret = efl_content_set(efl_part(efl_super(obj, EFL_UI_BUTTON_LEGACY_CLASS), part), content); 436 int_ret = efl_content_set(efl_part(efl_super(obj, EFL_UI_BUTTON_LEGACY_CLASS), part), content);
455 if (!int_ret) return EINA_FALSE; 437 if (!int_ret) return EINA_FALSE;
456 438
457 _icon_signal_emit(obj); 439 _elm_layout_legacy_icon_signal_emit(obj);
458 440
459 return EINA_TRUE; 441 return EINA_TRUE;
460} 442}
diff --git a/src/lib/elementary/efl_ui_check.c b/src/lib/elementary/efl_ui_check.c
index cce98bf5a0..da51f880ce 100644
--- a/src/lib/elementary/efl_ui_check.c
+++ b/src/lib/elementary/efl_ui_check.c
@@ -453,26 +453,6 @@ _efl_ui_check_legacy_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED)
453/* FIXME: replicated from elm_layout just because check's icon spot 453/* FIXME: replicated from elm_layout just because check's icon spot
454 * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we 454 * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we
455 * can changed the theme API */ 455 * can changed the theme API */
456static void
457_icon_signal_emit(Evas_Object *obj)
458{
459 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
460 char buf[64];
461
462 if (!elm_widget_resize_object_get(obj)) return;
463 if (!edje_object_part_exists(obj, "elm.swallow.content")) return;
464 snprintf(buf, sizeof(buf), "elm,state,icon,%s",
465 elm_layout_content_get(obj, "icon") ? "visible" : "hidden");
466
467 elm_layout_signal_emit(obj, buf, "elm");
468 edje_object_message_signal_process(wd->resize_obj);
469
470 efl_canvas_group_change(obj);
471}
472
473/* FIXME: replicated from elm_layout just because check's icon spot
474 * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we
475 * can changed the theme API */
476EOLIAN static Eina_Error 456EOLIAN static Eina_Error
477_efl_ui_check_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED) 457_efl_ui_check_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED)
478{ 458{
@@ -481,7 +461,7 @@ _efl_ui_check_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED)
481 int_ret = efl_ui_widget_theme_apply(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS)); 461 int_ret = efl_ui_widget_theme_apply(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS));
482 if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret; 462 if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret;
483 463
484 if (efl_finalized_get(obj)) _icon_signal_emit(obj); 464 if (efl_finalized_get(obj)) _elm_layout_legacy_icon_signal_emit(obj);
485 465
486 return int_ret; 466 return int_ret;
487} 467}
@@ -497,7 +477,7 @@ _efl_ui_check_legacy_efl_ui_widget_widget_sub_object_del(Eo *obj, void *_pd EINA
497 int_ret = elm_widget_sub_object_del(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS), sobj); 477 int_ret = elm_widget_sub_object_del(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS), sobj);
498 if (!int_ret) return EINA_FALSE; 478 if (!int_ret) return EINA_FALSE;
499 479
500 _icon_signal_emit(obj); 480 _elm_layout_legacy_icon_signal_emit(obj);
501 481
502 return EINA_TRUE; 482 return EINA_TRUE;
503} 483}
@@ -513,7 +493,7 @@ _efl_ui_check_legacy_content_set(Eo *obj, void *_pd EINA_UNUSED, const char *par
513 int_ret = efl_content_set(efl_part(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS), part), content); 493 int_ret = efl_content_set(efl_part(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS), part), content);
514 if (!int_ret) return EINA_FALSE; 494 if (!int_ret) return EINA_FALSE;
515 495
516 _icon_signal_emit(obj); 496 _elm_layout_legacy_icon_signal_emit(obj);
517 497
518 return EINA_TRUE; 498 return EINA_TRUE;
519} 499}
diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c
index 209665b1ad..34a9c2967e 100644
--- a/src/lib/elementary/efl_ui_layout.c
+++ b/src/lib/elementary/efl_ui_layout.c
@@ -3297,6 +3297,26 @@ _elm_layout_signal_callback_add_legacy(Eo *obj, Eo *edje, Eina_List **p_edje_sig
3297 _edje_signal_callback, esd); 3297 _edje_signal_callback, esd);
3298} 3298}
3299 3299
3300/* replicated from elm_layout just because legacy widget's icon spot
3301 * is elm.swallow.content, not elm.swallow.icon.
3302 */
3303void
3304_elm_layout_legacy_icon_signal_emit(Evas_Object *obj)
3305{
3306 char buf[63];
3307 Eo *edje;
3308
3309 edje = elm_layout_edje_get(obj);
3310 if (!edje) return;
3311 if (!edje_object_part_exists(obj, "elm.swallow.content")) return;
3312 snprintf(buf, sizeof(buf), "elm,state,icon,%s",
3313 elm_layout_content_get(obj, "icon") ? "visible" : "hidden");
3314
3315 elm_layout_signal_emit(obj, buf, "elm");
3316 edje_object_message_signal_process(edje);
3317 efl_canvas_group_change(obj);
3318}
3319
3300EAPI void 3320EAPI void
3301elm_layout_signal_callback_add(Eo *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data) 3321elm_layout_signal_callback_add(Eo *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data)
3302{ 3322{
diff --git a/src/lib/elementary/efl_ui_progressbar.c b/src/lib/elementary/efl_ui_progressbar.c
index 213579e375..bf0f14764a 100644
--- a/src/lib/elementary/efl_ui_progressbar.c
+++ b/src/lib/elementary/efl_ui_progressbar.c
@@ -747,23 +747,6 @@ _efl_ui_progressbar_legacy_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED)
747/* FIXME: replicated from elm_layout just because progressbar's icon spot 747/* FIXME: replicated from elm_layout just because progressbar's icon spot
748 * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we 748 * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we
749 * can changed the theme API */ 749 * can changed the theme API */
750static void
751_icon_signal_emit(Evas_Object *obj)
752{
753 char buf[64];
754
755 if (!elm_widget_resize_object_get(obj)) return;
756 snprintf(buf, sizeof(buf), "elm,state,icon,%s",
757 elm_layout_content_get(obj, "icon") ? "visible" : "hidden");
758
759 elm_layout_signal_emit(obj, buf, "elm");
760 edje_object_message_signal_process(elm_layout_edje_get(obj));
761 efl_canvas_group_change(obj);
762}
763
764/* FIXME: replicated from elm_layout just because progressbar's icon spot
765 * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we
766 * can changed the theme API */
767EOLIAN static Eina_Error 750EOLIAN static Eina_Error
768_efl_ui_progressbar_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED) 751_efl_ui_progressbar_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED)
769{ 752{
@@ -771,7 +754,7 @@ _efl_ui_progressbar_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNU
771 754
772 int_ret = efl_ui_widget_theme_apply(efl_super(obj, EFL_UI_PROGRESSBAR_LEGACY_CLASS)); 755 int_ret = efl_ui_widget_theme_apply(efl_super(obj, EFL_UI_PROGRESSBAR_LEGACY_CLASS));
773 if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret; 756 if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret;
774 if (efl_finalized_get(obj)) _icon_signal_emit(obj); 757 if (efl_finalized_get(obj)) _elm_layout_legacy_icon_signal_emit(obj);
775 758
776 return int_ret; 759 return int_ret;
777} 760}
@@ -787,7 +770,7 @@ _efl_ui_progressbar_legacy_efl_ui_widget_widget_sub_object_del(Eo *obj, void *_p
787 int_ret = elm_widget_sub_object_del(efl_super(obj, EFL_UI_PROGRESSBAR_LEGACY_CLASS), sobj); 770 int_ret = elm_widget_sub_object_del(efl_super(obj, EFL_UI_PROGRESSBAR_LEGACY_CLASS), sobj);
788 if (!int_ret) return EINA_FALSE; 771 if (!int_ret) return EINA_FALSE;
789 772
790 _icon_signal_emit(obj); 773 _elm_layout_legacy_icon_signal_emit(obj);
791 774
792 return EINA_TRUE; 775 return EINA_TRUE;
793} 776}
@@ -803,7 +786,7 @@ _efl_ui_progressbar_legacy_content_set(Eo *obj, void *_pd EINA_UNUSED, const cha
803 int_ret = efl_content_set(efl_part(efl_super(obj, EFL_UI_PROGRESSBAR_LEGACY_CLASS), part), content); 786 int_ret = efl_content_set(efl_part(efl_super(obj, EFL_UI_PROGRESSBAR_LEGACY_CLASS), part), content);
804 if (!int_ret) return EINA_FALSE; 787 if (!int_ret) return EINA_FALSE;
805 788
806 _icon_signal_emit(obj); 789 _elm_layout_legacy_icon_signal_emit(obj);
807 790
808 return EINA_TRUE; 791 return EINA_TRUE;
809} 792}
diff --git a/src/lib/elementary/efl_ui_radio.c b/src/lib/elementary/efl_ui_radio.c
index 34a82c737c..e78168318c 100644
--- a/src/lib/elementary/efl_ui_radio.c
+++ b/src/lib/elementary/efl_ui_radio.c
@@ -336,25 +336,6 @@ _efl_ui_radio_legacy_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED)
336 return obj; 336 return obj;
337} 337}
338 338
339/* FIXME: replicated from elm_layout just because radio's icon spot
340 * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we
341 * can changed the theme API */
342static void
343_icon_signal_emit(Evas_Object *obj)
344{
345 char buf[63];
346 Eo *edje;
347
348 edje = elm_widget_resize_object_get(obj);
349 if (!edje) return;
350 snprintf(buf, sizeof(buf), "elm,state,icon,%s",
351 elm_layout_content_get(obj, "icon") ? "visible" : "hidden");
352
353 elm_layout_signal_emit(obj, buf, "elm");
354 edje_object_message_signal_process(edje);
355 efl_canvas_group_change(obj);
356}
357
358EOLIAN static Eina_Error 339EOLIAN static Eina_Error
359_efl_ui_radio_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED) 340_efl_ui_radio_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED)
360{ 341{
@@ -365,7 +346,7 @@ _efl_ui_radio_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED)
365 /* FIXME: replicated from elm_layout just because radio's icon 346 /* FIXME: replicated from elm_layout just because radio's icon
366 * spot is elm.swallow.content, not elm.swallow.icon. Fix that 347 * spot is elm.swallow.content, not elm.swallow.icon. Fix that
367 * whenever we can changed the theme API */ 348 * whenever we can changed the theme API */
368 if (efl_finalized_get(obj)) _icon_signal_emit(obj); 349 if (efl_finalized_get(obj)) _elm_layout_legacy_icon_signal_emit(obj);
369 350
370 return int_ret; 351 return int_ret;
371} 352}
@@ -381,7 +362,7 @@ _efl_ui_radio_legacy_efl_ui_widget_widget_sub_object_del(Eo *obj, void *_pd EINA
381 int_ret = elm_widget_sub_object_del(efl_super(obj, EFL_UI_RADIO_LEGACY_CLASS), sobj); 362 int_ret = elm_widget_sub_object_del(efl_super(obj, EFL_UI_RADIO_LEGACY_CLASS), sobj);
382 if (!int_ret) return EINA_FALSE; 363 if (!int_ret) return EINA_FALSE;
383 364
384 _icon_signal_emit(obj); 365 _elm_layout_legacy_icon_signal_emit(obj);
385 366
386 return EINA_TRUE; 367 return EINA_TRUE;
387} 368}
@@ -397,7 +378,7 @@ _efl_ui_radio_legacy_content_set(Eo *obj, void *_pd EINA_UNUSED, const char *par
397 int_ret = efl_content_set(efl_part(efl_super(obj, EFL_UI_RADIO_LEGACY_CLASS), part), content); 378 int_ret = efl_content_set(efl_part(efl_super(obj, EFL_UI_RADIO_LEGACY_CLASS), part), content);
398 if (!int_ret) return EINA_FALSE; 379 if (!int_ret) return EINA_FALSE;
399 380
400 _icon_signal_emit(obj); 381 _elm_layout_legacy_icon_signal_emit(obj);
401 382
402 return EINA_TRUE; 383 return EINA_TRUE;
403} 384}
diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h
index 5f3efd8bb5..146f2f8c53 100644
--- a/src/lib/elementary/elm_priv.h
+++ b/src/lib/elementary/elm_priv.h
@@ -931,6 +931,7 @@ void _elm_entry_entry_paste(Evas_Object *obj, const char *entry);
931 931
932double _elm_atof(const char *s); 932double _elm_atof(const char *s);
933 933
934void _elm_layout_legacy_icon_signal_emit(Evas_Object *obj);
934// elm_layout and elm_entry LEGACY signal API (returned the user data pointer) 935// elm_layout and elm_entry LEGACY signal API (returned the user data pointer)
935void _elm_layout_signal_callback_add_legacy(Eo *obj, Eo *edje, Eina_List **p_edje_signals, const char *emission, const char *source, Edje_Signal_Cb func, void *data); 936void _elm_layout_signal_callback_add_legacy(Eo *obj, Eo *edje, Eina_List **p_edje_signals, const char *emission, const char *source, Edje_Signal_Cb func, void *data);
936void *_elm_layout_signal_callback_del_legacy(Eo *obj, Eo *edje, Eina_List **p_edje_signals, const char *emission, const char *source, Edje_Signal_Cb func); 937void *_elm_layout_signal_callback_del_legacy(Eo *obj, Eo *edje, Eina_List **p_edje_signals, const char *emission, const char *source, Edje_Signal_Cb func);