forked from enlightenment/enlightenment
e17/evry: better macros for plugin creation
SVN revision: 62403
This commit is contained in:
parent
1ea8e5a0e1
commit
04d8b8d521
|
@ -209,6 +209,22 @@ struct _Evry_Event_Action_Performed
|
||||||
evry->plugin_new(EVRY_PLUGIN(E_NEW(_base, 1)), _name, _(_name), _icon, _item_type, \
|
evry->plugin_new(EVRY_PLUGIN(E_NEW(_base, 1)), _name, _(_name), _icon, _item_type, \
|
||||||
_begin, _finish, _fetch, _free)
|
_begin, _finish, _fetch, _free)
|
||||||
|
|
||||||
|
#define EVRY_PLUGIN_BASE(_name, _icon, _item_type, _begin, _finish, _fetch) \
|
||||||
|
EVRY_PLUGIN_NEW(Evry_Plugin, _name, _icon, _item_type, _begin, _finish, _fetch, NULL)
|
||||||
|
|
||||||
|
#define EVRY_PLUGIN_INSTANCE(_p, _plugin) { \
|
||||||
|
_p = E_NEW(Plugin, 1); \
|
||||||
|
_p->base = *_plugin; \
|
||||||
|
_p->base.items = NULL; \
|
||||||
|
evry->item_new(&_p->base.base, (Evry_Plugin*)_p, \
|
||||||
|
_plugin->base.label, NULL, \
|
||||||
|
(Evry_Item_Free_Cb)_p->base.finish); \
|
||||||
|
_p->base.base.detail = eina_stringshare_add(_plugin->base.detail); \
|
||||||
|
_p->base.base.icon = eina_stringshare_add(_plugin->base.icon); \
|
||||||
|
_p->base.base.context = eina_stringshare_add(_plugin->base.context); \
|
||||||
|
_p->base.base.id = eina_stringshare_add(_plugin->base.id); \
|
||||||
|
}
|
||||||
|
|
||||||
#define EVRY_PLUGIN_FREE(_p) if (_p) evry->plugin_free(EVRY_PLUGIN(_p))
|
#define EVRY_PLUGIN_FREE(_p) if (_p) evry->plugin_free(EVRY_PLUGIN(_p))
|
||||||
|
|
||||||
#define EVRY_PLUGIN_ITEMS_FREE(_p) { \
|
#define EVRY_PLUGIN_ITEMS_FREE(_p) { \
|
||||||
|
@ -231,19 +247,6 @@ struct _Evry_Event_Action_Performed
|
||||||
|
|
||||||
typedef void (*Evry_Item_Free_Cb) (Evry_Item *it);
|
typedef void (*Evry_Item_Free_Cb) (Evry_Item *it);
|
||||||
|
|
||||||
#define EVRY_PLUGIN_INSTANCE(_p, _plugin) { \
|
|
||||||
_p = E_NEW(Plugin, 1); \
|
|
||||||
_p->base = *_plugin; \
|
|
||||||
_p->base.items = NULL; \
|
|
||||||
evry->item_new(&_p->base.base, (Evry_Plugin*)_p, \
|
|
||||||
_plugin->base.label, NULL, \
|
|
||||||
(Evry_Item_Free_Cb)_p->base.finish); \
|
|
||||||
_p->base.base.detail = eina_stringshare_add(_plugin->base.detail); \
|
|
||||||
_p->base.base.icon = eina_stringshare_add(_plugin->base.icon); \
|
|
||||||
_p->base.base.context = eina_stringshare_add(_plugin->base.context); \
|
|
||||||
_p->base.base.id = eina_stringshare_add(_plugin->base.id); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define EVRY_PLUGIN_ITEMS_CLEAR(_p) { \
|
#define EVRY_PLUGIN_ITEMS_CLEAR(_p) { \
|
||||||
Evry_Item *it; \
|
Evry_Item *it; \
|
||||||
EINA_LIST_FREE(EVRY_PLUGIN(_p)->items, it) \
|
EINA_LIST_FREE(EVRY_PLUGIN(_p)->items, it) \
|
||||||
|
|
|
@ -169,9 +169,8 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
int
|
int
|
||||||
evry_plug_actions_init()
|
evry_plug_actions_init()
|
||||||
{
|
{
|
||||||
_plug = EVRY_PLUGIN_NEW(Plugin, N_("Actions"), NULL,
|
_plug = EVRY_PLUGIN_BASE("Actions", NULL, EVRY_TYPE_ACTION,
|
||||||
EVRY_TYPE_ACTION,
|
_begin, _finish, _fetch);
|
||||||
_begin, _finish, _fetch, NULL);
|
|
||||||
|
|
||||||
_plug->browse = &_browse;
|
_plug->browse = &_browse;
|
||||||
|
|
||||||
|
|
|
@ -331,7 +331,7 @@ evry_aggregator_new(Evry_Window *win, int type)
|
||||||
{
|
{
|
||||||
Evry_Plugin *p;
|
Evry_Plugin *p;
|
||||||
|
|
||||||
p = EVRY_PLUGIN_NEW(Plugin, N_("All"), NULL, 0, _begin, _finish, _fetch, _free);
|
p = EVRY_PLUGIN_NEW(Plugin, "All", NULL, 0, _begin, _finish, _fetch, _free);
|
||||||
|
|
||||||
if (evry_plugin_register(p, type, -1))
|
if (evry_plugin_register(p, type, -1))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1023,35 +1023,31 @@ _plugins_init(const Evry_API *api)
|
||||||
if (!evry->api_version_check(EVRY_API_VERSION))
|
if (!evry->api_version_check(EVRY_API_VERSION))
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
p = EVRY_PLUGIN_NEW(Plugin, N_("Applications"),
|
p = EVRY_PLUGIN_BASE("Applications", _module_icon, EVRY_TYPE_APP,
|
||||||
_module_icon, EVRY_TYPE_APP,
|
_begin, _finish, _fetch);
|
||||||
_begin, _finish, _fetch, NULL);
|
|
||||||
p->complete = &_complete;
|
p->complete = &_complete;
|
||||||
p->config_path = "extensions/everything-apps";
|
p->config_path = "extensions/everything-apps";
|
||||||
evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 1);
|
evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 1);
|
||||||
_plugins = eina_list_append(_plugins, p);
|
_plugins = eina_list_append(_plugins, p);
|
||||||
|
|
||||||
|
|
||||||
p = EVRY_PLUGIN_NEW(Plugin, N_("Exebuf"),
|
p = EVRY_PLUGIN_BASE("Exebuf", _module_icon, EVRY_TYPE_APP,
|
||||||
_module_icon, EVRY_TYPE_APP,
|
_begin_exe, _finish_exe, _fetch_exe);
|
||||||
_begin_exe, _finish_exe, _fetch_exe, NULL);
|
|
||||||
p->complete = &_complete;
|
p->complete = &_complete;
|
||||||
p->config_path = "extensions/everything-apps";
|
p->config_path = "extensions/everything-apps";
|
||||||
_plugins = eina_list_append(_plugins, p);
|
_plugins = eina_list_append(_plugins, p);
|
||||||
if (evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 3))
|
if (evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 3))
|
||||||
p->config->min_query = 5;
|
p->config->min_query = 5;
|
||||||
|
|
||||||
p = EVRY_PLUGIN_NEW(Plugin, N_("Applications"),
|
p = EVRY_PLUGIN_BASE("Applications", _module_icon, EVRY_TYPE_APP,
|
||||||
_module_icon, EVRY_TYPE_APP,
|
_begin_mime, _finish, _fetch);
|
||||||
_begin_mime, _finish, _fetch, NULL);
|
|
||||||
p->complete = &_complete;
|
p->complete = &_complete;
|
||||||
p->config_path = "extensions/everything-apps";
|
p->config_path = "extensions/everything-apps";
|
||||||
evry->plugin_register(p, EVRY_PLUGIN_OBJECT, 1);
|
evry->plugin_register(p, EVRY_PLUGIN_OBJECT, 1);
|
||||||
_plugins = eina_list_append(_plugins, p);
|
_plugins = eina_list_append(_plugins, p);
|
||||||
|
|
||||||
p = EVRY_PLUGIN_NEW(Plugin, N_("Open With..."),
|
p = EVRY_PLUGIN_BASE("Open With...", _module_icon, EVRY_TYPE_APP,
|
||||||
_module_icon, EVRY_TYPE_APP,
|
_begin_mime, _finish_mime, _fetch_mime);
|
||||||
_begin_mime, _finish_mime, _fetch_mime, NULL);
|
|
||||||
p->config_path = "extensions/everything-apps";
|
p->config_path = "extensions/everything-apps";
|
||||||
evry->plugin_register(p, EVRY_PLUGIN_ACTION, 1);
|
evry->plugin_register(p, EVRY_PLUGIN_ACTION, 1);
|
||||||
_plugins = eina_list_append(_plugins, p);
|
_plugins = eina_list_append(_plugins, p);
|
||||||
|
|
|
@ -248,10 +248,8 @@ _plugins_init(const Evry_API *_api)
|
||||||
action_handler = evry->event_handler_add(EVRY_EVENT_ACTION_PERFORMED,
|
action_handler = evry->event_handler_add(EVRY_EVENT_ACTION_PERFORMED,
|
||||||
_cb_action_performed, NULL);
|
_cb_action_performed, NULL);
|
||||||
|
|
||||||
_plug = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Calculator"),
|
_plug = EVRY_PLUGIN_BASE("Calculator", _module_icon, EVRY_TYPE_TEXT,
|
||||||
_module_icon,
|
_begin, _finish, _fetch);
|
||||||
EVRY_TYPE_TEXT,
|
|
||||||
_begin, _finish, _fetch, NULL);
|
|
||||||
|
|
||||||
_plug->history = EINA_FALSE;
|
_plug->history = EINA_FALSE;
|
||||||
_plug->async_fetch = EINA_TRUE;
|
_plug->async_fetch = EINA_TRUE;
|
||||||
|
|
|
@ -139,9 +139,8 @@ _add_plugin(const char *name)
|
||||||
char path[4096];
|
char path[4096];
|
||||||
char title[4096];
|
char title[4096];
|
||||||
|
|
||||||
p = EVRY_PLUGIN_NEW(Evry_Plugin, N_(name),
|
p = EVRY_PLUGIN_BASE(name, _module_icon, COLLECTION_PLUGIN,
|
||||||
_module_icon, COLLECTION_PLUGIN,
|
_begin, _finish, _fetch);
|
||||||
_begin, _finish, _fetch, NULL);
|
|
||||||
p->browse = &_browse;
|
p->browse = &_browse;
|
||||||
|
|
||||||
snprintf(path, sizeof(path), "launcher/everything-%s", p->name);
|
snprintf(path, sizeof(path), "launcher/everything-%s", p->name);
|
||||||
|
|
|
@ -1355,33 +1355,38 @@ _plugins_init(const Evry_API *api)
|
||||||
|
|
||||||
#undef ACTION_NEW
|
#undef ACTION_NEW
|
||||||
|
|
||||||
#define PLUGIN_NEW(_name, _icon, _begin, _finish, _fetch, _browse) \
|
|
||||||
p = EVRY_PLUGIN_NEW(Evry_Plugin, _name, _icon, EVRY_TYPE_FILE, \
|
|
||||||
_begin, _finish, _fetch, NULL); \
|
|
||||||
p->browse = &_browse; \
|
|
||||||
p->config_path = "extensions/everything-files"; \
|
|
||||||
_plugins = eina_list_append(_plugins, p); \
|
|
||||||
|
|
||||||
|
p = EVRY_PLUGIN_BASE("Files", _module_icon, EVRY_TYPE_FILE,
|
||||||
PLUGIN_NEW(N_("Files"), _module_icon, _begin, _finish, _fetch, _browse);
|
_begin, _finish, _fetch);
|
||||||
p->input_type = EVRY_TYPE_FILE;
|
p->input_type = EVRY_TYPE_FILE;
|
||||||
p->cb_key_down = &_cb_key_down;
|
p->cb_key_down = &_cb_key_down;
|
||||||
|
p->browse = &_browse;
|
||||||
|
p->config_path = "extensions/everything-files";
|
||||||
p->actions = eina_list_append(p->actions, act_sort_date);
|
p->actions = eina_list_append(p->actions, act_sort_date);
|
||||||
p->actions = eina_list_append(p->actions, act_sort_name);
|
p->actions = eina_list_append(p->actions, act_sort_name);
|
||||||
|
_plugins = eina_list_append(_plugins, p);
|
||||||
|
|
||||||
if (evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 2))
|
if (evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 2))
|
||||||
p->config->min_query = 1;
|
p->config->min_query = 1;
|
||||||
|
|
||||||
|
|
||||||
PLUGIN_NEW(N_("Files"), _module_icon, _begin, _finish, _fetch, _browse);
|
p = EVRY_PLUGIN_BASE("Files", _module_icon, EVRY_TYPE_FILE,
|
||||||
|
_begin, _finish, _fetch);
|
||||||
p->cb_key_down = &_cb_key_down;
|
p->cb_key_down = &_cb_key_down;
|
||||||
|
p->browse = &_browse;
|
||||||
|
p->config_path = "extensions/everything-files";
|
||||||
p->actions = eina_list_append(p->actions, act_sort_date);
|
p->actions = eina_list_append(p->actions, act_sort_date);
|
||||||
p->actions = eina_list_append(p->actions, act_sort_name);
|
p->actions = eina_list_append(p->actions, act_sort_name);
|
||||||
|
_plugins = eina_list_append(_plugins, p);
|
||||||
evry->plugin_register(p, EVRY_PLUGIN_OBJECT, 2);
|
evry->plugin_register(p, EVRY_PLUGIN_OBJECT, 2);
|
||||||
|
|
||||||
if (_conf->show_recent || _conf->search_recent)
|
if (!_conf->show_recent && !_conf->search_recent)
|
||||||
{
|
return EINA_TRUE;
|
||||||
PLUGIN_NEW(N_("Recent Files"), _module_icon,
|
|
||||||
_recentf_begin, _finish, _recentf_fetch, _recentf_browse);
|
p = EVRY_PLUGIN_BASE("Recent Files", _module_icon, EVRY_TYPE_FILE,
|
||||||
|
_recentf_begin, _finish, _recentf_fetch);
|
||||||
|
p->browse = &_recentf_browse;
|
||||||
|
p->config_path = "extensions/everything-files";
|
||||||
|
|
||||||
if (evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 3))
|
if (evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 3))
|
||||||
{
|
{
|
||||||
|
@ -1389,17 +1394,16 @@ _plugins_init(const Evry_API *api)
|
||||||
p->config->min_query = 3;
|
p->config->min_query = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
PLUGIN_NEW(N_("Recent Files"), _module_icon,
|
p = EVRY_PLUGIN_BASE("Recent Files", _module_icon, EVRY_TYPE_FILE,
|
||||||
_recentf_begin, _finish, _recentf_fetch, _recentf_browse);
|
_recentf_begin, _finish, _recentf_fetch);
|
||||||
|
p->browse = &_recentf_browse;
|
||||||
|
p->config_path = "extensions/everything-files";
|
||||||
|
|
||||||
if (evry->plugin_register(p, EVRY_PLUGIN_OBJECT, 3))
|
if (evry->plugin_register(p, EVRY_PLUGIN_OBJECT, 3))
|
||||||
{
|
{
|
||||||
p->config->top_level = EINA_FALSE;
|
p->config->top_level = EINA_FALSE;
|
||||||
p->config->min_query = 3;
|
p->config->min_query = 3;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#undef PLUGIN_NEW
|
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,9 +183,7 @@ _plugins_init(const Evry_API *_api)
|
||||||
|
|
||||||
E_SETTINGS = evry->type_register("E_SETTINGS");
|
E_SETTINGS = evry->type_register("E_SETTINGS");
|
||||||
|
|
||||||
p = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Settings"),
|
p = EVRY_PLUGIN_BASE("Settings", "configure", E_SETTINGS, _begin, _finish, _fetch);
|
||||||
"configure", E_SETTINGS,
|
|
||||||
_begin, _finish, _fetch, NULL);
|
|
||||||
p->browse = &_browse;
|
p->browse = &_browse;
|
||||||
evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 10);
|
evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 10);
|
||||||
|
|
||||||
|
|
|
@ -60,13 +60,11 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
evry_plug_text_init(void)
|
evry_plug_text_init(void)
|
||||||
{
|
{
|
||||||
p1 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Text"),
|
p1 = EVRY_PLUGIN_BASE("Text", "accessories-text-editor",
|
||||||
"accessories-text-editor", EVRY_TYPE_TEXT,
|
EVRY_TYPE_TEXT, _begin, _finish, _fetch);
|
||||||
_begin, _finish, _fetch, NULL);
|
|
||||||
|
|
||||||
p2 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Text"),
|
p2 = EVRY_PLUGIN_BASE("Text", "accessories-text-editor",
|
||||||
"accessories-text-editor", EVRY_TYPE_TEXT,
|
EVRY_TYPE_TEXT, _begin, _finish, _fetch);
|
||||||
_begin, _finish, _fetch, NULL);
|
|
||||||
|
|
||||||
if (evry_plugin_register(p1, EVRY_PLUGIN_OBJECT, 999))
|
if (evry_plugin_register(p1, EVRY_PLUGIN_OBJECT, 999))
|
||||||
{
|
{
|
||||||
|
|
|
@ -411,10 +411,8 @@ _plugins_init(const Evry_API *_api)
|
||||||
if (!evry->api_version_check(EVRY_API_VERSION))
|
if (!evry->api_version_check(EVRY_API_VERSION))
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
_plug = EVRY_PLUGIN_NEW(Plugin, N_("Windows"),
|
_plug = EVRY_PLUGIN_BASE("Windows", "preferences-system-windows",
|
||||||
"preferences-system-windows",
|
EVRY_TYPE_BORDER, _begin, _finish, _fetch);
|
||||||
EVRY_TYPE_BORDER,
|
|
||||||
_begin, _finish, _fetch, NULL);
|
|
||||||
_plug->transient = EINA_TRUE;
|
_plug->transient = EINA_TRUE;
|
||||||
evry->plugin_register(_plug, EVRY_PLUGIN_SUBJECT, 2);
|
evry->plugin_register(_plug, EVRY_PLUGIN_SUBJECT, 2);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue