From fcce7736d83e65150f95bdf366df5e741dd78013 Mon Sep 17 00:00:00 2001 From: woochan lee Date: Wed, 29 Jul 2015 22:17:34 +0200 Subject: [PATCH] spinner: entry text makes to registered special value instead of number. Summary: Entry has only number text when activated and value changed, Even user registered special value to each spinner value. If the user registered special value, we should check then showing the special value instead of number text. Its will more helpful to expect the result when user set a spinner value using spinner entry. @fix Test Plan: There is a spinner sample in elementary_test. Changing editable value as TRUE for the last spinner object. Click the spinner to activated entry and check the result. Reviewers: Hermet, Jaehyun, cedric Reviewed By: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2844 Signed-off-by: Cedric BAIL --- legacy/elementary/src/lib/elm_spinner.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/legacy/elementary/src/lib/elm_spinner.c b/legacy/elementary/src/lib/elm_spinner.c index 42ff096f29..46e884cf13 100644 --- a/legacy/elementary/src/lib/elm_spinner.c +++ b/legacy/elementary/src/lib/elm_spinner.c @@ -53,8 +53,18 @@ static void _access_increment_decrement_info_say(Evas_Object *obj, static void _entry_show(Elm_Spinner_Data *sd) { + Eina_List *l; + Elm_Spinner_Special_Value *sv; char buf[32], fmt[32] = "%0.f"; + EINA_LIST_FOREACH(sd->special_values, l, sv) + { + if (sv->value == sd->val) + { + snprintf(buf, sizeof(buf), "%s", sv->label); + goto apply; + } + } /* try to construct just the format from given label * completely ignoring pre/post words */ @@ -91,6 +101,8 @@ _entry_show(Elm_Spinner_Data *sd) } } snprintf(buf, sizeof(buf), fmt, sd->val); + +apply: elm_object_text_set(sd->ent, buf); }