dont match parameters of exec line

SVN revision: 48902
This commit is contained in:
Hannes Janetzek 2010-05-15 21:22:06 +00:00
parent da786a09b0
commit 21a4955ee3
1 changed files with 29 additions and 17 deletions

View File

@ -345,10 +345,8 @@ _item_add(Plugin *p, Efreet_Desktop *desktop, const char *file, int match)
app = EVRY_ITEM_NEW(Evry_Item_App, p, desktop->name, _icon_get, _item_free); app = EVRY_ITEM_NEW(Evry_Item_App, p, desktop->name, _icon_get, _item_free);
EVRY_ACTN(app)->action = &_exec_open_file_action; EVRY_ACTN(app)->action = &_exec_open_file_action;
EVRY_ACTN(app)->remember_context = EINA_TRUE;
EVRY_ITEM(app)->id = eina_stringshare_add(desktop->exec); EVRY_ITEM(app)->id = eina_stringshare_add(desktop->exec);
EVRY_ITEM(app)->subtype = EVRY_TYPE_ACTION;
EVRY_ITEM(app)->fuzzy_match = match;
if (desktop->comment) if (desktop->comment)
EVRY_ITEM(app)->detail = eina_stringshare_add(desktop->comment); EVRY_ITEM(app)->detail = eina_stringshare_add(desktop->comment);
else if (desktop->generic_name) else if (desktop->generic_name)
@ -358,10 +356,7 @@ _item_add(Plugin *p, Efreet_Desktop *desktop, const char *file, int match)
{ {
app = EVRY_ITEM_NEW(Evry_Item_App, p, file, _icon_get, _item_free); app = EVRY_ITEM_NEW(Evry_Item_App, p, file, _icon_get, _item_free);
EVRY_ACTN(app)->action = &_exec_open_file_action; EVRY_ACTN(app)->action = &_exec_open_file_action;
EVRY_ACTN(app)->remember_context = EINA_TRUE;
EVRY_ITEM(app)->id = eina_stringshare_add(file); EVRY_ITEM(app)->id = eina_stringshare_add(file);
EVRY_ITEM(app)->subtype = EVRY_TYPE_ACTION;
EVRY_ITEM(app)->fuzzy_match = match;
} }
app->desktop = desktop; app->desktop = desktop;
@ -390,7 +385,10 @@ _item_add(Plugin *p, Efreet_Desktop *desktop, const char *file, int match)
} }
} }
EVRY_ACTN(app)->remember_context = EINA_TRUE;
EVRY_ITEM(app)->subtype = EVRY_TYPE_ACTION;
EVRY_ITEM(app)->fuzzy_match = match; EVRY_ITEM(app)->fuzzy_match = match;
EVRY_PLUGIN_ITEM_APPEND(p, app); EVRY_PLUGIN_ITEM_APPEND(p, app);
return app; return app;
@ -402,6 +400,8 @@ _add_desktop_list(Plugin *p, Eina_List *apps, const char *input)
Efreet_Desktop *desktop; Efreet_Desktop *desktop;
Eina_List *l; Eina_List *l;
int m1, m2; int m1, m2;
const char *exec, *end;
char buf[PATH_MAX];
EINA_LIST_FOREACH(apps, l, desktop) EINA_LIST_FOREACH(apps, l, desktop)
{ {
@ -410,17 +410,31 @@ _add_desktop_list(Plugin *p, Eina_List *apps, const char *input)
if (input) if (input)
{ {
char *exec = strrchr(desktop->exec, '/'); m1 = m2 = 0;
if (!exec++ || !exec) exec = desktop->exec;
exec = ecore_file_file_get(desktop->exec);
if (exec && (end = strchr(exec, '%')))
{
strncpy(buf, exec, end - exec - 1);
buf[end - exec] = 0;
m1 = evry->fuzzy_match(buf, input);
}
else
{
m1 = evry->fuzzy_match(exec, input);
}
m1 = evry->fuzzy_match(exec, input);
m2 = evry->fuzzy_match(desktop->name, input); m2 = evry->fuzzy_match(desktop->name, input);
if (!m1 || (m2 && m2 < m1)) if (!m1 || (m2 && m2 < m1))
m1 = m2; m1 = m2;
}
if (!input || m1) _item_add(p, desktop, NULL, m1); if (m1) _item_add(p, desktop, NULL, m1);
}
else
{
_item_add(p, desktop, NULL, 0);
}
} }
} }
@ -1285,8 +1299,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,