summaryrefslogtreecommitdiff
path: root/src/lib/elementary
diff options
context:
space:
mode:
authorAmitesh Singh <amitesh.sh@samsung.com>2017-10-27 11:48:10 +0900
committerAmitesh Singh <amitesh.sh@samsung.com>2017-10-27 11:56:22 +0900
commit21259e411d1d16956196d0ac5c12f5c96ab5a490 (patch)
tree72f0048b653475d83bdd462a76ae0169190fa0c2 /src/lib/elementary
parentef742319f5677ac230396db15d010bbb3e3bfaa7 (diff)
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.
Diffstat (limited to 'src/lib/elementary')
-rw-r--r--src/lib/elementary/efl_ui_progressbar.c14
-rw-r--r--src/lib/elementary/efl_ui_progressbar_private.h3
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)
109 Eina_Value val; 109 Eina_Value val;
110 110
111 eina_value_setup(&val, EINA_VALUE_TYPE_DOUBLE); 111 eina_value_setup(&val, EINA_VALUE_TYPE_DOUBLE);
112 if (!sd->is_legacy_format) 112 eina_value_set(&val, sd->val);
113 eina_value_set(&val, sd->val); 113
114 else // Keeping this bug since the legacy code was like that. 114 // Keeping this bug since the legacy code was like that.
115 if (sd->is_legacy_format_string && !sd->is_legacy_format_cb)
115 eina_value_set(&val, 100 * sd->val); 116 eina_value_set(&val, 100 * sd->val);
116 117
117 eina_strbuf_reset(sd->format_strbuf); 118 eina_strbuf_reset(sd->format_strbuf);
@@ -689,10 +690,12 @@ _format_legacy_to_format_eo_free_cb(void *data)
689EAPI void 690EAPI void
690elm_progressbar_unit_format_function_set(Evas_Object *obj, progressbar_func_type func, progressbar_freefunc_type free_func) 691elm_progressbar_unit_format_function_set(Evas_Object *obj, progressbar_func_type func, progressbar_freefunc_type free_func)
691{ 692{
693 EFL_UI_PROGRESSBAR_DATA_GET_OR_RETURN(obj, sd);
692 Pb_Format_Wrapper_Data *pfwd = malloc(sizeof(Pb_Format_Wrapper_Data)); 694 Pb_Format_Wrapper_Data *pfwd = malloc(sizeof(Pb_Format_Wrapper_Data));
693 695
694 pfwd->format_cb = func; 696 pfwd->format_cb = func;
695 pfwd->format_free_cb = free_func; 697 pfwd->format_free_cb = free_func;
698 sd->is_legacy_format_cb = EINA_TRUE;
696 699
697 efl_ui_format_cb_set(obj, pfwd, _format_legacy_to_format_eo_cb, 700 efl_ui_format_cb_set(obj, pfwd, _format_legacy_to_format_eo_cb,
698 _format_legacy_to_format_eo_free_cb); 701 _format_legacy_to_format_eo_free_cb);
@@ -715,10 +718,9 @@ elm_progressbar_span_size_get(const Evas_Object *obj)
715EAPI void 718EAPI void
716elm_progressbar_unit_format_set(Evas_Object *obj, const char *units) 719elm_progressbar_unit_format_set(Evas_Object *obj, const char *units)
717{ 720{
718 EFL_UI_PROGRESSBAR_DATA_GET_OR_RETURN(obj, sd); 721 EFL_UI_PROGRESSBAR_DATA_GET_OR_RETURN(obj, sd);
719
720 sd->is_legacy_format = EINA_TRUE;
721 722
723 sd->is_legacy_format_string = EINA_TRUE;
722 efl_ui_format_string_set(obj, units); 724 efl_ui_format_string_set(obj, units);
723} 725}
724 726
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
44 44
45 Eina_Bool pulse : 1; /**< Whether object is put in the pulsing mode */ 45 Eina_Bool pulse : 1; /**< Whether object is put in the pulsing mode */
46 Eina_Bool pulse_state : 1; /**< To start the pulsing animation, otherwise to stop it */ 46 Eina_Bool pulse_state : 1; /**< To start the pulsing animation, otherwise to stop it */
47 Eina_Bool is_legacy_format : 1; 47 Eina_Bool is_legacy_format_string : 1;
48 Eina_Bool is_legacy_format_cb : 1;
48}; 49};
49 50
50struct _Efl_Ui_Progress_Status 51struct _Efl_Ui_Progress_Status