summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-12-18 17:18:35 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-12-18 21:45:45 +0100
commit837528201f7761123974bcefef56b02967d758e6 (patch)
treeef0b3602c6ac6c7fb1e1524d25c9c00fcab1d72d
parent9ccc66b90004a29c0790d58106857dc5e3377976 (diff)
efl_ui_format: make this usable with the standard behaviour of accessors
a accessor is never delivering a value, only the pointer to a value. This makes format working with accessors for list array carray. Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D10909
-rw-r--r--src/bin/elementary/test_ui_spin_button.c2
-rw-r--r--src/lib/elementary/efl_ui_format.c4
-rw-r--r--src/tests/elementary/spec/efl_test_format.c4
3 files changed, 5 insertions, 5 deletions
diff --git a/src/bin/elementary/test_ui_spin_button.c b/src/bin/elementary/test_ui_spin_button.c
index 62f7a43562..4692075b10 100644
--- a/src/bin/elementary/test_ui_spin_button.c
+++ b/src/bin/elementary/test_ui_spin_button.c
@@ -57,7 +57,7 @@ test_ui_spin_button(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
57 efl_ui_range_limits_set(efl_added, 1, 12), 57 efl_ui_range_limits_set(efl_added, 1, 12),
58 efl_ui_range_value_set(efl_added, 1), 58 efl_ui_range_value_set(efl_added, 1),
59 efl_ui_spin_button_direct_text_input_set(efl_added, EINA_FALSE), 59 efl_ui_spin_button_direct_text_input_set(efl_added, EINA_FALSE),
60 efl_ui_format_values_set(efl_added, EINA_C_ARRAY_ACCESSOR_NEW(special_values)), 60 efl_ui_format_values_set(efl_added, EINA_C_ARRAY_ACCESSOR_PTR_NEW(special_values)),
61 efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_VERTICAL), 61 efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_VERTICAL),
62 efl_pack(bx, efl_added)); 62 efl_pack(bx, efl_added));
63 63
diff --git a/src/lib/elementary/efl_ui_format.c b/src/lib/elementary/efl_ui_format.c
index d3cafa1e5a..c4dc85353d 100644
--- a/src/lib/elementary/efl_ui_format.c
+++ b/src/lib/elementary/efl_ui_format.c
@@ -195,7 +195,7 @@ _value_compare(const Efl_Ui_Format_Value *val1, const Efl_Ui_Format_Value *val2)
195EOLIAN static void 195EOLIAN static void
196_efl_ui_format_format_values_set(Eo *obj, Efl_Ui_Format_Data *pd, Eina_Accessor *values) 196_efl_ui_format_format_values_set(Eo *obj, Efl_Ui_Format_Data *pd, Eina_Accessor *values)
197{ 197{
198 Efl_Ui_Format_Value v; 198 Efl_Ui_Format_Value *v;
199 int i; 199 int i;
200 if (pd->format_values) 200 if (pd->format_values)
201 { 201 {
@@ -219,7 +219,7 @@ _efl_ui_format_format_values_set(Eo *obj, Efl_Ui_Format_Data *pd, Eina_Accessor
219 pd->format_values = eina_inarray_new(sizeof(Efl_Ui_Format_Value), 4); 219 pd->format_values = eina_inarray_new(sizeof(Efl_Ui_Format_Value), 4);
220 EINA_ACCESSOR_FOREACH(values, i, v) 220 EINA_ACCESSOR_FOREACH(values, i, v)
221 { 221 {
222 Efl_Ui_Format_Value vcopy = { v.value, eina_stringshare_add(v.text) }; 222 Efl_Ui_Format_Value vcopy = { v->value, eina_stringshare_add(v->text) };
223 eina_inarray_insert_sorted(pd->format_values, &vcopy, (Eina_Compare_Cb)_value_compare); 223 eina_inarray_insert_sorted(pd->format_values, &vcopy, (Eina_Compare_Cb)_value_compare);
224 } 224 }
225 eina_accessor_free(values); 225 eina_accessor_free(values);
diff --git a/src/tests/elementary/spec/efl_test_format.c b/src/tests/elementary/spec/efl_test_format.c
index c3fa7d42f5..7540829edc 100644
--- a/src/tests/elementary/spec/efl_test_format.c
+++ b/src/tests/elementary/spec/efl_test_format.c
@@ -24,7 +24,7 @@ EFL_START_TEST(format_values)
24 Eina_Strbuf *buf = eina_strbuf_new(); 24 Eina_Strbuf *buf = eina_strbuf_new();
25 Eina_Value eina_val; 25 Eina_Value eina_val;
26 26
27 efl_ui_format_values_set(widget, EINA_C_ARRAY_ACCESSOR_NEW(values)); 27 efl_ui_format_values_set(widget, EINA_C_ARRAY_ACCESSOR_PTR_NEW(values));
28 eina_val = eina_value_int_init(17); 28 eina_val = eina_value_int_init(17);
29 efl_ui_format_formatted_value_get(widget, buf, eina_val); 29 efl_ui_format_formatted_value_get(widget, buf, eina_val);
30 ck_assert_str_eq(eina_strbuf_string_get(buf), "seventeen"); // Check that value works 30 ck_assert_str_eq(eina_strbuf_string_get(buf), "seventeen"); // Check that value works
@@ -141,7 +141,7 @@ EFL_START_TEST(format_mixed)
141 141
142 // Now we check combinations of different options 142 // Now we check combinations of different options
143 // Each one should be used in turn when the previous one fails: values, func, string, fallback 143 // Each one should be used in turn when the previous one fails: values, func, string, fallback
144 efl_ui_format_values_set(widget, EINA_C_ARRAY_ACCESSOR_NEW(values)); 144 efl_ui_format_values_set(widget, EINA_C_ARRAY_ACCESSOR_PTR_NEW(values));
145 efl_ui_format_func_set(widget, NULL, _partial_format_func, NULL); 145 efl_ui_format_func_set(widget, NULL, _partial_format_func, NULL);
146 efl_ui_format_string_set(widget, "%d rabbits", EFL_UI_FORMAT_STRING_TYPE_SIMPLE); 146 efl_ui_format_string_set(widget, "%d rabbits", EFL_UI_FORMAT_STRING_TYPE_SIMPLE);
147 147