diff options
author | Ryuan Choi <ryuan.choi@gmail.com> | 2014-01-16 22:44:07 +0900 |
---|---|---|
committer | Ryuan Choi <ryuan.choi@gmail.com> | 2014-01-16 22:50:40 +0900 |
commit | 28609ee56e8b2d1a8a693bac1f512ea805a146b9 (patch) | |
tree | 4ff1da915db4660993cbf0e149f923f3498ae01c | |
parent | 295898ff86c9add475771c68dbf1451864c48384 (diff) |
datetime: Delay elm_layout_theme_set until memebers are initialized in _smart_add
There are some warnings in elm_object_disabled_set() because elm_layout_theme_set()
calls _elm_datetime_smart_disable() before creating file->item_obj.
This patch refactors _smart_add to initialize file->item_obj before calling
elm_layout_theme_set().
-rw-r--r-- | src/lib/elm_datetime.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/src/lib/elm_datetime.c b/src/lib/elm_datetime.c index 42d6c8076..008b687a6 100644 --- a/src/lib/elm_datetime.c +++ b/src/lib/elm_datetime.c | |||
@@ -803,34 +803,40 @@ _elm_datetime_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED) | |||
803 | eo_do_super(obj, MY_CLASS, evas_obj_smart_add()); | 803 | eo_do_super(obj, MY_CLASS, evas_obj_smart_add()); |
804 | elm_widget_sub_object_parent_add(obj); | 804 | elm_widget_sub_object_parent_add(obj); |
805 | 805 | ||
806 | if (!elm_layout_theme_set(obj, "datetime", "base", | ||
807 | elm_widget_style_get(obj))) | ||
808 | CRI("Failed to set layout!"); | ||
809 | |||
810 | // module - initialise module for datetime | 806 | // module - initialise module for datetime |
811 | if (!dt_mod) dt_mod = _dt_mod_init(); | 807 | if (!dt_mod) dt_mod = _dt_mod_init(); |
812 | if ((dt_mod) && (dt_mod->obj_hook)) priv->mod_data = dt_mod->obj_hook(obj); | 808 | if (dt_mod) |
813 | |||
814 | // update module data | ||
815 | if (priv->mod_data) | ||
816 | { | 809 | { |
817 | priv->mod_data->base = obj; | 810 | if (dt_mod->obj_hook) |
818 | priv->mod_data->field_limit_get = _field_limit_get; | 811 | { |
819 | priv->mod_data->field_format_get = _field_format_get; | 812 | priv->mod_data = dt_mod->obj_hook(obj); |
820 | } | ||
821 | 813 | ||
822 | _field_list_init(obj); | 814 | // update module data |
823 | _reload_format(obj); | 815 | if (priv->mod_data) |
816 | { | ||
817 | priv->mod_data->base = obj; | ||
818 | priv->mod_data->field_limit_get = _field_limit_get; | ||
819 | priv->mod_data->field_format_get = _field_format_get; | ||
820 | } | ||
821 | } | ||
824 | 822 | ||
825 | if ((dt_mod) && (dt_mod->field_create)) | 823 | if (dt_mod->field_create) |
826 | { | ||
827 | for (idx = 0; idx < ELM_DATETIME_TYPE_COUNT; idx++) | ||
828 | { | 824 | { |
829 | field = priv->field_list + idx; | 825 | for (idx = 0; idx < ELM_DATETIME_TYPE_COUNT; idx++) |
830 | field->item_obj = dt_mod->field_create(priv->mod_data, idx); | 826 | { |
827 | field = priv->field_list + idx; | ||
828 | field->item_obj = dt_mod->field_create(priv->mod_data, idx); | ||
829 | } | ||
831 | } | 830 | } |
832 | } | 831 | } |
833 | 832 | ||
833 | if (!elm_layout_theme_set(obj, "datetime", "base", | ||
834 | elm_widget_style_get(obj))) | ||
835 | CRI("Failed to set layout!"); | ||
836 | |||
837 | _field_list_init(obj); | ||
838 | _reload_format(obj); | ||
839 | |||
834 | _field_list_arrange(obj); | 840 | _field_list_arrange(obj); |
835 | 841 | ||
836 | elm_widget_can_focus_set(obj, EINA_TRUE); | 842 | elm_widget_can_focus_set(obj, EINA_TRUE); |