summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2018-01-11 10:19:24 -0800
committerCedric BAIL <cedric@osg.samsung.com>2018-01-11 11:13:17 -0800
commit0e91525d25564a33153084462f15101a6a878ea3 (patch)
treee90f6e4a88b9fa61ccafc53fce93d531c1623a6c
parentf32f0d89f4c42080ff28d2b5a201f6ce8e0206b1 (diff)
ecore: remove use of efl_main_loop_get from efl_net_session_example.
-rw-r--r--src/examples/ecore/efl_net_session_example.c64
1 files changed, 40 insertions, 24 deletions
diff --git a/src/examples/ecore/efl_net_session_example.c b/src/examples/ecore/efl_net_session_example.c
index dfc827bcfa..55c8d05d33 100644
--- a/src/examples/ecore/efl_net_session_example.c
+++ b/src/examples/ecore/efl_net_session_example.c
@@ -1,12 +1,6 @@
1#define EFL_BETA_API_SUPPORT 1 1#include <Efl_Net.h>
2#define EFL_EO_API_SUPPORT 1
3#include <Ecore.h>
4#include <Ecore_Con.h>
5#include <Ecore_Getopt.h> 2#include <Ecore_Getopt.h>
6 3
7static int retval = EXIT_SUCCESS;
8
9
10static const char * 4static const char *
11_state_str(Efl_Net_Session_State state) 5_state_str(Efl_Net_Session_State state)
12{ 6{
@@ -96,8 +90,39 @@ static const Ecore_Getopt options = {
96 } 90 }
97}; 91};
98 92
99int 93static Eo *session = NULL;
100main(int argc, char **argv) 94
95EAPI_MAIN void
96efl_pause(void *data EINA_UNUSED,
97 const Efl_Event *ev EINA_UNUSED)
98{
99}
100
101EAPI_MAIN void
102efl_resume(void *data EINA_UNUSED,
103 const Efl_Event *ev EINA_UNUSED)
104{
105}
106
107EAPI_MAIN void
108efl_terminate(void *data EINA_UNUSED,
109 const Efl_Event *ev EINA_UNUSED)
110{
111 /* FIXME: For the moment the main loop doesn't get
112 properly destroyed on shutdown which disallow
113 relying on parent destroying their children */
114 if (session)
115 {
116 efl_del(session);
117 session = NULL;
118 }
119
120 fprintf(stderr, "INFO: main loop finished.\n");
121}
122
123EAPI_MAIN void
124efl_main(void *data EINA_UNUSED,
125 const Efl_Event *ev)
101{ 126{
102 char *str; 127 char *str;
103 Eina_List *techs = NULL; 128 Eina_List *techs = NULL;
@@ -118,16 +143,11 @@ main(int argc, char **argv)
118 ECORE_GETOPT_VALUE_NONE /* sentinel */ 143 ECORE_GETOPT_VALUE_NONE /* sentinel */
119 }; 144 };
120 int args; 145 int args;
121 Eo *session;
122 146
123 ecore_init(); 147 args = ecore_getopt_parse(&options, values, 0, NULL);
124 ecore_con_init();
125
126 args = ecore_getopt_parse(&options, values, argc, argv);
127 if (args < 0) 148 if (args < 0)
128 { 149 {
129 fputs("ERROR: Could not parse command line options.\n", stderr); 150 fputs("ERROR: Could not parse command line options.\n", stderr);
130 retval = EXIT_FAILURE;
131 goto end; 151 goto end;
132 } 152 }
133 153
@@ -152,12 +172,11 @@ main(int argc, char **argv)
152 } 172 }
153 } 173 }
154 174
155 session = efl_add(EFL_NET_SESSION_CLASS, efl_main_loop_get(), 175 session = efl_add(EFL_NET_SESSION_CLASS, ev->object,
156 efl_event_callback_array_add(efl_added, session_events_cbs(), NULL)); 176 efl_event_callback_array_add(efl_added, session_events_cbs(), NULL));
157 if (!session) 177 if (!session)
158 { 178 {
159 fputs("ERROR: Could not create Efl.Net.Session object.\n", stderr); 179 fputs("ERROR: Could not create Efl.Net.Session object.\n", stderr);
160 retval = EXIT_FAILURE;
161 goto end; 180 goto end;
162 } 181 }
163 182
@@ -169,13 +188,10 @@ main(int argc, char **argv)
169 188
170 printf("INFO: the session will active while this application runs. Use ^C (Control + C) to close it\n"); 189 printf("INFO: the session will active while this application runs. Use ^C (Control + C) to close it\n");
171 190
172 ecore_main_loop_begin(); 191 return ;
173
174 efl_del(session);
175 192
176 end: 193 end:
177 ecore_con_shutdown(); 194 efl_loop_quit(ev->object, eina_value_int_init(EXIT_FAILURE));
178 ecore_shutdown();
179
180 return retval;
181} 195}
196
197EFL_MAIN_EX();