This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository efl.
View the commit online.
commit 314a2f8c30cfdbc30496f938e460aa796ffdce77
Author: Cedric BAIL <[email protected]>
AuthorDate: Sun Nov 15 13:00:40 2026 -0600
elementary: the content parts of items can be filled at construction
Efl.Ui.Layout_Part_Content can be filled while the object that owns
the part is being constructed, and each part found a bug when tested
for what it holds after finalize:
- Default_Item and List_Placeholder_Item answer their part names
themselves and skipped the step of Layout_Base's part_get that loads
the theme, so content set on a part before finalize had no edje
group to go into and was lost.
- List_Placeholder_Item chose its theme in finalize, after the plain
list item group, which has no content part, was loaded. It now
chooses it in its constructor, which also lets a style given at
construction be the one it uses instead of being overwritten.
- Navigation_Bar dropped what it found for left_content and
right_content and answered NULL.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
src/lib/elementary/efl_ui_default_item.c | 1 +
src/lib/elementary/efl_ui_list_placeholder_item.c | 23 ++++++++------
src/lib/elementary/efl_ui_list_placeholder_item.eo | 2 +-
src/lib/elementary/efl_ui_navigation_bar.c | 4 +--
src/lib/elementary/elm_part_helper.h | 13 ++++++++
src/tests/elementary/efl_ui_test_layout.c | 37 ++++++++++++++++++++++
6 files changed, 67 insertions(+), 13 deletions(-)
diff --git a/src/lib/elementary/efl_ui_default_item.c b/src/lib/elementary/efl_ui_default_item.c
index aee1ffca18..093b944081 100644
--- a/src/lib/elementary/efl_ui_default_item.c
+++ b/src/lib/elementary/efl_ui_default_item.c
@@ -25,6 +25,7 @@ EOLIAN static Efl_Object *
_efl_ui_default_item_efl_part_part_get(const Eo *obj, void *pd EINA_UNUSED, const char *part)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
+ _elm_part_layout_theme_forward(obj);
if (eina_streq(part, "text"))
return ELM_PART_IMPLEMENT(EFL_UI_LAYOUT_PART_TEXT_CLASS, obj, "efl.text");
else if (eina_streq(part, "icon"))
diff --git a/src/lib/elementary/efl_ui_list_placeholder_item.c b/src/lib/elementary/efl_ui_list_placeholder_item.c
index 9173646375..25e71e8f7d 100644
--- a/src/lib/elementary/efl_ui_list_placeholder_item.c
+++ b/src/lib/elementary/efl_ui_list_placeholder_item.c
@@ -15,17 +15,17 @@
#define MY_CLASS_NAME "Efl.Ui.List_Placeholder_Item"
+/* The theme is chosen here, not at finalize, so that the content of a part
+ * given while the item is being constructed is swallowed by the group that
+ * has that part. */
EOLIAN static Efl_Object *
-_efl_ui_list_placeholder_item_efl_object_finalize(Eo *obj, void *pd EINA_UNUSED)
+_efl_ui_list_placeholder_item_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED)
{
- Eo *eo;
- eo = efl_finalize(efl_super(obj, MY_CLASS));
- ELM_WIDGET_DATA_GET_OR_RETURN(eo, wd, eo);
- Eina_Error theme_apply_ret = efl_ui_layout_theme_set(obj, "list_item", NULL, "placeholder");
-
- if (theme_apply_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC)
- CRI("Empty Item(%p) failed to set theme [efl/list_item:placeholder]!", eo);
- return eo;
+ obj = efl_constructor(efl_super(obj, MY_CLASS));
+ if (!elm_widget_theme_klass_get(obj))
+ elm_widget_theme_klass_set(obj, "list_item");
+ elm_widget_theme_style_set(obj, "placeholder");
+ return obj;
}
EOLIAN static void
@@ -44,7 +44,10 @@ _efl_ui_list_placeholder_item_efl_part_part_get(const Eo *obj, void *wd EINA_UNU
{
EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
if (eina_streq(part, "content"))
- return ELM_PART_IMPLEMENT(EFL_UI_LAYOUT_PART_CONTENT_CLASS, obj, "efl.content");
+ {
+ _elm_part_layout_theme_forward(obj);
+ return ELM_PART_IMPLEMENT(EFL_UI_LAYOUT_PART_CONTENT_CLASS, obj, "efl.content");
+ }
return efl_part_get(efl_super(obj, MY_CLASS), part);
}
diff --git a/src/lib/elementary/efl_ui_list_placeholder_item.eo b/src/lib/elementary/efl_ui_list_placeholder_item.eo
index fc78f4da84..6253ad5c6d 100644
--- a/src/lib/elementary/efl_ui_list_placeholder_item.eo
+++ b/src/lib/elementary/efl_ui_list_placeholder_item.eo
@@ -12,7 +12,7 @@ class @beta Efl.Ui.List_Placeholder_Item extends Efl.Ui.Item implements Efl.Cont
}
implements {
//Efl.Object
- Efl.Object.finalize;
+ Efl.Object.constructor;
Efl.Object.destructor;
Efl.Content.content { get; set; }
Efl.Content.content_unset;
diff --git a/src/lib/elementary/efl_ui_navigation_bar.c b/src/lib/elementary/efl_ui_navigation_bar.c
index 1ecc6282c1..c2af32e9f6 100644
--- a/src/lib/elementary/efl_ui_navigation_bar.c
+++ b/src/lib/elementary/efl_ui_navigation_bar.c
@@ -88,9 +88,9 @@ static Efl_Gfx_Entity *
_efl_ui_navigation_bar_content_get(const Eo *obj, Efl_Ui_Navigation_Bar_Data *_pd EINA_UNUSED, const char *part)
{
if (eina_streq(part, "left_content"))
- efl_content_get(efl_part(efl_super(obj, MY_CLASS), "efl.left_content"));
+ return efl_content_get(efl_part(efl_super(obj, MY_CLASS), "efl.left_content"));
else if (eina_streq(part, "right_content"))
- efl_content_get(efl_part(efl_super(obj, MY_CLASS), "efl.right_content"));
+ return efl_content_get(efl_part(efl_super(obj, MY_CLASS), "efl.right_content"));
return efl_content_get(efl_part(efl_super(obj, MY_CLASS), part));
}
diff --git a/src/lib/elementary/elm_part_helper.h b/src/lib/elementary/elm_part_helper.h
index 30230e7007..796a837345 100644
--- a/src/lib/elementary/elm_part_helper.h
+++ b/src/lib/elementary/elm_part_helper.h
@@ -3,6 +3,7 @@
#include "Elementary.h"
#include "elm_priv.h"
+#include "elm_widget_layout.h"
#include "efl_ui_layout_part_legacy.eo.h"
//#define ELM_PART_HOOK do { ERR("%s@%p:%s [%d]", efl_class_name_get(pd->obj), pd->obj, pd->part, (int) pd->temp); } while(0)
@@ -82,6 +83,18 @@ _elm_part_initialize(Eo *proxy, Eo *obj, const char *part)
return proxy;
}
+/* A swallow can only be made once the theme gives the layout its group, and
+ * a layout being built has none until finalize. Efl.Ui.Layout_Base.part_get
+ * brings the theme forward for that reason; a class answering part_get by
+ * itself, for parts of its own, has to do the same before it hands one out. */
+static inline void
+_elm_part_layout_theme_forward(const Eo *obj)
+{
+ Efl_Ui_Layout_Data *sd = efl_data_scope_safe_get(obj, EFL_UI_LAYOUT_BASE_CLASS);
+
+ if (sd && sd->needs_theme_apply) efl_ui_widget_theme_apply((Eo *) obj);
+}
+
static inline Eo *
ELM_PART_IMPLEMENT(const Efl_Class *part_klass, const Eo *obj, const char *part)
{
diff --git a/src/tests/elementary/efl_ui_test_layout.c b/src/tests/elementary/efl_ui_test_layout.c
index 9dad3bffd8..cfea966c49 100644
--- a/src/tests/elementary/efl_ui_test_layout.c
+++ b/src/tests/elementary/efl_ui_test_layout.c
@@ -851,6 +851,41 @@ EFL_START_TEST(efl_ui_layout_test_property_bind_unknown_key)
}
EFL_END_TEST
+/* The content parts of an item can be filled in the efl_add() that makes it:
+ * the item answers part_get by itself and has to bring its theme forward
+ * first, or there is no group to swallow the content into. */
+EFL_START_TEST(efl_ui_layout_test_item_content_at_construction)
+{
+ Eo *win = win_add(NULL, "win", EFL_UI_WIN_TYPE_BASIC);
+ Eo *icon = efl_add(EFL_UI_BOX_CLASS, win);
+ Eo *content = efl_add(EFL_UI_BOX_CLASS, win);
+ Eo *item, *placeholder;
+
+ item = efl_add(EFL_UI_LIST_DEFAULT_ITEM_CLASS, win,
+ efl_content_set(efl_part(efl_added, "icon"), icon));
+ ck_assert_ptr_eq(efl_content_get(efl_part(item, "icon")), icon);
+
+ placeholder = efl_add(EFL_UI_LIST_PLACEHOLDER_ITEM_CLASS, win,
+ efl_content_set(efl_part(efl_added, "content"), content));
+ ck_assert_ptr_eq(efl_content_get(efl_part(placeholder, "content")), content);
+}
+EFL_END_TEST
+
+/* The side contents of a navigation bar read back. */
+EFL_START_TEST(efl_ui_layout_test_navigation_bar_side_content)
+{
+ Eo *win = win_add(NULL, "win", EFL_UI_WIN_TYPE_BASIC);
+ Eo *bar = efl_add(EFL_UI_NAVIGATION_BAR_CLASS, win);
+ Eo *left = efl_add(EFL_UI_BOX_CLASS, win);
+ Eo *right = efl_add(EFL_UI_BOX_CLASS, win);
+
+ efl_content_set(efl_part(bar, "left_content"), left);
+ efl_content_set(efl_part(bar, "right_content"), right);
+ ck_assert_ptr_eq(efl_content_get(efl_part(bar, "left_content")), left);
+ ck_assert_ptr_eq(efl_content_get(efl_part(bar, "right_content")), right);
+}
+EFL_END_TEST
+
void efl_ui_test_layout(TCase *tc)
{
tcase_add_test(tc, efl_ui_layout_calc_subobjs_without_calc);
@@ -874,6 +909,8 @@ void efl_ui_test_layout(TCase *tc)
tcase_add_test(tc, efl_ui_layout_test_versioning);
tcase_add_test(tc, efl_ui_layout_test_freeze);
tcase_add_test(tc, efl_ui_layout_test_factory_bind_same_factory);
+ tcase_add_test(tc, efl_ui_layout_test_item_content_at_construction);
+ tcase_add_test(tc, efl_ui_layout_test_navigation_bar_side_content);
tcase_add_test(tc, efl_ui_layout_test_property_bind_unknown_key);
tcase_add_test(tc, efl_ui_layout_test_table_part_getters);
tcase_add_test(tc, efl_ui_layout_test_box_part);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.