void eim_config_init (Eim *e) { #ifdef CORE_DEBUG printf("TRACE: eim_initialize\n"); #endif assert (e); int nb_account = 0; int i; /* read config file to get account properties */ if (ecore_config_init ("eim") == ECORE_CONFIG_ERR_FAIL) { printf("WARNING: config file not available\n"); /* load default config and save it*/ _eim_load_default_config (); ecore_config_save (); } /* here we can load each configuration */ ecore_config_load(); nb_account = ecore_config_int_get(EIM_CONFIG_NB_ACCOUNT); for (i = 0; i < nb_account; i++) { ecore_list_append (e->account_properties, account_properties_new_from_config (i)); } }
/** * @param argc: Number of command line arguments supplied. * @param argv: Char* array containing the command line arguments supplied. * @return: To the system, normally 0. * @brief: The first function once enotes is called. */ int main(int argc, char *argv[]) { int note_count; /* IPC Check */ ecore_ipc_init(); dml("IPC Initiated Successfully", 1); /* loading will increment this if there are notes if not we may need to * create a blank one */ note_count = 0; if ((ecore_config_init("enotes")) == ECORE_CONFIG_ERR_FAIL) { ecore_ipc_shutdown(); return (-1); } ecore_app_args_set(argc, (const char **) argv); ecore_config_app_describe("E-Notes - Sticky Notes for Enlightenment\n\ Copyright (c) Thomas Fletcher\n\ Usage: enotes [options]"); /* Read the Usage and Configurations */ main_config = mainconfig_new(); if (read_configuration(main_config) != ECORE_CONFIG_PARSE_CONTINUE) { ecore_config_shutdown(); ecore_ipc_shutdown(); ecore_shutdown(); mainconfig_free(main_config); return (-1); } dml("Successfully Read Configurations and Usage", 1); process_note_storage_locations(); if (find_server() != 0) { if (remotecmd != NULL) send_to_server(remotecmd); else send_to_server("DEFNOTE"); } else { dml("Server wasn't found.. Creating one", 1); /* Setup Server */ setup_server(); /* Initialise the E-Libs */ ecore_init(); ecore_x_init(NULL); ecore_app_args_set(argc, (const char **) argv); if (!ecore_evas_init()) { mainconfig_free(main_config); return -1; } ewl_init(&argc, argv); edje_init(); dml("Efl Successfully Initiated", 1); autoload(); /* create autosave timer */ update_autosave(); if (remotecmd != NULL) handle_ipc_message(remotecmd); /* Begin the Control Centre */ if (main_config->controlcentre == 1) { setup_cc(); dml("Control Centre Setup", 1); } else { dml("No Control Centre - Displaying Notice", 1); if (get_note_count() == 0) new_note(); } if (main_config->welcome == 1) { open_welcome(); } /* Begin the main loop */ dml("Starting Main Loop", 1); ecore_main_loop_begin(); dml("Main Loop Ended", 1); /* Save Controlcentre Settings */ set_cc_pos(); autosave(); if (autosave_timer) ecore_timer_del(autosave_timer); /* Save and Free the Configuration */ ecore_config_save(); dml("Configuration Saved", 1); mainconfig_free(main_config); dml("Configuration Structure Free'd", 1); /* Shutdown the E-Libs */ edje_shutdown(); ecore_evas_shutdown(); ecore_x_shutdown(); ecore_shutdown(); dml("Efl Shutdown", 1); } /* End IPC */ ecore_ipc_shutdown(); dml("IPC Shutdown", 1); dml("Leaving.", 1); return (0); }
int main(int argc, char ** argv) { Eli_App * eap; eap = NULL; /* Initialize NLS */ #ifdef ENABLE_NLS setlocale(LC_MESSAGES, ""); setlocale(LC_MONETARY, ""); setlocale(LC_CTYPE, ""); bindtextdomain(PACKAGE, PACKAGE_LOCALE_DIR); bind_textdomain_codeset(PACKAGE, "UTF-8"); textdomain(PACKAGE); #endif /* Initialize Ecore */ if (!ecore_init()) { fprintf(stderr, _("Elitaire Error: Cannot init Ecore\n")); return 1; } if (!ecore_file_init()) { fprintf(stderr, _("Elitaire Error: Cannot init Ecore File\n")); return 1; } /* Initialize Edje */ if (!edje_init()) { fprintf(stderr, _("Elitaire Error: Cannot init Edje\n")); return 1; } /* Initialize Ecore_Config */ if (ecore_config_init("elitaire") != ECORE_CONFIG_ERR_SUCC) { fprintf(stderr, _("Elitaire Error: Cannot init Ecore Config\n")); return 1; } /* Initialize Ewl */ if (!ewl_init(&argc, argv)) { fprintf(stderr, _("Elitaire Error: Cannot init Ewl\n")); return 1; } /* Init Highscore and Statistics */ eli_highscore_init("elitaire"); eli_statistics_init("elitaire"); help_reader_init(PACKAGE_DATA_DIR"/doc/"); /* Init the main app */ eap = eli_app_new(); eli_app_init(eap, "edje"); eli_app_gui_make(eap); ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, sig_exit_cb, eap); /* ***Main Loop*** */ ecore_main_loop_begin(); eli_app_del(eap); /* shutdown all */ help_reader_shutdown(); eli_statistics_shutdown(); eli_highscore_shutdown(); ewl_shutdown(); //eli_app_gui_del(eap); ecore_config_shutdown(); ecore_file_shutdown(); edje_shutdown(); ecore_evas_shutdown(); ecore_shutdown(); return 0; }