e17/evry: revert last commit and cleanups

SVN revision: 62379
This commit is contained in:
Hannes Janetzek 2011-08-12 11:41:15 +00:00
parent 6a3e45a9d6
commit d662953a85
8 changed files with 58 additions and 73 deletions

View File

@ -16,12 +16,11 @@ static Ecore_Timer *cleanup_timer;
static const char *module_icon = NULL;
static E_Config_DD *conf_edd = NULL;
static E_Config_DD *plugin_conf_edd = NULL;
Evry_Config *evry_conf = NULL;
int _evry_events[NUM_EVRY_EVENTS];
int _e_module_evry_log_dom = -1;
static int _e_module_evry_log_dom = -1;
Evry_API *evry = NULL;
Evry_Config *evry_conf = NULL;
int _evry_events[NUM_EVRY_EVENTS];
/* module setup */
EAPI E_Module_Api e_modapi =
@ -138,10 +137,10 @@ e_modapi_init(E_Module *m)
evry_plug_windows_init(m);
evry_plug_settings_init(m);
evry_plug_calc_init(m);
e_datastore_set("evry_active", evry);
e_datastore_set("evry_api", evry);
EINA_LIST_FOREACH(e_datastore_get("evry_modules"), l, em)
em->active = em->init();
em->active = em->init(evry);
evry_plug_collection_init();
evry_plug_clipboard_init();
@ -169,26 +168,24 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
EINA_LIST_FOREACH(e_datastore_get("evry_modules"), l, em)
em->shutdown();
e_datastore_del("evry_active");
E_FREE(evry);
evry = NULL;
#ifndef USE_MODULE_EVERYTHING_AS_MODULES
evry_plug_apps_shutdown();
evry_plug_files_shutdown();
evry_plug_settings_shutdown();
evry_plug_windows_shutdown();
evry_plug_calc_shutdown();
#endif
evry_gadget_shutdown();
evry_shutdown();
evry_view_shutdown();
evry_view_help_shutdown();
evry_plug_clipboard_shutdown();
evry_plug_text_shutdown();
evry_plug_collection_shutdown();
evry_plug_actions_shutdown();
evry_view_shutdown();
evry_view_help_shutdown();
evry_gadget_shutdown();
evry_shutdown();
e_datastore_del("evry_api");
E_FREE(evry);
evry = NULL;
_config_free();
evry_history_free();
@ -239,13 +236,11 @@ e_modapi_save(E_Module *m __UNUSED__)
{
e_config_domain_save("module.everything", conf_edd, evry_conf);
#ifndef USE_MODULE_EVERYTHING_AS_MODULES
evry_plug_apps_save();
evry_plug_files_save();
evry_plug_settings_save();
evry_plug_windows_save();
evry_plug_calc_save();
#endif
return 1;
}

View File

@ -326,6 +326,7 @@ void evry_plug_calc_save(void);
Ecore_Event_Handler *evry_event_handler_add(int type, Eina_Bool (*func) (void *data, int type, void *event), const void *data);
extern Evry_API *evry;
extern Evry_History *evry_hist;
extern Evry_Config *evry_conf;
extern int _evry_events[NUM_EVRY_EVENTS];
@ -338,26 +339,9 @@ EAPI E_Config_Dialog *evry_config_dialog(E_Container *con, const char *params);
EAPI E_Config_Dialog *evry_collection_conf_dialog(E_Container *con, const char *params);
EAPI extern E_Module_Api e_modapi;
/*** Common Logging ***/
extern int _e_module_evry_log_dom;
#ifndef EINA_LOG_DEFAULT_COLOR
#define EINA_LOG_DEFAULT_COLOR EINA_COLOR_CYAN
#endif
#undef DBG
#undef INF
#undef WRN
#undef ERR
#define DBG(...) EINA_LOG_DOM_DBG(_e_module_evry_log_dom, __VA_ARGS__)
#define INF(...) EINA_LOG_DOM_INFO(_e_module_evry_log_dom, __VA_ARGS__)
#define WRN(...) EINA_LOG_DOM_WARN(_e_module_evry_log_dom, __VA_ARGS__)
#define ERR(...) EINA_LOG_DOM_ERR(_e_module_evry_log_dom, __VA_ARGS__)
/* #define CHECK_REFS 1
* #define PRINT_REFS 1
* #define CHECK_TIME 1 */
//#define CHECK_REFS 1
//#define PRINT_REFS 1
//#define CHECK_TIME 1
//#undef DBG
//#define DBG(...) ERR(__VA_ARGS__)

View File

@ -51,13 +51,11 @@ typedef struct _Evry_Event_Item_Changed Evry_Event_Item_Changed;
typedef struct _Evry_Event_Item_Selected Evry_Event_Item_Selected;
typedef struct _Evry_Event_Action_Performed Evry_Event_Action_Performed;
extern Evry_API *evry;
struct _Evry_Module
{
Eina_Bool active;
int (*init)(void);
int (*init)(const Evry_API *api);
void (*shutdown)(void);
};
@ -257,16 +255,16 @@ typedef void (*Evry_Item_Free_Cb) (Evry_Item *it);
#define EVRY_ACTION_FREE(_act) if (_act) evry->action_free(EVRY_ACTN(_act))
#define EVRY_MODULE_NEW(_module, _init, _shutdown) \
{ \
_module = E_NEW(Evry_Module, 1); \
_module->init = &_init; \
_module->shutdown = &_shutdown; \
Eina_List *l = e_datastore_get("evry_modules"); \
l = eina_list_append(l, _module); \
e_datastore_set("evry_modules", l); \
if ((e_datastore_get("evry_active"))) \
evry_module->active = _init(); \
#define EVRY_MODULE_NEW(_module, _evry, _init, _shutdown) \
{ \
_module = E_NEW(Evry_Module, 1); \
_module->init = &_init; \
_module->shutdown = &_shutdown; \
Eina_List *l = e_datastore_get("evry_modules"); \
l = eina_list_append(l, _module); \
e_datastore_set("evry_modules", l); \
if ((_evry = e_datastore_get("evry_api"))) \
evry_module->active = _init(_evry); \
}
#define EVRY_MODULE_FREE(_module) \
@ -291,7 +289,6 @@ typedef void (*Evry_Item_Free_Cb) (Evry_Item *it);
} while (0)
#ifndef EVRY_H
#ifndef EINA_LOG_DEFAULT_COLOR
#define EINA_LOG_DEFAULT_COLOR EINA_COLOR_CYAN
@ -308,4 +305,3 @@ typedef void (*Evry_Item_Free_Cb) (Evry_Item *it);
#define ERR(...) EINA_LOG_DOM_ERR(evry->log_dom , __VA_ARGS__)
#endif
#endif

View File

@ -51,6 +51,7 @@ struct _Module_Config
E_Module *module;
};
static const Evry_API *evry = NULL;
static Evry_Module *evry_module = NULL;
static Eina_List *handlers = NULL;
@ -1010,7 +1011,7 @@ _desktop_cache_update(void *data __UNUSED__, int type __UNUSED__, void *event __
}
static int
_plugins_init(void)
_plugins_init(const Evry_API *api)
{
Evry_Plugin *p;
int prio = 0;
@ -1020,6 +1021,8 @@ _plugins_init(void)
if (evry_module->active)
return EINA_TRUE;
evry = api;
if (!evry->api_version_check(EVRY_API_VERSION))
return EINA_FALSE;
@ -1349,7 +1352,7 @@ evry_plug_apps_init(E_Module *m)
{
_conf_init(m);
EVRY_MODULE_NEW(evry_module, _plugins_init, _plugins_shutdown);
EVRY_MODULE_NEW(evry_module, evry, _plugins_init, _plugins_shutdown);
/* taken from e_exebuf.c */
exelist_exe_edd = E_CONFIG_DD_NEW("E_Exe", E_Exe);

View File

@ -13,6 +13,7 @@ static Eina_Bool _cb_data(void *data, int type, void *event);
static Eina_Bool _cb_error(void *data, int type, void *event);
static Eina_Bool _cb_del(void *data, int type, void *event);
static const Evry_API *evry = NULL;
static Evry_Module *evry_module = NULL;
static Evry_Plugin *_plug;
static Ecore_Event_Handler *action_handler = NULL;
@ -30,7 +31,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__)
{
Evry_Item *it;
Plugin *p;
if (active)
return NULL;
@ -53,7 +54,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__)
it->context = eina_stringshare_ref(p->base.name);
cur_item = it;
active = EINA_TRUE;
return EVRY_PLUGIN(p);
}
@ -83,14 +84,11 @@ _run_bc(Plugin *p)
static void
_finish(Evry_Plugin *plugin)
{
GET_PLUGIN(p, plugin);
GET_PLUGIN(p, plugin);
Ecore_Event_Handler *h;
Evry_Item *it;
int items = 0;
if (!eina_list_data_find(p->base.items, cur_item))
EVRY_ITEM_FREE(cur_item);
EINA_LIST_FREE(p->base.items, it)
{
if ((items++ > 1) && (items < 10))
@ -108,9 +106,7 @@ _finish(Evry_Plugin *plugin)
ecore_exe_free(exe);
exe = NULL;
}
active = EINA_FALSE;
cur_item = NULL;
E_FREE(p);
}
@ -162,7 +158,7 @@ static int
_fetch(Evry_Plugin *plugin, const char *input)
{
GET_PLUGIN(p, plugin);
char buf[1024];
if (!input) return 0;
@ -218,7 +214,7 @@ _cb_error(void *data, int type __UNUSED__, void *event)
{
Ecore_Exe_Event_Data *ev = event;
Evry_Plugin *p = data;
if (ev->exe != exe)
return ECORE_CALLBACK_PASS_ON;
@ -242,11 +238,13 @@ _cb_del(void *data __UNUSED__, int type __UNUSED__, void *event)
}
static int
_plugins_init(void)
_plugins_init(const Evry_API *_api)
{
if (evry_module->active)
return EINA_TRUE;
evry = _api;
if (!evry->api_version_check(EVRY_API_VERSION))
return EINA_FALSE;
@ -293,7 +291,7 @@ _plugins_shutdown(void)
Eina_Bool
evry_plug_calc_init(E_Module *m)
{
EVRY_MODULE_NEW(evry_module, _plugins_init, _plugins_shutdown);
EVRY_MODULE_NEW(evry_module, evry, _plugins_init, _plugins_shutdown);
return EINA_TRUE;
}

View File

@ -90,6 +90,7 @@ struct _Module_Config
E_Module *module;
};
static const Evry_API *evry = NULL;
static Evry_Module *evry_module = NULL;
static Module_Config *_conf;
@ -1304,7 +1305,7 @@ _cb_key_down(Evry_Plugin *plugin, const Ecore_Event_Key *ev)
static int
_plugins_init(void)
_plugins_init(const Evry_API *api)
{
Evry_Action *act, *act_sort_date, *act_sort_name;
Evry_Plugin *p;
@ -1313,6 +1314,8 @@ _plugins_init(void)
if (evry_module->active)
return EINA_TRUE;
evry = api;
if (!evry->api_version_check(EVRY_API_VERSION))
return EINA_FALSE;
@ -1644,7 +1647,7 @@ evry_plug_files_init(E_Module *m)
{
_conf_init(m);
EVRY_MODULE_NEW(evry_module, _plugins_init, _plugins_shutdown);
EVRY_MODULE_NEW(evry_module, evry, _plugins_init, _plugins_shutdown);
return EINA_TRUE;
}

View File

@ -20,6 +20,7 @@ struct _Settings_Item
E_Configure_It *eci;
};
static const Evry_API *evry = NULL;
static Evry_Module *evry_module = NULL;
static Evry_Plugin *p;
static Evry_Action *act;
@ -173,11 +174,13 @@ _action(Evry_Action *act)
}
static int
_plugins_init(void)
_plugins_init(const Evry_API *_api)
{
if (evry_module->active)
return EINA_TRUE;
evry = _api;
if (!evry->api_version_check(EVRY_API_VERSION))
return EINA_FALSE;
@ -217,7 +220,7 @@ _plugins_shutdown(void)
Eina_Bool
evry_plug_settings_init(E_Module *m)
{
EVRY_MODULE_NEW(evry_module, _plugins_init, _plugins_shutdown);
EVRY_MODULE_NEW(evry_module, evry, _plugins_init, _plugins_shutdown);
e_module_delayed_set(m, 1);

View File

@ -26,6 +26,7 @@ struct _Border_Item
#define GET_BORDER(_bd, _it) Border_Item *_bd = (Border_Item *)_it;
static const Evry_API *evry = NULL;
static Evry_Module *evry_module = NULL;
static Evry_Plugin *_plug;
static Eina_List *_actions = NULL;
@ -401,13 +402,15 @@ _act_border(Evry_Action *act)
}
static int
_plugins_init(void)
_plugins_init(const Evry_API *_api)
{
Evry_Action *act;
if (evry_module->active)
return EINA_TRUE;
evry = _api;
if (!evry->api_version_check(EVRY_API_VERSION))
return EINA_FALSE;
@ -477,7 +480,7 @@ _plugins_shutdown(void)
Eina_Bool
evry_plug_windows_init(E_Module *m)
{
EVRY_MODULE_NEW(evry_module, _plugins_init, _plugins_shutdown);
EVRY_MODULE_NEW(evry_module, evry, _plugins_init, _plugins_shutdown);
return EINA_TRUE;
}