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 const char *module_icon = NULL;
static E_Config_DD *conf_edd = NULL; static E_Config_DD *conf_edd = NULL;
static E_Config_DD *plugin_conf_edd = NULL; static E_Config_DD *plugin_conf_edd = NULL;
static int _e_module_evry_log_dom = -1;
Evry_Config *evry_conf = NULL;
int _evry_events[NUM_EVRY_EVENTS];
int _e_module_evry_log_dom = -1;
Evry_API *evry = NULL; Evry_API *evry = NULL;
Evry_Config *evry_conf = NULL;
int _evry_events[NUM_EVRY_EVENTS];
/* module setup */ /* module setup */
EAPI E_Module_Api e_modapi = EAPI E_Module_Api e_modapi =
@ -138,10 +137,10 @@ e_modapi_init(E_Module *m)
evry_plug_windows_init(m); evry_plug_windows_init(m);
evry_plug_settings_init(m); evry_plug_settings_init(m);
evry_plug_calc_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) 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_collection_init();
evry_plug_clipboard_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) EINA_LIST_FOREACH(e_datastore_get("evry_modules"), l, em)
em->shutdown(); em->shutdown();
e_datastore_del("evry_active");
E_FREE(evry);
evry = NULL;
#ifndef USE_MODULE_EVERYTHING_AS_MODULES
evry_plug_apps_shutdown(); evry_plug_apps_shutdown();
evry_plug_files_shutdown(); evry_plug_files_shutdown();
evry_plug_settings_shutdown(); evry_plug_settings_shutdown();
evry_plug_windows_shutdown(); evry_plug_windows_shutdown();
evry_plug_calc_shutdown(); evry_plug_calc_shutdown();
#endif
evry_gadget_shutdown();
evry_shutdown();
evry_view_shutdown();
evry_view_help_shutdown();
evry_plug_clipboard_shutdown(); evry_plug_clipboard_shutdown();
evry_plug_text_shutdown(); evry_plug_text_shutdown();
evry_plug_collection_shutdown(); evry_plug_collection_shutdown();
evry_plug_actions_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(); _config_free();
evry_history_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); e_config_domain_save("module.everything", conf_edd, evry_conf);
#ifndef USE_MODULE_EVERYTHING_AS_MODULES
evry_plug_apps_save(); evry_plug_apps_save();
evry_plug_files_save(); evry_plug_files_save();
evry_plug_settings_save(); evry_plug_settings_save();
evry_plug_windows_save(); evry_plug_windows_save();
evry_plug_calc_save(); evry_plug_calc_save();
#endif
return 1; 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); 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_History *evry_hist;
extern Evry_Config *evry_conf; extern Evry_Config *evry_conf;
extern int _evry_events[NUM_EVRY_EVENTS]; 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 E_Config_Dialog *evry_collection_conf_dialog(E_Container *con, const char *params);
EAPI extern E_Module_Api e_modapi; EAPI extern E_Module_Api e_modapi;
/*** Common Logging ***/ //#define CHECK_REFS 1
extern int _e_module_evry_log_dom; //#define PRINT_REFS 1
//#define CHECK_TIME 1
#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 */
//#undef DBG //#undef DBG
//#define DBG(...) ERR(__VA_ARGS__) //#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_Item_Selected Evry_Event_Item_Selected;
typedef struct _Evry_Event_Action_Performed Evry_Event_Action_Performed; typedef struct _Evry_Event_Action_Performed Evry_Event_Action_Performed;
extern Evry_API *evry;
struct _Evry_Module struct _Evry_Module
{ {
Eina_Bool active; Eina_Bool active;
int (*init)(void); int (*init)(const Evry_API *api);
void (*shutdown)(void); 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_ACTION_FREE(_act) if (_act) evry->action_free(EVRY_ACTN(_act))
#define EVRY_MODULE_NEW(_module, _init, _shutdown) \ #define EVRY_MODULE_NEW(_module, _evry, _init, _shutdown) \
{ \ { \
_module = E_NEW(Evry_Module, 1); \ _module = E_NEW(Evry_Module, 1); \
_module->init = &_init; \ _module->init = &_init; \
_module->shutdown = &_shutdown; \ _module->shutdown = &_shutdown; \
Eina_List *l = e_datastore_get("evry_modules"); \ Eina_List *l = e_datastore_get("evry_modules"); \
l = eina_list_append(l, _module); \ l = eina_list_append(l, _module); \
e_datastore_set("evry_modules", l); \ e_datastore_set("evry_modules", l); \
if ((e_datastore_get("evry_active"))) \ if ((_evry = e_datastore_get("evry_api"))) \
evry_module->active = _init(); \ evry_module->active = _init(_evry); \
} }
#define EVRY_MODULE_FREE(_module) \ #define EVRY_MODULE_FREE(_module) \
@ -291,7 +289,6 @@ typedef void (*Evry_Item_Free_Cb) (Evry_Item *it);
} while (0) } while (0)
#ifndef EVRY_H
#ifndef EINA_LOG_DEFAULT_COLOR #ifndef EINA_LOG_DEFAULT_COLOR
#define EINA_LOG_DEFAULT_COLOR EINA_COLOR_CYAN #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__) #define ERR(...) EINA_LOG_DOM_ERR(evry->log_dom , __VA_ARGS__)
#endif #endif
#endif

View File

@ -51,6 +51,7 @@ struct _Module_Config
E_Module *module; E_Module *module;
}; };
static const Evry_API *evry = NULL;
static Evry_Module *evry_module = NULL; static Evry_Module *evry_module = NULL;
static Eina_List *handlers = NULL; static Eina_List *handlers = NULL;
@ -1010,7 +1011,7 @@ _desktop_cache_update(void *data __UNUSED__, int type __UNUSED__, void *event __
} }
static int static int
_plugins_init(void) _plugins_init(const Evry_API *api)
{ {
Evry_Plugin *p; Evry_Plugin *p;
int prio = 0; int prio = 0;
@ -1020,6 +1021,8 @@ _plugins_init(void)
if (evry_module->active) if (evry_module->active)
return EINA_TRUE; return EINA_TRUE;
evry = api;
if (!evry->api_version_check(EVRY_API_VERSION)) if (!evry->api_version_check(EVRY_API_VERSION))
return EINA_FALSE; return EINA_FALSE;
@ -1349,7 +1352,7 @@ evry_plug_apps_init(E_Module *m)
{ {
_conf_init(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 */ /* taken from e_exebuf.c */
exelist_exe_edd = E_CONFIG_DD_NEW("E_Exe", E_Exe); 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_error(void *data, int type, void *event);
static Eina_Bool _cb_del(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_Module *evry_module = NULL;
static Evry_Plugin *_plug; static Evry_Plugin *_plug;
static Ecore_Event_Handler *action_handler = NULL; static Ecore_Event_Handler *action_handler = NULL;
@ -30,7 +31,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__)
{ {
Evry_Item *it; Evry_Item *it;
Plugin *p; Plugin *p;
if (active) if (active)
return NULL; return NULL;
@ -53,7 +54,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__)
it->context = eina_stringshare_ref(p->base.name); it->context = eina_stringshare_ref(p->base.name);
cur_item = it; cur_item = it;
active = EINA_TRUE; active = EINA_TRUE;
return EVRY_PLUGIN(p); return EVRY_PLUGIN(p);
} }
@ -83,14 +84,11 @@ _run_bc(Plugin *p)
static void static void
_finish(Evry_Plugin *plugin) _finish(Evry_Plugin *plugin)
{ {
GET_PLUGIN(p, plugin); GET_PLUGIN(p, plugin);
Ecore_Event_Handler *h; Ecore_Event_Handler *h;
Evry_Item *it; Evry_Item *it;
int items = 0; 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) EINA_LIST_FREE(p->base.items, it)
{ {
if ((items++ > 1) && (items < 10)) if ((items++ > 1) && (items < 10))
@ -108,9 +106,7 @@ _finish(Evry_Plugin *plugin)
ecore_exe_free(exe); ecore_exe_free(exe);
exe = NULL; exe = NULL;
} }
active = EINA_FALSE; active = EINA_FALSE;
cur_item = NULL;
E_FREE(p); E_FREE(p);
} }
@ -162,7 +158,7 @@ static int
_fetch(Evry_Plugin *plugin, const char *input) _fetch(Evry_Plugin *plugin, const char *input)
{ {
GET_PLUGIN(p, plugin); GET_PLUGIN(p, plugin);
char buf[1024]; char buf[1024];
if (!input) return 0; if (!input) return 0;
@ -218,7 +214,7 @@ _cb_error(void *data, int type __UNUSED__, void *event)
{ {
Ecore_Exe_Event_Data *ev = event; Ecore_Exe_Event_Data *ev = event;
Evry_Plugin *p = data; Evry_Plugin *p = data;
if (ev->exe != exe) if (ev->exe != exe)
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
@ -242,11 +238,13 @@ _cb_del(void *data __UNUSED__, int type __UNUSED__, void *event)
} }
static int static int
_plugins_init(void) _plugins_init(const Evry_API *_api)
{ {
if (evry_module->active) if (evry_module->active)
return EINA_TRUE; return EINA_TRUE;
evry = _api;
if (!evry->api_version_check(EVRY_API_VERSION)) if (!evry->api_version_check(EVRY_API_VERSION))
return EINA_FALSE; return EINA_FALSE;
@ -293,7 +291,7 @@ _plugins_shutdown(void)
Eina_Bool Eina_Bool
evry_plug_calc_init(E_Module *m) 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; return EINA_TRUE;
} }

View File

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

View File

@ -20,6 +20,7 @@ struct _Settings_Item
E_Configure_It *eci; E_Configure_It *eci;
}; };
static const Evry_API *evry = NULL;
static Evry_Module *evry_module = NULL; static Evry_Module *evry_module = NULL;
static Evry_Plugin *p; static Evry_Plugin *p;
static Evry_Action *act; static Evry_Action *act;
@ -173,11 +174,13 @@ _action(Evry_Action *act)
} }
static int static int
_plugins_init(void) _plugins_init(const Evry_API *_api)
{ {
if (evry_module->active) if (evry_module->active)
return EINA_TRUE; return EINA_TRUE;
evry = _api;
if (!evry->api_version_check(EVRY_API_VERSION)) if (!evry->api_version_check(EVRY_API_VERSION))
return EINA_FALSE; return EINA_FALSE;
@ -217,7 +220,7 @@ _plugins_shutdown(void)
Eina_Bool Eina_Bool
evry_plug_settings_init(E_Module *m) 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); 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; #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_Module *evry_module = NULL;
static Evry_Plugin *_plug; static Evry_Plugin *_plug;
static Eina_List *_actions = NULL; static Eina_List *_actions = NULL;
@ -401,13 +402,15 @@ _act_border(Evry_Action *act)
} }
static int static int
_plugins_init(void) _plugins_init(const Evry_API *_api)
{ {
Evry_Action *act; Evry_Action *act;
if (evry_module->active) if (evry_module->active)
return EINA_TRUE; return EINA_TRUE;
evry = _api;
if (!evry->api_version_check(EVRY_API_VERSION)) if (!evry->api_version_check(EVRY_API_VERSION))
return EINA_FALSE; return EINA_FALSE;
@ -477,7 +480,7 @@ _plugins_shutdown(void)
Eina_Bool Eina_Bool
evry_plug_windows_init(E_Module *m) 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; return EINA_TRUE;
} }