summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyuan Choi <ryuan.choi@gmail.com>2014-02-05 01:26:37 +0900
committerRyuan Choi <ryuan.choi@gmail.com>2014-02-05 01:33:08 +0900
commitb44bc5ed31a1f1c0810e3873ad278e63a2ea0560 (patch)
tree5b018b7c2b8ce3c9ae7a3f06d1f781bb995140b8
parent4c0f5b0ff6f4d9253989a08d299859456b2d3e22 (diff)
datetime_input_ctxpopup: delay creation of ctxpopup until it is really needed.
-rw-r--r--src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c b/src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c
index ac744ae0e..3a34440dd 100644
--- a/src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c
+++ b/src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c
@@ -48,7 +48,7 @@ _datetime_resize_cb(void *data, Evas *e EINA_UNUSED,Evas_Object *obj EINA_UNUSED
48 Ctxpopup_Module_Data *ctx_mod; 48 Ctxpopup_Module_Data *ctx_mod;
49 49
50 ctx_mod = (Ctxpopup_Module_Data *)data; 50 ctx_mod = (Ctxpopup_Module_Data *)data;
51 if (!ctx_mod) return; 51 if (!ctx_mod || !ctx_mod->ctxpopup) return;
52 52
53 evas_object_hide(ctx_mod->ctxpopup); 53 evas_object_hide(ctx_mod->ctxpopup);
54} 54}
@@ -60,7 +60,7 @@ _datetime_move_cb(void *data, Evas *e EINA_UNUSED,Evas_Object *obj EINA_UNUSED,
60 Ctxpopup_Module_Data *ctx_mod; 60 Ctxpopup_Module_Data *ctx_mod;
61 61
62 ctx_mod = (Ctxpopup_Module_Data *)data; 62 ctx_mod = (Ctxpopup_Module_Data *)data;
63 if (!ctx_mod) return; 63 if (!ctx_mod || !ctx_mod->ctxpopup) return;
64 64
65 evas_object_hide(ctx_mod->ctxpopup); 65 evas_object_hide(ctx_mod->ctxpopup);
66} 66}
@@ -135,13 +135,26 @@ _field_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
135 Evas_Coord x = 0, y = 0, w = 0, h = 0, width; 135 Evas_Coord x = 0, y = 0, w = 0, h = 0, width;
136 136
137 ctx_mod = (Ctxpopup_Module_Data *)data; 137 ctx_mod = (Ctxpopup_Module_Data *)data;
138 if (!ctx_mod || !ctx_mod->ctxpopup) return; 138 if (!ctx_mod) return;
139
140 snprintf(buf, sizeof(buf), "datetime/%s", elm_object_style_get(obj));
141
142 if (!ctx_mod->ctxpopup)
143 {
144 ctx_mod->ctxpopup = elm_ctxpopup_add(obj);
145 elm_object_style_set(ctx_mod->ctxpopup, buf);
146 elm_ctxpopup_horizontal_set(ctx_mod->ctxpopup, EINA_TRUE);
147 evas_object_size_hint_weight_set(ctx_mod->ctxpopup, EVAS_HINT_EXPAND,
148 EVAS_HINT_EXPAND);
149 evas_object_size_hint_align_set(ctx_mod->ctxpopup, EVAS_HINT_FILL, 0.5);
150 evas_object_smart_callback_add(ctx_mod->ctxpopup, "dismissed",
151 _ctxpopup_dismissed_cb, ctx_mod);
152 }
139 153
140 elm_ctxpopup_hover_parent_set(ctx_mod->ctxpopup, elm_widget_top_get(obj)); 154 elm_ctxpopup_hover_parent_set(ctx_mod->ctxpopup, elm_widget_top_get(obj));
141 155
142 // because of the diskselector behaviour, it is being recreated 156 // because of the diskselector behaviour, it is being recreated
143 diskselector = elm_diskselector_add(elm_widget_top_get(ctx_mod->mod_data.base)); 157 diskselector = elm_diskselector_add(elm_widget_top_get(ctx_mod->mod_data.base));
144 snprintf(buf, sizeof(buf), "datetime/%s", elm_object_style_get(obj));
145 elm_object_style_set(diskselector, buf); 158 elm_object_style_set(diskselector, buf);
146 elm_object_content_set(ctx_mod->ctxpopup, diskselector); 159 elm_object_content_set(ctx_mod->ctxpopup, diskselector);
147 160
@@ -314,21 +327,9 @@ EAPI Elm_Datetime_Module_Data *
314obj_hook(Evas_Object *obj) 327obj_hook(Evas_Object *obj)
315{ 328{
316 Ctxpopup_Module_Data *ctx_mod; 329 Ctxpopup_Module_Data *ctx_mod;
317 char buf[BUFF_SIZE];
318
319 ctx_mod = ELM_NEW(Ctxpopup_Module_Data); 330 ctx_mod = ELM_NEW(Ctxpopup_Module_Data);
320 if (!ctx_mod) return NULL; 331 if (!ctx_mod) return NULL;
321 332
322 ctx_mod->ctxpopup = elm_ctxpopup_add(obj);
323 snprintf(buf, sizeof(buf), "datetime/%s", elm_object_style_get(obj));
324 elm_object_style_set(ctx_mod->ctxpopup, buf);
325 elm_ctxpopup_horizontal_set(ctx_mod->ctxpopup, EINA_TRUE);
326 evas_object_size_hint_weight_set(ctx_mod->ctxpopup, EVAS_HINT_EXPAND,
327 EVAS_HINT_EXPAND);
328 evas_object_size_hint_align_set(ctx_mod->ctxpopup, EVAS_HINT_FILL, 0.5);
329 evas_object_smart_callback_add(ctx_mod->ctxpopup, "dismissed",
330 _ctxpopup_dismissed_cb, ctx_mod);
331
332 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, 333 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
333 _datetime_resize_cb, ctx_mod); 334 _datetime_resize_cb, ctx_mod);
334 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, 335 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,