summaryrefslogtreecommitdiff
path: root/src/examples/emotion/emotion_signals_example.c
diff options
context:
space:
mode:
authorAvi Levin <avi.levin@samsung.com>2015-04-26 14:49:26 +0300
committerDaniel Zaoui <daniel.zaoui@samsung.com>2015-06-07 11:00:52 +0300
commitf9c116a48749c642eb31154a4cfb5f60a110dcba (patch)
tree2cbf4d8891d6aa65c5f8867cb95549947208b864 /src/examples/emotion/emotion_signals_example.c
parentb563efc52ffbc02ae33d4901326a583102975cbb (diff)
emotion: porting evas smart callbacks to eo
Diffstat (limited to 'src/examples/emotion/emotion_signals_example.c')
-rw-r--r--src/examples/emotion/emotion_signals_example.c87
1 files changed, 56 insertions, 31 deletions
diff --git a/src/examples/emotion/emotion_signals_example.c b/src/examples/emotion/emotion_signals_example.c
index dd83ac2eb3..3c56c40924 100644
--- a/src/examples/emotion/emotion_signals_example.c
+++ b/src/examples/emotion/emotion_signals_example.c
@@ -1,5 +1,8 @@
1//Compile with: 1//Compile with:
2// gcc -o emotion_signals_example emotion_signals_example.c `pkg-config --libs --cflags emotion evas ecore ecore-evas` 2// gcc -o emotion_signals_example emotion_signals_example.c `pkg-config --libs --cflags emotion evas ecore ecore-evas eo`
3
4#define EFL_EO_API_SUPPORT
5#define EFL_BETA_API_SUPPORT
3 6
4#include <Ecore.h> 7#include <Ecore.h>
5#include <Ecore_Evas.h> 8#include <Ecore_Evas.h>
@@ -30,74 +33,96 @@ _display_info(Evas_Object *o)
30 printf("\n"); 33 printf("\n");
31} 34}
32 35
33static void 36static Eina_Bool
34_playback_started_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) 37_playback_started_cb(void *data EINA_UNUSED,
38 Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
35{ 39{
36 printf(">>> Emotion object started playback.\n"); 40 printf(">>> Emotion object started playback.\n");
37 _display_info(o); 41 _display_info(o);
42
43 return EINA_TRUE;
38} 44}
39 45
40static void 46static Eina_Bool
41_playback_finished_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) 47_playback_finished_cb(void *data EINA_UNUSED,
48 Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
42{ 49{
43 printf(">>> Emotion object finished playback.\n"); 50 printf(">>> Emotion object finished playback.\n");
44 _display_info(o); 51 _display_info(o);
52
53 return EINA_TRUE;
45} 54}
46 55
47static void 56static Eina_Bool
48_open_done_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) 57_open_done_cb(void *data EINA_UNUSED,
58 Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
49{ 59{
50 printf(">>> Emotion object open done.\n"); 60 printf(">>> Emotion object open done.\n");
51 _display_info(o); 61 _display_info(o);
62
63 return EINA_TRUE;
52} 64}
53 65
54static void 66static Eina_Bool
55_position_update_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) 67_position_update_cb(void *data EINA_UNUSED,
68 Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
56{ 69{
57 printf(">>> Emotion object first position update.\n"); 70 printf(">>> Emotion object first position update.\n");
58 evas_object_smart_callback_del(o, "position_update", _position_update_cb); 71 eo_do(o, eo_event_callback_del(EMOTION_OBJECT_EVENT_POSITION_UPDATE,
72 _position_update_cb, NULL));
59 _display_info(o); 73 _display_info(o);
74
75 return EINA_TRUE;
60} 76}
61 77
62static void 78static Eina_Bool
63_frame_decode_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) 79_frame_decode_cb(void *data EINA_UNUSED,
80 Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
64{ 81{
65 printf(">>> Emotion object first frame decode.\n"); 82 printf(">>> Emotion object first frame decode.\n");
66 evas_object_smart_callback_del(o, "frame_decode", _frame_decode_cb); 83 eo_do(o, eo_event_callback_del(EMOTION_OBJECT_EVENT_FRAME_DECODE,
84 _frame_decode_cb, NULL));
67 _display_info(o); 85 _display_info(o);
86
87 return EINA_TRUE;
68} 88}
69 89
70static void 90static Eina_Bool
71_decode_stop_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) 91_decode_stop_cb(void *data EINA_UNUSED,
92 Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
72{ 93{
73 printf(">>> Emotion object decode stop.\n"); 94 printf(">>> Emotion object decode stop.\n");
74 _display_info(o); 95 _display_info(o);
96
97 return EINA_TRUE;
75} 98}
76 99
77static void 100static Eina_Bool
78_frame_resize_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) 101_frame_resize_cb(void *data EINA_UNUSED,
102 Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
79{ 103{
80 printf(">>> Emotion object frame resize.\n"); 104 printf(">>> Emotion object frame resize.\n");
81 _display_info(o); 105 _display_info(o);
106
107 return EINA_TRUE;
82} 108}
83 109
110static const Eo_Callback_Array_Item emotion_object_example_callbacks[] = {
111 { EMOTION_OBJECT_EVENT_PLAYBACK_STARTED, _playback_started_cb },
112 { EMOTION_OBJECT_EVENT_PLAYBACK_FINISHED, _playback_finished_cb },
113 { EMOTION_OBJECT_EVENT_OPEN_DONE, _open_done_cb },
114 { EMOTION_OBJECT_EVENT_POSITION_UPDATE, _position_update_cb },
115 { EMOTION_OBJECT_EVENT_FRAME_DECODE, _frame_decode_cb },
116 { EMOTION_OBJECT_EVENT_DECODE_STOP, _decode_stop_cb },
117 { EMOTION_OBJECT_EVENT_FRAME_RESIZE, _frame_resize_cb },
118 { NULL, NULL }
119};
120
84static void 121static void
85_setup_emotion_callbacks(Evas_Object *o) 122_setup_emotion_callbacks(Evas_Object *o)
86{ 123{
87 evas_object_smart_callback_add( 124 eo_do(o, eo_event_callback_add
88 o, "playback_started", _playback_started_cb, NULL); 125 (EMOTION_OBJECT_EVENT_PLAYBACK_STARTED, _playback_started_cb, NULL));
89 evas_object_smart_callback_add(
90 o, "playback_finished", _playback_finished_cb, NULL);
91 evas_object_smart_callback_add(
92 o, "open_done", _open_done_cb, NULL);
93 evas_object_smart_callback_add(
94 o, "position_update", _position_update_cb, NULL);
95 evas_object_smart_callback_add(
96 o, "frame_decode", _frame_decode_cb, NULL);
97 evas_object_smart_callback_add(
98 o, "decode_stop", _decode_stop_cb, NULL);
99 evas_object_smart_callback_add(
100 o, "frame_resize", _frame_resize_cb, NULL);
101} 126}
102 127
103int 128int