added common log domain to Evry_API

added EVRY_PLUGIN_UPDATE macro for evry_plugin_update (was ...async_update)
converted more plugins



SVN revision: 48743
This commit is contained in:
Hannes Janetzek 2010-05-10 23:45:49 +00:00
parent d62eb96fb4
commit bbe3d91149
9 changed files with 231 additions and 172 deletions

View File

@ -2,8 +2,9 @@
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/ */
#include "Evry.h" #include "e.h"
#include "e_mod_main.h" #include "e_mod_main.h"
#include "evry_api.h"
#include <ctype.h> #include <ctype.h>
static const char TRIGGER[] = "s "; static const char TRIGGER[] = "s ";
@ -12,6 +13,9 @@ static const char LANG_MODIFIER[] = "lang=";
typedef struct _Plugin Plugin; typedef struct _Plugin Plugin;
typedef struct _Module_Config Module_Config; typedef struct _Module_Config Module_Config;
static const Evry_API *evry = NULL;
static Evry_Module *evry_module = NULL;
static Eina_Bool active = EINA_FALSE;
static Module_Config *_conf; static Module_Config *_conf;
static char _config_path[] = "extensions/everthing-aspell"; static char _config_path[] = "extensions/everthing-aspell";
static char _config_domain[] = "module.everyhing-aspell"; static char _config_domain[] = "module.everyhing-aspell";
@ -235,10 +239,10 @@ _cb_data(void *data, int type __UNUSED__, void *event)
word = _space_skip(word_end + 1); word = _space_skip(word_end + 1);
} }
if (EVRY_PLUGIN(p)->items) /* if (EVRY_PLUGIN(p)->items)
{ * {
evry_list_win_show(); * evry_list_win_show();
} * } */
if (p->base.items) if (p->base.items)
EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD); EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD);
@ -385,12 +389,17 @@ _cleanup(Evry_Plugin *plugin)
} }
} }
static Eina_Bool static int
_plugins_init(void) _plugins_init(const Evry_API *_api)
{ {
Evry_Plugin *p; Evry_Plugin *p;
if (!evry_api_version_check(EVRY_API_VERSION)) if (active)
return EINA_TRUE;
evry = _api;
if (!evry->api_version_check(EVRY_API_VERSION))
return EINA_FALSE; return EINA_FALSE;
p = EVRY_PLUGIN_NEW(Plugin, N_("Spell Checker"), p = EVRY_PLUGIN_NEW(Plugin, N_("Spell Checker"),
@ -401,7 +410,7 @@ _plugins_init(void)
p->history = EINA_FALSE; p->history = EINA_FALSE;
p->async_fetch = EINA_TRUE; p->async_fetch = EINA_TRUE;
if (evry_plugin_register(p, EVRY_PLUGIN_SUBJECT, 100)) if (evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 100))
{ {
Plugin_Config *pc = p->config; Plugin_Config *pc = p->config;
pc->view_mode = VIEW_MODE_LIST; pc->view_mode = VIEW_MODE_LIST;
@ -414,13 +423,19 @@ _plugins_init(void)
_plug = (Plugin *) p; _plug = (Plugin *) p;
active = EINA_TRUE;
return EINA_TRUE; return EINA_TRUE;
} }
static void static void
_plugins_shutdown(void) _plugins_shutdown(void)
{ {
if (!active) return;
EVRY_PLUGIN_FREE(_plug); EVRY_PLUGIN_FREE(_plug);
active = EINA_FALSE;
} }
/***************************************************************************/ /***************************************************************************/
@ -607,7 +622,8 @@ _conf_init(E_Module *m)
_conf = e_config_domain_load(_config_domain, _conf_edd); _conf = e_config_domain_load(_config_domain, _conf_edd);
if (_conf && !evry_util_module_config_check(_("Everything Aspell"), _conf->version, if (_conf && !e_util_module_config_check
(_("Everything Aspell"), _conf->version,
MOD_CONFIG_FILE_EPOCH, MOD_CONFIG_FILE_VERSION)) MOD_CONFIG_FILE_EPOCH, MOD_CONFIG_FILE_VERSION))
_conf_free(); _conf_free();
@ -626,8 +642,6 @@ _conf_shutdown(void)
/***************************************************************************/ /***************************************************************************/
static Eina_Bool active = EINA_FALSE;
EAPI E_Module_Api e_modapi = EAPI E_Module_Api e_modapi =
{ {
E_MODULE_API_VERSION, E_MODULE_API_VERSION,
@ -637,11 +651,21 @@ EAPI E_Module_Api e_modapi =
EAPI void * EAPI void *
e_modapi_init(E_Module *m) e_modapi_init(E_Module *m)
{ {
if (e_datastore_get("everything_loaded")) Eina_List *l;
active = _plugins_init();
_conf_init(m); _conf_init(m);
if ((evry = e_datastore_get("everything_loaded")))
_plugins_init(evry);
evry_module = E_NEW(Evry_Module, 1);
evry_module->init = &_plugins_init;
evry_module->shutdown = &_plugins_shutdown;
l = e_datastore_get("everything_modules");
l = eina_list_append(l, evry_module);
e_datastore_set("everything_modules", l);
e_module_delayed_set(m, 1); e_module_delayed_set(m, 1);
return m; return m;
@ -650,11 +674,19 @@ e_modapi_init(E_Module *m)
EAPI int EAPI int
e_modapi_shutdown(E_Module *m) e_modapi_shutdown(E_Module *m)
{ {
if (active && e_datastore_get("everything_loaded")) Eina_List *l;
_plugins_shutdown();
_conf_shutdown(); _conf_shutdown();
if (e_datastore_get("everything_loaded"))
_plugins_shutdown();
l = e_datastore_get("everything_modules");
l = eina_list_remove(l, evry_module);
e_datastore_set("everything_modules", l);
E_FREE(evry_module);
return 1; return 1;
} }

View File

@ -4,7 +4,7 @@
#ifndef E_MOD_MAIN_H #ifndef E_MOD_MAIN_H
#define E_MOD_MAIN_H #define E_MOD_MAIN_H
#define MOD_CONFIG_FILE_EPOCH 0x0002 #define MOD_CONFIG_FILE_EPOCH 0x0003
#define MOD_CONFIG_FILE_GENERATION 0x008d #define MOD_CONFIG_FILE_GENERATION 0x008d
#define MOD_CONFIG_FILE_VERSION \ #define MOD_CONFIG_FILE_VERSION \
((MOD_CONFIG_FILE_EPOCH << 16) | MOD_CONFIG_FILE_GENERATION) ((MOD_CONFIG_FILE_EPOCH << 16) | MOD_CONFIG_FILE_GENERATION)

View File

@ -2,24 +2,27 @@
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/ */
#include "Evry.h" #include "e.h"
#include "e_mod_main.h" #include "e_mod_main.h"
#include "evry_api.h"
// TODO - show error when input not parseable // TODO - show error when input not parseable
static int _cb_data(void *data, int type, void *event); static int _cb_data(void *data, int type, void *event);
static int _cb_error(void *data, int type, void *event); static int _cb_error(void *data, int type, void *event);
static int _cb_del(void *data, int type, void *event); static int _cb_del(void *data, int type, void *event);
static const Evry_API *evry = NULL;
static Evry_Module *evry_module = NULL;
static Eina_Bool active = EINA_FALSE;
static Evry_Plugin *p1; static Evry_Plugin *p1;
static Ecore_Exe *exe = NULL; static Ecore_Exe *exe = NULL;
static Eina_List *history = NULL; static Eina_List *history = NULL;
static Eina_List *handlers = NULL; static Eina_List *handlers = NULL;
static int error = 0; static int error = 0;
static char _module_icon[] = "accessories-calculator"; static char _module_icon[] = "accessories-calculator";
static Evry_Plugin * static Evry_Plugin *
_begin(Evry_Plugin *p, const Evry_Item *item __UNUSED__) _begin(Evry_Plugin *p, const Evry_Item *item __UNUSED__)
{ {
@ -78,7 +81,7 @@ _cleanup(Evry_Plugin *p)
if (p->items) if (p->items)
{ {
evry_item_free(p->items->data); evry->item_free(p->items->data);
p->items = eina_list_remove_list(p->items, p->items); p->items = eina_list_remove_list(p->items, p->items);
} }
@ -87,7 +90,7 @@ _cleanup(Evry_Plugin *p)
if (items-- > 0) if (items-- > 0)
history = eina_list_prepend(history, eina_stringshare_add(it->label)); history = eina_list_prepend(history, eina_stringshare_add(it->label));
evry_item_free(it); evry->item_free(it);
} }
EINA_LIST_FREE(handlers, h) EINA_LIST_FREE(handlers, h)
@ -165,16 +168,6 @@ _fetch(Evry_Plugin *p, const char *input)
return 1; return 1;
} }
static void
_cb_free_item_changed(void *data, void *event)
{
Evry_Event_Item_Changed *ev = event;
evry_item_free(ev->item);
E_FREE(ev);
}
static int static int
_cb_data(void *data, int type __UNUSED__, void *event) _cb_data(void *data, int type __UNUSED__, void *event)
{ {
@ -190,13 +183,7 @@ _cb_data(void *data, int type __UNUSED__, void *event)
eina_stringshare_del(it->label); eina_stringshare_del(it->label);
it->label = eina_stringshare_add(ev->lines->line); it->label = eina_stringshare_add(ev->lines->line);
if (it) if (it) evry->event_item_changed(it, 0, 0);
{
Evry_Event_Item_Changed *ev = E_NEW(Evry_Event_Item_Changed, 1);
ev->item = it;
evry_item_ref(it);
ecore_event_add(EVRY_EVENT_ITEM_CHANGED, ev, _cb_free_item_changed, NULL);
}
} }
return 1; return 1;
@ -227,12 +214,19 @@ _cb_del(void *data __UNUSED__, int type __UNUSED__, void *event)
return 1; return 1;
} }
static Eina_Bool static int
_plugins_init(void) _plugins_init(const Evry_API *_api)
{ {
if (!evry_api_version_check(EVRY_API_VERSION)) if (active)
return EINA_TRUE;
evry = _api;
if (!evry->api_version_check(EVRY_API_VERSION))
return EINA_FALSE; return EINA_FALSE;
EVRY_TYPE_TEXT = evry->type_register("TEXT");
p1 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Calculator"), p1 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Calculator"),
_module_icon, _module_icon,
EVRY_TYPE_TEXT, EVRY_TYPE_TEXT,
@ -241,7 +235,7 @@ _plugins_init(void)
p1->history = EINA_FALSE; p1->history = EINA_FALSE;
p1->async_fetch = EINA_TRUE; p1->async_fetch = EINA_TRUE;
if (evry_plugin_register(p1, EVRY_PLUGIN_SUBJECT, 0)) if (evry->plugin_register(p1, EVRY_PLUGIN_SUBJECT, 0))
{ {
Plugin_Config *pc = p1->config; Plugin_Config *pc = p1->config;
pc->view_mode = VIEW_MODE_LIST; pc->view_mode = VIEW_MODE_LIST;
@ -249,26 +243,23 @@ _plugins_init(void)
pc->trigger = eina_stringshare_add("="); pc->trigger = eina_stringshare_add("=");
} }
active = EINA_TRUE;
return EINA_TRUE; return EINA_TRUE;
} }
static void static void
_plugins_shutdown(void) _plugins_shutdown(void)
{ {
if (!active) return;
EVRY_PLUGIN_FREE(p1); EVRY_PLUGIN_FREE(p1);
active = EINA_FALSE;
} }
/***************************************************************************/ /***************************************************************************/
/**/
/* actual module specifics */
static E_Module *module = NULL;
static Eina_Bool active = EINA_FALSE;
/***************************************************************************/
/**/
/* module setup */
EAPI E_Module_Api e_modapi = EAPI E_Module_Api e_modapi =
{ {
E_MODULE_API_VERSION, E_MODULE_API_VERSION,
@ -278,10 +269,18 @@ EAPI E_Module_Api e_modapi =
EAPI void * EAPI void *
e_modapi_init(E_Module *m) e_modapi_init(E_Module *m)
{ {
module = m; Eina_List *l;
if (e_datastore_get("everything_loaded")) if ((evry = e_datastore_get("everything_loaded")))
active = _plugins_init(); _plugins_init(evry);
evry_module = E_NEW(Evry_Module, 1);
evry_module->init = &_plugins_init;
evry_module->shutdown = &_plugins_shutdown;
l = e_datastore_get("everything_modules");
l = eina_list_append(l, evry_module);
e_datastore_set("everything_modules", l);
e_module_delayed_set(m, 1); e_module_delayed_set(m, 1);
@ -291,15 +290,16 @@ e_modapi_init(E_Module *m)
EAPI int EAPI int
e_modapi_shutdown(E_Module *m) e_modapi_shutdown(E_Module *m)
{ {
char *result; Eina_List *l;
if (active && e_datastore_get("everything_loaded")) if (e_datastore_get("everything_loaded"))
_plugins_shutdown(); _plugins_shutdown();
EINA_LIST_FREE(history, result) l = e_datastore_get("everything_modules");
eina_stringshare_del(result); l = eina_list_remove(l, evry_module);
e_datastore_set("everything_modules", l);
module = NULL; E_FREE(evry_module);
return 1; return 1;
} }
@ -310,5 +310,4 @@ e_modapi_save(E_Module *m)
return 1; return 1;
} }
/**/
/***************************************************************************/ /***************************************************************************/

View File

@ -2,8 +2,9 @@
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/ */
#include "Evry.h" #include "e.h"
#include "e_mod_main.h" #include "e_mod_main.h"
#include "evry_api.h"
#define IMPORT_STRETCH 0 #define IMPORT_STRETCH 0
#define IMPORT_TILE 1 #define IMPORT_TILE 1
@ -26,13 +27,15 @@ struct _Import
char *fdest; char *fdest;
}; };
static void _import_edj_gen(Import *import); static void _import_edj_gen(Import *import);
static int _import_cb_edje_cc_exit(void *data, int type, void *event); static int _import_cb_edje_cc_exit(void *data, int type, void *event);
static const Evry_API *evry = NULL;
static Evry_Module *evry_module = NULL;
static Eina_Bool active = EINA_FALSE;
static Import *import = NULL; static Import *import = NULL;
static Evry_Action *_act; static Evry_Action *_act;
static char _module_icon[] = "preferences-desktop-wallpaper"; static char _module_icon[] = "preferences-desktop-wallpaper";
static int static int
@ -43,7 +46,7 @@ _action(Evry_Action *act)
GET_FILE(file, act->it1.item); GET_FILE(file, act->it1.item);
if (!(evry_file_path_get(file))) if (!(evry->file_path_get(file)))
return 0; return 0;
if (import) if (import)
@ -99,11 +102,19 @@ _fetch(Evry_Action *act)
return it->items; return it->items;
} }
/* XXX free it->items list! */
static Eina_Bool
_plugins_init(void) static int
_plugins_init(const Evry_API *_api)
{ {
if (!evry_api_version_check(EVRY_API_VERSION)) Evry_Plugin *p;
if (active)
return EINA_TRUE;
evry = _api;
if (!evry->api_version_check(EVRY_API_VERSION))
return EINA_FALSE; return EINA_FALSE;
_act = EVRY_ACTION_NEW(_("Set as Wallpaper"), _act = EVRY_ACTION_NEW(_("Set as Wallpaper"),
@ -114,7 +125,9 @@ _plugins_init(void)
_act->remember_context = EINA_TRUE; _act->remember_context = EINA_TRUE;
EVRY_ITEM(_act)->browseable = EINA_TRUE; EVRY_ITEM(_act)->browseable = EINA_TRUE;
evry_action_register(_act, 2); evry->action_register(_act, 2);
active = EINA_TRUE;
return EINA_TRUE; return EINA_TRUE;
} }
@ -122,7 +135,11 @@ _plugins_init(void)
static void static void
_plugins_shutdown(void) _plugins_shutdown(void)
{ {
evry_action_free(_act); if (!active) return;
evry->action_free(_act);
active = EINA_FALSE;
} }
/* taken from e_int_config_wallpaper_import.c */ /* taken from e_int_config_wallpaper_import.c */
@ -347,9 +364,6 @@ _import_cb_edje_cc_exit(void *data, int type, void *event)
/***************************************************************************/ /***************************************************************************/
static E_Module *module = NULL;
static Eina_Bool active = EINA_FALSE;
EAPI E_Module_Api e_modapi = EAPI E_Module_Api e_modapi =
{ {
E_MODULE_API_VERSION, E_MODULE_API_VERSION,
@ -359,10 +373,18 @@ EAPI E_Module_Api e_modapi =
EAPI void * EAPI void *
e_modapi_init(E_Module *m) e_modapi_init(E_Module *m)
{ {
module = m; Eina_List *l;
if (e_datastore_get("everything_loaded")) if ((evry = e_datastore_get("everything_loaded")))
active = _plugins_init(); _plugins_init(evry);
evry_module = E_NEW(Evry_Module, 1);
evry_module->init = &_plugins_init;
evry_module->shutdown = &_plugins_shutdown;
l = e_datastore_get("everything_modules");
l = eina_list_append(l, evry_module);
e_datastore_set("everything_modules", l);
e_module_delayed_set(m, 1); e_module_delayed_set(m, 1);
@ -372,17 +394,16 @@ e_modapi_init(E_Module *m)
EAPI int EAPI int
e_modapi_shutdown(E_Module *m) e_modapi_shutdown(E_Module *m)
{ {
if (active && e_datastore_get("everything_loaded")) Eina_List *l;
if (e_datastore_get("everything_loaded"))
_plugins_shutdown(); _plugins_shutdown();
if (import) l = e_datastore_get("everything_modules");
{ l = eina_list_remove(l, evry_module);
if (import->exe_handler) e_datastore_set("everything_modules", l);
ecore_event_handler_del(import->exe_handler);
E_FREE(import);
}
module = NULL; E_FREE(evry_module);
return 1; return 1;
} }

View File

@ -2,8 +2,9 @@
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/ */
#include "Evry.h" #include "e.h"
#include "e_mod_main.h" #include "e_mod_main.h"
#include "evry_api.h"
#define BORDER_SHOW 1 #define BORDER_SHOW 1
#define BORDER_HIDE 2 #define BORDER_HIDE 2
@ -11,6 +12,10 @@
#define BORDER_TODESK 4 #define BORDER_TODESK 4
#define BORDER_CLOSE 5 #define BORDER_CLOSE 5
static const Evry_API *evry = NULL;
static Evry_Module *evry_module = NULL;
static Eina_Bool active = EINA_FALSE;
static Evry_Plugin *p1; static Evry_Plugin *p1;
static Eina_List *handlers = NULL; static Eina_List *handlers = NULL;
static Eina_Hash *border_hash = NULL; static Eina_Hash *border_hash = NULL;
@ -40,7 +45,7 @@ _cb_border_remove(void *data, int type, void *event)
static void _hash_free(void *data) static void _hash_free(void *data)
{ {
Evry_Item *it = data; Evry_Item *it = data;
evry_item_free(it); evry->item_free(it);
} }
static Evry_Plugin * static Evry_Plugin *
@ -215,18 +220,18 @@ _fetch(Evry_Plugin *p, const char *input)
_item_add(p, bd, 0, &prio); _item_add(p, bd, 0, &prio);
else else
{ {
m1 = evry_fuzzy_match(e_border_name_get(bd), input); m1 = evry->fuzzy_match(e_border_name_get(bd), input);
if (bd->client.icccm.name) if (bd->client.icccm.name)
{ {
m2 = evry_fuzzy_match(bd->client.icccm.name, input); m2 = evry->fuzzy_match(bd->client.icccm.name, input);
if (!m1 || (m2 && m2 < m1)) if (!m1 || (m2 && m2 < m1))
m1 = m2; m1 = m2;
} }
if (bd->desktop) if (bd->desktop)
{ {
m2 = evry_fuzzy_match(bd->desktop->name, input); m2 = evry->fuzzy_match(bd->desktop->name, input);
if (!m1 || (m2 && m2 < m1)) if (!m1 || (m2 && m2 < m1))
m1 = m2; m1 = m2;
} }
@ -341,27 +346,32 @@ _act_border(Evry_Action *act)
return 1; return 1;
} }
static int
static Eina_Bool _plugins_init(const Evry_API *_api)
_plugins_init(void)
{ {
Evry_Plugin *p;
Evry_Action *act; Evry_Action *act;
if (!evry_api_version_check(EVRY_API_VERSION)) if (active)
return EINA_TRUE;
evry = _api;
if (!evry->api_version_check(EVRY_API_VERSION))
return EINA_FALSE; return EINA_FALSE;
p1 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Windows"), NULL, EVRY_TYPE_BORDER, p1 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Windows"), NULL, EVRY_TYPE_BORDER,
_begin, _cleanup, _fetch, NULL); _begin, _cleanup, _fetch, NULL);
p1->transient = EINA_TRUE; p1->transient = EINA_TRUE;
evry_plugin_register(p1, EVRY_PLUGIN_SUBJECT, 2); evry->plugin_register(p1, EVRY_PLUGIN_SUBJECT, 2);
act = EVRY_ACTION_NEW(_("Switch to Window"), act = EVRY_ACTION_NEW(_("Switch to Window"),
EVRY_TYPE_BORDER, 0, "go-next", EVRY_TYPE_BORDER, 0, "go-next",
_act_border, _check_border); _act_border, _check_border);
EVRY_ITEM_DATA_INT_SET(act, BORDER_SHOW); EVRY_ITEM_DATA_INT_SET(act, BORDER_SHOW);
evry_action_register(act, 1); evry->action_register(act, 1);
_actions = eina_list_append(_actions, act); _actions = eina_list_append(_actions, act);
@ -370,28 +380,30 @@ _plugins_init(void)
_act_border, _check_border); _act_border, _check_border);
EVRY_ITEM_DATA_INT_SET(act, BORDER_HIDE); EVRY_ITEM_DATA_INT_SET(act, BORDER_HIDE);
_actions = eina_list_append(_actions, act); _actions = eina_list_append(_actions, act);
evry_action_register(act, 2); evry->action_register(act, 2);
act = EVRY_ACTION_NEW(_("Toggle Fullscreen"), act = EVRY_ACTION_NEW(_("Toggle Fullscreen"),
EVRY_TYPE_BORDER, 0, "view-fullscreen", EVRY_TYPE_BORDER, 0, "view-fullscreen",
_act_border, _check_border); _act_border, _check_border);
EVRY_ITEM_DATA_INT_SET(act, BORDER_FULLSCREEN); EVRY_ITEM_DATA_INT_SET(act, BORDER_FULLSCREEN);
_actions = eina_list_append(_actions, act); _actions = eina_list_append(_actions, act);
evry_action_register(act, 4); evry->action_register(act, 4);
act = EVRY_ACTION_NEW(_("Close"), act = EVRY_ACTION_NEW(_("Close"),
EVRY_TYPE_BORDER, 0, "view-fullscreen", EVRY_TYPE_BORDER, 0, "view-fullscreen",
_act_border, _check_border); _act_border, _check_border);
EVRY_ITEM_DATA_INT_SET(act, BORDER_CLOSE); EVRY_ITEM_DATA_INT_SET(act, BORDER_CLOSE);
_actions = eina_list_append(_actions, act); _actions = eina_list_append(_actions, act);
evry_action_register(act, 3); evry->action_register(act, 3);
act = EVRY_ACTION_NEW(_("Send to Desktop"), act = EVRY_ACTION_NEW(_("Send to Desktop"),
EVRY_TYPE_BORDER, 0, "go-previous", EVRY_TYPE_BORDER, 0, "go-previous",
_act_border, _check_border); _act_border, _check_border);
EVRY_ITEM_DATA_INT_SET(act, BORDER_TODESK); EVRY_ITEM_DATA_INT_SET(act, BORDER_TODESK);
_actions = eina_list_append(_actions, act); _actions = eina_list_append(_actions, act);
evry_action_register(act, 3); evry->action_register(act, 3);
active = EINA_TRUE;
return EINA_TRUE; return EINA_TRUE;
} }
@ -401,16 +413,18 @@ _plugins_shutdown(void)
{ {
Evry_Action *act; Evry_Action *act;
if (!active) return;
EVRY_PLUGIN_FREE(p1); EVRY_PLUGIN_FREE(p1);
EINA_LIST_FREE(_actions, act) EINA_LIST_FREE(_actions, act)
evry_action_free(act); evry->action_free(act);
active = EINA_FALSE;
} }
/***************************************************************************/ /***************************************************************************/
static E_Module *module = NULL;
static Eina_Bool active = EINA_FALSE;
EAPI E_Module_Api e_modapi = EAPI E_Module_Api e_modapi =
{ {
@ -421,10 +435,18 @@ EAPI E_Module_Api e_modapi =
EAPI void * EAPI void *
e_modapi_init(E_Module *m) e_modapi_init(E_Module *m)
{ {
module = m; Eina_List *l;
if (e_datastore_get("everything_loaded")) if ((evry = e_datastore_get("everything_loaded")))
active = _plugins_init(); _plugins_init(evry);
evry_module = E_NEW(Evry_Module, 1);
evry_module->init = &_plugins_init;
evry_module->shutdown = &_plugins_shutdown;
l = e_datastore_get("everything_modules");
l = eina_list_append(l, evry_module);
e_datastore_set("everything_modules", l);
e_module_delayed_set(m, 1); e_module_delayed_set(m, 1);
@ -434,10 +456,16 @@ e_modapi_init(E_Module *m)
EAPI int EAPI int
e_modapi_shutdown(E_Module *m) e_modapi_shutdown(E_Module *m)
{ {
if (active && e_datastore_get("everything_loaded")) Eina_List *l;
if (e_datastore_get("everything_loaded"))
_plugins_shutdown(); _plugins_shutdown();
module = NULL; l = e_datastore_get("everything_modules");
l = eina_list_remove(l, evry_module);
e_datastore_set("everything_modules", l);
E_FREE(evry_module);
return 1; return 1;
} }

View File

@ -292,7 +292,7 @@ EAPI int evry_util_exec_app(const Evry_Item *it_app, const Evry_Item *it_file);
EAPI char *evry_util_url_escape(const char *string, int inlength); EAPI char *evry_util_url_escape(const char *string, int inlength);
EAPI char *evry_util_url_unescape(const char *string, int length); EAPI char *evry_util_url_unescape(const char *string, int length);
EAPI void evry_util_file_detail_set(Evry_Item_File *file); EAPI void evry_util_file_detail_set(Evry_Item_File *file);
EAPI Eina_Bool evry_util_module_config_check(const char *module_name, int conf, int epoch, int version); EAPI int evry_util_module_config_check(const char *module_name, int conf, int epoch, int version);
EAPI Evas_Object *evry_util_icon_get(Evry_Item *it, Evas *e); EAPI Evas_Object *evry_util_icon_get(Evry_Item *it, Evas *e);
EAPI int evry_util_plugin_items_add(Evry_Plugin *p, Eina_List *items, const char *input, int match_detail, int set_usage); EAPI int evry_util_plugin_items_add(Evry_Plugin *p, Eina_List *items, const char *input, int match_detail, int set_usage);
EAPI int evry_items_sort_func(const void *data1, const void *data2); EAPI int evry_items_sort_func(const void *data1, const void *data2);

View File

@ -170,6 +170,7 @@ e_modapi_init(E_Module *m)
e_module_priority_set(m, -1000); e_module_priority_set(m, -1000);
_api = E_NEW(Evry_API, 1); _api = E_NEW(Evry_API, 1);
_api->log_dom = _e_module_evry_log_dom;
#define SET(func) (_api->func = &evry_##func); #define SET(func) (_api->func = &evry_##func);
SET(api_version_check); SET(api_version_check);
SET(item_new); SET(item_new);

View File

@ -26,6 +26,16 @@
#define EVRY_PLUGIN_SUBJECT 0 #define EVRY_PLUGIN_SUBJECT 0
#define EVRY_PLUGIN_ACTION 1 #define EVRY_PLUGIN_ACTION 1
#define EVRY_PLUGIN_OBJECT 2 #define EVRY_PLUGIN_OBJECT 2
EAPI extern Evry_Type EVRY_TYPE_NONE;
EAPI extern Evry_Type EVRY_TYPE_FILE;
EAPI extern Evry_Type EVRY_TYPE_DIR;
EAPI extern Evry_Type EVRY_TYPE_APP;
EAPI extern Evry_Type EVRY_TYPE_ACTION;
EAPI extern Evry_Type EVRY_TYPE_PLUGIN;
EAPI extern Evry_Type EVRY_TYPE_BORDER;
EAPI extern Evry_Type EVRY_TYPE_TEXT;
#endif #endif
typedef struct _Evry_API Evry_API; typedef struct _Evry_API Evry_API;
@ -106,6 +116,8 @@ struct _Evry_API
const char *(*file_path_get)(Evry_Item_File *file); const char *(*file_path_get)(Evry_Item_File *file);
const char *(*file_url_get)(Evry_Item_File *file); const char *(*file_url_get)(Evry_Item_File *file);
int log_dom;
}; };
#ifndef EVRY_H #ifndef EVRY_H
@ -186,5 +198,26 @@ struct _Evry_API
// should be renamed to ITEMS_FILTER // should be renamed to ITEMS_FILTER
#define EVRY_PLUGIN_ITEMS_ADD(_plugin, _items, _input, _match_detail, _set_usage) \ #define EVRY_PLUGIN_ITEMS_ADD(_plugin, _items, _input, _match_detail, _set_usage) \
evry->util_plugin_items_add(EVRY_PLUGIN(_plugin), _items, _input, _match_detail, _set_usage) evry->util_plugin_items_add(EVRY_PLUGIN(_plugin), _items, _input, _match_detail, _set_usage)
#define EVRY_PLUGIN_UPDATE(_p, _action) \
if (_p) evry->plugin_update(EVRY_PLUGIN(_p), _action)
#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(evry->log_dom , __VA_ARGS__)
#define INF(...) EINA_LOG_DOM_INFO(evry->log_dom , __VA_ARGS__)
#define WRN(...) EINA_LOG_DOM_WARN(evry->log_dom , __VA_ARGS__)
#define ERR(...) EINA_LOG_DOM_ERR(evry->log_dom , __VA_ARGS__)
#endif #endif
#endif #endif

View File

@ -617,61 +617,6 @@ evry_util_exec_app(const Evry_Item *it_app, const Evry_Item *it_file)
return 1; return 1;
} }
static int
_conf_timer(void *data)
{
/* e_util_dialog_internal(title, */
e_util_dialog_internal(_("Configuration Updated"), data);
return 0;
}
EAPI Eina_Bool
evry_util_module_config_check(const char *module_name, int conf, int epoch, int version)
{
if ((conf >> 16) < epoch)
{
char *too_old =
_("%s Configuration data needed "
"upgrading. Your old configuration<br> has been"
" wiped and a new set of defaults initialized. "
"This<br>will happen regularly during "
"development, so don't report a<br>bug. "
"This simply means the module needs "
"new configuration<br>data by default for "
"usable functionality that your old<br>"
"configuration simply lacks. This new set of "
"defaults will fix<br>that by adding it in. "
"You can re-configure things now to your<br>"
"liking. Sorry for the inconvenience.<br>");
char buf[4096];
snprintf(buf, sizeof(buf), too_old, module_name);
ecore_timer_add(1.0, _conf_timer, buf);
return EINA_FALSE;
}
else if (conf > version)
{
char *too_new =
_("Your %s Module configuration is NEWER "
"than the module version. This is "
"very<br>strange. This should not happen unless"
" you downgraded<br>the module or "
"copied the configuration from a place where"
"<br>a newer version of the module "
"was running. This is bad and<br>as a "
"precaution your configuration has been now "
"restored to<br>defaults. Sorry for the "
"inconvenience.<br>");
char buf[4096];
snprintf(buf, sizeof(buf), too_new, module_name);
ecore_timer_add(1.0, _conf_timer, buf);
return EINA_FALSE;
}
return EINA_TRUE;
}
/* taken from curl: /* taken from curl:
* *
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et