summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYossi Kantor <yossi.kantor@samsung.com>2014-06-12 17:52:33 +0300
committerDaniel Zaoui <daniel.zaoui@samsung.com>2014-09-17 15:08:41 +0300
commit4009776dca66f12aad987090924ca29959613af5 (patch)
treefb663e7f0df4bf850cfd03245e00425c3fee5527
parentc38625a600d35bbe1fda95f9df7f211582bbd71e (diff)
Porting to Eo: Elm Dayselector Item
-rw-r--r--src/lib/Makefile.am11
-rw-r--r--src/lib/elm_dayselector.c52
-rw-r--r--src/lib/elm_dayselector_item.eo8
-rw-r--r--src/lib/elm_widget_dayselector.h12
4 files changed, 56 insertions, 27 deletions
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index b16d58f52..cf31c9b55 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -847,7 +847,9 @@ BUILT_SOURCES = \
847 elm_widget_item.eo.c \ 847 elm_widget_item.eo.c \
848 elm_widget_item.eo.h \ 848 elm_widget_item.eo.h \
849 elm_color_item.eo.c \ 849 elm_color_item.eo.c \
850 elm_color_item.eo.h 850 elm_color_item.eo.h \
851 elm_dayselector_item.eo.c \
852 elm_dayselector_item.eo.h
851 853
852elementaryeolianfilesdir = $(datadir)/eolian/include/elementary-@VMAJ@ 854elementaryeolianfilesdir = $(datadir)/eolian/include/elementary-@VMAJ@
853elementaryeolianfiles_DATA = \ 855elementaryeolianfiles_DATA = \
@@ -943,7 +945,8 @@ elementaryeolianfiles_DATA = \
943 elm_web.eo \ 945 elm_web.eo \
944 elm_win.eo \ 946 elm_win.eo \
945 elm_widget_item.eo \ 947 elm_widget_item.eo \
946 elm_color_item.eo 948 elm_color_item.eo \
949 elm_dayselector_item.eo
947 950
948EXTRA_DIST += ${elementaryeolianfiles_DATA} 951EXTRA_DIST += ${elementaryeolianfiles_DATA}
949 952
@@ -1041,6 +1044,7 @@ nodist_includesunstable_HEADERS = \
1041 elm_win.eo.h \ 1044 elm_win.eo.h \
1042 elm_widget_item.eo.h \ 1045 elm_widget_item.eo.h \
1043 elm_color_item.eo.h \ 1046 elm_color_item.eo.h \
1047 elm_dayselector_item.eo.h \
1044 elm_layout.eo.legacy.h \ 1048 elm_layout.eo.legacy.h \
1045 elm_frame.eo.legacy.h \ 1049 elm_frame.eo.legacy.h \
1046 elm_hover.eo.legacy.h \ 1050 elm_hover.eo.legacy.h \
@@ -1105,7 +1109,8 @@ nodist_includesunstable_HEADERS = \
1105 elm_web.eo.legacy.h \ 1109 elm_web.eo.legacy.h \
1106 elm_win.eo.legacy.h \ 1110 elm_win.eo.legacy.h \
1107 elm_widget_item.eo.legacy.h \ 1111 elm_widget_item.eo.legacy.h \
1108 elm_color_item.eo.legacy.h 1112 elm_color_item.eo.legacy.h \
1113 elm_dayselector_item.eo.legacy.h
1109 1114
1110if HAVE_CXX11 1115if HAVE_CXX11
1111 1116
diff --git a/src/lib/elm_dayselector.c b/src/lib/elm_dayselector.c
index c67a9b253..f6b4a1501 100644
--- a/src/lib/elm_dayselector.c
+++ b/src/lib/elm_dayselector.c
@@ -62,7 +62,7 @@ _elm_dayselector_elm_widget_translate(Eo *obj EINA_UNUSED, Elm_Dayselector_Data
62 Eina_List *l; 62 Eina_List *l;
63 char buf[1024]; 63 char buf[1024];
64 struct tm time_daysel; 64 struct tm time_daysel;
65 Elm_Dayselector_Item *it; 65 Elm_Dayselector_Item_Data *it;
66 66
67 if (sd->weekdays_names_set) 67 if (sd->weekdays_names_set)
68 return EINA_TRUE; 68 return EINA_TRUE;
@@ -87,7 +87,7 @@ _update_items(Evas_Object *obj)
87 Eina_List *l; 87 Eina_List *l;
88 Eina_Bool rtl; 88 Eina_Bool rtl;
89 unsigned int last_day; 89 unsigned int last_day;
90 Elm_Dayselector_Item *it; 90 Elm_Dayselector_Item_Data *it;
91 91
92 ELM_DAYSELECTOR_DATA_GET(obj, sd); 92 ELM_DAYSELECTOR_DATA_GET(obj, sd);
93 93
@@ -117,7 +117,7 @@ _update_items(Evas_Object *obj)
117 117
118static inline unsigned int 118static inline unsigned int
119_item_location_get(Elm_Dayselector_Data *sd, 119_item_location_get(Elm_Dayselector_Data *sd,
120 Elm_Dayselector_Item *it) 120 Elm_Dayselector_Item_Data *it)
121{ 121{
122 return (ELM_DAYSELECTOR_MAX - sd->week_start + it->day) % 122 return (ELM_DAYSELECTOR_MAX - sd->week_start + it->day) %
123 ELM_DAYSELECTOR_MAX; 123 ELM_DAYSELECTOR_MAX;
@@ -130,7 +130,7 @@ _elm_dayselector_elm_widget_theme_apply(Eo *obj, Elm_Dayselector_Data *sd)
130 130
131 Eina_List *l; 131 Eina_List *l;
132 char buf[1024]; 132 char buf[1024];
133 Elm_Dayselector_Item *it; 133 Elm_Dayselector_Item_Data *it;
134 134
135 eo_do_super(obj, MY_CLASS, int_ret = elm_obj_widget_theme_apply()); 135 eo_do_super(obj, MY_CLASS, int_ret = elm_obj_widget_theme_apply());
136 if (!int_ret) return EINA_FALSE; 136 if (!int_ret) return EINA_FALSE;
@@ -160,7 +160,7 @@ _item_del_cb(void *data,
160{ 160{
161 Eina_List *l; 161 Eina_List *l;
162 char buf[1024]; 162 char buf[1024];
163 Elm_Dayselector_Item *it; 163 Elm_Dayselector_Item_Data *it;
164 164
165 ELM_DAYSELECTOR_DATA_GET(data, sd); 165 ELM_DAYSELECTOR_DATA_GET(data, sd);
166 166
@@ -175,7 +175,7 @@ _item_del_cb(void *data,
175 elm_layout_signal_emit(obj, buf, "elm"); 175 elm_layout_signal_emit(obj, buf, "elm");
176 176
177 VIEW(it) = NULL; 177 VIEW(it) = NULL;
178 elm_widget_item_free(it); 178 eo_del((Eo *)EO_OBJ(it));
179 179
180 elm_layout_sizing_eval(obj); 180 elm_layout_sizing_eval(obj);
181 break; 181 break;
@@ -189,7 +189,7 @@ _item_signal_emit_cb(void *data,
189 const char *emission, 189 const char *emission,
190 const char *source EINA_UNUSED) 190 const char *source EINA_UNUSED)
191{ 191{
192 Elm_Dayselector_Item *it = data; 192 Elm_Dayselector_Item_Data *it = data;
193 193
194 eina_stringshare_replace(&it->day_style, emission); 194 eina_stringshare_replace(&it->day_style, emission);
195} 195}
@@ -199,17 +199,17 @@ _item_clicked_cb(void *data,
199 Evas_Object *obj EINA_UNUSED, 199 Evas_Object *obj EINA_UNUSED,
200 void *event_info EINA_UNUSED) 200 void *event_info EINA_UNUSED)
201{ 201{
202 Elm_Dayselector_Item *it = data; 202 Elm_Dayselector_Item_Data *it = data;
203 203
204 evas_object_smart_callback_call(WIDGET(it), SIG_CHANGED, (void *)it->day); 204 evas_object_smart_callback_call(WIDGET(it), SIG_CHANGED, (void *)it->day);
205} 205}
206 206
207static Elm_Dayselector_Item * 207static Elm_Dayselector_Item_Data *
208_item_find(const Evas_Object *obj, 208_item_find(const Evas_Object *obj,
209 Elm_Dayselector_Day day) 209 Elm_Dayselector_Day day)
210{ 210{
211 Eina_List *l; 211 Eina_List *l;
212 Elm_Dayselector_Item *it; 212 Elm_Dayselector_Item_Data *it;
213 213
214 ELM_DAYSELECTOR_DATA_GET(obj, sd); 214 ELM_DAYSELECTOR_DATA_GET(obj, sd);
215 215
@@ -226,7 +226,7 @@ _elm_dayselector_elm_container_content_set(Eo *obj, Elm_Dayselector_Data *sd, co
226 226
227 int day; 227 int day;
228 char buf[1024]; 228 char buf[1024];
229 Elm_Dayselector_Item *it = NULL; 229 Elm_Dayselector_Item_Data *it = NULL;
230 230
231 if (strcmp(elm_object_widget_type_get(content), "Elm_Check")) 231 if (strcmp(elm_object_widget_type_get(content), "Elm_Check"))
232 return EINA_FALSE; 232 return EINA_FALSE;
@@ -251,7 +251,8 @@ _elm_dayselector_elm_container_content_set(Eo *obj, Elm_Dayselector_Data *sd, co
251 } 251 }
252 else 252 else
253 { 253 {
254 it = elm_widget_item_new(obj, Elm_Dayselector_Item); 254 Eo *eo_it = eo_add(ELM_DAYSELECTOR_ITEM_CLASS, obj);
255 it = eo_data_scope_get(eo_it, ELM_DAYSELECTOR_ITEM_CLASS);
255 it->day = day; 256 it->day = day;
256 257
257 snprintf(buf, sizeof(buf), "day%d", _item_location_get(sd, it)); 258 snprintf(buf, sizeof(buf), "day%d", _item_location_get(sd, it));
@@ -259,7 +260,7 @@ _elm_dayselector_elm_container_content_set(Eo *obj, Elm_Dayselector_Data *sd, co
259 eo_do_super(obj, MY_CLASS, int_ret = elm_obj_container_content_set(buf, content)); 260 eo_do_super(obj, MY_CLASS, int_ret = elm_obj_container_content_set(buf, content));
260 if (!int_ret) 261 if (!int_ret)
261 { 262 {
262 elm_widget_item_free(it); 263 eo_del(eo_it);
263 return EINA_FALSE; 264 return EINA_FALSE;
264 } 265 }
265 266
@@ -289,13 +290,20 @@ _elm_dayselector_elm_container_content_set(Eo *obj, Elm_Dayselector_Data *sd, co
289 return EINA_TRUE; 290 return EINA_TRUE;
290} 291}
291 292
293EOLIAN static void
294_elm_dayselector_item_eo_base_constructor(Eo *eo_item, Elm_Dayselector_Item_Data *item)
295{
296 eo_do_super(eo_item, ELM_DAYSELECTOR_ITEM_CLASS, eo_constructor());
297 item->base = eo_data_scope_get(eo_item, ELM_WIDGET_ITEM_CLASS);
298}
299
292EOLIAN static Evas_Object* 300EOLIAN static Evas_Object*
293_elm_dayselector_elm_container_content_unset(Eo *obj, Elm_Dayselector_Data *sd, const char *item) 301_elm_dayselector_elm_container_content_unset(Eo *obj, Elm_Dayselector_Data *sd, const char *item)
294{ 302{
295 int day; 303 int day;
296 char buf[1024]; 304 char buf[1024];
297 Evas_Object *content; 305 Evas_Object *content;
298 Elm_Dayselector_Item *it = NULL; 306 Elm_Dayselector_Item_Data *it = NULL;
299 307
300 day = atoi(item + (strlen(item) - 1)); 308 day = atoi(item + (strlen(item) - 1));
301 if (day < 0 || day > ELM_DAYSELECTOR_MAX) return NULL; 309 if (day < 0 || day > ELM_DAYSELECTOR_MAX) return NULL;
@@ -325,7 +333,7 @@ _elm_dayselector_elm_container_content_unset(Eo *obj, Elm_Dayselector_Data *sd,
325 elm_layout_signal_emit(obj, buf, "elm"); 333 elm_layout_signal_emit(obj, buf, "elm");
326 334
327 VIEW(it) = NULL; 335 VIEW(it) = NULL;
328 elm_widget_item_free(it); 336 eo_del((Eo *)EO_OBJ(it));
329 337
330 elm_layout_sizing_eval(obj); 338 elm_layout_sizing_eval(obj);
331 339
@@ -336,7 +344,7 @@ static void
336_items_style_set(Evas_Object *obj) 344_items_style_set(Evas_Object *obj)
337{ 345{
338 Eina_List *l; 346 Eina_List *l;
339 Elm_Dayselector_Item *it; 347 Elm_Dayselector_Item_Data *it;
340 unsigned int weekend_last; 348 unsigned int weekend_last;
341 349
342 ELM_DAYSELECTOR_DATA_GET(obj, sd); 350 ELM_DAYSELECTOR_DATA_GET(obj, sd);
@@ -426,13 +434,13 @@ _elm_dayselector_evas_object_smart_add(Eo *obj, Elm_Dayselector_Data *priv)
426EOLIAN static void 434EOLIAN static void
427_elm_dayselector_evas_object_smart_del(Eo *obj, Elm_Dayselector_Data *sd) 435_elm_dayselector_evas_object_smart_del(Eo *obj, Elm_Dayselector_Data *sd)
428{ 436{
429 Elm_Dayselector_Item *it; 437 Elm_Dayselector_Item_Data *it;
430 438
431 EINA_LIST_FREE(sd->items, it) 439 EINA_LIST_FREE(sd->items, it)
432 { 440 {
433 sd->items = eina_list_remove(sd->items, it); 441 sd->items = eina_list_remove(sd->items, it);
434 eina_stringshare_del(it->day_style); 442 eina_stringshare_del(it->day_style);
435 elm_widget_item_free(it); 443 eo_del((Eo *)EO_OBJ(it));
436 } 444 }
437 445
438 /* handles freeing sd */ 446 /* handles freeing sd */
@@ -476,7 +484,7 @@ _elm_dayselector_week_start_set(Eo *obj, Elm_Dayselector_Data *sd, Elm_Dayselect
476 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 484 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
477 Eina_List *l; 485 Eina_List *l;
478 char buf[1024]; 486 char buf[1024];
479 Elm_Dayselector_Item *it; 487 Elm_Dayselector_Item_Data *it;
480 488
481 /* just shuffling items, so swalling them directly */ 489 /* just shuffling items, so swalling them directly */
482 sd->week_start = day; 490 sd->week_start = day;
@@ -532,7 +540,7 @@ _elm_dayselector_weekdays_names_set(Eo *obj, Elm_Dayselector_Data *sd, const cha
532 int idx; 540 int idx;
533 time_t now; 541 time_t now;
534 struct tm time_daysel; 542 struct tm time_daysel;
535 Elm_Dayselector_Item *it; 543 Elm_Dayselector_Item_Data *it;
536 char buf[1024]; 544 char buf[1024];
537 545
538 if (weekdays) 546 if (weekdays)
@@ -564,7 +572,7 @@ _elm_dayselector_weekdays_names_get(Eo *obj, Elm_Dayselector_Data *sd EINA_UNUSE
564{ 572{
565 int idx; 573 int idx;
566 const char *weekday; 574 const char *weekday;
567 Elm_Dayselector_Item *it; 575 Elm_Dayselector_Item_Data *it;
568 Eina_List *weekdays = NULL; 576 Eina_List *weekdays = NULL;
569 577
570 for (idx = 0; idx < ELM_DAYSELECTOR_MAX; idx++) 578 for (idx = 0; idx < ELM_DAYSELECTOR_MAX; idx++)
@@ -589,3 +597,5 @@ _elm_dayselector_class_constructor(Eo_Class *klass)
589} 597}
590 598
591#include "elm_dayselector.eo.c" 599#include "elm_dayselector.eo.c"
600#include "elm_dayselector_item.eo.c"
601
diff --git a/src/lib/elm_dayselector_item.eo b/src/lib/elm_dayselector_item.eo
new file mode 100644
index 000000000..a45f06d99
--- /dev/null
+++ b/src/lib/elm_dayselector_item.eo
@@ -0,0 +1,8 @@
1class Elm_Dayselector_Item(Elm_Widget_Item)
2{
3 legacy_prefix: null;
4 eo_prefix: elm_dayselector_item;
5 implements {
6 Eo.Base.constructor;
7 }
8}
diff --git a/src/lib/elm_widget_dayselector.h b/src/lib/elm_widget_dayselector.h
index 77bcb72f6..6ce0d7d9c 100644
--- a/src/lib/elm_widget_dayselector.h
+++ b/src/lib/elm_widget_dayselector.h
@@ -2,6 +2,9 @@
2#define ELM_WIDGET_DAYSELECTOR_H 2#define ELM_WIDGET_DAYSELECTOR_H
3 3
4#include "Elementary.h" 4#include "Elementary.h"
5#include "elm_dayselector_item.eo.h"
6
7#include "elm_object_item_migration_temp.h"
5 8
6/* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR 9/* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR
7 * CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT 10 * CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT
@@ -33,10 +36,10 @@ struct _Elm_Dayselector_Data
33 Eina_Bool weekdays_names_set : 1; 36 Eina_Bool weekdays_names_set : 1;
34}; 37};
35 38
36typedef struct _Elm_Dayselector_Item Elm_Dayselector_Item; 39typedef struct _Elm_Dayselector_Item_Data Elm_Dayselector_Item_Data;
37struct _Elm_Dayselector_Item 40struct _Elm_Dayselector_Item_Data
38{ 41{
39 ELM_WIDGET_ITEM; 42 Elm_Widget_Item_Data *base;
40 Elm_Dayselector_Day day; 43 Elm_Dayselector_Day day;
41 const char *day_style; 44 const char *day_style;
42}; 45};
@@ -70,4 +73,7 @@ struct _Elm_Dayselector_Item
70 if (EINA_UNLIKELY(!eo_isa((obj), ELM_DAYSELECTOR_CLASS))) \ 73 if (EINA_UNLIKELY(!eo_isa((obj), ELM_DAYSELECTOR_CLASS))) \
71 return 74 return
72 75
76#define ELM_DAYSELECTOR_ITEM_DATA_GET(o, sd) \
77 Elm_Dayselector_Item_Data * sd = eo_data_scope_get((Eo *)o, ELM_DAYSELECTOR_ITEM_CLASS)
78
73#endif 79#endif