Beispiel #1
0
static void
_ecore_imf_xim_shutdown(void)
{
   while (open_ims)
     {
        XIM_Im_Info *info = open_ims->data;
        Ecore_X_Display *display = ecore_x_display_get();

        _ecore_imf_xim_info_im_shutdown(display, EINA_FALSE, info);
     }

   ecore_x_shutdown();

   if (_ecore_imf_xim_log_dom > 0)
     {
        eina_log_domain_unregister(_ecore_imf_xim_log_dom);
        _ecore_imf_xim_log_dom = -1;
     }

   eina_shutdown();
}
Beispiel #2
0
/**
 * Frees memory and shuts down the library for other programming libraries.
 * @return @c ECORE_CONFIG_ERR_IGNORED
 * @ingroup Ecore_Config_Lib_Lib_Group
 */
EAPI int
ecore_config_system_shutdown(void)
{
   int                 ret;

   __ecore_config_system_init--;
   if (__ecore_config_system_init > 0)
      return ECORE_CONFIG_ERR_IGNORED;

   ret = _ecore_config_ipc_exit();
   if (__ecore_config_app_name)
      free(__ecore_config_app_name);
   while(__ecore_config_bundle_local->data)
     ecore_config_dst(__ecore_config_bundle_local->data);
   free(__ecore_config_bundle_local);
   free(__ecore_config_server_local);
   free(__ecore_config_server_global);
   eina_log_domain_unregister(_ecore_config_log_dom);
   _ecore_config_log_dom = -1;
   return ret;
}
Beispiel #3
0
/**
 * @internal
 * @brief Shut down the magic string module.
 *
 * @return #EINA_TRUE on success, #EINA_FALSE on failure.
 *
 * This function shuts down the magic string module set up by
 * eina_magic string_init(). It is called by eina_shutdown().
 *
 * @see eina_shutdown()
 */
Eina_Bool
eina_magic_string_shutdown(void)
{
   Eina_Magic_String *ems, *ems_end;

   ems = _eina_magic_strings;
   ems_end = ems + _eina_magic_strings_count;

   for (; ems < ems_end; ems++)
      if (ems->string_allocated)
         free((char *)ems->string);

         free(_eina_magic_strings);
   _eina_magic_strings = NULL;
   _eina_magic_strings_count = 0;
   _eina_magic_strings_allocated = 0;

   eina_log_domain_unregister(_eina_magic_string_log_dom);
   _eina_magic_string_log_dom = -1;

   return EINA_TRUE;
}
Eina_Bool
eina_mempool_shutdown(void)
{
   /* builtin backends */
#ifdef EINA_STATIC_BUILD_BUDDY
   buddy_shutdown();
#endif
#ifdef EINA_STATIC_BUILD_CHAINED_POOL
   chained_shutdown();
#endif
#ifdef EINA_STATIC_BUILD_EMEMOA_FIXED
   ememoa_fixed_shutdown();
#endif
#ifdef EINA_STATIC_BUILD_EMEMOA_UNKNOWN
   ememoa_unknown_shutdown();
#endif
#ifdef EINA_STATIC_BUILD_FIXED_BITMAP
   fixed_bitmap_shutdown();
#endif
#ifdef EINA_STATIC_BUILD_ONE_BIG
   one_big_shutdown();
#endif
#ifdef EINA_STATIC_BUILD_PASS_THROUGH
   pass_through_shutdown();
#endif
   /* dynamic backends */
   eina_module_list_free(_modules);
   if (_modules)
      eina_array_free(_modules);

   if (_backends)
      eina_hash_free(_backends);

   eina_log_domain_unregister(_eina_mempool_log_dom);
   _eina_mempool_log_dom = -1;

   return EINA_TRUE;
}
Beispiel #5
0
EAPI int
ecore_event_shutdown(void)
{
   if (--_ecore_event_init_count != 0)
     return _ecore_event_init_count;

   ecore_event_type_flush(ECORE_EVENT_KEY_DOWN,
                          ECORE_EVENT_KEY_UP,
                          ECORE_EVENT_MOUSE_BUTTON_DOWN,
                          ECORE_EVENT_MOUSE_BUTTON_UP,
                          ECORE_EVENT_MOUSE_MOVE,
                          ECORE_EVENT_MOUSE_WHEEL,
                          ECORE_EVENT_MOUSE_IN,
                          ECORE_EVENT_MOUSE_OUT,
                          ECORE_EVENT_AXIS_UPDATE,
                          ECORE_EVENT_MOUSE_BUTTON_CANCEL,
                          ECORE_EVENT_JOYSTICK);
   ecore_input_joystick_shutdown();
   eina_log_domain_unregister(_ecore_input_log_dom);
   _ecore_input_log_dom = -1;
   ecore_shutdown();
   return _ecore_event_init_count;
}
Beispiel #6
0
void EwkMain::shutdownInitializedEFLModules(EFLModuleInitFailure module)
{
    switch (module) {
    case EFLModuleInitFailure::Edje:
#ifdef HAVE_ECORE_X
        ecore_x_shutdown();
#endif
    case EFLModuleInitFailure::EcoreX:
        efreet_shutdown();
    case EFLModuleInitFailure::Efreet:
        ecore_imf_shutdown();
    case EFLModuleInitFailure::EcoreImf:
        ecore_evas_shutdown();
    case EFLModuleInitFailure::EcoreEvas:
        ecore_shutdown();
    case EFLModuleInitFailure::Ecore:
        evas_shutdown();
    case EFLModuleInitFailure::Evas:
        eina_log_domain_unregister(m_logDomainId);
        m_logDomainId = -1;
    case EFLModuleInitFailure::EinaLog:
        eina_shutdown();
    }
}
Beispiel #7
0
EAPI int
ecore_drm2_shutdown(void)
{
   if (_ecore_drm2_init_count < 1)
     {
        ERR("Ecore_Drm2 shutdown called without init");
        return 0;
     }

   if (--_ecore_drm2_init_count != 0) return _ecore_drm2_init_count;

   ECORE_DRM2_EVENT_OUTPUT_CHANGED = -1;
   ECORE_DRM2_EVENT_ACTIVATE = -1;

   eina_log_domain_unregister(_ecore_drm2_log_dom);
   _ecore_drm2_log_dom = -1;

   elput_shutdown();
   eeze_shutdown();
   ecore_shutdown();
   eina_shutdown();

   return _ecore_drm2_init_count;
}
Beispiel #8
0
EAPI int
eio_init(void)
{
   if (++_eio_init_count != 1)
     return _eio_init_count;

   if (!eina_init())
     {
        fprintf(stderr, "Eio can not initialize Eina\n");
        return --_eio_init_count;
     }

   _eio_log_dom_global = eina_log_domain_register("eio", EIO_DEFAULT_LOG_COLOR);
   if (_eio_log_dom_global < 0)
     {
        EINA_LOG_ERR("Eio can not create a general log domain.");
        goto shutdown_eina;
     }

   if (!ecore_init())
     {
        ERR("Can not initialize Ecore\n");
        goto unregister_log_domain;
     }

   memset(&progress_pool, 0, sizeof(progress_pool));
   memset(&direct_info_pool, 0, sizeof(direct_info_pool));
   memset(&char_pool, 0, sizeof(char_pool));
   memset(&associate_pool, 0, sizeof(associate_pool));

   eina_lock_new(&(progress_pool.lock));
   progress_pool.mem_size = sizeof (Eio_Progress);
   eina_lock_new(&(direct_info_pool.lock));
   direct_info_pool.mem_size = sizeof (Eio_File_Direct_Info);
   eina_lock_new(&(char_pool.lock));
   char_pool.mem_size = sizeof (Eio_File_Char);
   eina_lock_new(&(associate_pool.lock));
   associate_pool.mem_size = sizeof (Eio_File_Associate);

   eina_spinlock_new(&(memory_pool_lock));
   eina_lock_new(&(memory_pool_mutex));
   eina_condition_new(&(memory_pool_cond), &(memory_pool_mutex));

   eio_monitor_init();

   efreet_mime_init();

   io_manager = efl_add(EFL_IO_MANAGER_CLASS, ecore_main_loop_get());
   efl_loop_register(ecore_main_loop_get(), EFL_IO_MANAGER_CLASS, io_manager);

   eina_log_timing(_eio_log_dom_global,
                   EINA_LOG_STATE_STOP,
                   EINA_LOG_STATE_INIT);

   return _eio_init_count;

unregister_log_domain:
   eina_log_domain_unregister(_eio_log_dom_global);
   _eio_log_dom_global = -1;
shutdown_eina:
   eina_shutdown();
   return --_eio_init_count;
}
Beispiel #9
0
EAPI int
eeze_init(void)
{
   if (++_eeze_init_count != 1)
     return _eeze_init_count;

   if (!eina_init())
     return --_eeze_init_count;

   _eeze_udev_log_dom = eina_log_domain_register("eeze_udev", EINA_COLOR_CYAN);
   if (_eeze_udev_log_dom < 0)
     {
        EINA_LOG_ERR("Could not register 'eeze_udev' log domain.");
        goto eina_fail;
     }
   _eeze_net_log_dom = eina_log_domain_register("eeze_net", EINA_COLOR_GREEN);
   if (_eeze_net_log_dom < 0)
     {
        EINA_LOG_ERR("Could not register 'eeze_net' log domain.");
        goto eina_net_fail;
     }

   _eeze_sensor_log_dom = eina_log_domain_register("eeze_sensor", EINA_COLOR_BLUE);
   if (_eeze_sensor_log_dom < 0)
     {
        EINA_LOG_ERR("Could not register 'eeze_sensor' log domain.");
        goto eina_sensor_fail;
     }

   if (!ecore_init())
     goto ecore_fail;
#ifdef HAVE_EEZE_MOUNT
   if (!eeze_disk_init())
     goto eeze_fail;
#endif
   if (!(udev = udev_new()))
     {
        EINA_LOG_ERR("Could not initialize udev library!");
        goto fail;
     }
   if (!eeze_net_init())
     {
        EINA_LOG_ERR("Error initializing eeze_net subsystems!");
        goto net_fail;
     }
   if (!eeze_sensor_init())
     {
        EINA_LOG_ERR("Error initializing eeze_sensor subsystems!");
        goto sensor_fail;
     }

   return _eeze_init_count;

sensor_fail:
   eeze_net_shutdown();
net_fail:
   udev_unref(udev);
fail:
#ifdef HAVE_EEZE_MOUNT
   eeze_disk_shutdown();
eeze_fail:
#endif
   ecore_shutdown();
ecore_fail:
   eina_log_domain_unregister(_eeze_sensor_log_dom);
   _eeze_sensor_log_dom = -1;
eina_sensor_fail:
   eina_log_domain_unregister(_eeze_net_log_dom);
   _eeze_net_log_dom = -1;
eina_net_fail:
   eina_log_domain_unregister(_eeze_udev_log_dom);
   _eeze_udev_log_dom = -1;
eina_fail:
   eina_shutdown();
   return --_eeze_init_count;
}
Beispiel #10
0
/**
 * @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;
}
Beispiel #11
0
/**
 * @internal
 * @returns the number of initializations left for this system
 * @brief Attempts to shut down the subsystem if nothing else is using it
 */
void
efreet_ini_shutdown(void)
{
    eina_log_domain_unregister(_efreet_ini_log_dom);
    _efreet_ini_log_dom = -1;
}
Beispiel #12
0
EAPI int
elm_main(int argc, char **argv)
{
   Ethumb_Client *client;
   int r = 0;

#if ENABLE_NLS
   setlocale(LC_ALL, "");
   bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
   bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
   textdomain(GETTEXT_PACKAGE);
#endif

   eio_init();
   elm_need_efreet();
   elm_need_ethumb();
   elm_init(argc, argv);

   __log_domain = eina_log_domain_register("ephoto", EINA_COLOR_ORANGE);
   if (!__log_domain)
     {
        EINA_LOG_ERR("Could not register log domain: Ephoto");
        r = 1;
        goto end_log_domain;
     }

   elm_theme_extension_add(NULL, PACKAGE_DATA_DIR"/themes/default/ephoto.edj");

   if (!efreet_mime_init())
     ERR("Could not init efreet_mime!");

   client = elm_thumb_ethumb_client_get();
   if (!client)
     {
        ERR("could not get ethumb_client");
        r = 1;
        goto end;
     }
   ethumb_client_crop_align_set(client, 0.5, 0.5);
   ethumb_client_aspect_set(client, ETHUMB_THUMB_CROP);
   ethumb_client_orientation_set(client, ETHUMB_THUMB_ORIENT_ORIGINAL);

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   DBG("Logging initialized");
   if (argc > 2)
     {
        printf("Too Many Arguments!\n");
        _ephoto_display_usage();
        r = 1;
        goto end;
     }
   else if (argc < 2)
     {
        Evas_Object *win = ephoto_window_add(NULL);
        if (!win)
          {
             r = 1;
             goto end;
          }
     }
   else if (!strncmp(argv[1], "--help", 6))
     {
        _ephoto_display_usage();
        r = 0;
        goto end;
     }
   else
     {
        char *real = ecore_file_realpath(argv[1]);
        if (!real)
          {
             printf("invalid file or directory: '%s'\n", argv[1]);
             r = 1;
             goto end;
          }
        Evas_Object *win = ephoto_window_add(real);
        free(real);
        if (!win)
          {
             r = 1;
             goto end;
          }
     }

   elm_run();

 end:
   eina_log_domain_unregister(__log_domain);
   efreet_mime_shutdown();
 end_log_domain:
   elm_shutdown();
   eio_shutdown();

   return r;
}
Beispiel #13
0
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
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;
}
Beispiel #15
0
EAPI int
elm_main(int argc, char **argv)
{
    int ret = -1;
    Eupnp_Control_Point *c;

    if (!eupnp_init())
    {
        fprintf(stderr, "Failed to initialize eupnp module.");
        return -1;
    }

    if (!eupnp_ecore_init())
    {
        fprintf(stderr, "Could not initialize eupnp-ecore module");
        goto eupnp_ecore_init_err;
    }

    if ((_log_domain = eina_log_domain_register("light_status_monitor", EINA_COLOR_BLUE)) < 0)
    {
        fprintf(stderr, "Failed to create a logging domain for the application.");
        goto log_domain_reg_error;
    }

    c = eupnp_control_point_new();

    if (!c)
    {
        fprintf(stderr, "Could not create control point instance");
        goto eupnp_cp_alloc_error;
    }

    /* Subscribe for device events */
    eupnp_event_bus_subscribe(EUPNP_EVENT_DEVICE_READY,
                              EUPNP_CALLBACK(on_device_ready), NULL);
    eupnp_event_bus_subscribe(EUPNP_EVENT_DEVICE_GONE,
                              EUPNP_CALLBACK(on_device_gone), NULL);

    /* Start control point */
    eupnp_control_point_start(c);
    igd_client_win_create();

    /* Send a test search for all devices*/
    if (!eupnp_control_point_discovery_request_send(c, 5, IGD_DEVICE_ST))
    {
        WRN("Failed to perform MSearch.");
    }
    else
        DBG("MSearch sent sucessfully.");

    elm_run();

    /* Shutdown procedure */
    ret = 0;
    elm_shutdown();
    eupnp_control_point_stop(c);
    eupnp_control_point_free(c);

eupnp_cp_alloc_error:
    eina_log_domain_unregister(_log_domain);
log_domain_reg_error:
    eupnp_ecore_shutdown();
eupnp_ecore_init_err:
    eupnp_shutdown();

    return -1;
}
Beispiel #16
0
/**
 * @internal
 * @brief Shut down the convert module.
 *
 * @return #EINA_TRUE on success, #EINA_FALSE on failure.
 *
 * This function shuts down the convert module set up by
 * eina_convert_init(). It is called by eina_shutdown().
 *
 * @see eina_shutdown()
 */
Eina_Bool eina_convert_shutdown(void)
{
	eina_log_domain_unregister(_eina_convert_log_dom);
	_eina_convert_log_dom = -1;
	return EINA_TRUE;
}
Beispiel #17
0
int
main(int argc, char *argv[])
{
   char path[PATH_MAX + 128], buf[PATH_MAX];
   FILE *log;
   int fd;
   const char *log_file_dir = NULL;
   const char *hostname_str = NULL;

#ifdef HAVE_SYS_RESOURCE_H
   setpriority(PRIO_PROCESS, 0, 19);
#elif _WIN32
   SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS);
#endif

   if (!eina_init()) return 1;

   efreetd_mp_stat = eina_mempool_add("chained_mempool",
                                      "struct stat", NULL,
                                     sizeof(struct stat), 10);
   if (!efreetd_mp_stat) return 1;

   if (!ecore_init()) goto ecore_error;
   ecore_app_args_set(argc, (const char **)argv);
   if (!ecore_file_init()) goto ecore_file_error;
   if (!ipc_init()) goto ipc_error;
   if (!cache_init()) goto cache_error;

   log_file_dir = eina_environment_tmp_get();
   if (gethostname(buf, sizeof(buf)) < 0)
     hostname_str = "";
   else
     hostname_str = buf;
   snprintf(path, sizeof(path), "%s/efreetd_%s_XXXXXX.log",
            log_file_dir, hostname_str);
   fd = eina_file_mkstemp(path, NULL);
   if (fd < 0)
     {
        ERR("Can't create log file '%s'\b", path);
        goto tmp_error;
     }
   log = fdopen(fd, "wb");
   if (!log) goto tmp_error;
   eina_log_print_cb_set(eina_log_print_cb_file, log);
   efreetd_log_dom = eina_log_domain_register("efreetd", EFREETD_DEFAULT_LOG_COLOR);
   if (efreetd_log_dom < 0)
     {
        EINA_LOG_ERR("Efreet: Could not create a log domain for efreetd.");
        goto tmp_error;
     }

   ecore_main_loop_begin();

   eina_mempool_del(efreetd_mp_stat);

   cache_shutdown();
   ipc_shutdown();
   ecore_file_shutdown();
   ecore_shutdown();
   eina_log_domain_unregister(efreetd_log_dom);
   efreetd_log_dom = -1;
   eina_shutdown();
   return 0;

tmp_error:
   cache_shutdown();
cache_error:
   ipc_shutdown();
ipc_error:
   ecore_file_shutdown();
ecore_file_error:
   ecore_shutdown();
ecore_error:
   if (efreetd_log_dom >= 0) eina_log_domain_unregister(efreetd_log_dom);
   efreetd_log_dom = -1;
   eina_shutdown();
   return 1;
}
Beispiel #18
0
EAPI int
eio_shutdown(void)
{
   Eio_File_Direct_Info *info;
   Eio_File_Char *cin;
   Eio_Progress *pg;
   Eio_File_Associate *asso;
   Eio_File *f;
   Eina_List *l;

   if (_eio_init_count <= 0)
     {
        ERR("Init count not greater than 0 in shutdown.");
        return 0;
     }
   if (--_eio_init_count != 0)
     return _eio_init_count;

   eina_log_timing(_eio_log_dom_global,
                   EINA_LOG_STATE_START,
                   EINA_LOG_STATE_SHUTDOWN);

   efl_del(io_manager);
   io_manager = NULL;

   EINA_LIST_FOREACH(tracked_thread, l, f)
     ecore_thread_cancel(f->thread);

   EINA_LIST_FREE(tracked_thread, f)
     {
        if (!ecore_thread_wait(f->thread, 0.5))
          CRI("We couldn't terminate in less than 30s some pending IO. This can led to some crash.");
     }

   efreet_mime_shutdown();

   eio_monitor_shutdown();

   eina_condition_free(&(memory_pool_cond));
   eina_lock_free(&(memory_pool_mutex));
   eina_spinlock_free(&(memory_pool_lock));

   eina_lock_free(&(direct_info_pool.lock));
   eina_lock_free(&(progress_pool.lock));
   eina_lock_free(&(char_pool.lock));
   eina_lock_free(&(associate_pool.lock));

   /* Cleanup pool */
   EINA_TRASH_CLEAN(&progress_pool.trash, pg)
     free(pg);
   progress_pool.count = 0;

   EINA_TRASH_CLEAN(&direct_info_pool.trash, info)
     free(info);
   direct_info_pool.count = 0;

   EINA_TRASH_CLEAN(&char_pool.trash, cin)
     free(cin);
   char_pool.count = 0;

   EINA_TRASH_CLEAN(&associate_pool.trash, asso)
     free(asso);
   associate_pool.count = 0;

   ecore_shutdown();
   eina_log_domain_unregister(_eio_log_dom_global);
   _eio_log_dom_global = -1;
   eina_shutdown();

   return _eio_init_count;
}
static void
module_close(Evas_Module *em)
{
    eina_log_domain_unregister(_evas_log_dom_module);
}
Beispiel #20
0
int
main(int argc, char **argv)
{
   int i;
   struct stat st;
#ifdef HAVE_REALPATH
   char rpath[PATH_MAX], rpath2[PATH_MAX];
#endif

   setlocale(LC_NUMERIC, "C");

   ecore_app_no_system_modules();

   if (!eina_init())
     return -1;

   _edje_cc_log_dom = eina_log_domain_register
     ("edje_cc", EDJE_CC_DEFAULT_LOG_COLOR);
   if (_edje_cc_log_dom < 0)
     {
       EINA_LOG_ERR("Enable to create a log domain.");
       exit(-1);
     }
   if (!eina_log_domain_level_check(_edje_cc_log_dom, EINA_LOG_LEVEL_WARN))
     eina_log_domain_level_set("edje_cc", EINA_LOG_LEVEL_WARN);

   progname = ecore_file_file_get(argv[0]);
   eina_log_print_cb_set(_edje_cc_log_cb, NULL);

   tmp_dir = getenv("TMPDIR");

   img_dirs = eina_list_append(img_dirs, ".");
   
   /* add defines to epp so edc files can detect edje_cc version */
   defines = eina_list_append(defines, mem_strdup("-DEDJE_VERSION_12=12"));

   for (i = 1; i < argc; i++)
     {
	if (!strcmp(argv[i], "-h"))
	  {
	     main_help();
	     exit(0);
	  }
	else if ((!strcmp(argv[i], "-V")) || (!strcmp(argv[i], "--version")))
	  {
	     printf("Version: %s\n", PACKAGE_VERSION);
	     exit(0);
	  }
	else if (!strcmp(argv[i], "-v"))
	  {
	     eina_log_domain_level_set("edje_cc", EINA_LOG_LEVEL_INFO);
	  }
	else if (!strcmp(argv[i], "-no-lossy"))
	  {
	     no_lossy = 1;
	  }
	else if (!strcmp(argv[i], "-no-comp"))
	  {
	     no_comp = 1;
          }
        else if (!strcmp(argv[i], "-no-raw"))
          {
             no_raw = 1;
          }
        else if (!strcmp(argv[i], "-no-etc1"))
          {
             no_etc1 = 1;
          }
        else if (!strcmp(argv[i], "-no-etc2"))
          {
             no_etc2 = 1;
          }
	else if (!strcmp(argv[i], "-no-save"))
	  {
	     no_save = 1;
	  }
	else if ((!strcmp(argv[i], "-id") || !strcmp(argv[i], "--image_dir")) && (i < (argc - 1)))
	  {
	     i++;
	     img_dirs = eina_list_append(img_dirs, argv[i]);
	  }
	else if ((!strcmp(argv[i], "-fd") || !strcmp(argv[i], "--font_dir")) && (i < (argc - 1)))
	  {
	     i++;
	     fnt_dirs = eina_list_append(fnt_dirs, argv[i]);
	  }
        else if ((!strcmp(argv[i], "-sd") || !strcmp(argv[i], "--sound_dir")) && (i < (argc - 1)))
          {
             i++;
             snd_dirs = eina_list_append(snd_dirs, argv[i]);
          }
        else if ((!strcmp(argv[i], "-md") || !strcmp(argv[i], "--mo_dir")) && (i < (argc - 1)))
          {
             i++;
             mo_dirs = eina_list_append(mo_dirs, argv[i]);
          }
        else if ((!strcmp(argv[i], "-vd") || !strcmp(argv[i], "--vibration_dir")) && (i < (argc - 1)))
          {
             i++;
             vibration_dirs = eina_list_append(vibration_dirs, argv[i]);
          }
        else if ((!strcmp(argv[i], "-dd") || !strcmp(argv[i], "--data_dir")) && (i < (argc - 1)))
          {
             i++;
             data_dirs = eina_list_append(data_dirs, argv[i]);
          }
	else if ((!strcmp(argv[i], "-td") || !strcmp(argv[i], "--tmp_dir")) && (i < (argc - 1)))
	  {
	     i++;
             if (!tmp_dir)
               tmp_dir = argv[i];
	  }
        else if ((!strcmp(argv[i], "-l") || !strcmp(argv[i], "--license")) && (i < (argc - 1)))
          {
             i++;
             if (!license)
               license = argv[i];
             else
               licenses = eina_list_append(licenses, argv[i]);
          }
        else if ((!strcmp(argv[i], "-a") || !strcmp(argv[i], "--authors")) && (i < (argc - 1)))
          {
             i++;
             if (!authors)
               authors = argv[i];
          }
	else if ((!strcmp(argv[i], "-min-quality")) && (i < (argc - 1)))
	  {
	     i++;
	     min_quality = atoi(argv[i]);
	     if (min_quality < 0) min_quality = 0;
	     if (min_quality > 100) min_quality = 100;
	  }
	else if ((!strcmp(argv[i], "-max-quality")) && (i < (argc - 1)))
	  {
	     i++;
	     max_quality = atoi(argv[i]);
	     if (max_quality < 0) max_quality = 0;
	     if (max_quality > 100) max_quality = 100;
	  }
	else if (!strcmp(argv[i], "-fastcomp"))
	  {
             compress_mode = EET_COMPRESSION_SUPERFAST;
	  }
	else if (!strcmp(argv[i], "-fastdecomp"))
	  {
             compress_mode = EET_COMPRESSION_VERYFAST;
	  }
	else if (!strcmp(argv[i], "-threads"))
	  {
             threads = 1;
	  }
	else if (!strcmp(argv[i], "-nothreads"))
	  {
             threads = 0;
	  }
	else if (!strncmp(argv[i], "-D", 2))
	  {
	     defines = eina_list_append(defines, mem_strdup(argv[i]));
	  }
	else if ((!strcmp(argv[i], "-o")) && (i < (argc - 1)))
	  {
	     i++;
	     file_out = argv[i];
	  }
	else if ((!strcmp(argv[i], "-w")) && (i < (argc - 1)))
	  {
             i++;
             watchfile = argv[i];
             unlink(watchfile);
	  }
	else if (!strcmp(argv[i], "-annotate"))
	  {
             annotate = 1;
          }
	else if ((!strcmp(argv[i], "-deps")) && (i < (argc - 1)))
	  {
	     i++;
	     depfile = argv[i];
	     unlink(depfile);
	  }
	else if (!file_in)
	  file_in = argv[i];
	else if (!file_out)
	  file_out = argv[i];
     }

   if (!file_in)
     {
	ERR("no input file specified.");
	main_help();
	exit(-1);
     }

   pfx = eina_prefix_new(argv[0],            /* argv[0] value (optional) */
                         main,               /* an optional symbol to check path of */
                         "EDJE",             /* env var prefix to use (XXX_PREFIX, XXX_BIN_DIR etc. */
                         "edje",             /* dir to add after "share" (PREFIX/share/DIRNAME) */
                         "include/edje.inc", /* a magic file to check for in PREFIX/share/DIRNAME for success */
                         PACKAGE_BIN_DIR,    /* package bin dir @ compile time */
                         PACKAGE_LIB_DIR,    /* package lib dir @ compile time */
                         PACKAGE_DATA_DIR,   /* package data dir @ compile time */
                         PACKAGE_DATA_DIR    /* if locale needed  use LOCALE_DIR */
                        );

   /* check whether file_in exists */
#ifdef HAVE_REALPATH
   if (!realpath(file_in, rpath) || stat(rpath, &st) || !S_ISREG(st.st_mode))
#else
   if (stat(file_in, &st) || !S_ISREG(st.st_mode))
#endif
     {
	ERR("file not found: %s.", file_in);
	main_help();
	exit(-1);
     }

   if (!file_out)
      {
         char *suffix;

         if ((suffix = strstr(file_in,".edc")) && (suffix[4] == 0))
            {
               file_out = strdup(file_in);
               if (file_out)
                  {
                     suffix = strstr(file_out,".edc");
                     strcpy(suffix,".edj");
                  }
            }
      }
   if (!file_out)
     {
	ERR("no output file specified.");
	main_help();
	exit(-1);
     }

#ifdef HAVE_REALPATH
   if (realpath(file_out, rpath2) && !strcmp (rpath, rpath2))
#else
   if (!strcmp (file_in, file_out))
#endif
     {
	ERR("input file equals output file.");
	main_help();
	exit(-1);
     }

   using_file(file_in, 'E');
   if (annotate) using_file(file_out, 'O');

   if (!edje_init())
     exit(-1);

   edje_file = mem_alloc(SZ(Edje_File));
   edje_file->compiler = strdup("edje_cc");
   edje_file->version = EDJE_FILE_VERSION;
   edje_file->minor = EDJE_FILE_MINOR;
   edje_file->feature_ver = 1; /* increment this every time we add a field
				* or feature to the edje file format that
				* does not load nicely as a NULL or 0 value
				* and needs a special fallback initialization
				*/
   edje_file->base_scale = FROM_INT(1);

   source_edd();
   source_fetch();

   data_setup();
   compile();
   reorder_parts();
   data_process_scripts();
   data_process_lookups();
   data_process_script_lookups();
   data_write();

   eina_prefix_free(pfx);
   pfx = NULL;
   
   edje_shutdown();
   eina_log_domain_unregister(_edje_cc_log_dom);
   eina_shutdown();

   return 0;
}
Beispiel #21
0
int
main(int    argc,
     char **argv)
{
   unsigned char exit_option = 0;
   char *library_path = NULL;

   enlil_init();

   LOG_DOMAIN = eina_log_domain_register("bin_load_sync", "\033[34;1m");

   //ecore_getopt
   Ecore_Getopt_Value values[] = {
      ECORE_GETOPT_VALUE_BOOL(exit_option),
      ECORE_GETOPT_VALUE_BOOL(exit_option),
      ECORE_GETOPT_VALUE_BOOL(exit_option),
      ECORE_GETOPT_VALUE_STR(library_path),
      ECORE_GETOPT_VALUE_BOOL(exit_option),
   };
   ecore_app_args_set(argc, (const char **)argv);
   int nonargs = ecore_getopt_parse(&options, values, argc, argv);
   if (nonargs < 0)
     return 1;
   else if (nonargs != argc)
     {
        fputs("Invalid non-option argument", stderr);
        ecore_getopt_help(stderr, &options);
        return 1;
     }
   if(!library_path)
     {
        fprintf(stderr, "You must specify the location of your enlil !\n");
        return 0;
     }

   if(exit_option)
     return 0;
   //

   Enlil_Library *library = enlil_library_new(_monitor_album_new_cb, _monitor_album_delete_cb, _monitor_enlil_delete_cb,
                                              _monitor_photo_new_cb, _monitor_photo_delete_cb, _monitor_photo_update_cb,
                                              NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
   enlil_library_path_set(library, library_path);

   Enlil_Sync *_sync = enlil_sync_new(enlil_library_path_get(library),
                                      _sync_album_new_cb, _sync_album_update_cb, _sync_album_disappear_cb,
                                      _sync_photo_new_cb, _sync_photo_update_cb, _sync_photo_disappear_cb,
                                      _sync_done_cb, _sync_start_cb, _sync_error_cb, library);
   enlil_library_sync_set(library, _sync);

   Enlil_Load *load = enlil_load_new(library,
                                     _load_album_done_cb,
                                     _load_done_cb, _load_error_cb, library);

   enlil_library_monitor_start(library);

   t0 = ecore_time_get();

   enlil_load_run(load);
   ecore_main_loop_begin();

   enlil_sync_free(&_sync);
   enlil_library_free(&library);
   eina_log_domain_unregister(LOG_DOMAIN);

   enlil_shutdown();

   return 0;
}
Eina_Bool
eina_mempool_init(void)
{
   char *path;

   _eina_mempool_log_dom = eina_log_domain_register("eina_mempool",
                                                    EINA_LOG_COLOR_DEFAULT);
   if (_eina_mempool_log_dom < 0)
     {
        EINA_LOG_ERR("Could not register log domain: eina_mempool");
        return 0;
     }

   EINA_ERROR_NOT_MEMPOOL_MODULE = eina_error_msg_static_register(
         EINA_ERROR_NOT_MEMPOOL_MODULE_STR);
   _backends = eina_hash_string_superfast_new(NULL);

   /* dynamic backends */
   _modules = eina_module_arch_list_get(NULL,
                                        PACKAGE_LIB_DIR "/eina/modules/mp",
                                        MODULE_ARCH);

   path = eina_module_environment_path_get("HOME", "/.eina/mp/modules/mp");
   _modules = eina_module_arch_list_get(_modules, path, MODULE_ARCH);
   if (path)
      free(path);

   path = eina_module_environment_path_get("EINA_MODULES_MEMPOOL_DIR",
                                           "/eina/modules/mp");
   _modules = eina_module_arch_list_get(_modules, path, MODULE_ARCH);
   if (path)
      free(path);

   path = eina_module_symbol_path_get((const void *)eina_init,
                                      "/eina/modules/mp");
   _modules = eina_module_arch_list_get(_modules, path, MODULE_ARCH);
   if (path)
      free(path);

   if (!_modules)
     {
        ERR("no mempool modules able to be loaded.");
        eina_hash_free(_backends);
        goto mempool_init_error;
     }

   eina_module_list_load(_modules);

   /* builtin backends */
#ifdef EINA_STATIC_BUILD_BUDDY
   buddy_init();
#endif
#ifdef EINA_STATIC_BUILD_CHAINED_POOL
   chained_init();
#endif
#ifdef EINA_STATIC_BUILD_EMEMOA_FIXED
   ememoa_fixed_init();
#endif
#ifdef EINA_STATIC_BUILD_EMEMOA_UNKNOWN
   ememoa_unknown_init();
#endif
#ifdef EINA_STATIC_BUILD_FIXED_BITMAP
   fixed_bitmap_init();
#endif
#ifdef EINA_STATIC_BUILD_ONE_BIG
   one_big_init();
#endif
#ifdef EINA_STATIC_BUILD_PASS_THROUGH
   pass_through_init();
#endif

   return EINA_TRUE;

mempool_init_error:
   eina_log_domain_unregister(_eina_mempool_log_dom);
   _eina_mempool_log_dom = -1;

   return EINA_FALSE;
}
Beispiel #23
0
/**
 * Prepare the library for use through initialization of any required connections and / or
 * variables
 *
 * @return boolean EINA_TRUE for success, EINA_FALSE on error.
 */
Eina_Bool init(DB *db, Zrpcdb_Connect_Cb cb, Ecore_Event_Handler_Cb error_cb, Ecore_Event_Handler_Cb result_cb, zentific_config *conf){
	Esql *e;

	if ((!db) || (!cb) || (!conf))
		return EINA_FALSE;

	eina_init();
	zrpcdb_log_dom = eina_log_domain_register("zrpcdb", EINA_COLOR_ORANGE);
	if (zrpcdb_log_dom < 0) {
		fprintf(stderr, "Could not init zrpcdb log domain\n");
		goto err;
	}
	INF("Initializing source 'zrpcdb'");

	if (!db_config_parse(db, conf->DB_MODULES_PATH)){
		ERR("Could not parse config file");
		goto log;
	}

	/* make sure that we have all config options */
	if ((!db->config->backend) || (!db->config->username) ||
		(!db->config->password) || (!db->config->database)) {

		ERR("Missing options in db->config file. Requires HOSTNAME, USERNAME, PASSWORD, and DATABASE fields.");
		goto cfg;
	}
	/* FIXME: better value here */
	esql_init();
	if (db->config->conns < 5){
		WRN("DB init: DB pool size must be at least 5. Resizing to 5.");
		db->config->conns = 5;
	}
	e = esql_pool_new(db->config->conns, ESQL_TYPE_MYSQL);
	EINA_SAFETY_ON_NULL_GOTO(e, esql);
	esql_data_set(e, db);
	db->pool_size = db->config->conns;
	esql_connect_callback_set(e, (Esql_Connect_Cb)init_cb, cb);
	esql_database_set(e, db->config->database);
	if (!esql_connect(e, db->config->backend, db->config->username, db->config->password)){
		ERR("Could not begin database connection!");
		goto conn;
	}
	db->e = e;
	if (!init_count++){
		ZRPCDB_EVENT_ERROR = ecore_event_type_new();
		zrpc_err = ecore_event_handler_add(ZRPCDB_EVENT_ERROR, error_cb, db);
		ZRPCDB_EVENT_RESULT = ecore_event_type_new();
		zrpc_res = ecore_event_handler_add(ZRPCDB_EVENT_RESULT, result_cb, db);
		type_cbs = eina_hash_int64_new(NULL);
		db_cbs = eina_hash_int64_new(NULL);
		db_cb_params = eina_hash_int64_new(NULL);
	}
//	eina_log_domain_level_set("zrpcdb", db->config->loglevel);
	return EINA_TRUE;
conn:
	esql_free(e);
esql:
	esql_shutdown();
cfg:
	db_config_free(db->config);
log:
	eina_log_domain_unregister(zrpcdb_log_dom);
	zrpcdb_log_dom = -1;
err:
	eina_shutdown();
	return EINA_FALSE;
}
Beispiel #24
0
/*
 * Run with "EINA_LOG_LEVELS=upnp_sniffer:4,Eupnp.DeviceInfo:4 ./upnp_sniffer"
 * for watching all log messages.
 */
int main(void)
{
   Eupnp_Control_Point *c;
   int ret = -1;

   if (!eupnp_init())
     {
	fprintf(stderr, "Failed to initialize eina log module.\n");
	return ret;
     }

   if ((_log_domain = eina_log_domain_register("upnp_sniffer", EINA_COLOR_BLUE)) < 0)
     {
	fprintf(stderr, "Failed to create a logging domain for the application.\n");
	goto log_domain_reg_error;
     }

   if (!eupnp_ecore_init())
     {
	fprintf(stderr, "Could not initialize eupnp-ecore\n");
	goto eupnp_ecore_init_error;
     }

   c = eupnp_control_point_new();
   if (!c)
     {
	fprintf(stderr, "Could not create control point instance\n");
	goto eupnp_cp_alloc_error;
     }

   /* Subscribe for device events */
   eupnp_event_bus_subscribe(EUPNP_EVENT_DEVICE_FOUND,
			     EUPNP_CALLBACK(on_device_found), NULL);
   eupnp_event_bus_subscribe(EUPNP_EVENT_DEVICE_READY,
			     EUPNP_CALLBACK(on_device_ready), NULL);
   eupnp_event_bus_subscribe(EUPNP_EVENT_DEVICE_GONE,
			     EUPNP_CALLBACK(on_device_gone), NULL);

   /* Subscribe for service events */
   eupnp_event_bus_subscribe(EUPNP_EVENT_SERVICE_FOUND,
			     EUPNP_CALLBACK(on_service_found), NULL);
   eupnp_event_bus_subscribe(EUPNP_EVENT_SERVICE_GONE,
			     EUPNP_CALLBACK(on_service_gone), NULL);

   /* Start control point */
   eupnp_control_point_start(c);

   eupnp_control_point_discovery_request_send(c, 5, "upnp:rootdevice");

   ret = 0;
   INF("Started sniffing on the UPnP network.");
   ecore_main_loop_begin();
   INF("Shutting down application.");

   /* Shutdown procedure */
   eupnp_control_point_stop(c);
   eupnp_control_point_free(c);

   eupnp_cp_alloc_error:
   eupnp_cp_init_error:
      eupnp_ecore_shutdown();
   eupnp_ecore_init_error:
      eina_log_domain_unregister(_log_domain);
   log_domain_reg_error:
      eupnp_shutdown();

   return ret;
}
Beispiel #25
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;
}
Beispiel #26
0
/**
 * Shut down connections, signal handlers sockets etc.
 *
 * This function shuts down all things set up in ecore_init() and cleans up all
 * event queues, handlers, filters, timers, idlers, idle enterers/exiters
 * etc. set up after ecore_init() was called.
 *
 * Do not call this function from any callback that may be called from the main
 * loop, as the main loop will then fall over and not function properly.
 */
EAPI int
ecore_shutdown(void)
{
    /*
     * take a lock here because _ecore_event_shutdown() does callbacks
     */
    _ecore_lock();
    if (--_ecore_init_count != 0)
        goto unlock;

    /* this looks horrible - a hack for now, but something to note. as
     * we delete the _thread_call pipe a thread COULD be doing
     * ecore_pipe_write() or what not to it at the same time - we
     * must ensure all possible users of this _thread_call are finished
     * and exited before we delete it here */
    /*
     * ok - this causes other valgrind complaints regarding glib aquiring
     * locks internally. so fix bug a or bug b. let's leave the original
     * bug in then and leave this as a note for now
      Ecore_Pipe *p;
      p = _thread_call;
      _thread_call = NULL;
      ecore_pipe_wait(p, 1, 0.1);
      ecore_pipe_del(p);
     */
    eina_lock_free(&_thread_safety);
    eina_condition_free(&_thread_cond);
    eina_lock_free(&_thread_mutex);
    eina_condition_free(&_thread_feedback_cond);
    eina_lock_free(&_thread_feedback_mutex);
    eina_lock_free(&_thread_id_lock);

    if (_ecore_fps_debug) _ecore_fps_debug_shutdown();
    _ecore_poller_shutdown();
    _ecore_animator_shutdown();
    _ecore_glib_shutdown();
    _ecore_job_shutdown();
    _ecore_thread_shutdown();
    _ecore_exe_shutdown();
    _ecore_idle_enterer_shutdown();
    _ecore_idle_exiter_shutdown();
    _ecore_idler_shutdown();
    _ecore_timer_shutdown();
    _ecore_event_shutdown();
    _ecore_main_shutdown();
    _ecore_signal_shutdown();
    _ecore_main_loop_shutdown();

#if HAVE_MALLINFO
    if (getenv("ECORE_MEM_STAT"))
    {
        _ecore_memory_statistic(NULL);

        ERR("[%i] Memory MAX total: %i, free: %i",
            _ecore_memory_pid,
            _ecore_memory_max_total,
            _ecore_memory_max_free);
    }
#endif
    ecore_mempool_shutdown();
    eina_log_domain_unregister(_ecore_log_dom);
    _ecore_log_dom = -1;
    eina_shutdown();
#ifdef HAVE_EVIL
    evil_shutdown();
#endif
unlock:
    _ecore_unlock();

    return _ecore_init_count;
}
/**
 * @internal
 * @return Returns > 0 on success or 0 on failure
 * @brief Initialize the Desktop parser subsystem
 */
int
efreet_desktop_init(void)
{
    char buf[PATH_MAX];

    _efreet_desktop_log_dom = eina_log_domain_register("Efreet_desktop", EFREET_DEFAULT_LOG_COLOR);
    if (_efreet_desktop_log_dom < 0)
    {
        ERROR("Efreet: Could not create a log domain for Efreet_desktop");
        return 0;
    }
    if (!ecore_file_init())
        goto ecore_error;
    desktop_edd = efreet_desktop_edd_init();
    if (!desktop_edd)
        goto edd_error;

    efreet_desktop_cache = eina_hash_string_superfast_new(NULL);
    efreet_desktop_types = NULL;

    EFREET_DESKTOP_TYPE_APPLICATION = efreet_desktop_type_add("Application",
                                        efreet_desktop_application_fields_parse,
                                        efreet_desktop_application_fields_save,
                                        NULL);
    EFREET_DESKTOP_TYPE_LINK = efreet_desktop_type_add("Link",
                                    efreet_desktop_link_fields_parse,
                                    efreet_desktop_link_fields_save, NULL);
    EFREET_DESKTOP_TYPE_DIRECTORY = efreet_desktop_type_add("Directory", NULL,
                                                                NULL, NULL);

    EFREET_EVENT_DESKTOP_CACHE_UPDATE = ecore_event_type_new();

    snprintf(buf, sizeof(buf), "%s/.efreet", efreet_home_dir_get());
    if (!ecore_file_mkpath(buf)) goto cache_error;

    if (efreet_cache_update)
    {
        efreet_desktop_exe_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
                                                             efreet_desktop_exe_cb, NULL);
        if (!efreet_desktop_exe_handler) goto cache_error;

        cache_monitor = ecore_file_monitor_add(buf,
                                               efreet_desktop_cache_update_cb,
                                               NULL);
        if (!cache_monitor) goto handler_error;

        efreet_desktop_changes_listen();

        ecore_exe_run(PACKAGE_LIB_DIR "/efreet/efreet_desktop_cache_create", NULL);

    }

    /* TODO: Defer eet open until we actually need it open. */
    cache = eet_open(efreet_desktop_cache_file(), EET_FILE_MODE_READ);

    return 1;

handler_error:
    if (efreet_desktop_exe_handler) ecore_event_handler_del(efreet_desktop_exe_handler);
cache_error:
    if (efreet_desktop_cache) eina_hash_free(efreet_desktop_cache);
edd_error:
    ecore_file_shutdown();
ecore_error:
    eina_log_domain_unregister(_efreet_desktop_log_dom);
    return 0;
}
Beispiel #28
0
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;
    }

#ifdef HAVE_ECORE_X
    if (!ecore_x_init(0)) {
        CRITICAL("could not init ecore_x.");
        goto error_ecore_x;
    }
#endif

    if (!_ewk_init_body()) {
        CRITICAL("could not init body");
        goto error_edje;
    }

    return ++_ewkInitCount;

#ifdef HAVE_ECORE_X
error_ecore_x:
    edje_shutdown();
#endif
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;
}
Beispiel #29
0
int
ecore_wince_init()
{
    WNDCLASS wc;

    if (++_ecore_wince_init_count != 1)
        return _ecore_wince_init_count;

    if (!eina_init())
        return --_ecore_wince_init_count;

    eina_log_print_cb_set(_ecore_wince_error_print_cb, NULL);
    _ecore_wince_log_dom_global = eina_log_domain_register("ecore_wince", ECORE_WINCE_DEFAULT_LOG_COLOR);
    if (_ecore_wince_log_dom_global < 0)
    {
        EINA_LOG_ERR("Ecore_WinCE: Could not register log domain");
        goto shutdown_eina;
    }

    if (!ecore_event_init())
    {
        ERR("Ecore_WinCE: Could not init ecore_event");
        goto unregister_log_domain;
    }

    _ecore_wince_instance = GetModuleHandle(NULL);
    if (!_ecore_wince_instance)
    {
        ERR("GetModuleHandle() failed");
        goto shutdown_ecore_event;
    }

    memset (&wc, 0, sizeof (wc));
    wc.style = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc = _ecore_wince_window_procedure;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = _ecore_wince_instance;
    wc.hIcon = NULL;
    wc.hCursor = LoadCursor (NULL, IDC_ARROW);
    wc.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
    wc.lpszMenuName =  NULL;
    wc.lpszClassName = ECORE_WINCE_WINDOW_CLASS;

    if(!RegisterClass(&wc))
    {
        ERR("RegisterClass() failed");
        goto free_library;
    }

    if (!ECORE_WINCE_EVENT_MOUSE_IN)
    {
        ECORE_WINCE_EVENT_MOUSE_IN              = ecore_event_type_new();
        ECORE_WINCE_EVENT_MOUSE_OUT             = ecore_event_type_new();
        ECORE_WINCE_EVENT_WINDOW_FOCUS_IN       = ecore_event_type_new();
        ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT      = ecore_event_type_new();
        ECORE_WINCE_EVENT_WINDOW_DAMAGE         = ecore_event_type_new();
        ECORE_WINCE_EVENT_WINDOW_CREATE         = ecore_event_type_new();
        ECORE_WINCE_EVENT_WINDOW_DESTROY        = ecore_event_type_new();
        ECORE_WINCE_EVENT_WINDOW_SHOW           = ecore_event_type_new();
        ECORE_WINCE_EVENT_WINDOW_HIDE           = ecore_event_type_new();
        ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new();
    }

    return _ecore_wince_init_count;

free_library:
    FreeLibrary(_ecore_wince_instance);
shutdown_ecore_event:
    ecore_event_shutdown();
unregister_log_domain:
    eina_log_domain_unregister(_ecore_wince_log_dom_global);
shutdown_eina:
    eina_shutdown();

    return --_ecore_wince_init_count;
}
Beispiel #30
0
int
main(int argc, char *argv[])
{
   char path[PATH_MAX];
   FILE *log;

   strcpy(path, "/tmp/efreetd_XXXXXX");
   if (mkstemp(path) < 0)
     {
        perror("mkstemp");
        return 1;
     }
   if (chmod(path, 0700) < 0)
     {
        perror("chmod");
        return 1;
     }

   log = fopen(path, "wb");
   if (!log) return 1;

   if (!eina_init()) return 1;
   eina_log_print_cb_set(eina_log_print_cb_file, log);

   efreetd_log_dom = eina_log_domain_register("efreetd", EFREETD_DEFAULT_LOG_COLOR);
   if (efreetd_log_dom < 0)
     {
        EINA_LOG_ERR("Efreet: Could not create a log domain for efreetd.");
        goto ecore_error;
     }
   if (!ecore_init()) goto ecore_error;
   ecore_app_args_set(argc, (const char **)argv);
   if (!ecore_file_init()) goto ecore_file_error;

   if (!dbus_init()) goto dbus_error;
   if (!cache_init()) goto cache_error;

#ifdef HAVE_SYS_RESOURCE_H
   setpriority(PRIO_PROCESS, 0, 19);
#elif _WIN32
    SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS);
#endif

   ecore_main_loop_begin();

   cache_shutdown();
   dbus_shutdown();
   ecore_file_shutdown();
   ecore_shutdown();
   eina_log_domain_unregister(efreetd_log_dom);
   efreetd_log_dom = -1;
   eina_shutdown();
   return 0;

cache_error:
   dbus_shutdown();
dbus_error:
   ecore_file_shutdown();
ecore_file_error:
   ecore_shutdown();
ecore_error:
   if (efreetd_log_dom >= 0)
     eina_log_domain_unregister(efreetd_log_dom);
   efreetd_log_dom = -1;
   eina_shutdown();
   return 1;
}