/** * @return Returns the number of times the init function as been called * minus the corresponding init call. * @brief Shuts down Efreet if a balanced number of init/shutdown calls have * been made */ EAPI int efreet_shutdown(void) { if (--_efreet_init_count != 0) return _efreet_init_count; efreet_util_shutdown(); efreet_menu_shutdown(); efreet_desktop_shutdown(); efreet_ini_shutdown(); efreet_icon_shutdown(); efreet_xml_shutdown(); efreet_cache_shutdown(); efreet_base_shutdown(); eina_log_domain_unregister(_efreet_log_domain_global); IF_RELEASE(efreet_lang); IF_RELEASE(efreet_lang_country); IF_RELEASE(efreet_lang_modifier); efreet_parsed_locale = 0; /* reset this in case they init efreet again */ ecore_file_shutdown(); ecore_shutdown(); eet_shutdown(); eina_shutdown(); return _efreet_init_count; }
EAPI int efreet_shutdown(void) { if (_efreet_init_count <= 0) { EINA_LOG_ERR("Init count not greater than 0 in shutdown."); return 0; } if (--_efreet_init_count != 0) return _efreet_init_count; efreet_util_shutdown(); efreet_menu_shutdown(); efreet_desktop_shutdown(); efreet_ini_shutdown(); efreet_icon_shutdown(); efreet_xml_shutdown(); efreet_cache_shutdown(); efreet_base_shutdown(); IF_RELEASE(efreet_lang); IF_RELEASE(efreet_lang_country); IF_RELEASE(efreet_lang_modifier); IF_RELEASE(efreet_language); efreet_parsed_locale = 0; /* reset this in case they init efreet again */ ecore_file_shutdown(); ecore_shutdown(); eet_shutdown(); eina_shutdown(); return _efreet_init_count; }
/** * @return Returns > 0 if the initialization was successful, 0 otherwise * @brief Initializes the Efreet system */ EAPI int efreet_init(void) { if (++_efreet_init_count != 1) return _efreet_init_count; if (!eina_init()) return --_efreet_init_count; if (!eet_init()) goto shutdown_eina; if (!ecore_init()) goto shutdown_eet; if (!ecore_file_init()) goto shutdown_ecore; _efreet_log_domain_global = eina_log_domain_register("efreet", EFREET_DEFAULT_LOG_COLOR); if (_efreet_log_domain_global < 0) { EINA_LOG_ERR("Efreet could create a general log domain."); goto shutdown_ecore_file; } if (!efreet_base_init()) goto unregister_log_domain; if (!efreet_cache_init()) goto shutdown_efreet_base; if (!efreet_xml_init()) goto shutdown_efreet_cache; if (!efreet_icon_init()) goto shutdown_efreet_xml; if (!efreet_ini_init()) goto shutdown_efreet_icon; if (!efreet_desktop_init()) goto shutdown_efreet_ini; if (!efreet_menu_init()) goto shutdown_efreet_desktop; if (!efreet_util_init()) goto shutdown_efreet_menu; return _efreet_init_count; shutdown_efreet_menu: efreet_menu_shutdown(); shutdown_efreet_desktop: efreet_desktop_shutdown(); shutdown_efreet_ini: efreet_ini_shutdown(); shutdown_efreet_icon: efreet_icon_shutdown(); shutdown_efreet_xml: efreet_xml_shutdown(); shutdown_efreet_cache: efreet_cache_shutdown(); shutdown_efreet_base: efreet_base_shutdown(); unregister_log_domain: eina_log_domain_unregister(_efreet_log_domain_global); shutdown_ecore_file: ecore_file_shutdown(); shutdown_ecore: ecore_shutdown(); shutdown_eet: eet_shutdown(); shutdown_eina: eina_shutdown(); return --_efreet_init_count; }
EAPI int efreet_init(void) { #ifndef _WIN32 char *tmp; #endif if (++_efreet_init_count != 1) return _efreet_init_count; #ifndef _WIN32 /* Find users real uid and gid */ tmp = getenv("SUDO_UID"); if (tmp) ruid = strtoul(tmp, NULL, 10); else ruid = getuid(); tmp = getenv("SUDO_GID"); if (tmp) rgid = strtoul(tmp, NULL, 10); else rgid = getgid(); #endif if (!eina_init()) return --_efreet_init_count; if (!eet_init()) goto shutdown_eina; if (!ecore_init()) goto shutdown_eet; if (!ecore_file_init()) goto shutdown_ecore; if (!efreet_base_init()) goto shutdown_ecore_file; if (!efreet_cache_init()) goto shutdown_efreet_base; if (!efreet_xml_init()) goto shutdown_efreet_cache; if (!efreet_icon_init()) goto shutdown_efreet_xml; if (!efreet_ini_init()) goto shutdown_efreet_icon; if (!efreet_desktop_init()) goto shutdown_efreet_ini; if (!efreet_menu_init()) goto shutdown_efreet_desktop; if (!efreet_util_init()) goto shutdown_efreet_menu; #ifdef ENABLE_NLS bindtextdomain(PACKAGE, LOCALE_DIR); bind_textdomain_codeset(PACKAGE, "UTF-8"); #endif return _efreet_init_count; shutdown_efreet_menu: efreet_menu_shutdown(); shutdown_efreet_desktop: efreet_desktop_shutdown(); shutdown_efreet_ini: efreet_ini_shutdown(); shutdown_efreet_icon: efreet_icon_shutdown(); shutdown_efreet_xml: efreet_xml_shutdown(); shutdown_efreet_cache: efreet_cache_shutdown(); shutdown_efreet_base: efreet_base_shutdown(); shutdown_ecore_file: ecore_file_shutdown(); shutdown_ecore: ecore_shutdown(); shutdown_eet: eet_shutdown(); shutdown_eina: eina_shutdown(); return --_efreet_init_count; }