'everything'

- add plugin option whether items should be shown in aggregator
- fix cleanup of thumb view when there are no items


SVN revision: 47677
This commit is contained in:
Hannes Janetzek 2010-04-02 04:19:38 +00:00
parent d50bb8061f
commit fc578352d0
8 changed files with 72 additions and 20 deletions

View File

@ -6,6 +6,7 @@
#define EVRY_ASYNC_UPDATE_ADD 0 #define EVRY_ASYNC_UPDATE_ADD 0
#define EVRY_ASYNC_UPDATE_CLEAR 1 #define EVRY_ASYNC_UPDATE_CLEAR 1
#define EVRY_ASYNC_UPDATE_REFRESH 2
extern int _e_module_evry_log_dom; extern int _e_module_evry_log_dom;
@ -145,9 +146,6 @@ struct _Evry_Plugin
const char *trigger; const char *trigger;
/* whether the plugin uses evry_async_update to add new items */
int async_fetch;
/* list of items visible for everything */ /* list of items visible for everything */
Eina_List *items; Eina_List *items;
@ -171,6 +169,13 @@ struct _Evry_Plugin
Evas_Object *(*config_page) (Evry_Plugin *p); Evas_Object *(*config_page) (Evry_Plugin *p);
void (*config_apply) (Evry_Plugin *p); void (*config_apply) (Evry_Plugin *p);
/* show in aggregator. default is TRUE */
Eina_Bool aggregate;
/* whether the plugin uses evry_async_update to add new
items. default is FALSE */
Eina_Bool async_fetch;
/* not to be set by plugin! */ /* not to be set by plugin! */
Plugin_Config *config; Plugin_Config *config;
}; };
@ -240,6 +245,8 @@ struct _Evry_Action
/* use icon name from theme */ /* use icon name from theme */
const char *icon; const char *icon;
void *data;
int priority; int priority;
}; };

View File

@ -41,9 +41,14 @@ EAPI E_Module_Api e_modapi =
static Eina_Bool list_cb(Eina_Module *m, void *data) static Eina_Bool list_cb(Eina_Module *m, void *data)
{ {
if (eina_module_load(m)) int err;
return EINA_TRUE;
if ((err = eina_module_load(m)))
{
return EINA_TRUE;
}
ERR("loading failed (%d), %s", err, eina_module_file_get(m));
return EINA_FALSE; return EINA_FALSE;
} }
@ -243,7 +248,7 @@ _config_init()
evry_conf->scroll_animate = 0; evry_conf->scroll_animate = 0;
evry_conf->scroll_speed = 0.08; evry_conf->scroll_speed = 0.08;
evry_conf->hide_input = 0; evry_conf->hide_input = 0;
evry_conf->hide_list = 1; evry_conf->hide_list = 0;
evry_conf->quick_nav = 1; evry_conf->quick_nav = 1;
evry_conf->conf_subjects = NULL; evry_conf->conf_subjects = NULL;
evry_conf->conf_actions = NULL; evry_conf->conf_actions = NULL;
@ -396,6 +401,8 @@ evry_plugin_new(Evry_Plugin *base, const char *name, int type,
p->action = action; p->action = action;
p->config_page = config_page; p->config_page = config_page;
p->config_apply = config_apply; p->config_apply = config_apply;
p->aggregate = EINA_TRUE;
p->async_fetch = EINA_FALSE;
return p; return p;
} }

View File

@ -317,8 +317,16 @@ evry_item_select(const Evry_State *state, Evry_Item *it)
{ {
Evry_State *s = (Evry_State *)state; Evry_State *s = (Evry_State *)state;
if (!s && it && selector && selector->state)
{
s = selector->state;
if (s->plugin != it->plugin)
return;
}
s->plugin_auto_selected = EINA_FALSE; s->plugin_auto_selected = EINA_FALSE;
s->item_auto_selected = EINA_FALSE; s->item_auto_selected = EINA_FALSE;
_evry_item_sel(s, it); _evry_item_sel(s, it);
_evry_selector_update(selector); _evry_selector_update(selector);
} }
@ -401,7 +409,10 @@ evry_plugin_async_update(Evry_Plugin *p, int action)
} }
/* update aggregator */ /* update aggregator */
if (eina_list_count(s->cur_plugins) > 0) if ((eina_list_count(s->cur_plugins) > 1 ) ||
/* add aggregator for actions */
(selector == selectors[1] &&
(eina_list_count(s->cur_plugins) > 0 )))
{ {
/* add aggregator */ /* add aggregator */
if (!(s->cur_plugins->data == agg)) if (!(s->cur_plugins->data == agg))
@ -428,9 +439,10 @@ evry_plugin_async_update(Evry_Plugin *p, int action)
_evry_view_update(s, NULL); _evry_view_update(s, NULL);
} }
else if (action == EVRY_ASYNC_UPDATE_CLEAR) else if (action == EVRY_ASYNC_UPDATE_REFRESH)
{ {
_evry_view_clear(s);
_evry_view_update(s, NULL);
} }
} }

View File

@ -127,6 +127,8 @@ _fetch(Evry_Plugin *plugin, const char *input)
{ {
EINA_LIST_FOREACH(lp, l, pp) EINA_LIST_FOREACH(lp, l, pp)
{ {
if (!pp->aggregate) continue;
EINA_LIST_FOREACH(pp->items, ll, it) EINA_LIST_FOREACH(pp->items, ll, it)
{ {
if (!it->fuzzy_match) if (!it->fuzzy_match)
@ -149,6 +151,8 @@ _fetch(Evry_Plugin *plugin, const char *input)
{ {
EINA_LIST_FOREACH(lp, l, pp) EINA_LIST_FOREACH(lp, l, pp)
{ {
if (!pp->aggregate) continue;
for (cnt = 0, ll = pp->items; ll && cnt < 50; ll = ll->next, cnt++) for (cnt = 0, ll = pp->items; ll && cnt < 50; ll = ll->next, cnt++)
{ {
if (!eina_list_data_find_list(items, ll->data)) if (!eina_list_data_find_list(items, ll->data))
@ -165,6 +169,8 @@ _fetch(Evry_Plugin *plugin, const char *input)
EINA_LIST_FOREACH(lp, l, pp) EINA_LIST_FOREACH(lp, l, pp)
{ {
if (!pp->aggregate) continue;
EINA_LIST_FOREACH(pp->items, ll, it) EINA_LIST_FOREACH(pp->items, ll, it)
{ {
if (evry_history_item_usage_set(p->selector->history, it, input, context) && if (evry_history_item_usage_set(p->selector->history, it, input, context) &&
@ -181,6 +187,9 @@ _fetch(Evry_Plugin *plugin, const char *input)
if (lp && ((eina_list_count(lp) == 2) || (!EVRY_PLUGIN(p)->items))) if (lp && ((eina_list_count(lp) == 2) || (!EVRY_PLUGIN(p)->items)))
{ {
pp = lp->data; pp = lp->data;
if (pp->aggregate)
{
EINA_LIST_FOREACH(pp->items, l, it) EINA_LIST_FOREACH(pp->items, l, it)
{ {
if (!eina_list_data_find_list(items, it)) if (!eina_list_data_find_list(items, it))
@ -191,6 +200,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
} }
} }
} }
}
if (items) eina_list_free(items); if (items) eina_list_free(items);

View File

@ -340,13 +340,23 @@ evry_util_exec_app(const Evry_Item *it_app, const Evry_Item *it_file)
if (it_file) if (it_file)
{ {
ITEM_FILE(file, it_file); ITEM_FILE(file, it_file);
int len;
len = strlen(app->file) + strlen(file->uri) + 2; /* files = eina_list_append(files, file->uri);
*
* e_exec(zone, NULL, app->file, files, NULL);
*
* if (files)
* eina_list_free(files); */
char *tmp;
int len;
tmp = eina_str_escape(file->uri);
len = strlen(app->file) + strlen(tmp) + 2;
exe = malloc(len); exe = malloc(len);
snprintf(exe, len, "%s %s", app->file, file->uri); snprintf(exe, len, "%s %s", app->file, tmp);
e_exec(zone, NULL, exe, NULL, NULL); e_exec(zone, NULL, exe, NULL, NULL);
free(exe); E_FREE(exe);
E_FREE(tmp);
} }
else else
{ {

View File

@ -326,6 +326,8 @@ _init(void)
"accessories-dictionary", TRIGGER, "accessories-dictionary", TRIGGER,
NULL, _cleanup, _fetch, NULL, NULL, NULL, NULL); NULL, _cleanup, _fetch, NULL, NULL, NULL, NULL);
EVRY_PLUGIN(p)->aggregate = EINA_FALSE;
evry_plugin_register(EVRY_PLUGIN(p), 100); evry_plugin_register(EVRY_PLUGIN(p), 100);
plugin = p; plugin = p;

View File

@ -210,6 +210,8 @@ _init(void)
p1 = evry_plugin_new(NULL, "Calculator", type_subject, NULL, "TEXT", 1, "accessories-calculator", "=", p1 = evry_plugin_new(NULL, "Calculator", type_subject, NULL, "TEXT", 1, "accessories-calculator", "=",
_begin, _cleanup, _fetch, _action, NULL, NULL, NULL); _begin, _cleanup, _fetch, _action, NULL, NULL, NULL);
p1->aggregate = EINA_FALSE;
evry_plugin_register(p1, 0); evry_plugin_register(p1, 0);
return EINA_TRUE; return EINA_TRUE;

View File

@ -635,6 +635,8 @@ _view_clear(Evry_View *view)
Item *it; Item *it;
_clear_items(v->span); _clear_items(v->span);
if (sd->items) eina_list_free(sd->items);
sd->items = NULL;
if (sd->idle_enter) ecore_idle_enterer_del(sd->idle_enter); if (sd->idle_enter) ecore_idle_enterer_del(sd->idle_enter);
sd->idle_enter = ecore_idle_enterer_before_add(_e_smart_reconfigure_do, v->span); sd->idle_enter = ecore_idle_enterer_before_add(_e_smart_reconfigure_do, v->span);