Example #1
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);

    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.");
    }

    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;
}
Example #2
0
E_API void *
e_modapi_init(E_Module *m)
{
   Eina_List *l;
   Evry_Module *em;
   char buf[4096];

   _mod_evry = m;

   /* add module supplied action */
   act = e_action_add("everything");
   if (act)
     {
        act->func.go = _e_mod_action_cb;
        act->func.go_edge = _e_mod_action_cb_edge;
        e_action_predef_name_set
          (N_("Everything Launcher"),
          N_("Show Everything Launcher"),
          "everything", "", NULL, 0);
     }

   maug = e_int_menus_menu_augmentation_add
       ("main/1", _e_mod_menu_add, NULL, NULL, NULL);

   e_configure_registry_category_add
     ("launcher", 80, _("Launcher"), NULL, "modules-launcher");

   snprintf(buf, sizeof(buf), "%s/e-module-everything.edj", e_module_dir_get(m));
   module_icon = eina_stringshare_add(buf);

   e_configure_registry_item_add
     ("launcher/run_everything", 40, _("Everything Configuration"),
     NULL, module_icon, evry_config_dialog);
   evry_init();

   _evry_type_init("NONE");
   _evry_type_init("FILE");
   _evry_type_init("DIRECTORY");
   _evry_type_init("APPLICATION");
   _evry_type_init("ACTION");
   _evry_type_init("PLUGIN");
   _evry_type_init("BORDER");
   _evry_type_init("TEXT");

   _config_init();

   _evry_events[EVRY_EVENT_ITEMS_UPDATE] = ecore_event_type_new();
   _evry_events[EVRY_EVENT_ITEM_SELECTED] = ecore_event_type_new();
   _evry_events[EVRY_EVENT_ITEM_CHANGED] = ecore_event_type_new();
   _evry_events[EVRY_EVENT_ACTION_PERFORMED] = ecore_event_type_new();
   _evry_events[EVRY_EVENT_PLUGIN_SELECTED] = ecore_event_type_new();

   evry = E_NEW(Evry_API, 1);
#define SET(func) (evry->func = &evry_##func);
   SET(api_version_check);
   SET(item_new);
   SET(item_free);
   SET(item_ref);
   SET(plugin_new);
   SET(plugin_free);
   SET(plugin_register);
   SET(plugin_unregister);
   SET(plugin_update);
   SET(plugin_find);
   SET(action_new);
   SET(action_free);
   SET(action_register);
   SET(action_unregister);
   SET(action_find);
   SET(api_version_check);
   SET(type_register);
   SET(icon_theme_get);
   SET(fuzzy_match);
   SET(util_exec_app);
   SET(util_url_escape);
   SET(util_url_unescape);
   SET(util_file_detail_set);
   SET(util_plugin_items_add);
   SET(util_md5_sum);
   SET(util_icon_get);
   SET(item_changed);
   SET(file_path_get);
   SET(file_url_get);
   SET(history_item_add);
   SET(history_types_get);
   SET(history_item_usage_set);
   SET(event_handler_add);
#undef SET

   evry_history_init();
   evry_plug_actions_init();
   evry_plug_apps_init(m);
   evry_plug_files_init(m);
   evry_plug_windows_init(m);
   evry_plug_settings_init(m);
   evry_plug_calc_init(m);
   e_datastore_set("evry_api", evry);

   EINA_LIST_FOREACH (e_datastore_get("evry_modules"), l, em)
     em->active = em->init(evry);

   evry_plug_collection_init();
   evry_plug_clipboard_init();
   evry_plug_text_init();
   evry_view_init();
   evry_view_help_init();
   evry_gadget_init();

   e_module_priority_set(m, -1000);
   e_module_delayed_set(m, 1);

   /* cleanup every hour :) */
   cleanup_timer = ecore_timer_loop_add(3600, _cleanup_history, NULL);

   return m;
}