summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2015-05-04 02:16:33 +0200
committerDave Andreoli <dave@gurumeditation.it>2015-05-04 02:16:33 +0200
commitef4c303dc390f5f05c62f9836c98108550980657 (patch)
tree52d8a5fa4f5b8d2c4c47e8d9b0d8aebeadfc3feb
parent02044396ec93932251ed6c6fc574f7a4d8e1d929 (diff)
Fix slideshow smart events event_info
Changed all the callback_call to pass the correct Elm_Object_Item (Eo) pointer, was passing Elm_Slideshow_Item_Data instead. @fix Also updated the test
-rw-r--r--src/bin/test_slideshow.c27
-rw-r--r--src/lib/elm_slideshow.c8
2 files changed, 27 insertions, 8 deletions
diff --git a/src/bin/test_slideshow.c b/src/bin/test_slideshow.c
index f4560023a..449d0164c 100644
--- a/src/bin/test_slideshow.c
+++ b/src/bin/test_slideshow.c
@@ -80,6 +80,7 @@ _get(void *data, Evas_Object *obj)
80 //elm_photocam_file_set(photo, data); 80 //elm_photocam_file_set(photo, data);
81 //elm_photocam_zoom_mode_set(photo, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT); 81 //elm_photocam_zoom_mode_set(photo, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT);
82 82
83 printf("_get (item data: '%s')\n", (char*)data);
83 Evas_Object *photo = elm_image_add(obj); 84 Evas_Object *photo = elm_image_add(obj);
84 elm_image_file_set(photo, data, NULL); 85 elm_image_file_set(photo, data, NULL);
85 elm_image_fill_outside_set(photo, EINA_FALSE); 86 elm_image_fill_outside_set(photo, EINA_FALSE);
@@ -88,9 +89,26 @@ _get(void *data, Evas_Object *obj)
88} 89}
89 90
90static void 91static void
91_slide_transition(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 92_del(void *data, Evas_Object *obj EINA_UNUSED)
93{
94 printf("_del (item data: '%s')\n", (char*)data);
95}
96
97
98static void
99_changed_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
100{
101 Elm_Object_Item *slide_it = (Elm_Object_Item *) event_info;
102 printf("CHANGED (item data: '%s')\n",
103 (char*)elm_object_item_data_get(slide_it));
104}
105
106static void
107_transition_end_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
92{ 108{
93 Elm_Object_Item *slide_it = (Elm_Object_Item *) event_info; 109 Elm_Object_Item *slide_it = (Elm_Object_Item *) event_info;
110 printf("TRANSITION,END (item data: '%s')\n",
111 (char*)elm_object_item_data_get(slide_it));
94 if (data == slide_it) 112 if (data == slide_it)
95 printf("Reaches to End of slides\n"); 113 printf("Reaches to End of slides\n");
96} 114}
@@ -123,20 +141,21 @@ test_slideshow(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
123 slideshow = elm_slideshow_add(win); 141 slideshow = elm_slideshow_add(win);
124 elm_slideshow_loop_set(slideshow, EINA_TRUE); 142 elm_slideshow_loop_set(slideshow, EINA_TRUE);
125 evas_object_size_hint_weight_set(slideshow, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 143 evas_object_size_hint_weight_set(slideshow, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
144 evas_object_smart_callback_add(slideshow, "changed", _changed_cb, NULL);
126 elm_win_resize_object_add(win, slideshow); 145 elm_win_resize_object_add(win, slideshow);
127 evas_object_show(slideshow); 146 evas_object_show(slideshow);
128 147
129 itc.func.get = _get; 148 itc.func.get = _get;
130 itc.func.del = NULL; 149 itc.func.del = _del;
131 150
132 for (i = 0; imgs[i]; i++) 151 for (i = 0; imgs[i]; i++)
133 { 152 {
134 const char *img = eina_stringshare_printf("%s/images/%s", elm_app_data_dir_get(), imgs[i]); 153 const char *img = eina_stringshare_printf("%s/images/%s", elm_app_data_dir_get(), imgs[i]);
135 printf("Img : %s\n", img);
136 slide_last_it = elm_slideshow_item_add(slideshow, &itc, img); 154 slide_last_it = elm_slideshow_item_add(slideshow, &itc, img);
137 } 155 }
138 156
139 evas_object_smart_callback_add(slideshow, "transition,end", _slide_transition, slide_last_it); 157 evas_object_smart_callback_add(slideshow, "transition,end",
158 _transition_end_cb, slide_last_it);
140 159
141 notify = elm_notify_add(win); 160 notify = elm_notify_add(win);
142 elm_notify_align_set(notify, 0.5, 1.0); 161 elm_notify_align_set(notify, 0.5, 1.0);
diff --git a/src/lib/elm_slideshow.c b/src/lib/elm_slideshow.c
index d2a943dbd..aae7150fd 100644
--- a/src/lib/elm_slideshow.c
+++ b/src/lib/elm_slideshow.c
@@ -270,7 +270,7 @@ _on_slideshow_end(void *data,
270 elm_layout_signal_emit(data, "anim,end", "slideshow"); 270 elm_layout_signal_emit(data, "anim,end", "slideshow");
271 271
272 if (emission != NULL) 272 if (emission != NULL)
273 evas_object_smart_callback_call(data, SIG_TRANSITION_END, sd->current); 273 evas_object_smart_callback_call(data, SIG_TRANSITION_END, EO_OBJ(sd->current));
274} 274}
275 275
276static Eina_Bool 276static Eina_Bool
@@ -475,7 +475,7 @@ _elm_slideshow_item_show(Eo *eo_item EINA_UNUSED, Elm_Slideshow_Item_Data *item)
475 475
476 sd->previous = sd->current; 476 sd->previous = sd->current;
477 sd->current = next; 477 sd->current = next;
478 evas_object_smart_callback_call(WIDGET(item), SIG_CHANGED, sd->current); 478 evas_object_smart_callback_call(WIDGET(item), SIG_CHANGED, EO_OBJ(sd->current));
479} 479}
480 480
481EOLIAN static void 481EOLIAN static void
@@ -512,7 +512,7 @@ _elm_slideshow_next(Eo *obj, Elm_Slideshow_Data *sd)
512 512
513 sd->previous = sd->current; 513 sd->previous = sd->current;
514 sd->current = next; 514 sd->current = next;
515 evas_object_smart_callback_call(obj, SIG_CHANGED, sd->current); 515 evas_object_smart_callback_call(obj, SIG_CHANGED, EO_OBJ(sd->current));
516} 516}
517 517
518EOLIAN static void 518EOLIAN static void
@@ -549,7 +549,7 @@ _elm_slideshow_previous(Eo *obj, Elm_Slideshow_Data *sd)
549 549
550 sd->previous = sd->current; 550 sd->previous = sd->current;
551 sd->current = prev; 551 sd->current = prev;
552 evas_object_smart_callback_call(obj, SIG_CHANGED, sd->current); 552 evas_object_smart_callback_call(obj, SIG_CHANGED, EO_OBJ(sd->current));
553} 553}
554 554
555EOLIAN static const Eina_List* 555EOLIAN static const Eina_List*