summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2018-01-08 16:04:22 -0800
committerCedric BAIL <cedric@osg.samsung.com>2018-01-08 16:04:22 -0800
commit419145a298d1297a1d5008c3c76bc3d7ea143d0f (patch)
treeab1553b050f73c3d0f35bd8813c203662c2a83be
parenta0e81d1276e0c47f8ff0ed450d823ea3fadba87f (diff)
ecore: remove use of efl_main_loop_get from efl_net_control_example.
-rw-r--r--src/examples/ecore/efl_net_control_example.c62
1 files changed, 36 insertions, 26 deletions
diff --git a/src/examples/ecore/efl_net_control_example.c b/src/examples/ecore/efl_net_control_example.c
index ac9a4d6f5b..1adffc68c9 100644
--- a/src/examples/ecore/efl_net_control_example.c
+++ b/src/examples/ecore/efl_net_control_example.c
@@ -1,14 +1,10 @@
1#define EFL_BETA_API_SUPPORT 1
2#define EFL_EO_API_SUPPORT 1
3#ifdef HAVE_SYS_SOCKET_H 1#ifdef HAVE_SYS_SOCKET_H
4 #include <sys/socket.h> 2 #include <sys/socket.h>
5#endif 3#endif
6#include <Ecore.h> 4#include <Efl_Net.h>
7#include <Ecore_Con.h>
8#include <Ecore_Getopt.h> 5#include <Ecore_Getopt.h>
9#include <ctype.h> 6#include <ctype.h>
10 7
11static int retval = EXIT_SUCCESS;
12static Eina_Bool monitoring = EINA_TRUE; 8static Eina_Bool monitoring = EINA_TRUE;
13 9
14static const char * 10static const char *
@@ -1184,10 +1180,10 @@ _cmd_access_point_configure_proxy(Eo *ctl, size_t argc, char **argv)
1184} 1180}
1185 1181
1186static void 1182static void
1187_cmd_quit(Eo *ctl EINA_UNUSED, size_t argc EINA_UNUSED, char **argv EINA_UNUSED) 1183_cmd_quit(Eo *ctl, size_t argc EINA_UNUSED, char **argv EINA_UNUSED)
1188{ 1184{
1189 printf("INFO: bye!\n"); 1185 printf("INFO: bye!\n");
1190 ecore_main_loop_quit(); 1186 efl_loop_quit(efl_loop_get(ctl), EINA_VALUE_EMPTY);
1191} 1187}
1192 1188
1193static void 1189static void
@@ -1412,28 +1408,47 @@ EFL_CALLBACKS_ARRAY_DEFINE(ctl_events_cbs,
1412 { EFL_NET_CONTROL_EVENT_AGENT_BROWSER_URL, _ctl_agent_browser_url }, 1408 { EFL_NET_CONTROL_EVENT_AGENT_BROWSER_URL, _ctl_agent_browser_url },
1413 { EFL_NET_CONTROL_EVENT_AGENT_REQUEST_INPUT, _ctl_agent_request_input }); 1409 { EFL_NET_CONTROL_EVENT_AGENT_REQUEST_INPUT, _ctl_agent_request_input });
1414 1410
1415int 1411static Eo *copier = NULL;
1416main(int argc EINA_UNUSED, char **argv EINA_UNUSED) 1412
1413
1414EAPI_MAIN void
1415efl_pause(void *data EINA_UNUSED,
1416 const Efl_Event *ev EINA_UNUSED)
1417{
1418}
1419
1420EAPI_MAIN void
1421efl_resume(void *data EINA_UNUSED,
1422 const Efl_Event *ev EINA_UNUSED)
1423{
1424}
1425
1426EAPI_MAIN void
1427efl_terminate(void *data EINA_UNUSED,
1428 const Efl_Event *ev EINA_UNUSED)
1429{
1430 efl_del(copier);
1431 copier = NULL;
1432}
1433
1434EAPI_MAIN void
1435efl_main(void *data EINA_UNUSED,
1436 const Efl_Event *ev)
1417{ 1437{
1418 Eo *ctl; 1438 Eo *ctl;
1419 Eo *input; 1439 Eo *input;
1420 Eo *copier;
1421 Eina_Slice line_delimiter = EINA_SLICE_STR("\n"); 1440 Eina_Slice line_delimiter = EINA_SLICE_STR("\n");
1422 1441
1423 ecore_init(); 1442 ctl = efl_add(EFL_NET_CONTROL_CLASS, ev->object,
1424 ecore_con_init();
1425
1426 ctl = efl_add(EFL_NET_CONTROL_CLASS, efl_main_loop_get(),
1427 efl_event_callback_array_add(efl_added, ctl_events_cbs(), NULL)); 1443 efl_event_callback_array_add(efl_added, ctl_events_cbs(), NULL));
1428 if (!ctl) 1444 if (!ctl)
1429 { 1445 {
1430 fputs("ERROR: Could not create Efl.Net.Control object.\n", stderr); 1446 fputs("ERROR: Could not create Efl.Net.Control object.\n", stderr);
1431 retval = EXIT_FAILURE;
1432 goto end; 1447 goto end;
1433 } 1448 }
1434 1449
1435 input = efl_add(EFL_IO_STDIN_CLASS, efl_main_loop_get()); 1450 input = efl_add(EFL_IO_STDIN_CLASS, ev->object);
1436 copier = efl_add(EFL_IO_COPIER_CLASS, efl_main_loop_get(), 1451 copier = efl_add(EFL_IO_COPIER_CLASS, ev->object,
1437 efl_io_copier_source_set(efl_added, input), 1452 efl_io_copier_source_set(efl_added, input),
1438 efl_io_copier_line_delimiter_set(efl_added, line_delimiter), 1453 efl_io_copier_line_delimiter_set(efl_added, line_delimiter),
1439 efl_io_copier_buffer_limit_set(efl_added, 8192), 1454 efl_io_copier_buffer_limit_set(efl_added, 8192),
@@ -1443,15 +1458,10 @@ main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
1443 printf("INFO: monitoring is on, disable with 'monitor off'. See 'help'.\n"); 1458 printf("INFO: monitoring is on, disable with 'monitor off'. See 'help'.\n");
1444 printf("INFO: type commands, if unsure try: 'help'\n"); 1459 printf("INFO: type commands, if unsure try: 'help'\n");
1445 1460
1446 ecore_main_loop_begin(); 1461 return ;
1447
1448 efl_del(copier);
1449 efl_del(input);
1450 efl_del(ctl);
1451 1462
1452 end: 1463 end:
1453 ecore_con_shutdown(); 1464 efl_loop_quit(efl_loop_get(ev->object), eina_value_int_init(EXIT_FAILURE));
1454 ecore_shutdown();
1455
1456 return retval;
1457} 1465}
1466
1467EFL_MAIN_EX();