ami pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=21259e411d1d16956196d0ac5c12f5c96ab5a490

commit 21259e411d1d16956196d0ac5c12f5c96ab5a490
Author: Amitesh Singh <amitesh...@samsung.com>
Date:   Fri Oct 27 11:48:10 2017 +0900

    Efl.Ui.Progressbar: fix val to be val when legacy format_function_set() is 
called
    
    In Pb, the legacy units_format_set's user callback uses value to
    be 100*value (0.0 to 100.0) and legacy format_function_set uses
    value of range "0.0 to 1.0". This was broken after my patch.
    Lets keep this behaviour in legacy APIs.
    
    In case of new EO APIs, the value will be always from 0.0 to 1.0
    in both format_string() and format_cb callbacks.
---
 src/lib/elementary/efl_ui_progressbar.c         | 14 ++++++++------
 src/lib/elementary/efl_ui_progressbar_private.h |  3 ++-
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/lib/elementary/efl_ui_progressbar.c 
b/src/lib/elementary/efl_ui_progressbar.c
index 1b2042a7bc..fdb8e2e1f4 100644
--- a/src/lib/elementary/efl_ui_progressbar.c
+++ b/src/lib/elementary/efl_ui_progressbar.c
@@ -109,9 +109,10 @@ _units_set(Evas_Object *obj)
         Eina_Value val;
 
         eina_value_setup(&val, EINA_VALUE_TYPE_DOUBLE);
-        if (!sd->is_legacy_format)
-          eina_value_set(&val, sd->val);
-        else // Keeping this bug since the legacy code was like that.
+        eina_value_set(&val, sd->val);
+
+        // Keeping this bug since the legacy code was like that.
+        if (sd->is_legacy_format_string && !sd->is_legacy_format_cb)
           eina_value_set(&val, 100 * sd->val);
 
         eina_strbuf_reset(sd->format_strbuf);
@@ -689,10 +690,12 @@ _format_legacy_to_format_eo_free_cb(void *data)
 EAPI void
 elm_progressbar_unit_format_function_set(Evas_Object *obj, 
progressbar_func_type func, progressbar_freefunc_type free_func)
 {
+   EFL_UI_PROGRESSBAR_DATA_GET_OR_RETURN(obj, sd);
    Pb_Format_Wrapper_Data *pfwd = malloc(sizeof(Pb_Format_Wrapper_Data));
 
    pfwd->format_cb = func;
    pfwd->format_free_cb = free_func;
+   sd->is_legacy_format_cb = EINA_TRUE;
 
    efl_ui_format_cb_set(obj, pfwd, _format_legacy_to_format_eo_cb,
                         _format_legacy_to_format_eo_free_cb);
@@ -715,10 +718,9 @@ elm_progressbar_span_size_get(const Evas_Object *obj)
 EAPI void
 elm_progressbar_unit_format_set(Evas_Object *obj, const char *units)
 {
-  EFL_UI_PROGRESSBAR_DATA_GET_OR_RETURN(obj, sd);
-
-  sd->is_legacy_format = EINA_TRUE;
+   EFL_UI_PROGRESSBAR_DATA_GET_OR_RETURN(obj, sd);
 
+   sd->is_legacy_format_string = EINA_TRUE;
    efl_ui_format_string_set(obj, units);
 }
 
diff --git a/src/lib/elementary/efl_ui_progressbar_private.h 
b/src/lib/elementary/efl_ui_progressbar_private.h
index 76ce9907c4..c9b0c9b11f 100644
--- a/src/lib/elementary/efl_ui_progressbar_private.h
+++ b/src/lib/elementary/efl_ui_progressbar_private.h
@@ -44,7 +44,8 @@ struct _Efl_Ui_Progressbar_Data
 
    Eina_Bool             pulse : 1; /**< Whether object is put in the pulsing 
mode */
    Eina_Bool             pulse_state : 1; /**< To start the pulsing animation, 
otherwise to stop it */
-   Eina_Bool             is_legacy_format : 1;
+   Eina_Bool             is_legacy_format_string : 1;
+   Eina_Bool             is_legacy_format_cb : 1;
 };
 
 struct _Efl_Ui_Progress_Status

-- 


Reply via email to