summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyuan Choi <ryuan.choi@gmail.com>2014-02-06 01:02:39 +0900
committerRyuan Choi <ryuan.choi@gmail.com>2014-02-06 01:14:39 +0900
commit3fb3eaf6942512937177188b1ab6462f1b493a39 (patch)
tree122f6785d5e91b1d5d11cbbf1ccd99a81dc865e3
parentc5ee73d54f8f84e3f1d858f7d2c6c4395aa1ab88 (diff)
datetime: Enhance launching time of test_datetime by avoiding _reload_format() in visible_set()
visible_set() only changes the visibility of one field while _reload_format() changes everything. This patch makes visible_set() just change only related field when only it's state is really changd(enabled <-> disabled) instead of calling _reload_format().
-rw-r--r--src/lib/elm_datetime.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/src/lib/elm_datetime.c b/src/lib/elm_datetime.c
index e47188bd8..6100b1ccc 100644
--- a/src/lib/elm_datetime.c
+++ b/src/lib/elm_datetime.c
@@ -982,6 +982,7 @@ _field_visible_set(Eo *obj, void *_pd, va_list *list)
982{ 982{
983 Elm_Datetime_Field_Type fieldtype = va_arg(*list, Elm_Datetime_Field_Type); 983 Elm_Datetime_Field_Type fieldtype = va_arg(*list, Elm_Datetime_Field_Type);
984 Eina_Bool visible = va_arg(*list, int); 984 Eina_Bool visible = va_arg(*list, int);
985 char buf[BUFFER_SIZE];
985 Datetime_Field *field; 986 Datetime_Field *field;
986 987
987 Elm_Datetime_Smart_Data *sd = _pd; 988 Elm_Datetime_Smart_Data *sd = _pd;
@@ -989,10 +990,51 @@ _field_visible_set(Eo *obj, void *_pd, va_list *list)
989 if (fieldtype > ELM_DATETIME_AMPM) return; 990 if (fieldtype > ELM_DATETIME_AMPM) return;
990 991
991 field = sd->field_list + fieldtype; 992 field = sd->field_list + fieldtype;
993 visible = !!visible;
992 if (field->visible == visible) return; 994 if (field->visible == visible) return;
993 995
994 field->visible = visible; 996 field->visible = visible;
995 _reload_format(obj); 997
998 if (visible)
999 {
1000 sd->enabled_field_count++;
1001
1002 if (!field->fmt_exist) return;
1003
1004 snprintf(buf, sizeof(buf), EDC_PART_FIELD_ENABLE_SIG_STR,
1005 field->location);
1006 elm_layout_signal_emit(obj, buf, "elm");
1007
1008 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
1009 edje_object_message_signal_process(wd->resize_obj);
1010
1011 snprintf(buf, sizeof(buf), EDC_PART_FIELD_STR, field->location);
1012 elm_layout_content_unset(obj, buf);
1013 elm_layout_content_set(obj, buf, field->item_obj);
1014 }
1015 else
1016 {
1017 sd->enabled_field_count--;
1018
1019 if (!field->fmt_exist) return;
1020
1021 snprintf(buf, sizeof(buf), EDC_PART_FIELD_DISABLE_SIG_STR,
1022 field->location);
1023 elm_layout_signal_emit(obj, buf, "elm");
1024
1025 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
1026 edje_object_message_signal_process(wd->resize_obj);
1027
1028 snprintf(buf, sizeof(buf), EDC_PART_FIELD_STR, field->location);
1029 evas_object_hide(elm_layout_content_unset(obj, buf));
1030 }
1031
1032 elm_layout_sizing_eval(obj);
1033
1034 if (!visible) return;
1035 if (!dt_mod || !dt_mod->field_value_display) return;
1036
1037 dt_mod->field_value_display(sd->mod_data, field->item_obj);
996} 1038}
997 1039
998EAPI void 1040EAPI void