From: Hannes Janetzek Date: Sun, 30 May 2010 21:44:20 +0000 (+0000) Subject: - fix switching to object selector X-Git-Tag: submit/efl/20131021.015651~7283 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c493357679b11cc341fcf5d89649c7d58e0172c3;p=platform%2Fupstream%2Fenlightenment.git - fix switching to object selector - dont add plugins twice in browse_item - enable plugins plugin SVN revision: 49336 --- diff --git a/src/modules/everything/evry.c b/src/modules/everything/evry.c index 989b811..75e8dd1 100644 --- a/src/modules/everything/evry.c +++ b/src/modules/everything/evry.c @@ -1713,9 +1713,13 @@ evry_browse_item(Evry_Item *it) EINA_LIST_FOREACH(sel->plugins, l, p) { - if (pref && !strcmp(p->name, pref->name)) - continue; - + if (pref) + { + if ((!strcmp(p->name, pref->name)) || + (!strcmp(p->name, it->plugin->name))) + continue; + } + if ((p->browse) && (pp = p->browse(p, it))) { plugins = eina_list_append(plugins, pp); @@ -1850,7 +1854,7 @@ evry_selectors_switch(int dir, int slide) { Evry_Item *it; - if (!s || !(it = s->cur_item) || !(it->plugin == (CUR_SEL)->actions)) + if (!s || !(it = s->cur_item) || !(CHECK_TYPE(it, EVRY_TYPE_ACTION))) return 0; GET_ACTION(act,it); diff --git a/src/modules/everything/evry_plug_collection.c b/src/modules/everything/evry_plug_collection.c index 12c28d1..61a4cc7 100644 --- a/src/modules/everything/evry_plug_collection.c +++ b/src/modules/everything/evry_plug_collection.c @@ -10,12 +10,14 @@ typedef struct _Plugin Plugin; struct _Plugin { Evry_Plugin base; + + Eina_List *plugins; }; static Eina_List *plugins = NULL; -static const char _module_icon[] = "start"; +static const char _module_icon[] = "application-other"; static Evry_Type COLLECTION_PLUGIN; - +static Plugin_Config plugin_config; static Evry_Plugin * _browse(Evry_Plugin *plugin, const Evry_Item *item) @@ -28,6 +30,9 @@ _browse(Evry_Plugin *plugin, const Evry_Item *item) if (!CHECK_TYPE(item, COLLECTION_PLUGIN)) return NULL; + if (item->plugin != plugin) + return NULL; + pc = item->data; pp = pc->plugin; @@ -35,7 +40,11 @@ _browse(Evry_Plugin *plugin, const Evry_Item *item) if (pp->begin && (inst = pp->begin(pp, NULL))) { - inst->config = pc; + if (!strcmp(plugin->name, "Plugins")) + inst->config = &plugin_config; + else + inst->config = pc; + return inst; } @@ -58,7 +67,7 @@ _add_item(Plugin *p, Plugin_Config *pc) it->icon_get = itp->icon_get; it->data = pc; it->browseable = EINA_TRUE; - p->base.items = eina_list_append(p->base.items, it); + p->plugins = eina_list_append(p->plugins, it); } return it; } @@ -74,7 +83,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item) EINA_LIST_FOREACH(plugin->config->plugins, l, pc) _add_item(p, pc); - + return EVRY_PLUGIN(p); } @@ -91,23 +100,29 @@ _begin_all(Evry_Plugin *plugin, const Evry_Item *item) { if (!strcmp(pc->name, "All") || !strcmp(pc->name, "Actions") || + !strcmp(pc->name, "Text") || + !strcmp(pc->name, "Calculator") || + !strcmp(pc->name, "Spell Checker") || !strcmp(pc->name, "Plugins")) continue; - + _add_item(p, pc); } - + return EVRY_PLUGIN(p); } static void _finish(Evry_Plugin *plugin) { - Evry_Plugin *inst; + Evry_Item *it; GET_PLUGIN(p, plugin); - EVRY_PLUGIN_ITEMS_FREE(p); + EVRY_PLUGIN_ITEMS_CLEAR(p); + + EINA_LIST_FREE(p->plugins, it) + EVRY_ITEM_FREE(it); E_FREE(p); } @@ -117,7 +132,11 @@ _fetch(Evry_Plugin *plugin, const char *input) { GET_PLUGIN(p, plugin); - return !!(p->base.items); + EVRY_PLUGIN_ITEMS_CLEAR(p); + + EVRY_PLUGIN_ITEMS_ADD(p, p->plugins, input, 1, 0); + + return !!(plugin->items); } Eina_Bool @@ -129,24 +148,30 @@ evry_plug_collection_init(void) char path[4096]; char title[4096]; + plugin_config.min_query = 0; + plugin_config.top_level = EINA_TRUE; + plugin_config.aggregate = EINA_FALSE; + plugin_config.view_mode = VIEW_MODE_NONE; + COLLECTION_PLUGIN = evry_type_register("COLLECTION_PLUGIN"); e_configure_registry_category_add ("extensions", 80, _("Extensions"), NULL, "preferences-extensions"); - + p = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Plugins"), _module_icon, COLLECTION_PLUGIN, _begin_all, _finish, _fetch, NULL); p->browse = &_browse; - if (evry_plugin_register(p, EVRY_PLUGIN_SUBJECT, 1)) + if (evry_plugin_register(p, EVRY_PLUGIN_SUBJECT, 100)) { - p->config->enabled = EINA_FALSE; - p->config->aggregate = EINA_FALSE; + p->config->aggregate = EINA_TRUE; + p->config->top_level = EINA_TRUE; + p->config->view_mode = VIEW_MODE_THUMB; } - plugins = eina_list_append(plugins, p); + plugins = eina_list_append(plugins, p); + - EINA_LIST_FOREACH(evry_conf->collections, l, pc) { p = EVRY_PLUGIN_NEW(Evry_Plugin, N_(pc->name), @@ -163,15 +188,15 @@ evry_plug_collection_init(void) snprintf(path, sizeof(path), "extensions/everything-%s", p->name); snprintf(title, sizeof(title), "Everything %s", p->name); - + e_configure_registry_item_add (path, 110, title, NULL, NULL/*icon*/, evry_collection_conf_dialog); p->config_path = eina_stringshare_add(path); - + plugins = eina_list_append(plugins, p); } - + return EINA_TRUE; } @@ -179,7 +204,7 @@ void evry_plug_collection_shutdown(void) { Evry_Plugin *p; - + EINA_LIST_FREE(plugins, p) { if (p->config_path) @@ -187,7 +212,7 @@ evry_plug_collection_shutdown(void) e_configure_registry_item_del(p->config_path); eina_stringshare_del(p->config_path); } - + EVRY_PLUGIN_FREE(p); } }