Efl.Ui.Format: fix regressions

(1) Following commit did not care of efl_ui_format_string_get(set) of
elm_slider_part_indicator_eo.c

   e776f5f Efl.Ui.Format revamp

Even though you call elm_slider_indicator_format_set with "%1.0f",
elm_slider_indicator_format_get returns NULL.

(2) The commit does not initialize format variables
   - elm_slider_indicator_format_get
   - elm_slider_unit_format_get
   - elm_progressbar_unit_format_get

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D9276
This commit is contained in:
Shinwoo Kim 2019-07-11 10:33:55 +00:00 committed by Marcel Hollerbach
parent fa333608b7
commit a3a07f6e83
3 changed files with 9 additions and 11 deletions

View File

@ -1053,7 +1053,7 @@ elm_progressbar_unit_format_set(Evas_Object *obj, const char *units)
EAPI const char * EAPI const char *
elm_progressbar_unit_format_get(const Evas_Object *obj) elm_progressbar_unit_format_get(const Evas_Object *obj)
{ {
const char *fmt; const char *fmt = NULL;
efl_ui_format_string_get(obj, &fmt, NULL); efl_ui_format_string_get(obj, &fmt, NULL);
return fmt; return fmt;
} }

View File

@ -1124,7 +1124,7 @@ _indi_default_format_free_cb(void *data)
} }
EOLIAN static void EOLIAN static void
_elm_slider_part_indicator_efl_ui_format_format_string_set(Eo *obj, void *_pd EINA_UNUSED, const char *template) _elm_slider_part_indicator_efl_ui_format_format_string_set(Eo *obj, void *_pd EINA_UNUSED, const char *template, Efl_Ui_Format_String_Type type EINA_UNUSED)
{ {
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS); Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
Elm_Slider_Data *sd = efl_data_scope_get(pd->obj, ELM_SLIDER_CLASS); Elm_Slider_Data *sd = efl_data_scope_get(pd->obj, ELM_SLIDER_CLASS);
@ -1135,13 +1135,13 @@ _elm_slider_part_indicator_efl_ui_format_format_string_set(Eo *obj, void *_pd EI
efl_ui_format_func_set(efl_part(pd->obj, "indicator"), pd->obj, _indi_default_format_cb, _indi_default_format_free_cb); efl_ui_format_func_set(efl_part(pd->obj, "indicator"), pd->obj, _indi_default_format_cb, _indi_default_format_free_cb);
} }
EOLIAN static const char * EOLIAN static void
_elm_slider_part_indicator_efl_ui_format_format_string_get(const Eo *obj, void *_pd EINA_UNUSED) _elm_slider_part_indicator_efl_ui_format_format_string_get(const Eo *obj, void *_pd EINA_UNUSED, const char **template, Efl_Ui_Format_String_Type *type EINA_UNUSED)
{ {
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS); Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
Elm_Slider_Data *sd = efl_data_scope_get(pd->obj, ELM_SLIDER_CLASS); Elm_Slider_Data *sd = efl_data_scope_get(pd->obj, ELM_SLIDER_CLASS);
return sd->indi_template; if (template) *template = sd->indi_template;
} }
EOLIAN static void EOLIAN static void
@ -1207,7 +1207,7 @@ elm_slider_unit_format_set(Evas_Object *obj, const char *units)
EAPI const char * EAPI const char *
elm_slider_unit_format_get(const Evas_Object *obj) elm_slider_unit_format_get(const Evas_Object *obj)
{ {
const char* fmt; const char* fmt = NULL;
efl_ui_format_string_get(obj, &fmt, NULL); efl_ui_format_string_get(obj, &fmt, NULL);
return fmt; return fmt;
} }
@ -1386,7 +1386,7 @@ elm_slider_indicator_format_set(Evas_Object *obj, const char *indicator)
EAPI const char * EAPI const char *
elm_slider_indicator_format_get(const Evas *obj) elm_slider_indicator_format_get(const Evas *obj)
{ {
const char *fmt; const char *fmt = NULL;
efl_ui_format_string_get(efl_part(obj, "indicator"), &fmt, NULL); efl_ui_format_string_get(efl_part(obj, "indicator"), &fmt, NULL);
return fmt; return fmt;
} }

View File

@ -9,11 +9,9 @@ EOAPI EFL_FUNC_BODY_CONST(elm_slider_part_indicator_visible_mode_get, Elm_Slider
void _elm_slider_part_indicator_efl_ui_format_format_cb_set(Eo *obj, void *pd, void *func_data, Efl_Ui_Format_Func func, Eina_Free_Cb func_free_cb); void _elm_slider_part_indicator_efl_ui_format_format_cb_set(Eo *obj, void *pd, void *func_data, Efl_Ui_Format_Func func, Eina_Free_Cb func_free_cb);
void _elm_slider_part_indicator_efl_ui_format_format_string_set(Eo *obj, void *_pd, const char *template, Efl_Ui_Format_String_Type type);
void _elm_slider_part_indicator_efl_ui_format_format_string_set(Eo *obj, void *pd, const char *units); void _elm_slider_part_indicator_efl_ui_format_format_string_get (const Eo *obj, void *_pd, const char **template, Efl_Ui_Format_String_Type *type);
const char *_elm_slider_part_indicator_efl_ui_format_format_string_get(const Eo *obj, void *pd);
void _elm_slider_part_indicator_efl_ui_format_apply_formatted_value(Eo *obj, Elm_Part_Data *pd); void _elm_slider_part_indicator_efl_ui_format_apply_formatted_value(Eo *obj, Elm_Part_Data *pd);