not to have any data lying around after cleanup you
can use this */
#define EVRY_PLUGIN_FREE(_p) \
- evry_plugin_free(EVRY_PLUGIN(_p), 0); \
+ if (_p) evry_plugin_free(EVRY_PLUGIN(_p), 0); \
E_FREE(_p);
struct _Evry_Item
/* use up/down keys for prev/next in thumb view */
int cycle_mode;
+ unsigned char first_run;
+
/* not saved data */
- Eina_List *plugins;
Eina_List *actions;
Eina_List *views;
-
+
int min_w, min_h;
-
- unsigned char first_run;
};
struct _Plugin_Config
/* #undef DBG
* #define DBG(...) ERR(__VA_ARGS__) */
-#define CONFIG_VERSION 12
+#define CONFIG_VERSION 13
/* actual module specifics */
static void _e_mod_action_cb(E_Object *obj, const char *params);
evry_plug_clipboard_shutdown();
evry_plug_text_shutdown();
- EINA_LIST_FREE(evry_conf->plugins, p)
- evry_plugin_free(p, 1);
+ /* EINA_LIST_FREE(evry_conf->plugins, p)
+ * evry_plugin_free(p, 1); */
EINA_LIST_FREE(evry_conf->actions, a)
evry_action_free(a);
e_modapi_save(E_Module *m __UNUSED__)
{
e_config_domain_save("module.everything", conf_edd, evry_conf);
-
return 1;
}
evry_conf->version = 11;
}
- if (evry_conf && evry_conf->version == 11)
+ if (evry_conf && evry_conf->version <= 12)
{
Plugin_Config *pc;
+ Eina_List *conf[3];
+ int i;
- EINA_LIST_FREE(evry_conf->conf_subjects, pc)
- {
- if (pc->name) eina_stringshare_del(pc->name);
- if (pc->trigger) eina_stringshare_del(pc->trigger);
- E_FREE(pc);
- }
- EINA_LIST_FREE(evry_conf->conf_actions, pc)
- {
- if (pc->name) eina_stringshare_del(pc->name);
- if (pc->trigger) eina_stringshare_del(pc->trigger);
- E_FREE(pc);
- }
- EINA_LIST_FREE(evry_conf->conf_objects, pc)
+ conf[0] = evry_conf->conf_subjects;
+ conf[1] = evry_conf->conf_actions;
+ conf[2] = evry_conf->conf_objects;
+
+ for (i = 0; i < 3; i++)
{
- if (pc->name) eina_stringshare_del(pc->name);
- if (pc->trigger) eina_stringshare_del(pc->trigger);
- E_FREE(pc);
+ EINA_LIST_FREE(conf[i], pc)
+ {
+ if (pc->name) eina_stringshare_del(pc->name);
+ if (pc->trigger) eina_stringshare_del(pc->trigger);
+ E_FREE(pc);
+ }
}
+ evry_conf->conf_subjects = NULL;
+ evry_conf->conf_actions = NULL;
+ evry_conf->conf_objects = NULL;
+
evry_conf->version = CONFIG_VERSION;
}
_config_free(void)
{
Plugin_Config *pc;
+ int i;
+ Eina_List *conf[3];
- /* free config */
- if (evry_conf->cmd_terminal)
- eina_stringshare_del(evry_conf->cmd_terminal);
- EINA_LIST_FREE(evry_conf->conf_subjects, pc)
- {
- if (pc->name) eina_stringshare_del(pc->name);
- if (pc->trigger) eina_stringshare_del(pc->trigger);
- E_FREE(pc);
- }
- EINA_LIST_FREE(evry_conf->conf_actions, pc)
- {
- if (pc->name) eina_stringshare_del(pc->name);
- if (pc->trigger) eina_stringshare_del(pc->trigger);
- E_FREE(pc);
- }
- EINA_LIST_FREE(evry_conf->conf_objects, pc)
+ conf[0] = evry_conf->conf_subjects;
+ conf[1] = evry_conf->conf_actions;
+ conf[2] = evry_conf->conf_objects;
+
+ for (i = 0; i < 3; i++)
{
- if (pc->name) eina_stringshare_del(pc->name);
- if (pc->trigger) eina_stringshare_del(pc->trigger);
- E_FREE(pc);
+ EINA_LIST_FREE(conf[i], pc)
+ {
+ if (pc->name) eina_stringshare_del(pc->name);
+ if (pc->trigger) eina_stringshare_del(pc->trigger);
+ if (pc->plugin) evry_plugin_free(pc->plugin, 1);
+ E_FREE(pc);
+ }
}
+
+ if (evry_conf->cmd_terminal)
+ eina_stringshare_del(evry_conf->cmd_terminal);
+ if (evry_conf->cmd_sudo)
+ eina_stringshare_del(evry_conf->cmd_sudo);
+
E_FREE(evry_conf);
}
static int
_evry_cb_plugin_sort(const void *data1, const void *data2)
{
- const Evry_Plugin *p1 = data1;
- const Evry_Plugin *p2 = data2;
- if (!p1->config) return -1;
- if (!p2->config) return 1;
+ const Plugin_Config *pc1 = data1;
+ const Plugin_Config *pc2 = data2;
- return p1->config->priority - p2->config->priority;
+ return pc1->priority - pc2->priority;
}
Evry_Plugin *
p->history = EINA_TRUE;
p->view_mode = VIEW_MODE_NONE;
- DBG("%s", p->name);
-
return p;
}
evry_plugin_unregister(p);
DBG("%s", p->name);
-
+ if (p->config) p->config->plugin = NULL;
if (p->name) eina_stringshare_del(p->name);
if (p->label) eina_stringshare_del(p->label);
if (p->type_in) eina_stringshare_del(p->type_in);
act->action = action;
act->check_item = check_item;
act->icon = (icon ? eina_stringshare_add(icon) : NULL);
-
- DBG("%s", name);
return act;
}
void
evry_plugin_register(Evry_Plugin *p, int priority)
{
- Eina_List *l, *confs = NULL;
+ Eina_List *l, *confs;
Plugin_Config *pc;
-
- DBG("%s", p->name);
+ Eina_List *conf[3];
+ int i = 0;
- evry_conf->plugins = eina_list_append(evry_conf->plugins, p);
-
- if (p->type == type_subject)
- confs = evry_conf->conf_subjects;
- else if (p->type == type_action)
- confs = evry_conf->conf_actions;
- else if (p->type == type_object)
- confs = evry_conf->conf_objects;
+ conf[0] = evry_conf->conf_subjects;
+ conf[1] = evry_conf->conf_actions;
+ conf[2] = evry_conf->conf_objects;
- EINA_LIST_FOREACH(confs, l, pc)
+ EINA_LIST_FOREACH(conf[p->type], l, pc)
if (pc->name && p->name && !strcmp(pc->name, p->name))
break;
pc->trigger = eina_stringshare_add(p->trigger);
pc->trigger_only = 1;
}
-
- pc->plugin = p;
- confs = eina_list_append(confs, pc);
+ conf[p->type] = eina_list_append(conf[p->type], pc);
}
p->config = pc;
- evry_conf->plugins = eina_list_sort(evry_conf->plugins,
- eina_list_count(evry_conf->plugins),
- _evry_cb_plugin_sort);
+ pc->plugin = p;
+
+ conf[p->type] = eina_list_sort(conf[p->type], -1, _evry_cb_plugin_sort);
- if (p->type == type_subject)
- evry_conf->conf_subjects = confs;
- else if (p->type == type_action)
- evry_conf->conf_actions = confs;
- else if (p->type == type_object)
- evry_conf->conf_objects = confs;
+ EINA_LIST_FOREACH(conf[p->type], l, pc)
+ pc->priority = i++;
+
+ evry_conf->conf_subjects = conf[0];
+ evry_conf->conf_actions = conf[1];
+ evry_conf->conf_objects = conf[2];
- if (p->type == type_subject)
+ if (p->type == type_subject && !p->type_in)
{
char buf[256];
snprintf(buf, sizeof(buf), _("Show %s Plugin"), p->name);
{
DBG("%s", p->name);
- evry_conf->plugins = eina_list_remove(evry_conf->plugins, p);
+ /* evry_conf->plugins = eina_list_remove(evry_conf->plugins, p); */
if (p->type == type_subject)
{
int evry_show(E_Zone *zone, const char *params);
void evry_hide(void);
-EAPI Evry_Plugin *evry_plug_aggregator_new(Evry_Selector *selector);
+EAPI Evry_Plugin *evry_plug_aggregator_new(Evry_Selector *selector, int type);
EAPI void evry_plug_aggregator_free(Evry_Plugin *plugin);
EAPI Evry_Plugin *evry_plug_actions_new(int type);
ecore_timer_del(_show_timer);
_show_timer = NULL;
-
list->visible = EINA_FALSE;
_evry_selector_free(selectors[0]);
_evry_selector_free(selectors[1]);
static Evry_Selector *
_evry_selector_new(int type)
{
- Evry_Plugin *p;
- Eina_List *l;
+ Plugin_Config *pc;
+ Eina_List *l, *pcs;
Evry_Selector *sel = E_NEW(Evry_Selector, 1);
Evas_Object *o = edje_object_add(win->popup->evas);
sel->o_main = o;
"e/modules/everything/selector_item");
evas_object_show(o);
+ sel->aggregator = evry_plug_aggregator_new(sel, type);
+
if (type == type_subject)
{
sel->history = evry_hist->subjects;
- sel->actions = evry_plug_actions_new(type_subject);
+ sel->actions = evry_plug_actions_new(type);
edje_object_part_swallow(win->o_main, "e.swallow.subject_selector", o);
+ pcs = evry_conf->conf_subjects;
}
else if (type == type_action)
{
sel->history = evry_hist->actions;
- sel->actions = evry_plug_actions_new(type_action);
+ sel->actions = evry_plug_actions_new(type);
edje_object_part_swallow(win->o_main, "e.swallow.action_selector", o);
+ pcs = evry_conf->conf_actions;
}
else if (type == type_object)
{
sel->history = evry_hist->subjects;
edje_object_part_swallow(win->o_main, "e.swallow.object_selector", o);
+ pcs = evry_conf->conf_objects;
}
- p = evry_plug_aggregator_new(sel);
-
- sel->plugins = eina_list_append(sel->plugins, p);
- sel->aggregator = p;
-
- EINA_LIST_FOREACH(evry_conf->plugins, l, p)
+ EINA_LIST_FOREACH(pcs, l, pc)
{
- if (!p->config->enabled) continue;
- if (p->type != type) continue;
- sel->plugins = eina_list_append(sel->plugins, p);
+ if (!pc->enabled) continue;
+ if (!pc->plugin) continue;
+ if (pc->plugin == sel->aggregator) continue;
+ sel->plugins = eina_list_append(sel->plugins, pc->plugin);
}
return sel;
while (sel->states)
_evry_state_pop(sel);
- if (sel->aggregator)
- evry_plugin_free(sel->aggregator, 1);
-
- if (sel->actions)
- evry_plug_actions_free(sel->actions);
-
+ EVRY_PLUGIN_FREE(sel->aggregator);
+ EVRY_PLUGIN_FREE(sel->actions);
+
if (sel->plugins) eina_list_free(sel->plugins);
if (sel->update_timer)
EINA_LIST_FOREACH(sel->plugins, l, plugin)
{
- if ((plugin == sel->actions) || (plugin == sel->aggregator) ||
+ if ((plugin == sel->actions) ||
(plugin->type_in && type_out && plugin->type_in == type_out))
{
if (plugin->begin)
EINA_LIST_FREE(s->plugins, p)
p->cleanup(p);
- if (sel->aggregator)
- sel->aggregator->cleanup(sel->aggregator);
+ sel->aggregator->cleanup(sel->aggregator);
E_FREE(s);
{
_evry_selector_objects_get(act);
_evry_selector_update(selectors[2]);
- edje_object_signal_emit(win->o_main,
- "e,state,object_selector_show", "e");
+ edje_object_signal_emit(win->o_main, "e,state,object_selector_show", "e");
next_selector = 2;
}
_evry_selector_activate(selectors[next_selector]);
else if (selector == selectors[1] && dir < 0)
{
_evry_selector_activate(selectors[0]);
-
- edje_object_signal_emit(win->o_main,
- "e,state,object_selector_hide", "e");
+ edje_object_signal_emit(win->o_main, "e,state,object_selector_hide", "e");
}
else if (selector == selectors[2] && dir > 0)
{
while (selector->states)
_evry_state_pop(selector);
- edje_object_signal_emit(win->o_main,
- "e,state,object_selector_hide", "e");
-
+ edje_object_signal_emit(win->o_main, "e,state,object_selector_hide", "e");
_evry_selector_activate(selectors[0]);
}
else if (selector == selectors[2] && dir < 0)
if ((len_inp >= len) &&
(!strncmp(s->inp, p->config->trigger, len)))
{
- len_trigger = len;
+ len_trigger = len;
s->cur_plugins = eina_list_append(s->cur_plugins, p);
if(len_inp == len)
p->fetch(p, NULL);
if (!s->cur_plugins)
{
- s->input = s->inp;
+ s->input = s->inp;
- EINA_LIST_FOREACH(s->plugins, l, p)
+ EINA_LIST_FOREACH(s->plugins, l, p)
{
if ((!win->plugin_dedicated) &&
(p->config->trigger_only) &&
}
}
- if ((eina_list_count(s->cur_plugins) > 0) &&
- /* dont add aggregator when there is only one plugin
- which wont show items in agrregator */
- !(eina_list_count(s->cur_plugins) == 1 &&
- !((Evry_Plugin *)s->cur_plugins->data)->aggregate))
- {
- s->cur_plugins = eina_list_prepend(s->cur_plugins, sel->aggregator);
- sel->aggregator->fetch(sel->aggregator, input);
- }
- else
- sel->aggregator->cleanup(sel->aggregator);
+ if (sel->aggregator->fetch(sel->aggregator, input))
+ _evry_plugin_list_insert(s, sel->aggregator);
}
if (s->plugin_auto_selected ||
p = s->cur_plugins->data;
s->plugin_auto_selected = EINA_TRUE;
}
- else if (p)
- {
- s->plugin_auto_selected = EINA_FALSE;
- }
+
+ if (p)
+ s->plugin_auto_selected = EINA_FALSE;
if (s->plugin != p)
- {
- _evry_item_desel(s, NULL);
- }
+ _evry_item_desel(s, NULL);
s->plugin = p;
}
C(scroll_speed);
#undef C
- /* evry_conf->plugins = eina_list_sort(evry_conf->plugins, -1,
- * _evry_cb_plugin_sort); */
-
if (evry_conf->conf_subjects) eina_list_free(evry_conf->conf_subjects);
if (evry_conf->conf_actions) eina_list_free(evry_conf->conf_actions);
if (evry_conf->conf_objects) eina_list_free(evry_conf->conf_objects);
/* first is aggregator itself */
lp = s->cur_plugins->next;
-
- /* EINA_LIST_FOREACH(lp, l, pp)
- * {
- * if (pp->changed)
- * {
- * plugin->changed = 1;
- * break;
- * }
- * }
- *
- * if (!plugin->changed)
- * return 1; */
- /* printf("aggreator changed\n"); */
-
EVRY_PLUGIN_ITEMS_FREE(p);
return o;
}
-static void
-_plugin_free(Evry_Plugin *plugin)
-{
- PLUGIN(p, plugin);
-
- E_FREE(plugin->config);
- E_FREE(p);
-}
-
Evry_Plugin *
-evry_plug_aggregator_new(Evry_Selector *selector)
+evry_plug_aggregator_new(Evry_Selector *sel, int type)
{
Plugin *p;
- Plugin_Config *pc;
-
+
p = E_NEW(Plugin, 1);
- EVRY_PLUGIN_NEW(EVRY_PLUGIN(p), N_("All"), 0, "", "",
- NULL, _cleanup, _fetch, _icon_get, _plugin_free);
+ EVRY_PLUGIN_NEW(EVRY_PLUGIN(p), N_("All"), type, "", "",
+ NULL, _cleanup, _fetch, _icon_get, NULL);
EVRY_PLUGIN(p)->action = &_action;
-
- pc = E_NEW(Plugin_Config, 1);
- pc->enabled = 1;
- pc->priority = -1;
- pc->view_mode = -1;
- EVRY_PLUGIN(p)->config = pc;
-
- p->selector = selector;
+ EVRY_PLUGIN(p)->history = EINA_FALSE;
+
+ evry_plugin_register(EVRY_PLUGIN(p), -1);
+ p->selector = sel;
return EVRY_PLUGIN(p);
}
}
sd->items = eina_list_sort(sd->items, eina_list_count(sd->items), _sort_cb);
-
+ if (!sd->cur_item && sd->items) sd->cur_item = sd->items->data;
+
if (update || !last_vis || v->plugin != p)
{
v->plugin = p;
if (sd->items)
l = eina_list_data_find_list(sd->items, sd->cur_item);
-
+ if (!l)
+ l = sd->items;
+
if (v->mode == VIEW_MODE_THUMB && !evry_conf->cycle_mode)
{
if (!strcmp(ev->key, "Right"))