static void ui_app_lang_changed(app_event_info_h event_info, void *user_data) { // APP_EVENT_LANGUAGE_CHANGED char *locale = NULL; system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale); elm_language_set(locale); free(locale); return; }
EAPI_MAIN int elm_main(int argc, char **argv) { int ret = EXIT_FAILURE; int args; int i; Editor *ed; unsigned int ed_count = 0; Eina_Bool quit_opt = EINA_FALSE; Eina_Bool debug = EINA_FALSE; Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_BOOL(debug), ECORE_GETOPT_VALUE_BOOL(quit_opt), ECORE_GETOPT_VALUE_BOOL(quit_opt) }; const Module *mod_ptr; const Module *mod_end = &(_modules[EINA_C_ARRAY_LENGTH(_modules)]); const char *env; unsigned int debug_flags = 0; args = ecore_getopt_parse(&_options, values, argc, argv); if (args < 0) { EINA_LOG_CRIT("Getopt failed"); goto end; } /* Quit option requested? End now, with success */ if (quit_opt) { ret = EXIT_SUCCESS; goto end; } if (debug) debug_flags = ~0U; /* Are we running in tree? */ env = getenv("WAR2EDIT_IN_TREE"); _in_tree = (env) ? !!atoi(env) : EINA_FALSE; elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); elm_language_set(""); elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR); elm_app_compile_lib_dir_set(PACKAGE_LIB_DIR); elm_app_compile_data_dir_set(PACKAGE_DATA_DIR); elm_app_info_set(elm_main, "war2edit", "sprites/units/units.eet"); if (EINA_UNLIKELY(!_edje_get(NULL))) { EINA_LOG_CRIT("Failed to get edje theme"); goto end; } for (mod_ptr = _modules; mod_ptr != mod_end; ++mod_ptr) { if (EINA_UNLIKELY(EINA_FALSE == mod_ptr->init())) { EINA_LOG_CRIT("Failed to initialize module \"%s\"", mod_ptr->name); goto modules_shutdown; } } /* Open editors for each specified files */ for (i = args; i < argc; ++i) { /* If an editor fails to open, don't close now */ ed = editor_new(argv[i], debug_flags); if (!ed) ERR("Failed to create editor with file \"%s\"", argv[i]); else ++ed_count; } if (ed_count == 0) { ed = editor_new(NULL, debug_flags); if (EINA_UNLIKELY(!ed)) { CRI("Failed to create editor"); goto modules_shutdown; } } /* === Main loop === */ elm_run(); ret = EXIT_SUCCESS; modules_shutdown: for (--mod_ptr; mod_ptr >= _modules; --mod_ptr) mod_ptr->shutdown(); end: if (_edje_file) { free(_edje_file); _edje_file = NULL; } return ret; }