summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2017-09-25 15:52:36 -0700
committerCedric BAIL <cedric@osg.samsung.com>2017-09-25 15:52:36 -0700
commit39318789a88cf5e3930c9ed6e9d437aa374ce7ad (patch)
tree10ec16b74adc99fecc2fbf0cd01f42cd8993d87e /src
parentfdc92ca868c76a2e7d7cdb701a7a27262858b23a (diff)
elementary: migrate elementary_config to use the new macro with lifecycle support.
Diffstat (limited to 'src')
-rw-r--r--src/bin/elementary/config.c99
1 files changed, 60 insertions, 39 deletions
diff --git a/src/bin/elementary/config.c b/src/bin/elementary/config.c
index 90b815a4f8..9f56205e11 100644
--- a/src/bin/elementary/config.c
+++ b/src/bin/elementary/config.c
@@ -4259,22 +4259,41 @@ _exit_timer(void *data EINA_UNUSED)
4259 return ECORE_CALLBACK_CANCEL; 4259 return ECORE_CALLBACK_CANCEL;
4260} 4260}
4261 4261
4262EAPI_MAIN void
4263efl_terminate(void *data EINA_UNUSED,
4264 const Efl_Event *ev EINA_UNUSED)
4265{
4266 fprintf(stderr, "Terminating.\n");
4267 if (interactive)
4268 {
4269 const char *web_backend_set = elm_config_web_backend_get();
4270
4271 web_backend = elm_object_text_get(web_backend_entry);
4272 fprintf(stderr, "[%s] vs [%s]\n", web_backend, web_backend_set);
4273 if (web_backend_set != web_backend ||
4274 (web_backend && web_backend_set && !!strcmp(web_backend, web_backend_set)))
4275 {
4276 elm_config_web_backend_set(web_backend);
4277 fprintf(stderr, "web backend set to : [%s]\n", elm_config_web_backend_get());
4278 elm_config_all_flush();
4279 }
4280 }
4281}
4282
4262/* this is your elementary main function - it MUST be called IMMEDIATELY 4283/* this is your elementary main function - it MUST be called IMMEDIATELY
4263 * after elm_init() and MUST be passed argc and argv, and MUST be called 4284 * after elm_init() and MUST be passed argc and argv, and MUST be called
4264 * elm_main and not be static - must be a visible symbol with EAPI infront */ 4285 * elm_main and not be static - must be a visible symbol with EAPI infront */
4265EAPI_MAIN int 4286EAPI_MAIN void
4266elm_main(int argc, 4287efl_main(void *data EINA_UNUSED, const Efl_Event *ev)
4267 char **argv)
4268{ 4288{
4269 int i; 4289 Efl_Loop_Arguments *arge = ev->info;
4290 char *arg;
4291 Eina_Array_Iterator iterator;
4292 unsigned int i;
4270 4293
4271 elm_app_info_set(elm_main, "elementary", "images/logo.png"); 4294 EINA_ARRAY_ITER_NEXT(arge->argv, i, arg, iterator)
4272 elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
4273 elm_app_compile_data_dir_set(PACKAGE_DATA_DIR);
4274
4275 for (i = 1; i < argc; i++)
4276 { 4295 {
4277 if (!strcmp(argv[i], "-h")) 4296 if (!strcmp(arg, "-h"))
4278 { 4297 {
4279 printf("Usage:\n" 4298 printf("Usage:\n"
4280 " -h This help\n" 4299 " -h This help\n"
@@ -4285,42 +4304,50 @@ elm_main(int argc,
4285 " -w WEB_BACKEND Set the web backend to be used\n" 4304 " -w WEB_BACKEND Set the web backend to be used\n"
4286 ); 4305 );
4287 } 4306 }
4288 else if (!strcmp(argv[i], "-q")) 4307 else if (!strcmp(arg, "-q"))
4289 { 4308 {
4290 quiet = 1; 4309 quiet = 1;
4291 interactive = 0; 4310 interactive = 0;
4292 } 4311 }
4293 else if ((!strcmp(argv[i], "-t")) && (i < argc - 1)) 4312 else if ((!strcmp(arg, "-t")) && (i < eina_array_count(arge->argv)))
4294 { 4313 {
4295 i++; 4314 i++;
4296 theme_set = argv[i]; 4315 theme_set = arg;
4297 interactive = 0; 4316 interactive = 0;
4298 } 4317 }
4299 else if ((!strcmp(argv[i], "-f")) && (i < argc - 1)) 4318 else if ((!strcmp(arg, "-f")) && (i < eina_array_count(arge->argv)))
4300 { 4319 {
4301 i++; 4320 i++;
4302 finger_size_set = argv[i]; 4321 finger_size_set = arg;
4303 interactive = 0; 4322 interactive = 0;
4304 } 4323 }
4305 else if ((!strcmp(argv[i], "-s")) && (i < argc - 1)) 4324 else if ((!strcmp(arg, "-s")) && (i < eina_array_count(arge->argv)))
4306 { 4325 {
4307 i++; 4326 i++;
4308 scale_set = argv[i]; 4327 scale_set = arg;
4309 interactive = 0; 4328 interactive = 0;
4310 } 4329 }
4311 else if ((!strcmp(argv[i], "-w")) && (i < argc - 1)) 4330 else if ((!strcmp(arg, "-w")) && (i < eina_array_count(arge->argv)))
4312 { 4331 {
4313 i++; 4332 i++;
4314 web_backend = argv[i]; 4333 web_backend = arg;
4315 interactive = 0; 4334 interactive = 0;
4316 } 4335 }
4317 } 4336 }
4337
4318 /* put here any init code specific to this app like parsing args, etc. */ 4338 /* put here any init code specific to this app like parsing args, etc. */
4319 if (!quiet) 4339 if (arge->initialization)
4320 { 4340 {
4321#ifdef ELM_EFREET 4341#ifdef ELM_EFREET
4322 elm_need_efreet(); 4342 elm_need_efreet();
4323#endif 4343#endif
4344 elm_app_info_set(efl_main, "elementary", "images/logo.png");
4345 elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
4346 elm_app_compile_data_dir_set(PACKAGE_DATA_DIR);
4347 }
4348
4349 if (!quiet)
4350 {
4324 win_create(); /* create main window */ 4351 win_create(); /* create main window */
4325 if (!interactive) 4352 if (!interactive)
4326 ecore_timer_add(2.0, _exit_timer, NULL); 4353 ecore_timer_add(2.0, _exit_timer, NULL);
@@ -4336,26 +4363,20 @@ elm_main(int argc,
4336 4363
4337 if (quiet) elm_exit(); 4364 if (quiet) elm_exit();
4338 } 4365 }
4339 elm_run(); /* and run the program now and handle all events, etc. */ 4366}
4340 /* if the mainloop that elm_run() runs exists, we exit the app */
4341 /* exit code */
4342
4343 if (interactive)
4344 {
4345 const char *web_backend_set = elm_config_web_backend_get();
4346 4367
4347 web_backend = elm_object_text_get(web_backend_entry); 4368EAPI_MAIN void
4348 fprintf(stderr, "[%s] vs [%s]\n", web_backend, web_backend_set); 4369efl_resume(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
4349 if (web_backend_set != web_backend || 4370{
4350 (web_backend && web_backend_set && !!strcmp(web_backend, web_backend_set))) 4371 fprintf(stderr, "Resuming activity.\n");
4351 { 4372}
4352 elm_config_web_backend_set(web_backend);
4353 fprintf(stderr, "web backend set to : [%s]\n", elm_config_web_backend_get());
4354 elm_config_all_flush();
4355 }
4356 }
4357 4373
4358 return 0; 4374EAPI_MAIN void
4375efl_pause(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
4376{
4377 fprintf(stderr, "Let's take a pause.\n");
4378 elm_config_all_flush();
4359} 4379}
4380
4360/* All elementary apps should use this. Put it right after elm_main() */ 4381/* All elementary apps should use this. Put it right after elm_main() */
4361ELM_MAIN() 4382EFL_MAIN_EX()