forked from enlightenment/enlightenment
disambiguate api: separate begin() and browse().
cleanups SVN revision: 48587
This commit is contained in:
parent
3ca39a9bec
commit
1958516715
|
@ -453,14 +453,14 @@ _scan_end_func(void *data)
|
|||
{
|
||||
if (_conf->cache_dirs)
|
||||
{
|
||||
EINA_LIST_REVERSE_FOREACH(p->files, l, item)
|
||||
EINA_LIST_FOREACH(p->files, l, item)
|
||||
{
|
||||
GET_FILE(file, item);
|
||||
|
||||
if (!item->usage &&
|
||||
(hi = evry_history_add(evry_hist->subjects, item, NULL, NULL)))
|
||||
{
|
||||
hi->last_used = SIX_DAYS_AGO + (0.001 * (double) cnt++);
|
||||
hi->last_used = SIX_DAYS_AGO - (0.001 * (double) cnt++);
|
||||
hi->usage = TIME_FACTOR(hi->last_used);
|
||||
hi->data = eina_stringshare_ref(file->mime);
|
||||
item->hi = hi;
|
||||
|
@ -468,7 +468,7 @@ _scan_end_func(void *data)
|
|||
else if (item->hi && (item->hi->count == 1) &&
|
||||
(item->hi->last_used < SIX_DAYS_AGO))
|
||||
{
|
||||
item->hi->last_used = SIX_DAYS_AGO + (0.001 * (double) cnt++);
|
||||
item->hi->last_used = SIX_DAYS_AGO - (0.001 * (double) cnt++);
|
||||
item->hi->usage = TIME_FACTOR(hi->last_used);
|
||||
}
|
||||
|
||||
|
@ -574,10 +574,10 @@ _read_directory(Plugin *p)
|
|||
}
|
||||
|
||||
static Evry_Plugin *
|
||||
_begin(Evry_Plugin *plugin, const Evry_Item *it)
|
||||
_browse(Evry_Plugin *plugin, const Evry_Item *it)
|
||||
{
|
||||
Plugin *p = NULL;
|
||||
|
||||
|
||||
if (it && CHECK_TYPE(it, EVRY_TYPE_FILE))
|
||||
{
|
||||
/* browsing */
|
||||
|
@ -594,9 +594,22 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it)
|
|||
|
||||
p->directory = eina_stringshare_add(file->path);
|
||||
p->parent = EINA_TRUE;
|
||||
p->dirs_only = parent->dirs_only;
|
||||
/* p->dirs_only = parent->dirs_only; */
|
||||
|
||||
_read_directory(p);
|
||||
|
||||
return EVRY_PLUGIN(p);
|
||||
}
|
||||
else if (it && CHECK_TYPE(it, EVRY_TYPE_ACTION))
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Evry_Plugin *
|
||||
_begin(Evry_Plugin *plugin, const Evry_Item *it)
|
||||
{
|
||||
Plugin *p = NULL;
|
||||
|
||||
if (it && CHECK_TYPE(it, EVRY_TYPE_ACTION))
|
||||
{
|
||||
/* provide object */
|
||||
/* GET_ACTION(act, it); */
|
||||
|
@ -611,6 +624,9 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it)
|
|||
p->directory = eina_stringshare_add(e_user_homedir_get());
|
||||
p->parent = EINA_FALSE;
|
||||
p->show_recent = EINA_TRUE;
|
||||
_read_directory(p);
|
||||
|
||||
return EVRY_PLUGIN(p);
|
||||
}
|
||||
else if (!it)
|
||||
{
|
||||
|
@ -621,10 +637,11 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it)
|
|||
if (_conf->show_homedir)
|
||||
p->directory = eina_stringshare_add(e_user_homedir_get());
|
||||
|
||||
/* p->show_recent = (_conf->show_recent || _conf->search_recent); */
|
||||
p->show_recent = EINA_TRUE;
|
||||
p->parent = EINA_FALSE;
|
||||
|
||||
_read_directory(p);
|
||||
|
||||
if (clear_cache)
|
||||
{
|
||||
History_Types *ht = evry_history_types_get(evry_hist->subjects, EVRY_TYPE_FILE);
|
||||
|
@ -634,16 +651,11 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it)
|
|||
}
|
||||
clear_cache = EINA_FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
|
||||
return EVRY_PLUGIN(p);
|
||||
}
|
||||
|
||||
if (p->directory)
|
||||
_read_directory(p);
|
||||
|
||||
return EVRY_PLUGIN(p);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1201,6 +1213,7 @@ _plugins_init(void)
|
|||
p1 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Files"), NULL,
|
||||
EVRY_TYPE_FILE,
|
||||
_begin, _cleanup, _fetch, NULL);
|
||||
p1->browse = &_browse;
|
||||
p1->config_path = "extensions/everything-files";
|
||||
evry_plugin_register(p1, EVRY_PLUGIN_SUBJECT, 3);
|
||||
/* p1->complete = &_complete; */
|
||||
|
@ -1208,14 +1221,17 @@ _plugins_init(void)
|
|||
p2 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Files"), NULL,
|
||||
EVRY_TYPE_FILE,
|
||||
_begin, _cleanup, _fetch, NULL);
|
||||
p2->browse = &_browse;
|
||||
p2->config_path = "extensions/everything-files";
|
||||
evry_plugin_register(p2, EVRY_PLUGIN_OBJECT, 1);
|
||||
|
||||
|
||||
act = EVRY_ACTION_NEW(N_("Open Folder (EFM)"),
|
||||
EVRY_TYPE_FILE, 0,
|
||||
"folder-open",
|
||||
_open_folder_action,
|
||||
_open_folder_check);
|
||||
act->remember_context = EINA_TRUE;
|
||||
evry_action_register(act, 0);
|
||||
_actions = eina_list_append(_actions, act);
|
||||
|
||||
|
@ -1223,7 +1239,6 @@ _plugins_init(void)
|
|||
EVRY_TYPE_FILE, 0,
|
||||
"system-run",
|
||||
_open_term_action, NULL);
|
||||
act->remember_context = EINA_FALSE;
|
||||
evry_action_register(act, 2);
|
||||
_actions = eina_list_append(_actions, act);
|
||||
|
||||
|
@ -1231,7 +1246,6 @@ _plugins_init(void)
|
|||
EVRY_TYPE_FILE, 0,
|
||||
"edit-delete",
|
||||
_file_trash_action, NULL);
|
||||
act->remember_context = EINA_FALSE;
|
||||
EVRY_ITEM_DATA_INT_SET(act, ACT_TRASH);
|
||||
evry_action_register(act, 2);
|
||||
_actions = eina_list_append(_actions, act);
|
||||
|
@ -1250,7 +1264,6 @@ _plugins_init(void)
|
|||
"go-next",
|
||||
_file_copy_action, NULL);
|
||||
act->it2.subtype = EVRY_TYPE_DIR;
|
||||
act->remember_context = EINA_FALSE;
|
||||
EVRY_ITEM_DATA_INT_SET(act, ACT_COPY);
|
||||
evry_action_register(act, 2);
|
||||
_actions = eina_list_append(_actions, act);
|
||||
|
@ -1260,7 +1273,6 @@ _plugins_init(void)
|
|||
"go-next",
|
||||
_file_copy_action, NULL);
|
||||
act->it2.subtype = EVRY_TYPE_DIR;
|
||||
act->remember_context = EINA_FALSE;
|
||||
EVRY_ITEM_DATA_INT_SET(act, ACT_MOVE);
|
||||
evry_action_register(act, 2);
|
||||
_actions = eina_list_append(_actions, act);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "e.h"
|
||||
|
||||
#define EVRY_API_VERSION 12
|
||||
#define EVRY_API_VERSION 13
|
||||
|
||||
#define EVRY_ACTION_OTHER 0
|
||||
#define EVRY_ACTION_FINISHED 1
|
||||
|
@ -89,20 +89,22 @@ typedef unsigned int Evry_Type;
|
|||
#define EVRY_ITEM_ICON_SET(_item, _icon) ((Evry_Item *)_item)->icon = _icon
|
||||
|
||||
|
||||
#define EVRY_ITEM_NEW(_base, _plugin, _label, _icon_get, _free) \
|
||||
(_base *) evry_item_new(EVRY_ITEM(E_NEW(_base, 1)), EVRY_PLUGIN(_plugin), _label, _icon_get, _free);
|
||||
#define EVRY_ITEM_NEW(_base, _plugin, _label, _icon_get, _free) \
|
||||
(_base *) evry_item_new(EVRY_ITEM(E_NEW(_base, 1)), EVRY_PLUGIN(_plugin), \
|
||||
_label, _icon_get, _free)
|
||||
|
||||
|
||||
#define EVRY_PLUGIN_NEW(_base, _name, _icon, _item_type, _begin, _cleanup, _fetch, _free) \
|
||||
evry_plugin_new(EVRY_PLUGIN(E_NEW(_base, 1)), _name, _(_name), _icon, _item_type, _begin, _cleanup, _fetch, _free) \
|
||||
evry_plugin_new(EVRY_PLUGIN(E_NEW(_base, 1)), _name, _(_name), _icon, _item_type, \
|
||||
_begin, _cleanup, _fetch, _free)
|
||||
|
||||
|
||||
#define EVRY_ACTION_NEW(_name, _in1, _in2, _icon, _action, _check) \
|
||||
#define EVRY_ACTION_NEW(_name, _in1, _in2, _icon, _action, _check) \
|
||||
evry_action_new(_name, _(_name), _in1, _in2, _icon, _action, _check)
|
||||
|
||||
|
||||
#define EVRY_PLUGIN_FREE(_p) \
|
||||
if (_p) evry_plugin_free(EVRY_PLUGIN(_p));
|
||||
if (_p) evry_plugin_free(EVRY_PLUGIN(_p))
|
||||
|
||||
|
||||
#define EVRY_PLUGIN_ITEMS_CLEAR(_p) \
|
||||
|
@ -110,13 +112,11 @@ typedef unsigned int Evry_Type;
|
|||
eina_list_free(EVRY_PLUGIN(_p)->items); \
|
||||
EVRY_PLUGIN(_p)->items = NULL;
|
||||
|
||||
|
||||
#define EVRY_PLUGIN_ITEMS_FREE(_p) \
|
||||
Evry_Item *evryitem; \
|
||||
EINA_LIST_FREE(EVRY_PLUGIN(_p)->items, evryitem) \
|
||||
evry_item_free(evryitem)
|
||||
|
||||
|
||||
#define EVRY_PLUGIN_ITEMS_SORT(_p, _sortcb) \
|
||||
EVRY_PLUGIN(_p)->items = eina_list_sort \
|
||||
(EVRY_PLUGIN(_p)->items, eina_list_count(EVRY_PLUGIN(_p)->items), _sortcb)
|
||||
|
@ -184,7 +184,7 @@ struct _Evry_Action
|
|||
/* identifier */
|
||||
const char *name;
|
||||
|
||||
struct
|
||||
struct
|
||||
{
|
||||
const Evry_Item *item;
|
||||
Evry_Type type;
|
||||
|
@ -193,7 +193,7 @@ struct _Evry_Action
|
|||
Eina_List *items;
|
||||
} it1;
|
||||
|
||||
struct
|
||||
struct
|
||||
{
|
||||
const Evry_Item *item;
|
||||
Evry_Type type;
|
||||
|
@ -205,7 +205,7 @@ struct _Evry_Action
|
|||
/* this action is specific for a context. e.g. copy for file-type
|
||||
is not, image viewer is. default is TRUE */
|
||||
Eina_Bool remember_context;
|
||||
|
||||
|
||||
int (*action) (Evry_Action *act);
|
||||
int (*check_item) (Evry_Action *act, const Evry_Item *it);
|
||||
void (*free) (Evry_Action *act);
|
||||
|
@ -235,59 +235,68 @@ struct _Evry_Plugin
|
|||
/* identifier */
|
||||
const char *name;
|
||||
|
||||
/* show this plugin only when triggered */
|
||||
const char *trigger;
|
||||
|
||||
/* list of items visible for everything after fetch */
|
||||
Eina_List *items;
|
||||
|
||||
/* run when plugin is activated. when returns plugin it is added
|
||||
to the list of current plugins and queried for results */
|
||||
Evry_Plugin *(*begin) (Evry_Plugin *p, const Evry_Item *item);
|
||||
|
||||
/* get candidates matching string, fill 'items' list */
|
||||
/* required: get candidates matching string, fill 'items' list */
|
||||
int (*fetch) (Evry_Plugin *p, const char *input);
|
||||
|
||||
/* run when state is removed in which this plugin is active */
|
||||
/* required: run when state is removed in which this plugin is
|
||||
active. free 'items' here */
|
||||
void (*finish) (Evry_Plugin *p);
|
||||
|
||||
/* try to complete current item:
|
||||
/* optional: plugin is added to the list of current plugins and
|
||||
queried for results when not returning NULL. The previos
|
||||
selectors item is passed, i.e. a plugin registered as action
|
||||
receives the subject, a plugin registered as object receives the
|
||||
action item. here you can check wheter the plugin can be queried,
|
||||
for given context (provided by item) */
|
||||
Evry_Plugin *(*begin) (Evry_Plugin *p, const Evry_Item *item);
|
||||
|
||||
/* optional: provide a list of subitems of 'item'. this function
|
||||
must return a new instance which must be freed in 'finish' */
|
||||
Evry_Plugin *(*browse) (Evry_Plugin *p, const Evry_Item *item);
|
||||
|
||||
/* optional: try to complete current item:
|
||||
return: EVRY_COMPLETE_INPUT when input was changed
|
||||
return: EVRY_COMPLETE_BROWSE to browse item */
|
||||
int (*complete) (Evry_Plugin *p, const Evry_Item *item, char **input);
|
||||
|
||||
/* handle key events: return 1 when key is handled by plugin */
|
||||
/* optional: handle key events: return positive when key was
|
||||
handled */
|
||||
int (*cb_key_down) (Evry_Plugin *p, const Ecore_Event_Key *ev);
|
||||
|
||||
/* optional: use this when you extend the plugin struct */
|
||||
/* optional: use this when begin returned a new instance or you
|
||||
have extended plugin struct */
|
||||
void (*free) (Evry_Plugin *p);
|
||||
|
||||
/* show in aggregator */
|
||||
/* optional: show in aggregator */
|
||||
/* default TRUE */
|
||||
Eina_Bool aggregate;
|
||||
|
||||
/* whether the plugin uses evry_async_update to add new items. */
|
||||
/* optinal: whether the plugin uses evry_async_update to add new items */
|
||||
/* default FALSE */
|
||||
Eina_Bool async_fetch;
|
||||
|
||||
/* request VIEW_MODE for plugin */
|
||||
/* optional: request VIEW_MODE for plugin */
|
||||
int view_mode;
|
||||
|
||||
/* request items to be remembered for usage statistic */
|
||||
/* optional: request items to be remembered for usage statistic */
|
||||
/* default TRUE */
|
||||
Eina_Bool history;
|
||||
|
||||
/* if transient, item is removed from history on shutdown */
|
||||
/* optional: if transient, item is removed from history on cleanup */
|
||||
/* default FALSE */
|
||||
Eina_Bool transient;
|
||||
|
||||
/* not to be set by plugin! */
|
||||
Plugin_Config *config;
|
||||
|
||||
/* config path registered for the module */
|
||||
/* optional: config path registered for the module */
|
||||
const char *config_path;
|
||||
|
||||
/* do not set by plugin! */
|
||||
/* optional: default trigger. show this plugin only when triggered */
|
||||
const char *trigger;
|
||||
|
||||
/* not to be set by plugin! */
|
||||
Plugin_Config *config;
|
||||
unsigned int request;
|
||||
};
|
||||
|
||||
|
@ -404,7 +413,7 @@ struct _Plugin_Config
|
|||
|
||||
int min_query;
|
||||
int aggregate;
|
||||
|
||||
|
||||
Evry_Plugin *plugin;
|
||||
};
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ evry_show(E_Zone *zone, const char *params)
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
E_OBJECT_CHECK_RETURN(zone, 0);
|
||||
E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0);
|
||||
|
||||
|
@ -279,7 +279,7 @@ evry_hide(int clear)
|
|||
else if (selector == selectors[2])
|
||||
_evry_selectors_switch(1);
|
||||
}
|
||||
|
||||
|
||||
/* just to be sure */
|
||||
selector = selectors[0];
|
||||
|
||||
|
@ -288,9 +288,9 @@ evry_hide(int clear)
|
|||
slide = 1;
|
||||
_evry_state_pop(selector);
|
||||
}
|
||||
|
||||
_evry_clear(selector);
|
||||
_evry_clear(selector);
|
||||
|
||||
_evry_clear(selector);
|
||||
_evry_clear(selector);
|
||||
Evry_State *s = selector->state;
|
||||
selector->aggregator->fetch(selector->aggregator, s->input);
|
||||
_evry_selector_update(selector);
|
||||
|
@ -300,7 +300,7 @@ evry_hide(int clear)
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* _evry_view_clear(selector->state); */
|
||||
if (_show_timer)
|
||||
ecore_timer_del(_show_timer);
|
||||
|
@ -556,7 +556,7 @@ evry_plugin_async_update(Evry_Plugin *p, int action)
|
|||
|
||||
if (s->request != p->request)
|
||||
return;
|
||||
|
||||
|
||||
agg = sel->aggregator;
|
||||
|
||||
if (action == EVRY_ASYNC_UPDATE_ADD)
|
||||
|
@ -948,7 +948,7 @@ static int
|
|||
_evry_selector_thumb(Evry_Selector *sel, const Evry_Item *it)
|
||||
{
|
||||
Evas_Coord w, h;
|
||||
|
||||
|
||||
if (sel->do_thumb)
|
||||
e_thumb_icon_end(sel->o_thumb);
|
||||
|
||||
|
@ -962,7 +962,7 @@ _evry_selector_thumb(Evry_Selector *sel, const Evry_Item *it)
|
|||
|
||||
if (!file->mime)
|
||||
return 0;
|
||||
|
||||
|
||||
if (!(evry_file_path_get(file)))
|
||||
return 0;
|
||||
|
||||
|
@ -1091,10 +1091,10 @@ _evry_selector_update(Evry_Selector *sel)
|
|||
else
|
||||
edje_object_part_text_set(sel->o_main, "e.text.plugin", "");
|
||||
}
|
||||
|
||||
|
||||
if (sel == selectors[0])
|
||||
{
|
||||
if (item_changed)
|
||||
if (item_changed)
|
||||
{
|
||||
_evry_selector_update_actions(sel);
|
||||
}
|
||||
|
@ -1103,7 +1103,7 @@ _evry_selector_update(Evry_Selector *sel)
|
|||
sel = selectors[1];
|
||||
if (sel->update_timer)
|
||||
ecore_timer_del(sel->update_timer);
|
||||
sel->update_timer = NULL;
|
||||
sel->update_timer = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1281,24 +1281,23 @@ evry_browse_item(Evry_Selector *sel)
|
|||
if (!it || !it->browseable)
|
||||
return 0;
|
||||
|
||||
if (it->plugin->begin && (pp = it->plugin->begin(it->plugin, it)))
|
||||
plugins = eina_list_append(plugins, pp);
|
||||
|
||||
if (!plugins)
|
||||
EINA_LIST_FOREACH(sel->plugins, l, p)
|
||||
{
|
||||
EINA_LIST_FOREACH(sel->plugins, l, p)
|
||||
{
|
||||
if (p == it->plugin)
|
||||
continue;
|
||||
if (p == it->plugin)
|
||||
continue;
|
||||
|
||||
if (!p->begin)
|
||||
continue;
|
||||
if (!p->browse)
|
||||
continue;
|
||||
|
||||
if ((pp = p->begin(p, it)))
|
||||
plugins = eina_list_append(plugins, pp);
|
||||
}
|
||||
if ((pp = p->browse(p, it)))
|
||||
plugins = eina_list_append(plugins, pp);
|
||||
}
|
||||
|
||||
/* FIXME this is a special case for actions */
|
||||
if ((!plugins && it->plugin->browse) &&
|
||||
(pp = it->plugin->browse(it->plugin, it)))
|
||||
plugins = eina_list_append(plugins, pp);
|
||||
|
||||
if (!plugins)
|
||||
return 0;
|
||||
|
||||
|
@ -1442,17 +1441,17 @@ _evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|||
|
||||
mod = 0;
|
||||
|
||||
if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)
|
||||
if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)
|
||||
mod |= E_BINDING_MODIFIER_SHIFT;
|
||||
if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)
|
||||
if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)
|
||||
mod |= E_BINDING_MODIFIER_CTRL;
|
||||
if (ev->modifiers & ECORE_EVENT_MODIFIER_ALT)
|
||||
if (ev->modifiers & ECORE_EVENT_MODIFIER_ALT)
|
||||
mod |= E_BINDING_MODIFIER_ALT;
|
||||
if (ev->modifiers & ECORE_EVENT_MODIFIER_WIN)
|
||||
if (ev->modifiers & ECORE_EVENT_MODIFIER_WIN)
|
||||
mod |= E_BINDING_MODIFIER_WIN;
|
||||
|
||||
if (bind->key && (!strcmp(bind->key, ev->keyname)) &&
|
||||
((bind->modifiers == mod) || (bind->any_mod)))
|
||||
((bind->modifiers == mod) || (bind->any_mod)))
|
||||
{
|
||||
if (!(act = e_action_find(bind->action))) continue;
|
||||
|
||||
|
@ -1461,7 +1460,7 @@ _evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!selector || !selector->state)
|
||||
return 1;
|
||||
|
||||
|
@ -1869,7 +1868,7 @@ _evry_plugin_action(Evry_Selector *sel, int finished)
|
|||
act->action(act);
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
act->it1.item = it_subj;
|
||||
act->it1.items = s_subj->sel_items;
|
||||
|
@ -2075,7 +2074,7 @@ _evry_matches_update(Evry_Selector *sel, int async)
|
|||
{
|
||||
EINA_LIST_FOREACH(s->cur_plugins, l, p)
|
||||
{
|
||||
p->request = s->request;
|
||||
p->request = s->request;
|
||||
p->fetch(p, s->input);
|
||||
}
|
||||
}
|
||||
|
@ -2131,7 +2130,7 @@ _evry_matches_update(Evry_Selector *sel, int async)
|
|||
if ((p->config->trigger) && (p->config->trigger_only))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (p == sel->aggregator)
|
||||
continue;
|
||||
|
||||
|
@ -2141,7 +2140,7 @@ _evry_matches_update(Evry_Selector *sel, int async)
|
|||
s->cur_plugins = eina_list_append(s->cur_plugins, p);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
p->request = s->request;
|
||||
|
||||
if ((p->fetch(p, input)) || (sel->states->next))
|
||||
|
|
|
@ -132,7 +132,6 @@ _hist_entry_cleanup_cb(const Eina_Hash *hash, const void *key, void *data, void
|
|||
if (hi->data)
|
||||
eina_stringshare_del(hi->data);
|
||||
E_FREE(hi);
|
||||
printf("remove %s\n", (char *) key);
|
||||
|
||||
he->items = eina_list_remove_list(he->items, l);
|
||||
}
|
||||
|
|
|
@ -33,37 +33,41 @@ _finish(Evry_Plugin *plugin)
|
|||
}
|
||||
}
|
||||
|
||||
static Evry_Plugin *
|
||||
_browse(Evry_Plugin *plugin, const Evry_Item *it)
|
||||
{
|
||||
Evry_Action *act;
|
||||
Plugin *p;
|
||||
Eina_List *l;
|
||||
|
||||
if (!CHECK_TYPE(it, EVRY_TYPE_ACTION))
|
||||
return NULL;
|
||||
|
||||
act = EVRY_ACTN(it);
|
||||
|
||||
p = E_NEW(Plugin, 1);
|
||||
p->base = *plugin;
|
||||
p->base.items = NULL;
|
||||
p->actions = act->fetch(act);
|
||||
p->parent = EINA_TRUE;
|
||||
p->action = act;
|
||||
|
||||
return EVRY_PLUGIN(p);
|
||||
}
|
||||
|
||||
static Evry_Plugin *
|
||||
_begin(Evry_Plugin *plugin, const Evry_Item *it)
|
||||
{
|
||||
GET_PLUGIN(p, plugin);
|
||||
Evry_Action *act;
|
||||
Eina_List *l;
|
||||
|
||||
if (!it || !it->type) return NULL;
|
||||
|
||||
if (it->browseable)
|
||||
{
|
||||
EINA_LIST_FOREACH(evry_conf->actions, l, act)
|
||||
{
|
||||
if (act == EVRY_ACTN(it))
|
||||
{
|
||||
p = E_NEW(Plugin, 1);
|
||||
p->base = *plugin;
|
||||
p->base.items = NULL;
|
||||
p->actions = act->fetch(act);
|
||||
p->parent = EINA_TRUE;
|
||||
p->action = act;
|
||||
return EVRY_PLUGIN(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
GET_PLUGIN(p, plugin);
|
||||
|
||||
EINA_LIST_FOREACH(evry_conf->actions, l, act)
|
||||
{
|
||||
if (((!act->it1.type) ||
|
||||
(CHECK_TYPE(it, act->it1.type)) ||
|
||||
(CHECK_SUBTYPE(it, act->it1.type))) &&
|
||||
if (((!act->it1.type) ||
|
||||
(CHECK_TYPE(it, act->it1.type)) ||
|
||||
(CHECK_SUBTYPE(it, act->it1.type))) &&
|
||||
(!act->check_item || act->check_item(act, it)))
|
||||
{
|
||||
act->base.plugin = plugin;
|
||||
|
@ -112,7 +116,7 @@ _cb_sort(const void *data1, const void *data2)
|
|||
}
|
||||
|
||||
if (it1->fuzzy_match || it2->fuzzy_match)
|
||||
|
||||
|
||||
if (it1->fuzzy_match || it2->fuzzy_match)
|
||||
{
|
||||
if (it1->fuzzy_match && !it2->fuzzy_match)
|
||||
|
@ -164,7 +168,17 @@ evry_plug_actions_new(Evry_Selector *sel, int type)
|
|||
{
|
||||
Evry_Plugin *plugin;
|
||||
|
||||
plugin = EVRY_PLUGIN_NEW(Plugin, N_("Actions"), NULL, 0, _begin, _finish, _fetch, NULL);
|
||||
if (type == EVRY_PLUGIN_SUBJECT)
|
||||
{
|
||||
plugin = EVRY_PLUGIN_NEW(Plugin, N_("Actions"), NULL, 0, NULL, _finish, _fetch, NULL);
|
||||
}
|
||||
else if (type == EVRY_PLUGIN_ACTION)
|
||||
{
|
||||
plugin = EVRY_PLUGIN_NEW(Plugin, N_("Actions"), NULL, 0, _begin, _finish, _fetch, NULL);
|
||||
}
|
||||
else return NULL;
|
||||
|
||||
plugin->browse = &_browse;
|
||||
|
||||
GET_PLUGIN(p, plugin);
|
||||
p->selector = sel;
|
||||
|
|
|
@ -160,7 +160,8 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
|||
EINA_LIST_FOREACH(pp->items, l, it)
|
||||
{
|
||||
if (it->usage >= 0)
|
||||
evry_history_item_usage_set(p->selector->history, it, input, context);
|
||||
evry_history_item_usage_set(p->selector->history,
|
||||
it, input, context);
|
||||
it->fuzzy_match = evry_fuzzy_match(it->label, input);
|
||||
items = _add_item(p, items, it);
|
||||
}
|
||||
|
@ -179,7 +180,8 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
|||
if (it->fuzzy_match || p->selector == selectors[2])
|
||||
{
|
||||
if (it->usage >= 0)
|
||||
evry_history_item_usage_set(p->selector->history, it, input, context);
|
||||
evry_history_item_usage_set(p->selector->history,
|
||||
it, input, context);
|
||||
|
||||
items = _add_item(p, items, it);
|
||||
}
|
||||
|
@ -196,7 +198,8 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
|||
EINA_LIST_FOREACH(pp->items, ll, it)
|
||||
{
|
||||
if (it->usage >= 0)
|
||||
evry_history_item_usage_set(p->selector->history, it, NULL, context);
|
||||
evry_history_item_usage_set(p->selector->history,
|
||||
it, NULL, context);
|
||||
it->fuzzy_match = 0;
|
||||
items = _add_item(p, items, it);
|
||||
}
|
||||
|
@ -210,10 +213,12 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
|||
EINA_LIST_FOREACH(pp->items, ll, it)
|
||||
{
|
||||
if ((it->usage >= 0) &&
|
||||
(evry_history_item_usage_set(p->selector->history, it, input, context)) &&
|
||||
(evry_history_item_usage_set(p->selector->history,
|
||||
it, input, context)) &&
|
||||
(!eina_list_data_find_list(items, it)))
|
||||
{
|
||||
items = _add_item(p, items, it);
|
||||
it->fuzzy_match = 0;
|
||||
items = _add_item(p, items, it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue