'everything' module:

- settings plug: dont show system, this duplicates items shown by apps already
- apps plug: free desktops


SVN revision: 41673
This commit is contained in:
Hannes Janetzek 2009-08-10 18:39:11 +00:00
parent d07e0e19a3
commit e19541a137
2 changed files with 45 additions and 47 deletions

View File

@ -65,6 +65,7 @@ _list_free(Evry_Plugin *p)
{ {
app = it->data[0]; app = it->data[0];
if (app->file) eina_stringshare_del(app->file); if (app->file) eina_stringshare_del(app->file);
if (app->desktop) efreet_desktop_free(app->desktop);
E_FREE(app); E_FREE(app);
evry_item_free(it); evry_item_free(it);
} }
@ -91,7 +92,7 @@ _item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio)
{ {
Evry_Item *it; Evry_Item *it;
Evry_App *app; Evry_App *app;
Efreet_Desktop *desktop2; Efreet_Desktop *d2;
Inst *inst = p->private; Inst *inst = p->private;
if (desktop) if (desktop)
@ -105,7 +106,6 @@ _item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio)
Eina_List *l; Eina_List *l;
int len; int len;
char *tmp; char *tmp;
int found = 0;
if (eina_hash_find(inst->added, file)) if (eina_hash_find(inst->added, file))
return; return;
@ -115,26 +115,30 @@ _item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio)
snprintf(match, sizeof(match), "%s*", tmp); snprintf(match, sizeof(match), "%s*", tmp);
l = efreet_util_desktop_exec_glob_list(match); l = efreet_util_desktop_exec_glob_list(match);
EINA_LIST_FREE(l, desktop) EINA_LIST_FREE(l, d2)
if (desktop->exec && !strncmp(file, desktop->exec, len)) {
{ if (!desktop && d2->exec && !strncmp(file, d2->exec, len))
found = 1; {
break; desktop = d2;
} efreet_desktop_ref(desktop);
}
eina_list_free(l); efreet_desktop_free(d2);
}
free(tmp); free(tmp);
if (!found) if (!desktop)
eina_hash_add(inst->added, file, file); eina_hash_add(inst->added, file, file);
} }
if (desktop) if (desktop)
{ {
if ((desktop2 = eina_hash_find(inst->added, file)) && if ((d2 = eina_hash_find(inst->added, file)) &&
desktop == desktop2) ((desktop == d2) ||
(!strcmp(desktop->exec, d2->exec))))
return; return;
efreet_desktop_ref(desktop);
eina_hash_add(inst->added, file, desktop); eina_hash_add(inst->added, file, desktop);
file = NULL; file = NULL;
} }
@ -179,6 +183,7 @@ _add_desktop_list(Evry_Plugin *p, Eina_List *apps, char *m1, char *m2)
* else if (e_util_glob_case_match(desktop->comment, m2)) * else if (e_util_glob_case_match(desktop->comment, m2))
* _item_add(p, desktop, NULL, 4); * _item_add(p, desktop, NULL, 4);
* } */ * } */
efreet_desktop_free(desktop);
} }
} }
@ -262,17 +267,11 @@ _fetch(Evry_Plugin *p, const char *input)
/* add apps matching input */ /* add apps matching input */
if (!p->items && input) if (!p->items && input)
{ {
Eina_List *cats = efreet_util_desktop_categories_list(); l = efreet_util_desktop_name_glob_list("*");
Eina_List *apps; if (l)
const char *cat;
EINA_LIST_FREE(cats, cat)
{ {
if (eina_list_count(p->items) > 99) break; _add_desktop_list(p, l, match1, match2);
if (!strcmp(cat, "Screensaver")) continue; eina_list_free(l);
apps = efreet_util_desktop_category_list(cat);
_add_desktop_list(p, apps, match1, match2);
} }
} }
@ -329,7 +328,7 @@ _fetch(Evry_Plugin *p, const char *input)
it = evry_item_new(p, _("Run in Terminal")); it = evry_item_new(p, _("Run in Terminal"));
app = E_NEW(Evry_App, 1); app = E_NEW(Evry_App, 1);
if (input) if (input)
app->file = eina_stringshare_add(input); app->file = eina_stringshare_add(match1);
else else
app->file = eina_stringshare_add(""); app->file = eina_stringshare_add("");
it->data[0] = app; it->data[0] = app;

View File

@ -41,8 +41,8 @@ _cb_sort(const void *data1, const void *data2)
static int static int
_fetch(Evry_Plugin *p, const char *input) _fetch(Evry_Plugin *p, const char *input)
{ {
char match1[4096]; char match1[128];
char match2[4096]; char match2[128];
Eina_List *l, *ll; Eina_List *l, *ll;
E_Configure_Cat *ecat; E_Configure_Cat *ecat;
E_Configure_It *eci; E_Configure_It *eci;
@ -52,25 +52,23 @@ _fetch(Evry_Plugin *p, const char *input)
snprintf(match1, sizeof(match1), "%s*", input); snprintf(match1, sizeof(match1), "%s*", input);
snprintf(match2, sizeof(match2), "*%s*", input); snprintf(match2, sizeof(match2), "*%s*", input);
for (l = e_configure_registry; l; l = l->next) EINA_LIST_FOREACH(e_configure_registry, l, ecat)
{ {
ecat = l->data; if ((ecat->pri < 0) || (!ecat->items)) continue;
if ((ecat->pri >= 0) && (ecat->items)) if (!strcmp(ecat->cat, "system")) continue;
EINA_LIST_FOREACH(ecat->items, ll, eci)
{ {
for (ll = ecat->items; ll; ll = ll->next) if (eci->pri >= 0)
{ {
eci = ll->data; if (e_util_glob_case_match(eci->label, match1))
if (eci->pri >= 0) _item_add(p, eci, 1);
{ else if (e_util_glob_case_match(eci->label, match2))
if (e_util_glob_case_match(eci->label, match1)) _item_add(p, eci, 2);
_item_add(p, eci, 1); else if (e_util_glob_case_match(ecat->label, match1))
else if (e_util_glob_case_match(eci->label, match2)) _item_add(p, eci, 3);
_item_add(p, eci, 2); else if (e_util_glob_case_match(ecat->label, match2))
else if (e_util_glob_case_match(ecat->label, match1)) _item_add(p, eci, 4);
_item_add(p, eci, 3);
else if (e_util_glob_case_match(ecat->label, match2))
_item_add(p, eci, 4);
}
} }
} }
} }
@ -116,18 +114,19 @@ _action(Evry_Action *act, Evry_Item *it, Evry_Item *it2 __UNUSED__, const char *
eci = it->data[0]; eci = it->data[0];
con = e_container_current_get(e_manager_current_get()); con = e_container_current_get(e_manager_current_get());
for (l = e_configure_registry; l && !found; l = l->next) EINA_LIST_FOREACH(e_configure_registry, l, ecat)
{ {
ecat = l->data; if (found) break;
for (ll = ecat->items; ll && !found; ll = ll->next)
EINA_LIST_FOREACH(ecat->items, ll, eci2)
{ {
eci2 = ll->data;
if (eci == eci2) if (eci == eci2)
{ {
found = 1;
snprintf(buf, sizeof(buf), "%s/%s", snprintf(buf, sizeof(buf), "%s/%s",
ecat->cat, ecat->cat,
eci->item); eci->item);
found = 1;
break;
} }
} }
} }