EAPI int estate_init(void) { if (++_init_count == 1) { if (EINA_UNLIKELY(!eina_init())) { EINA_LOG_CRIT("Failed to init Eina"); return --_init_count; } _estate_log_dom = eina_log_domain_register("estate", EINA_COLOR_WHITE); if (EINA_UNLIKELY(_estate_log_dom < 0)) { EINA_LOG_CRIT("Failed to create log domain"); eina_shutdown(); return --_init_count; } #if 0 ESTATE_EVENT_ENTERER = ecore_event_type_new(); ESTATE_EVENT_EXITER = ecore_event_type_new(); ESTATE_EVENT_TRANSITION = ecore_event_type_new(); #endif } return _init_count; }
EOLIAN static Eo_Base * _emerite_eo_base_constructor(Eo *obj, Emerite_Data *pd) { Eina_Bool chk; char exe[PATH_MAX]; const char exe_name[] = "emerite"; obj = eo_constructor(eo_super(obj, MY_CLASS)); if (email_in_tree_is()) { snprintf(exe, sizeof(exe), "%s/emerite/%s", BUILD_BIN_DIR, exe_name); } else { snprintf(exe, sizeof(exe), "%s", exe_name); } exe[sizeof(exe) - 1] = '\0'; pd->exe = ecore_exe_pipe_run(exe, ECORE_EXE_TERM_WITH_PARENT, pd); if (EINA_UNLIKELY(!pd->exe)) { EINA_LOG_CRIT("Failed to create Ecore_Exe"); return NULL; // FIXME leak } chk = email_subprocess_callback_register(pd->exe, ECORE_EXE_EVENT_DEL, _exe_del_cb, obj); if (EINA_UNLIKELY(!chk)) { EINA_LOG_CRIT("Failed to register deletion callback"); return NULL; // FIXME leak } return obj; }
int main(int argc, char *argv[]) { Ecore_Evas *window; Evas *canvas; Evas_Object *edje; const char *text; ecore_evas_init(); edje_init(); window = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); if (!window) { EINA_LOG_CRIT("could not create window."); return -1; } canvas = ecore_evas_get(window); text = (argc > 1) ? argv[1] : NULL; edje = create_my_group(canvas, text); if (!edje) return -2; ecore_evas_show(window); ecore_main_loop_begin(); evas_object_del(edje); ecore_evas_free(window); edje_shutdown(); ecore_evas_shutdown(); return 0; }
int config_load (rockon_config *config) { char *username; int ipc_path_lenght; assert(config); /* default values */ config->launch_server = 0; config->auto_reconnect = 0; config->reconnect_interval = 3; username = getenv("USER"); ipc_path_lenght = strlen(username) + 22; config->ipc_path = (char*) malloc(sizeof(char) * ipc_path_lenght); if (config->ipc_path == NULL) { EINA_LOG_CRIT("malloc ipc_path failed"); return 0; } snprintf(config->ipc_path, ipc_path_lenght, "unix:///tmp/xmms-ipc-%s", username); if ((config->config_filename = get_config_filename ("rockon.conf"))) { config->lcfg_obj = lcfg_new(config->config_filename); if (lcfg_parse(config->lcfg_obj) != lcfg_status_ok) { return 0; } lcfg_accept(config->lcfg_obj, config_visitor_load, config); return 1; } return 0; }
void termpty_init(void) { if (_termpty_log_dom >= 0) return; _termpty_log_dom = eina_log_domain_register("termpty", NULL); if (_termpty_log_dom < 0) EINA_LOG_CRIT("could not create log domain 'termpty'."); }
void miniview_init(void) { if (_miniview_log_dom >= 0) return; _miniview_log_dom = eina_log_domain_register("miniview", NULL); if (_miniview_log_dom < 0) EINA_LOG_CRIT(_("Could not create logging domain '%s'."), "miniview"); }
int ewk_init(void) { if (_ewkInitCount) return ++_ewkInitCount; if (!eina_init()) goto error_eina; _ewk_log_dom = eina_log_domain_register("ewebkit", EINA_COLOR_ORANGE); if (_ewk_log_dom < 0) { EINA_LOG_CRIT("could not register log domain 'ewebkit'"); goto error_log_domain; } if (!evas_init()) { CRITICAL("could not init evas."); goto error_evas; } if (!ecore_init()) { CRITICAL("could not init ecore."); goto error_ecore; } if (!ecore_evas_init()) { CRITICAL("could not init ecore_evas."); goto error_ecore_evas; } if (!edje_init()) { CRITICAL("could not init edje."); goto error_edje; } if (!_ewk_init_body()) { CRITICAL("could not init body"); goto error_edje; } return ++_ewkInitCount; error_edje: ecore_evas_shutdown(); error_ecore_evas: ecore_shutdown(); error_ecore: evas_shutdown(); error_evas: eina_log_domain_unregister(_ewk_log_dom); _ewk_log_dom = -1; error_log_domain: eina_shutdown(); error_eina: return 0; }
int log_init(void) { __log_dom = eina_log_domain_register(PACKAGE, EINA_COLOR_YELLOW); if (EINA_UNLIKELY(__log_dom < 0)) { EINA_LOG_CRIT("Failed to register log domain"); return 0; } return 1; }
Eina_Bool log_init(void) { _war2edit_log_dom = eina_log_domain_register("war2edit", EINA_COLOR_GREEN); if (EINA_UNLIKELY(_war2edit_log_dom < 0)) { EINA_LOG_CRIT("Failed to create log domain"); goto fail; } return EINA_TRUE; fail: return EINA_FALSE; }
bool InjectedBundle::initialize(const WebProcessCreationParameters&, API::Object* initializationUserData) { m_platformBundle = eina_module_new(m_path.utf8().data()); if (!m_platformBundle) { EINA_LOG_CRIT("Error loading the injected bundle: eina_module_new() failed"); return false; } if (!eina_module_load(m_platformBundle)) { EINA_LOG_CRIT("Error loading the injected bundle from %s: %s", m_path.utf8().data(), eina_error_msg_get(eina_error_get())); eina_module_free(m_platformBundle); m_platformBundle = 0; return false; } WKBundleInitializeFunctionPtr initializeFunction = reinterpret_cast<WKBundleInitializeFunctionPtr>(eina_module_symbol_get(m_platformBundle, "WKBundleInitialize")); if (!initializeFunction) { EINA_LOG_CRIT("Error loading WKBundleInitialize symbol from injected bundle."); return false; } initializeFunction(toAPI(this), toAPI(initializationUserData)); return true; }
rockon_config* config_new() { rockon_config *config = NULL; config = (rockon_config*) malloc(sizeof(rockon_config)); if (config == NULL) EINA_LOG_CRIT("Couldn't allocate memory for config."); if (config_load (config) == 0) INFO("Couldn't load config. Loaded default values."); // TODO get this path from config config->edj_data_path = strdup("./build/default/src/gui_data/gui.edj"); return config; }
static int _log_init(void) { const char *env; __libemail_log_domain_ = eina_log_domain_register(PACKAGE, EINA_COLOR_ORANGE); if (EINA_UNLIKELY(__libemail_log_domain_ < 0)) { EINA_LOG_CRIT("Failed to register log domain"); return INIT_FAIL; } env = getenv("EMAIL_IN_TREE"); if (env) _in_tree = !!atoi(env); DBG("Running in tree: %s", _in_tree ? "yes" : "no"); return INIT_OK; }
media_info* media_info_new() { media_info* info = NULL; info = (media_info*) malloc(sizeof(media_info)); if (! info) EINA_LOG_CRIT("Couldn't allocate memory for media info."); info->id = 0; info->artist = NULL; info->album = NULL; info->title = NULL; info->url = NULL; info->comment = NULL; info->genre = NULL; info->date = NULL; info->bitrate = 0; info->duration = 0; info->tracknr = 0; return info; }
static Evas_Object *create_my_group(Evas *canvas, const char *text) { Evas_Object *edje; edje = edje_object_add(canvas); if (!edje) { EINA_LOG_CRIT("could not create edje object!"); return NULL; } if (!edje_object_file_set(edje, PACKAGE_DATA_DIR"/edje_example.edj", "my_group")) { int err = edje_object_load_error_get(edje); const char *errmsg = edje_load_error_str(err); EINA_LOG_ERR("could not load 'my_group' from edje_example.edj: %s", errmsg); evas_object_del(edje); return NULL; } if (text) { if (!edje_object_part_text_set(edje, "text", text)) { EINA_LOG_WARN("could not set the text. " "Maybe part 'text' does not exist?"); } } evas_object_move(edje, 0, 0); evas_object_resize(edje, WIDTH, HEIGHT); evas_object_show(edje); return edje; }
rockon_data* rockon_data_new() { rockon_data *rdata; rdata = (rockon_data*) malloc(sizeof(rockon_data)); if (rdata == NULL) { EINA_LOG_CRIT("malloc rockon_data failed"); } rdata->ecore_fdh = NULL; rdata->connection = NULL; rdata->reconn_timer = NULL; rdata->config = config_new(); rdata->playback_status = 0; rdata->playback_id = 0; rdata->playback_playtime = 0; rdata->playback_info = NULL; rdata->volume = NULL; rdata->playlists = NULL; rdata->current_playlist = NULL; return rdata; }
EAPI int elm_main(int argc, char **argv) { Evas_Object *window; Evas_Object *layout; Evas_Object *edje; Evas_Object *grid; Evas_Object *list; char path[PATH_MAX]; Eina_Bool quit_option = EINA_FALSE; int args; Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_BOOL(crazy_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_NONE }; _log_domain = eina_log_domain_register("Excessive", NULL); if (_log_domain < 0) { EINA_LOG_CRIT("could not create log domain 'Excessive'."); return -1; } args = ecore_getopt_parse(&options, values, argc, argv); if (args < 0) { ERR("could not parse command line options."); return -1; } if (quit_option) return 0; excessive_browse_init(); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); elm_theme_extension_add(NULL, PACKAGE_DATA_DIR "/themes/theme.edj"); elm_theme_overlay_add(NULL, PACKAGE_DATA_DIR "/themes/theme.edj"); elm_need_efreet(); elm_need_ethumb(); window = elm_win_add(NULL, PACKAGE_NAME, ELM_WIN_BASIC); if (!window) { ERR("could'nt create window."); return -1; } /* FIXME: later remember last size */ elm_win_alpha_set(window, 1); evas_object_resize(window, 800, 600); elm_win_title_set(window, PACKAGE_STRING); elm_win_autodel_set(window, 1); layout = elm_layout_add(window); if (!layout) { ERR("couldn't create layout object."); return -1; } evas_object_size_hint_align_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_weight_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_win_resize_object_add(window, layout); if (!elm_layout_theme_set(layout, "layout", "application", "content")) { ERR("could not load style 'content' from theme"); return -1; } evas_object_show(layout); evas_object_show(window); edje = elm_layout_edje_get(layout); grid = edje_object_part_external_object_get(edje, "grid"); evas_object_data_set(grid, "excessive/layout", layout); evas_object_data_set(layout, "excessive/win", window); evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_gengrid_bounce_set(grid, EINA_FALSE, EINA_TRUE); elm_gengrid_align_set(grid, 0.5, 0.5); elm_gengrid_item_size_set(grid, 128, 128); excessive_browse_load(layout); list = edje_object_part_external_object_get(edje, "shortcut"); excessive_shortcut_init(list, grid); if (argc < args + 1) { getcwd(path, PATH_MAX); excessive_browse_directory(grid, path); } else { excessive_browse_directory(grid, argv[args]); } elm_run(); excessive_shortcut_shutdown(); excessive_browse_shutdown(); return 0; }
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; }
static void _fatalError(void *user_data, const char *msg, ...) { EINA_LOG_CRIT("%s", msg); }
int main(int argc, char *argv[]) { Eina_Bool quit_option = EINA_FALSE; char *source = NULL, *header = NULL; int arg_index, ret = 0; Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_STR(prefix), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_NONE }; setlocale(LC_NUMERIC, "C"); eina_init(); ecore_init(); ecore_evas_init(); edje_init(); if (argc < 2) { fprintf(stderr, "Missing action. See '--help or -h'.\n"); ret = 1; goto error_log; } _log_dom = eina_log_domain_register("elementary_codegen", EINA_COLOR_YELLOW); if (_log_dom < 0) { EINA_LOG_CRIT("could not register log domain 'elementary_codegen'"); ret = 1; goto error_log; } arg_index = ecore_getopt_parse(&optdesc, values, argc, argv); if (arg_index < 0) { ERR("could not parse arguments."); ret = 1; goto error_getopt; } else if (quit_option) goto error_getopt; else if (arg_index != argc - 4) { fprintf(stderr, "Incorrect number of parameters. Requires " \ "fours arguments, an edje, the group, " \ "the source output (foo.c) and the header(foo.h).\n" \ "See %s --help\n", argv[0]); ret = 1; goto error_getopt; } file = argv[arg_index++]; // check if the file is accessible if (access(file, R_OK) == -1) { ERR("File '%s' not accessible, error %d (%s).\n", file, errno, strerror(errno)); ret = 1; goto error_getopt; } group = argv[arg_index++]; source = argv[arg_index++]; header = argv[arg_index++]; if (!edje_file_group_exists(file, group)) { ERR("The group %s not exists", group); ret = 2; goto error_getopt; } ee = ecore_evas_buffer_new(1, 1); if (!ee) { ERR("could not create ecore_evas_buffer"); ret = 3; goto error_getopt; } if (!_file_descriptors_open(source, header)) { ERR("Could not create the source files, error %d (%s)", errno, strerror(errno)); ret = 4; goto error_getopt; } if (!_headers_write(header)) { ERR("Could not write the header, error %d (%s)", errno, strerror(errno)); ret = 5; goto error_getopt; } if (!_theme_set_write()) WRN("Theme set getter/setter not created. Group name: %s invalid.", group); if (!_parse()) { ERR("Could not parsing the EDJE"); ret = 6; goto error_getopt; } if (!_footer_write(header)) { ERR("Could not write the footer, error %d (%s)", errno, strerror(errno)); ret = 7; goto error_getopt; } if (!_file_descriptors_close()) { ERR("Could not close the source files, error %d (%s)", errno, strerror(errno)); ret = 8; } error_getopt: if (ee) ecore_evas_free(ee); error_log: edje_shutdown(); ecore_evas_shutdown(); ecore_shutdown(); eina_log_domain_unregister(_log_dom); eina_shutdown(); if (ret > 4) { unlink(header); unlink(source); } return ret; }
int ewk_init(void) { if (_ewk_init_count) return ++_ewk_init_count; if (!eina_init()) goto error_eina; _ewk_log_dom = eina_log_domain_register("ewebkit", EINA_COLOR_ORANGE); if (_ewk_log_dom < 0) { EINA_LOG_CRIT("could not register log domain 'ewebkit'"); goto error_log_domain; } if (!evas_init()) { CRITICAL("could not init evas."); goto error_evas; } if (!ecore_init()) { CRITICAL("could not init ecore."); goto error_ecore; } if (!ecore_evas_init()) { CRITICAL("could not init ecore_evas."); goto error_ecore_evas; } if (!edje_init()) { CRITICAL("could not init edje."); goto error_edje; } #ifdef ENABLE_GLIB_SUPPORT g_type_init(); if (!g_thread_supported()) g_thread_init(0); #ifdef ENABLE_GTK_PLUGINS_SUPPORT gdk_threads_init(); if (!gtk_init_check(0, 0)) WRN("Could not initialize GTK support."); #endif if (!ecore_main_loop_glib_integrate()) WRN("Ecore was not compiled with GLib support, some plugins will not " "work (ie: Adobe Flash)"); #endif JSC::initializeThreading(); WTF::initializeMainThread(); WebCore::InitializeLoggingChannelsIfNecessary(); // Page cache capacity (in pages). Comment from Mac port: // (Research indicates that value / page drops substantially after 3 pages.) // FIXME: Expose this with an API and/or calculate based on available resources WebCore::pageCache()->setCapacity(3); WebCore::PageGroup::setShouldTrackVisitedLinks(true); // TODO: this should move to WebCore, already reported to webkit-gtk folks: if (1) { SoupSession* session = WebCore::ResourceHandle::defaultSession(); soup_session_add_feature_by_type(session, SOUP_TYPE_CONTENT_SNIFFER); } return ++_ewk_init_count; error_edje: ecore_evas_shutdown(); error_ecore_evas: ecore_shutdown(); error_ecore: evas_shutdown(); error_evas: eina_log_domain_unregister(_ewk_log_dom); _ewk_log_dom = -1; error_log_domain: eina_shutdown(); error_eina: return 0; }
int ewk_init(void) { if (_ewkInitCount) return ++_ewkInitCount; if (!eina_init()) goto error_eina; _ewk_log_dom = eina_log_domain_register("ewebkit2", EINA_COLOR_ORANGE); if (_ewk_log_dom < 0) { EINA_LOG_CRIT("could not register log domain 'ewebkit2'"); goto error_log_domain; } if (!evas_init()) { CRITICAL("could not init evas."); goto error_evas; } if (!ecore_init()) { CRITICAL("could not init ecore."); goto error_ecore; } if (!ecore_evas_init()) { CRITICAL("could not init ecore_evas."); goto error_ecore_evas; } if (!ecore_imf_init()) { CRITICAL("could not init ecore_imf."); goto error_ecore_imf; } if (!efreet_init()) { CRITICAL("could not init efreet."); goto error_efreet; } #ifdef HAVE_ECORE_X if (!ecore_x_init(0)) { CRITICAL("could not init ecore_x."); goto error_ecore_x; } #endif if (!edje_init()) { CRITICAL("Could not init edje."); goto error_edje; } if (!ecore_main_loop_glib_integrate()) { WARN("Ecore was not compiled with GLib support, some plugins will not " "work (ie: Adobe Flash)"); } return ++_ewkInitCount; error_edje: #ifdef HAVE_ECORE_X ecore_x_shutdown(); error_ecore_x: #else efreet_shutdown(); #endif error_efreet: ecore_imf_shutdown(); error_ecore_imf: ecore_evas_shutdown(); error_ecore_evas: ecore_shutdown(); error_ecore: evas_shutdown(); error_evas: eina_log_domain_unregister(_ewk_log_dom); _ewk_log_dom = -1; error_log_domain: eina_shutdown(); error_eina: return 0; }
int EwkMain::initialize() { if (m_initCount) return ++m_initCount; if (!eina_init()) { EINA_LOG_CRIT("could not init eina."); return 0; } m_logDomainId = eina_log_domain_register("ewebkit2", EINA_COLOR_ORANGE); if (m_logDomainId < 0) { EINA_LOG_CRIT("could not register log domain 'ewebkit2'"); shutdownInitializedEFLModules(EFLModuleInitFailure::EinaLog); return 0; } if (!evas_init()) { CRITICAL("could not init evas."); shutdownInitializedEFLModules(EFLModuleInitFailure::Evas); return 0; } if (!ecore_init()) { CRITICAL("could not init ecore."); shutdownInitializedEFLModules(EFLModuleInitFailure::Ecore); return 0; } if (!ecore_evas_init()) { CRITICAL("could not init ecore_evas."); shutdownInitializedEFLModules(EFLModuleInitFailure::EcoreEvas); return 0; } if (!ecore_imf_init()) { CRITICAL("could not init ecore_imf."); shutdownInitializedEFLModules(EFLModuleInitFailure::EcoreImf); return 0; } if (!efreet_init()) { CRITICAL("could not init efreet."); shutdownInitializedEFLModules(EFLModuleInitFailure::Efreet); return 0; } #ifdef HAVE_ECORE_X if (!ecore_x_init(0)) { CRITICAL("could not init ecore_x."); shutdownInitializedEFLModules(EFLModuleInitFailure::EcoreX); return 0; } #endif if (!edje_init()) { CRITICAL("Could not init edje."); shutdownInitializedEFLModules(EFLModuleInitFailure::Edje); return 0; } if (!ecore_main_loop_glib_integrate()) { WARN("Ecore was not compiled with GLib support, some plugins will not " "work (ie: Adobe Flash)"); } return ++m_initCount; }