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 1ac8cdaed849e4b0131e90a62832f81d0396f6aa
Author: Cedric BAIL <[email protected]>
AuthorDate: Sun Nov 15 19:25:04 2026 -0600
elementary:layout: property_bind refuses a key that is not a part
Once the widget has said it has no such property, Layout_Base took any
key as the name of a part, so a typo bound without an error and never
showed anything. The key, once its alias is resolved, must now be a
part of the theme (a signal key is not a part and is left alone), or
the bind returns EFL_PROPERTY_ERROR_INVALID_KEY and logs one ERR. As
part_get() does, a theme still waiting to be applied is applied first;
a layout with no group loaded yet cannot be asked and is taken as it
comes.
Efl.Ui.Default_Item answers to "icon" and "extra" for efl.icon and
efl.extra in part_get(), so it now maps them for property_bind too.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
src/lib/elementary/efl_ui_default_item.c | 13 ++++++++
src/lib/elementary/efl_ui_default_item.eo | 1 +
src/lib/elementary/efl_ui_layout.c | 36 ++++++++++++++++++++
src/tests/elementary/efl_ui_test_layout.c | 55 +++++++++++++++++++++++++++++++
4 files changed, 105 insertions(+)
diff --git a/src/lib/elementary/efl_ui_default_item.c b/src/lib/elementary/efl_ui_default_item.c
index 3063cd164c..aee1ffca18 100644
--- a/src/lib/elementary/efl_ui_default_item.c
+++ b/src/lib/elementary/efl_ui_default_item.c
@@ -36,6 +36,19 @@ _efl_ui_default_item_efl_part_part_get(const Eo *obj, void *pd EINA_UNUSED, cons
}
+// The short names the item answers to for its parts (see part_get()) bind to those parts
+EOLIAN static Eina_Error
+_efl_ui_default_item_efl_ui_property_bind_property_bind(Eo *obj, void *pd EINA_UNUSED,
+ const char *key, const char *property)
+{
+ if (key)
+ {
+ if (eina_streq(key, "icon")) key = "efl.icon";
+ else if (eina_streq(key, "extra")) key = "efl.extra";
+ }
+ return efl_ui_property_bind(efl_super(obj, MY_CLASS), key, property);
+}
+
#define EFL_UI_DEFAULT_ITEM_EXTRA_OPS \
ELM_PART_TEXT_DEFAULT_OPS(efl_ui_default_item), \
ELM_PART_CONTENT_DEFAULT_OPS(efl_ui_default_item)
diff --git a/src/lib/elementary/efl_ui_default_item.eo b/src/lib/elementary/efl_ui_default_item.eo
index 189cd19cc4..955edf6710 100644
--- a/src/lib/elementary/efl_ui_default_item.eo
+++ b/src/lib/elementary/efl_ui_default_item.eo
@@ -30,5 +30,6 @@ abstract Efl.Ui.Default_Item extends Efl.Ui.Item implements
Efl.Content.content { get; set; }
Efl.Content.content_unset;
Efl.Part.part_get;
+ Efl.Ui.Property_Bind.property_bind;
}
}
diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c
index 7015515511..48a35283c3 100644
--- a/src/lib/elementary/efl_ui_layout.c
+++ b/src/lib/elementary/efl_ui_layout.c
@@ -2793,6 +2793,32 @@ _efl_ui_layout_unbind_part(Eina_Hash **hashp, Eina_Stringshare *property, const
*hashp = fresh;
}
+// Whether a key names a part of the theme of the widget. Without a group to ask (a layout
+// whose file is not loaded yet) there is no way to say, and it is taken as it comes.
+static Eina_Bool
+_efl_ui_layout_part_known(Eo *obj, Efl_Ui_Layout_Data *pd, const char *part)
+{
+ const char *group = NULL;
+
+ ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_TRUE);
+
+ // As part_get() does: the theme is brought forward to the first question asked of it
+ if (pd->needs_theme_apply) efl_ui_widget_theme_apply(obj);
+
+ if (!wd->resize_obj || !efl_isa(wd->resize_obj, EFL_CANVAS_LAYOUT_CLASS)) return EINA_TRUE;
+ edje_object_file_get(wd->resize_obj, NULL, &group);
+ if (!group) return EINA_TRUE;
+
+ if (!elm_widget_is_legacy(obj))
+ {
+ // The two parts a widget answers to by a short name (see part_get())
+ if (eina_streq(part, "background"))
+ return efl_layout_group_part_exist_get(wd->resize_obj, "efl.background");
+ if (eina_streq(part, "shadow")) return EINA_TRUE;
+ }
+ return efl_layout_group_part_exist_get(wd->resize_obj, part);
+}
+
EOLIAN static Eina_Error
_efl_ui_layout_base_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Layout_Data *pd, const char *key, const char *property)
{
@@ -2814,6 +2840,16 @@ _efl_ui_layout_base_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Layout_Da
if (!_elm_layout_part_aliasing_eval(obj, &key, EINA_TRUE))
return EFL_PROPERTY_ERROR_INVALID_KEY;
+ // A key that is not a part of the theme, once the aliases are resolved, is a typo
+ // that would never show anything (a signal is not a part)
+ if (strncmp(SIGNAL_PREFIX, key, sizeof(SIGNAL_PREFIX) - 1) &&
+ !_efl_ui_layout_part_known(obj, pd, key))
+ {
+ ERR("'%s' is neither a property nor a part of the theme of %s: cannot bind it to '%s'.",
+ key, efl_debug_name_get(obj), property ? property : "");
+ return EFL_PROPERTY_ERROR_INVALID_KEY;
+ }
+
// Check if there is a model and register it
_efl_ui_layout_base_model_watch(obj, pd);
diff --git a/src/tests/elementary/efl_ui_test_layout.c b/src/tests/elementary/efl_ui_test_layout.c
index ae399f6a8a..b8992d0354 100644
--- a/src/tests/elementary/efl_ui_test_layout.c
+++ b/src/tests/elementary/efl_ui_test_layout.c
@@ -746,6 +746,60 @@ EFL_START_TEST(efl_ui_layout_test_box_part_indices)
}
EFL_END_TEST
+static int _bind_errors = 0;
+
+static void
+_count_bind_errors(const Eina_Log_Domain *d EINA_UNUSED, Eina_Log_Level level,
+ const char *file EINA_UNUSED, const char *fnc EINA_UNUSED,
+ int line EINA_UNUSED, const char *fmt EINA_UNUSED,
+ void *data EINA_UNUSED, va_list args EINA_UNUSED)
+{
+ if (level == EINA_LOG_LEVEL_ERR) _bind_errors++;
+}
+
+/* A key that is neither a property nor a part of the theme is refused, and
+ * said once. */
+EFL_START_TEST(efl_ui_layout_test_property_bind_unknown_key)
+{
+ char buf[PATH_MAX];
+ Evas_Object *win, *ly, *item;
+ Eina_Error err;
+
+ win = win_add(NULL, "layout", EFL_UI_WIN_TYPE_BASIC);
+
+ ly = efl_add(EFL_UI_LAYOUT_CLASS, win);
+ snprintf(buf, sizeof(buf), "%s/objects/test.edj", ELM_TEST_DATA_DIR);
+ ck_assert(efl_file_simple_load(ly, buf, "layout"));
+
+ _bind_errors = 0;
+ eina_log_print_cb_set(_count_bind_errors, NULL);
+ err = efl_ui_property_bind(ly, "txet", "text_property");
+ eina_log_print_cb_set(NULL, NULL);
+ ck_assert_int_eq(err, EFL_PROPERTY_ERROR_INVALID_KEY);
+ ck_assert_int_eq(_bind_errors, 1);
+
+ /* A part of the theme, a property of the widget, and a signal bind */
+ _bind_errors = 0;
+ eina_log_print_cb_set(_count_bind_errors, NULL);
+ ck_assert_int_eq(efl_ui_property_bind(ly, "text", "text_property"), 0);
+ ck_assert_int_eq(efl_ui_property_bind(ly, "element1", "text_property"), 0);
+ ck_assert_int_eq(efl_ui_property_bind(ly, "signal/emit", "text_property"), 0);
+ ck_assert_int_eq(efl_ui_property_bind(ly, "style", "style_property"), 0);
+ eina_log_print_cb_set(NULL, NULL);
+ ck_assert_int_eq(_bind_errors, 0);
+
+ /* The names a list item answers to for the parts of its theme */
+ item = efl_add(EFL_UI_LIST_DEFAULT_ITEM_CLASS, win);
+ _bind_errors = 0;
+ eina_log_print_cb_set(_count_bind_errors, NULL);
+ ck_assert_int_eq(efl_ui_property_bind(item, "text", "t"), 0);
+ ck_assert_int_eq(efl_ui_property_bind(item, "icon", "i"), 0);
+ ck_assert_int_eq(efl_ui_property_bind(item, "extra", "e"), 0);
+ eina_log_print_cb_set(NULL, NULL);
+ ck_assert_int_eq(_bind_errors, 0);
+}
+EFL_END_TEST
+
void efl_ui_test_layout(TCase *tc)
{
tcase_add_test(tc, efl_ui_layout_calc_subobjs_without_calc);
@@ -768,6 +822,7 @@ 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_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.