diff options
author | Daniel Juyung Seo <seojuyung2@gmail.com> | 2015-02-10 17:15:45 +0900 |
---|---|---|
committer | Daniel Juyung Seo <seojuyung2@gmail.com> | 2015-02-10 17:16:08 +0900 |
commit | a40e351ef68ab34ee87344829d5a5df83ca7256b (patch) | |
tree | af63c711f0c0fa6046213ef1dd54842fbcc56cbd /src/modules/datetime_input_ctxpopup | |
parent | a25a38d816c2ca21cbf3674bbc2f1a2ef16dca3b (diff) |
datetime: Clean up datetime module codes.
Diffstat (limited to 'src/modules/datetime_input_ctxpopup')
-rw-r--r-- | src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c b/src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c index dafb8d72f..c8b345de4 100644 --- a/src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c +++ b/src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c | |||
@@ -30,7 +30,7 @@ struct _DiskItem_Data | |||
30 | static void | 30 | static void |
31 | _diskselector_item_free_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) | 31 | _diskselector_item_free_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) |
32 | { | 32 | { |
33 | if (data) free(data); | 33 | free(data); |
34 | } | 34 | } |
35 | 35 | ||
36 | static void | 36 | static void |
@@ -69,7 +69,7 @@ _datetime_move_cb(void *data, Evas *e EINA_UNUSED,Evas_Object *obj EINA_UNUSED, | |||
69 | static void | 69 | static void |
70 | _field_value_set(struct tm *tim, Elm_Datetime_Field_Type field_type, int val) | 70 | _field_value_set(struct tm *tim, Elm_Datetime_Field_Type field_type, int val) |
71 | { | 71 | { |
72 | if (field_type >= DATETIME_FIELD_COUNT - 1) return; | 72 | if (field_type >= (DATETIME_FIELD_COUNT - 1)) return; |
73 | 73 | ||
74 | int *timearr[]= { &tim->tm_year, &tim->tm_mon, &tim->tm_mday, &tim->tm_hour, &tim->tm_min }; | 74 | int *timearr[]= { &tim->tm_year, &tim->tm_mon, &tim->tm_mday, &tim->tm_hour, &tim->tm_min }; |
75 | *timearr[field_type] = val; | 75 | *timearr[field_type] = val; |
@@ -78,7 +78,7 @@ _field_value_set(struct tm *tim, Elm_Datetime_Field_Type field_type, int val) | |||
78 | static int | 78 | static int |
79 | _field_value_get(struct tm *tim, Elm_Datetime_Field_Type field_type) | 79 | _field_value_get(struct tm *tim, Elm_Datetime_Field_Type field_type) |
80 | { | 80 | { |
81 | if (field_type >= DATETIME_FIELD_COUNT - 1) return -1; | 81 | if (field_type >= (DATETIME_FIELD_COUNT - 1)) return -1; |
82 | 82 | ||
83 | int *timearr[]= { &tim->tm_year, &tim->tm_mon, &tim->tm_mday, &tim->tm_hour, &tim->tm_min }; | 83 | int *timearr[]= { &tim->tm_year, &tim->tm_mon, &tim->tm_mday, &tim->tm_hour, &tim->tm_min }; |
84 | return (*timearr[field_type]); | 84 | return (*timearr[field_type]); |
@@ -216,11 +216,11 @@ _field_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) | |||
216 | evas_object_move(ctx_mod->ctxpopup, (x+w/2), (y+h)); | 216 | evas_object_move(ctx_mod->ctxpopup, (x+w/2), (y+h)); |
217 | 217 | ||
218 | // if the direction of Ctxpopup is upwards, move it to the top of datetime | 218 | // if the direction of Ctxpopup is upwards, move it to the top of datetime |
219 | if (elm_ctxpopup_direction_get (ctx_mod->ctxpopup) == ELM_CTXPOPUP_DIRECTION_UP) | 219 | if (elm_ctxpopup_direction_get(ctx_mod->ctxpopup) == ELM_CTXPOPUP_DIRECTION_UP) |
220 | { | 220 | { |
221 | elm_ctxpopup_direction_priority_set(ctx_mod->ctxpopup, ELM_CTXPOPUP_DIRECTION_UP, | 221 | elm_ctxpopup_direction_priority_set(ctx_mod->ctxpopup, ELM_CTXPOPUP_DIRECTION_UP, |
222 | ELM_CTXPOPUP_DIRECTION_DOWN, -1, -1); | 222 | ELM_CTXPOPUP_DIRECTION_DOWN, -1, -1); |
223 | evas_object_move(ctx_mod->ctxpopup, (x+w/2), y); | 223 | evas_object_move(ctx_mod->ctxpopup, (x + w / 2), y); |
224 | } | 224 | } |
225 | evas_object_show(ctx_mod->ctxpopup); | 225 | evas_object_show(ctx_mod->ctxpopup); |
226 | } | 226 | } |
@@ -232,32 +232,32 @@ _access_set(Evas_Object *obj, Elm_Datetime_Field_Type field_type) | |||
232 | 232 | ||
233 | switch (field_type) | 233 | switch (field_type) |
234 | { | 234 | { |
235 | case ELM_DATETIME_YEAR: | 235 | case ELM_DATETIME_YEAR: |
236 | type = "datetime field, year"; | 236 | type = "datetime field, year"; |
237 | break; | 237 | break; |
238 | 238 | ||
239 | case ELM_DATETIME_MONTH: | 239 | case ELM_DATETIME_MONTH: |
240 | type = "datetime field, month"; | 240 | type = "datetime field, month"; |
241 | break; | 241 | break; |
242 | 242 | ||
243 | case ELM_DATETIME_DATE: | 243 | case ELM_DATETIME_DATE: |
244 | type = "datetime field, date"; | 244 | type = "datetime field, date"; |
245 | break; | 245 | break; |
246 | 246 | ||
247 | case ELM_DATETIME_HOUR: | 247 | case ELM_DATETIME_HOUR: |
248 | type = "datetime field, hour"; | 248 | type = "datetime field, hour"; |
249 | break; | 249 | break; |
250 | 250 | ||
251 | case ELM_DATETIME_MINUTE: | 251 | case ELM_DATETIME_MINUTE: |
252 | type = "datetime field, minute"; | 252 | type = "datetime field, minute"; |
253 | break; | 253 | break; |
254 | 254 | ||
255 | case ELM_DATETIME_AMPM: | 255 | case ELM_DATETIME_AMPM: |
256 | type = "datetime field, AM PM"; | 256 | type = "datetime field, AM PM"; |
257 | break; | 257 | break; |
258 | 258 | ||
259 | default: | 259 | default: |
260 | break; | 260 | break; |
261 | } | 261 | } |
262 | 262 | ||
263 | _elm_access_text_set | 263 | _elm_access_text_set |
@@ -266,7 +266,7 @@ _access_set(Evas_Object *obj, Elm_Datetime_Field_Type field_type) | |||
266 | (_elm_access_info_get(obj), ELM_ACCESS_STATE, NULL, NULL); | 266 | (_elm_access_info_get(obj), ELM_ACCESS_STATE, NULL, NULL); |
267 | } | 267 | } |
268 | 268 | ||
269 | // module fucns for the specific module type | 269 | // module funcs for the specific module type |
270 | EAPI void | 270 | EAPI void |
271 | field_value_display(Elm_Datetime_Module_Data *module_data, Evas_Object *obj) | 271 | field_value_display(Elm_Datetime_Module_Data *module_data, Evas_Object *obj) |
272 | { | 272 | { |
@@ -350,11 +350,8 @@ obj_unhook(Elm_Datetime_Module_Data *module_data) | |||
350 | if (ctx_mod->ctxpopup) | 350 | if (ctx_mod->ctxpopup) |
351 | evas_object_del(ctx_mod->ctxpopup); | 351 | evas_object_del(ctx_mod->ctxpopup); |
352 | 352 | ||
353 | if (ctx_mod) | 353 | free(ctx_mod); |
354 | { | 354 | ctx_mod = NULL; |
355 | free(ctx_mod); | ||
356 | ctx_mod = NULL; | ||
357 | } | ||
358 | } | 355 | } |
359 | 356 | ||
360 | EAPI void | 357 | EAPI void |