From: Enlightenment S. <no-...@en...> - 2009-08-12 18:47:58
|
Log: 'everything' module: - core: cleanup async_update function - tracker: cleanups Author: jeffdameth Date: 2009-08-12 11:47:46 -0700 (Wed, 12 Aug 2009) New Revision: 41715 Modified: trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry_plug_border.c trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-12 17:57:34 UTC (rev 41714) +++ trunk/e/src/modules/everything/evry.c 2009-08-12 18:47:46 UTC (rev 41715) @@ -599,20 +599,21 @@ static void _evry_selector_activate(Evry_Selector *sel) { - if (selector) + if (selector && selector->state) { + Evry_State *s = selector->state; + Evry_Plugin *p; + Eina_List *l; + + _evry_list_clear_list(s); + edje_object_signal_emit(selector->o_main, "e,state,unselected", "e"); - edje_object_part_text_set(selector->o_main, "e.text.plugin", ""); - + if (update_timer) { - Evry_State *s = selector->state; - - /* XXX what if an async plugin is selected */ - if (s && s->plugin && !s->plugin->async_query) + if (s->plugin && !s->plugin->async_query) { - _evry_list_clear_list(s); _evry_matches_update(selector); _evry_selector_update(selector); } @@ -620,6 +621,13 @@ update_timer = NULL; } + EINA_LIST_FOREACH(selector->plugins, l, p) + { + e_box_unpack(p->tab); + evas_object_del(p->tab); + p->tab = NULL; + } + _evry_list_win_hide(); } @@ -704,7 +712,7 @@ it = s->sel_item; - if (!it && s->plugin) + if (s->plugin && (!it || s->item_auto_selected)) { /* get first item */ if (s->plugin->items) @@ -943,6 +951,7 @@ _evry_list_clear_list(s); _evry_state_pop(sel); _evry_selector_update(sel); + sel->aggregator->fetch(sel->aggregator, NULL); _evry_list_update(sel->state); _evry_update_text_label(sel->state); } @@ -969,7 +978,7 @@ if (update_timer) { - /* XXX redundant > selector_activate, + /* duplicate code: selector_activate, plugin_action, update_timer !!! */ if (!s->plugin->async_query) { @@ -1003,8 +1012,6 @@ edje_object_signal_emit(win->o_main, "e,state,object_selector_hide", "e"); - _evry_list_clear_list(s); - while (selector->states) _evry_state_pop(selector); @@ -1510,11 +1517,13 @@ static void _evry_list_item_sel(Evry_State *s, Evry_Item *it) { + if (s->sel_item == it) return; + if (list->visible && selector->state == s) { if (s->sel_item) _evry_list_item_desel(s, s->sel_item); - + edje_object_signal_emit(it->o_bg, "e,state,selected", "e"); if (it->o_icon) edje_object_signal_emit(it->o_icon, "e,state,selected", "e"); @@ -1754,9 +1763,10 @@ static void _evry_list_tabs_update(Evry_State *s) { + Eina_List *l; Evry_Plugin *p; - + /* remove tabs for not active plugins */ EINA_LIST_FOREACH(selector->plugins, l, p) { @@ -1767,7 +1777,7 @@ p->tab = NULL; } } - + /* show/update tabs of active plugins */ EINA_LIST_FOREACH(s->cur_plugins, l, p) { @@ -1844,7 +1854,7 @@ pc = E_NEW(Plugin_Config, 1); pc->name = eina_stringshare_add(p->name); pc->enabled = 1; - pc->priority = 100; + pc->priority = 1; p->config = pc; action_selector = p; @@ -1921,7 +1931,6 @@ } } - /* if (input) TODO sort */ if (p->items) return 1; return 0; @@ -1976,7 +1985,7 @@ pc = E_NEW(Plugin_Config, 1); pc->name = eina_stringshare_add(p->name); pc->enabled = 1; - pc->priority = 100; + pc->priority = -1; p->config = pc; return p; @@ -2004,7 +2013,6 @@ eina_list_free(p->items); p->items = NULL; - EINA_LIST_FOREACH(s->cur_plugins, l, plugin) { for (cnt = 0, ll = plugin->items; ll && cnt < 15; ll = ll->next, cnt++) @@ -2042,19 +2050,44 @@ return NULL; } +static void +_evry_plugin_list_insert(Evry_State *s, Evry_Plugin *p) +{ + Eina_List *l; + Evry_Plugin *plugin; + + EINA_LIST_FOREACH(s->cur_plugins, l, plugin) + if (p == plugin) + return; + else + if (p->config->priority < plugin->config->priority) + break; + + if (l) + s->cur_plugins = eina_list_prepend_relative_list(s->cur_plugins, p, l); + else + s->cur_plugins = eina_list_append(s->cur_plugins, p); + +} + EAPI void evry_plugin_async_update(Evry_Plugin *p, int action) { Evry_State *s; - + Evry_Plugin *agg; + if (!win) return; s = selector->state; + /* received data from a plugin of the current selector ? */ if (!s || !eina_list_data_find(s->plugins, p)) return; + agg = selector->aggregator; + if (action == EVRY_ASYNC_UPDATE_ADD) { + /* remove plugin and update selector. */ if (!p->items) { if (!eina_list_data_find(s->cur_plugins, p)) return; @@ -2064,82 +2097,71 @@ if (p == s->plugin) { s->plugin = NULL; - /* _evry_list_clear_list(s); */ _evry_selector_update(selector); - if (list->visible) - _evry_list_tabs_update(s); } - return; } - - if (!eina_list_data_find(s->cur_plugins, p)) + else { - s->cur_plugins = eina_list_append(s->cur_plugins, p); - if (!s->plugin) _evry_select_plugin(s, p); - } + /* add plugin to current plugins*/ + _evry_plugin_list_insert(s, p); - if (eina_list_count(s->cur_plugins) > 1) - { - if (s->plugin == selector->aggregator) - _evry_list_clear_list(s); - - selector->aggregator->fetch(selector->aggregator, NULL); - - if (!eina_list_data_find(s->cur_plugins, selector->aggregator)) + /* update aggregator */ + if (eina_list_count(s->cur_plugins) > 1) { - s->cur_plugins = eina_list_prepend(s->cur_plugins, - selector->aggregator); - _evry_list_clear_list(s); + if (s->plugin == agg) + _evry_list_clear_list(s); - s->plugin = selector->aggregator; + agg->fetch(agg, NULL); + + /* add aggregator */ + if (!(s->cur_plugins->data == agg)) + { + s->cur_plugins = eina_list_prepend(s->cur_plugins, agg); + _evry_list_clear_list(s); + s->plugin = agg; + } } - } - if (list->visible) - _evry_list_tabs_update(s); - - if ((s->plugin == p) || (s->plugin == selector->aggregator)) - { - p = s->plugin; - - if ((s->item_auto_selected) && (s->plugin->items->data != s->sel_item)) + /* plugin is active */ + if ((s->plugin == p) || (s->plugin == agg)) { - s->sel_item = NULL; + p = s->plugin; _evry_selector_update(selector); - } - if (list->visible) - { - Eina_List *l; - Evry_Item *it; - evas_event_freeze(list->popup->evas); - e_box_freeze(list->o_list); - EINA_LIST_FOREACH(p->items, l, it) - if (it->o_bg) e_box_unpack(it->o_bg); - - e_box_thaw(list->o_list); - evas_event_thaw(list->popup->evas); - } + if (list->visible) + { + Eina_List *l; + Evry_Item *it; + evas_event_freeze(list->popup->evas); + e_box_freeze(list->o_list); + EINA_LIST_FOREACH(p->items, l, it) + if (it->o_bg) e_box_unpack(it->o_bg); + e_box_thaw(list->o_list); + evas_event_thaw(list->popup->evas); - _evry_list_show_items(s, p); - - if (list->visible && s->sel_item) - { - /* TODO check this again!*/ - _evry_list_item_sel(s, s->sel_item); - _evry_list_scroll_to(s, s->sel_item); + _evry_list_show_items(s, p); + _evry_list_scroll_to(s, s->sel_item); + } } } - else if (s->plugin) + + /* plugin box was updated: realign */ + if (s->plugin) { + _evry_list_tabs_update(s); _evry_list_tab_scroll_to(s, s->plugin); } - - _evry_selector_update(selector); } - else if ((action == EVRY_ASYNC_UPDATE_CLEAR) && (s->plugin == p)) + else if (action == EVRY_ASYNC_UPDATE_CLEAR) { + Evry_Plugin *tmp = s->plugin; + + s->plugin = p; _evry_list_clear_list(s); + s->plugin = tmp; + + s->cur_plugins = eina_list_remove(s->cur_plugins, p); + agg->fetch(agg, NULL); } } Modified: trunk/e/src/modules/everything/evry_plug_border.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border.c 2009-08-12 17:57:34 UTC (rev 41714) +++ trunk/e/src/modules/everything/evry_plug_border.c 2009-08-12 18:47:46 UTC (rev 41715) @@ -85,12 +85,8 @@ { if (e_util_glob_case_match(bd->desktop->exec, match1)) _item_add(p, bd, 1); - else if (e_util_glob_case_match(bd->desktop->exec, match2)) - _item_add(p, bd, 2); else if (e_util_glob_case_match(bd->desktop->name, match1)) _item_add(p, bd, 1); - else if (e_util_glob_case_match(bd->desktop->name, match2)) - _item_add(p, bd, 2); } } } Modified: trunk/e/src/modules/everything/evry_plug_tracker.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-12 17:57:34 UTC (rev 41714) +++ trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-12 18:47:46 UTC (rev 41715) @@ -10,16 +10,10 @@ int active; char *condition; char *service; - /* Eina_List *items; */ int max_hits; }; static E_DBus_Connection *conn = NULL; - -/* static Evry_Plugin *p1 = NULL; - * static Evry_Plugin *p2 = NULL; - * static Evry_Plugin *p3 = NULL; - * static Evry_Plugin *p4 = NULL; */ static Eina_List *plugins = NULL; @@ -136,10 +130,6 @@ return; } - /* evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_CLEAR); - * _cleanup(p); - * */ - dbus_message_iter_init(msg, &array); if(dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_ARRAY) { @@ -155,9 +145,10 @@ /* dbus_message_iter_get_basic(&iter, &service); */ dbus_message_iter_next(&iter); dbus_message_iter_get_basic(&iter, &mime); + /* dbus_message_iter_next(&iter); - * dbus_message_iter_get_basic(&iter, &date); */ - /* printf("date: %s\n",date); */ + * dbus_message_iter_get_basic(&iter, &date); + * printf("%s : %s\n", date, uri); */ if (uri && mime) _item_add(p, uri, mime, 1); } @@ -173,20 +164,22 @@ { Inst *inst = p->private; DBusMessage *msg; - DBusMessageIter iter; int live_query_id = 0; + int max_hits = inst->max_hits; int offset = 0; int sort_descending = 1; int sort_by_service = 0; + int sort_by_access = 0; char *search_text; char *fields[2]; char *keywords[1]; char *sort_fields[1]; fields[0] = "File:Mime"; + /* fields[1] = "File:Modified"; */ fields[1] = "File:Accessed"; keywords[0] = ""; - sort_fields[0] = ""; - + /* sort_fields[0] = "File:Modified"; */ + sort_fields[0] = "File:Accessed"; char **_fields = fields; char **_keywords = keywords; char **_sort_fields = sort_fields; @@ -194,15 +187,17 @@ _cleanup(p); if (!conn) return 0; - /* if (!input || (strlen(input) < 3)) return 0; */ if (input && (strlen(input) > 2)) { search_text = malloc(sizeof(char) * strlen(input) + 3); sprintf(search_text, "*%s*", input); + max_hits = 50; } - else if (!p->begin) + else if (!p->begin && p->type == type_object) { + + sort_by_access = 1; search_text = ""; } else return 0; @@ -216,15 +211,15 @@ dbus_message_append_args(msg, DBUS_TYPE_INT32, &live_query_id, DBUS_TYPE_STRING, &inst->service, - DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &_fields, 1, + DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &_fields, 1 + sort_by_access, DBUS_TYPE_STRING, &search_text, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &_keywords, 0, DBUS_TYPE_STRING, &inst->condition, DBUS_TYPE_BOOLEAN, &sort_by_service, - DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &_sort_fields, 0, + DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &_sort_fields, sort_by_access, DBUS_TYPE_BOOLEAN, &sort_descending, DBUS_TYPE_INT32, &offset, - DBUS_TYPE_INT32, &inst->max_hits, + DBUS_TYPE_INT32, &max_hits, DBUS_TYPE_INVALID); e_dbus_message_send(conn, msg, _dbus_cb_reply, -1, p); @@ -304,61 +299,11 @@ _plugin_new("Music", type_subject, "Music", 20, 0); _plugin_new("Videos", type_subject, "Videos", 20, 0); _plugin_new("Documents", type_subject, "Documents", 20, 0); - _plugin_new("Text", type_subject, "Text Files", 20, 0); + _plugin_new("Text", type_subject, "TextFiles", 20, 0); _plugin_new("Find Files", type_object, "Files", 20, 1); _plugin_new("Folders", type_object, "Folders", 20, 0); - - /* p = E_NEW(Evry_Plugin, 1); - * p->name = "Images"; - * p->type = type_subject; - * p->type_in = "NONE"; - * p->type_out = "FILE"; - * p->async_query = 1; - * p->fetch = &_fetch; - * p->cleanup = &_cleanup; - * p->icon_get = &_item_icon_get; - * inst = E_NEW(Inst, 1); - * inst->condition = ""; - * inst->service = "Images"; - * inst->results = 10; - * p->private = inst; - * evry_plugin_register(p); - * plugins = eina_list_append(plugins, p); - * - * p = E_NEW(Evry_Plugin, 1); - * p->name = "Find Files"; - * p->type = type_object; - * p->type_in = "NONE"; - * p->type_out = "FILE"; - * p->async_query = 1; - * p->begin = &_begin; - * p->fetch = &_fetch; - * p->cleanup = &_cleanup; - * p->icon_get = &_item_icon_get; - * inst = E_NEW(Inst, 1); - * inst->condition = ""; - * inst->service = "Files"; - * p->private = inst; - * evry_plugin_register(p); - * plugins = eina_list_append(plugins, p); - * - * p4 = E_NEW(Evry_Plugin, 1); - * p4->name = "Folders"; - * p4->type = type_object; - * p4->type_in = "NONE"; - * p4->type_out = "FILE"; - * p4->async_query = 1; - * p4->fetch = &_fetch; - * p4->cleanup = &_cleanup; - * p4->icon_get = &_item_icon_get; - * inst = E_NEW(Inst, 1); - * inst->condition = ""; - * inst->service = "Folders"; - * p4->private = inst; - * evry_plugin_register(p4); */ - return EINA_TRUE; } |
From: Enlightenment S. <no-...@en...> - 2009-08-12 19:00:39
|
Log: whitespace cleanup Author: jeffdameth Date: 2009-08-12 12:00:25 -0700 (Wed, 12 Aug 2009) New Revision: 41716 Modified: trunk/e/src/modules/everything/e_mod_main.c trunk/e/src/modules/everything/e_mod_main.h trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry_config.c trunk/e/src/modules/everything/evry_plug_apps.c trunk/e/src/modules/everything/evry_plug_aspell.c trunk/e/src/modules/everything/evry_plug_border_act.c trunk/e/src/modules/everything/evry_plug_calc.c trunk/e/src/modules/everything/evry_plug_clipboard.c trunk/e/src/modules/everything/evry_plug_dir_browse.c trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/e_mod_main.c =================================================================== --- trunk/e/src/modules/everything/e_mod_main.c 2009-08-12 18:47:46 UTC (rev 41715) +++ trunk/e/src/modules/everything/e_mod_main.c 2009-08-12 19:00:25 UTC (rev 41716) @@ -96,9 +96,9 @@ plugins = eina_module_list_get(NULL, m->dir, 1, &list_cb, NULL); if (plugins) printf("plugins loaded\n"); - else + else printf("could not find plugins in %s\n", m->dir); - + /* add module supplied action */ act = e_action_add("everything"); if (act) @@ -112,7 +112,7 @@ e_configure_registry_category_add("extensions", 80, _("Extensions"), NULL, "preferences-extensions"); e_configure_registry_item_add("extensions/run_everything", 40, _("Run Everything"), NULL, "system-run", evry_config_dialog); - + e_module_delayed_set(m, 1); return m; @@ -122,7 +122,7 @@ e_modapi_shutdown(E_Module *m __UNUSED__) { E_Config_Dialog *cfd; - + /* remove module-supplied menu additions */ if (maug) { @@ -145,9 +145,9 @@ eina_module_list_unload(plugins); eina_module_list_flush(plugins); eina_array_free(plugins); - + eina_module_shutdown(); - + while ((cfd = e_config_dialog_get("E", "_config_everything_dialog"))) e_object_del(E_OBJECT(cfd)); e_configure_registry_item_del("extensions/run_everything"); e_configure_registry_category_del("extensions"); @@ -233,7 +233,7 @@ Eina_List *l; Plugin_Config *pc; Eina_Bool found = 0; - + evry_conf->plugins = eina_list_append(evry_conf->plugins, plugin); EINA_LIST_FOREACH(evry_conf->plugins_conf, l, pc) @@ -252,18 +252,18 @@ pc->enabled = 1; pc->priority = eina_list_count(evry_conf->plugins); - evry_conf->plugins_conf = eina_list_append(evry_conf->plugins_conf, pc); + evry_conf->plugins_conf = eina_list_append(evry_conf->plugins_conf, pc); } /* if (plugin->trigger && !pc->trigger) * pc->trigger = eina_stringshare_add(plugin->trigger); */ - + plugin->config = pc; evry_conf->plugins = eina_list_sort(evry_conf->plugins, eina_list_count(evry_conf->plugins), _evry_cb_plugin_sort); - + /* TODO sorting, initialization, etc */ } Modified: trunk/e/src/modules/everything/e_mod_main.h =================================================================== --- trunk/e/src/modules/everything/e_mod_main.h 2009-08-12 18:47:46 UTC (rev 41715) +++ trunk/e/src/modules/everything/e_mod_main.h 2009-08-12 19:00:25 UTC (rev 41716) @@ -42,7 +42,7 @@ int auto_select_first; Eina_Hash *key_bindings; - + /**/ Eina_List *plugins; Eina_List *actions; @@ -53,10 +53,10 @@ struct _Plugin_Config { const char *name; - + int loaded; int enabled; - + /* minimum input chars to query this source */ int min_query; @@ -69,14 +69,14 @@ struct _Evry_Item { Evry_Plugin *plugin; - + const char *label; const char *uri; const char *mime; Eina_Bool browseable; - + /* these are only for internally use by plugins */ /* used e.g. as pointer for item data (Efreet_Desktop) or */ /* for internal stuff, like priority hints for sorting, etc */ @@ -87,89 +87,89 @@ Evas_Object *o_icon; Evas_Object *o_bg; }; - + struct _Evry_Plugin { const char *name; const char *icon; enum {type_subject, type_action, type_object } type; - + const char *type_in; const char *type_out; const char *trigger; - + /* sync/async ?*/ Eina_Bool async_query; /* whether candidates can be shown without input * e.g. borders, app history */ - Eina_Bool need_query; + Eina_Bool need_query; Eina_Bool browseable; - + /* run when plugin is activated. */ int (*begin) (Evry_Plugin *p, const Evry_Item *item); int (*browse) (Evry_Plugin *p, const Evry_Item *item); - + /* get candidates matching string, fills 'candidates' list */ int (*fetch) (Evry_Plugin *p, const char *input); /* run before new query and when hiding 'everything' */ void (*cleanup) (Evry_Plugin *p); - Evas_Object *(*icon_get) (Evry_Plugin *p, const Evry_Item *it, Evas *e); + Evas_Object *(*icon_get) (Evry_Plugin *p, const Evry_Item *it, Evas *e); /* provide more information for a candidate */ /* int (*candidate_info) (Evas *evas, Evry_Item *item); */ /* optional: default action for this plugins items */ int (*action) (Evry_Plugin *p, const Evry_Item *item, const char *input); Evry_Action *act; - + /* optional: create list of items when shown (e.g. for sorting) */ void (*realize_items) (Evry_Plugin *p, Evas *e); Eina_List *items; - + Evas_Object *(*config_page) (void); void (*config_apply) (void); /* only for internal use by plugin */ void *private; - + /* not to be set by plugin! */ Evas_Object *tab; Plugin_Config *config; -}; +}; struct _Evry_Action { const char *name; - + const char *type_in1; const char *type_in2; const char *type_out; - + int (*action) (Evry_Action *act, const Evry_Item *it1, const Evry_Item *it2, const char *input); - int (*check_item) (Evry_Action *act, const Evry_Item *it); + int (*check_item) (Evry_Action *act, const Evry_Item *it); - Evas_Object *(*icon_get) (Evry_Action *act, Evas *e); + Evas_Object *(*icon_get) (Evry_Action *act, Evas *e); /* use icon name from theme */ const char *icon; - + Eina_Bool is_default; - + /* only for internal use by plugin */ void *private; /* not to be set by plugin! */ Evas_Object *o_icon; -}; +}; struct _Evry_App { Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-12 18:47:46 UTC (rev 41715) +++ trunk/e/src/modules/everything/evry.c 2009-08-12 19:00:25 UTC (rev 41716) @@ -3,7 +3,7 @@ /* TODO */ /* - animations - * - mouse handlers + * - mouse handlers * - show item descriptions * - keybinding configuration * - shortcuts for plugins @@ -33,7 +33,7 @@ Evry_Item *sel_item; /* Eina_List *sel_items; */ - + /* this is for the case when the current plugin was not selected manually and a higher priority (async) plugin retrieves candidates, the higher priority plugin is made current */ @@ -78,7 +78,7 @@ Evas_Object *o_list; Evas_Object *o_tabs; Eina_List *items; - + int ev_last_is_mouse; Evry_Item *item_mouseover; Ecore_Animator *scroll_animator; @@ -93,14 +93,14 @@ /* struct _Evry_List_Item * { * Evry_Item *item; - * + * * Evas_Object *o_icon; * Evas_Object *o_bg; - * + * * const char *label; * }; */ - + static int _evry_cb_key_down(void *data, int type, void *event); /* static int _evry_cb_mouse_down(void *data, int type, void *event); * static int _evry_cb_mouse_up(void *data, int type, void *event); @@ -169,10 +169,8 @@ static int _evry_plug_aggregator_action(Evry_Plugin *p, const Evry_Item *item, const char *input); static void _evry_plug_aggregator_cleanup(Evry_Plugin *p); static Evas_Object *_evry_plug_aggregator_item_icon_get(Evry_Plugin *p, const Evry_Item *it, Evas *e); -/* static int _evry_cb_plugin_sort_by_trigger(const void *data1, const void *data2); */ /* local subsystem globals */ - static Evry_Window *win = NULL; static Evry_List_Window *list = NULL; static Ecore_X_Window input_window = 0; @@ -180,7 +178,6 @@ static Ecore_Timer *update_timer = NULL; static Evry_Selector *selectors[3]; static Evry_Selector *selector = NULL; - static Evry_Plugin *action_selector = NULL; /* externally accessible functions */ @@ -188,7 +185,7 @@ evry_init(void) { _evry_plug_actions_init(); - + return 1; } @@ -204,10 +201,10 @@ evry_show(E_Zone *zone) { if (win) return 0; - + E_OBJECT_CHECK_RETURN(zone, 0); E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0); - + input_window = ecore_x_window_input_new(zone->container->win, zone->x, zone->y, zone->w, zone->h); ecore_x_window_show(input_window); @@ -221,7 +218,7 @@ if (!list) goto error; list->visible = EINA_FALSE; - + /* TODO check NULL */ selectors[0] = _evry_selector_new(type_subject); selectors[1] = _evry_selector_new(type_action); @@ -232,17 +229,17 @@ _evry_selector_update(selector); e_popup_layer_set(list->popup, 255); - e_popup_layer_set(win->popup, 255); - e_popup_show(win->popup); + e_popup_layer_set(win->popup, 255); + e_popup_show(win->popup); e_popup_show(list->popup); - + if (list->visible) { e_popup_show(list->popup); _evry_list_update(selector->state); } e_box_align_set(list->o_tabs, 0.0, 0.5); - + handlers = eina_list_append (handlers, ecore_event_handler_add (ECORE_EVENT_KEY_DOWN, _evry_cb_key_down, NULL)); @@ -285,7 +282,7 @@ evry_hide(void) { Ecore_Event *ev; - + if (!win) return; _evry_list_clear_list(selector->state); @@ -301,17 +298,17 @@ selectors[1] = NULL; selectors[2] = NULL; selector = NULL; - + _evry_list_win_free(list); list = NULL; - + _evry_window_free(win); win = NULL; EINA_LIST_FREE(handlers, ev) ecore_event_handler_del(ev); handlers = NULL; - + ecore_x_window_free(input_window); e_grabinput_release(input_window, input_window); input_window = 0; @@ -322,7 +319,7 @@ evry_clear_input(void) { Evry_State *s = selector->state; - + if (s->input[0] != 0) { s->input[0] = 0; @@ -333,13 +330,13 @@ evry_item_new(Evry_Plugin *p, const char *label) { Evry_Item *it; - + it = E_NEW(Evry_Item, 1); if (!it) return NULL; - + it->plugin = p; if (label) it->label = eina_stringshare_add(label); - + return it; } @@ -350,12 +347,6 @@ E_FREE(it); } -/* static void - * _evry_list_cb_list_shown(void *data, Evas_Object *obj, const char *emission, const char *source) - * { - * _evry_list_scroll_to(selector->state, selector->state->sel_item); - * } */ - static Evry_List_Window * _evry_list_win_new(E_Zone *zone) { @@ -363,10 +354,10 @@ Evry_List_Window *list_win; E_Popup *popup; Evas_Object *o; - + x = (zone->w / 2) - (win->popup->w / 3); y = (zone->h / 2); - + popup = e_popup_new(zone, x + 50, y - 4, /*XXX get from theme ?*/ win->popup->w * 2/3 - 100, evry_conf->height); @@ -444,7 +435,7 @@ if (list->visible) return; list->visible = EINA_TRUE; - + _evry_list_update(selector->state); edje_object_signal_emit(list->o_main, "e,state,list_show", "e"); @@ -455,14 +446,14 @@ { Eina_List *l; Evry_Plugin *p; - + if (!list->visible) return; list->visible = EINA_FALSE; EINA_LIST_FOREACH(selector->plugins, l, p) { - e_box_unpack(p->tab); + e_box_unpack(p->tab); evas_object_del(p->tab); p->tab = NULL; } @@ -490,7 +481,7 @@ e_object_del(E_OBJECT(popup)); return NULL; } - + win->popup = popup; o = edje_object_add(popup->evas); @@ -504,7 +495,7 @@ y = (zone->h / 2) - mh; e_popup_move_resize(popup, x, y, mw, mh); - + o = win->o_main; e_popup_edje_bg_object_set(win->popup, o); evas_object_move(o, 0, 0); @@ -512,7 +503,7 @@ evas_object_show(o); ecore_x_netwm_window_type_set(popup->evas_win, ECORE_X_WINDOW_TYPE_UTILITY); - + return win; } @@ -558,7 +549,7 @@ } if (type == type_action) sel->plugins = eina_list_append(sel->plugins, action_selector); - + return sel; } @@ -567,7 +558,7 @@ { Evry_State *s; Evry_Plugin *p; - + if (sel->o_icon) evas_object_del(sel->o_icon); evas_object_del(sel->o_main); @@ -576,11 +567,11 @@ { _evry_list_clear_list(sel->state); } - + EINA_LIST_FREE(sel->states, s) { free(s->input); - + EINA_LIST_FREE(s->plugins, p) { p->cleanup(p); @@ -589,7 +580,7 @@ } E_FREE(s); } - + _evry_plug_aggregator_free(sel->aggregator); if (sel->plugins) eina_list_free(sel->plugins); @@ -606,35 +597,35 @@ Eina_List *l; _evry_list_clear_list(s); - + edje_object_signal_emit(selector->o_main, "e,state,unselected", "e"); edje_object_part_text_set(selector->o_main, "e.text.plugin", ""); - + if (update_timer) { if (s->plugin && !s->plugin->async_query) { _evry_matches_update(selector); - _evry_selector_update(selector); + _evry_selector_update(selector); } ecore_timer_del(update_timer); update_timer = NULL; } - + EINA_LIST_FOREACH(selector->plugins, l, p) { - e_box_unpack(p->tab); + e_box_unpack(p->tab); evas_object_del(p->tab); p->tab = NULL; } _evry_list_win_hide(); } - + selector = sel; edje_object_signal_emit(sel->o_main, "e,state,selected", "e"); - + if (sel->state) { _evry_update_text_label(sel->state); @@ -642,8 +633,8 @@ if (sel->state->sel_item) edje_object_part_text_set(sel->o_main, "e.text.plugin", sel->state->sel_item->plugin->name); - - if (list->visible && sel->state->plugin) + + if (list->visible && sel->state->plugin) { _evry_list_tabs_update(sel->state); _evry_list_show_items(sel->state, sel->state->plugin); @@ -657,9 +648,9 @@ Evry_State *s = sel->state; Evry_Item *it; Evas_Object *o; - + if (!edje_object_part_exists(sel->o_main, "e.swallow.icons")) return; - + if (sel->o_icon) { evas_object_del(sel->o_icon); @@ -679,7 +670,7 @@ evas_object_show(o); sel->o_icon = o; } - } + } else if (s->plugin && s->plugin->icon) { o = e_icon_add(win->popup->evas); @@ -709,7 +700,7 @@ s->plugin = NULL; s->sel_item = NULL; } - + it = s->sel_item; if (s->plugin && (!it || s->item_auto_selected)) @@ -723,9 +714,9 @@ } } } - + _evry_selector_icon_set(sel); - + if (it) { edje_object_part_text_set(sel->o_main, "e.text.label", it->label); @@ -739,12 +730,12 @@ { /* no items for this state - clear selector */ edje_object_part_text_set(sel->o_main, "e.text.label", ""); - if (sel == selector && s && s->plugin) + if (sel == selector && s && s->plugin) edje_object_part_text_set(sel->o_main, "e.text.plugin", s->plugin->name); else edje_object_part_text_set(sel->o_main, "e.text.plugin", ""); } - + if (sel == selectors[0]) { _evry_selector_actions_get(it); @@ -757,8 +748,8 @@ { if (!list->visible) return; if (!s->plugin) return; - - _evry_list_clear_list(s); + + _evry_list_clear_list(s); _evry_list_tabs_update(s); _evry_list_show_items(s, s->plugin); _evry_list_scroll_to(s, s->sel_item); @@ -785,7 +776,7 @@ if (!plugins) return 0; _evry_state_new(sel, plugins); - + _evry_matches_update(sel); return 1; @@ -806,7 +797,7 @@ _evry_state_new(sel, plugins); return 1; } - + EINA_LIST_FOREACH(sel->plugins, l, p) { if (strcmp(p->type_in, it->plugin->type_out) && @@ -823,9 +814,9 @@ } if (!plugins) return 0; - + _evry_state_new(sel, plugins); - + _evry_matches_update(sel); return 1; @@ -838,14 +829,12 @@ Evry_Plugin *p; Evry_Selector *sel = selectors[2]; Evry_Item *it; - + while (sel->state) _evry_state_pop(sel); - // TODO let 'object' plugins take subject and action - // into account. selectors[0]->state->sel_item; it = selectors[0]->state->sel_item; - + EINA_LIST_FOREACH(sel->plugins, l, p) { if (strcmp(p->type_out, type) && @@ -859,7 +848,7 @@ else plugins = eina_list_append(plugins, p); } - + if (!plugins) return 0; _evry_state_new(sel, plugins); @@ -883,7 +872,7 @@ sel->states = eina_list_prepend(sel->states, s); sel->state = s; - + return s; } @@ -895,11 +884,11 @@ free(sel->state->input); EINA_LIST_FREE(sel->state->plugins, p) p->cleanup(p); - + E_FREE(sel->state); - + sel->states = eina_list_remove_list(sel->states, sel->states); - + if (sel->states) sel->state = sel->states->data; else @@ -915,7 +904,7 @@ Evry_Plugin *p; it = s->sel_item; - + if (!it || !it->browseable) return; _evry_list_clear_list(sel->state); @@ -928,7 +917,7 @@ if (p->browse(p, it)) plugins = eina_list_append(plugins, p); } - + if (plugins) { _evry_state_new(sel, plugins); @@ -945,9 +934,9 @@ _evry_browse_back(Evry_Selector *sel) { Evry_State *s = sel->state; - + if (!s || !sel->states->next) return; - + _evry_list_clear_list(s); _evry_state_pop(sel); _evry_selector_update(sel); @@ -960,7 +949,7 @@ _evry_selectors_switch(void) { Evry_State *s = selector->state; - + if (selector == selectors[0]) { if (s->sel_item) @@ -969,7 +958,7 @@ else if (selector == selectors[1]) { int next_selector = 0; - + if (s->plugin == action_selector) { Evry_Action *act; @@ -982,19 +971,19 @@ plugin_action, update_timer !!! */ if (!s->plugin->async_query) { - _evry_list_clear_list(s); + _evry_list_clear_list(s); _evry_matches_update(selector); - _evry_selector_update(selector); + _evry_selector_update(selector); } ecore_timer_del(update_timer); update_timer = NULL; } act = s->sel_item->data[0]; - + if (act && act->type_in2) { - + sel = selectors[2]; _evry_selector_objects_get(act->type_in2); _evry_selector_update(sel); @@ -1014,7 +1003,7 @@ while (selector->states) _evry_state_pop(selector); - + _evry_selector_activate(selectors[0]); } } @@ -1030,11 +1019,9 @@ ev = event; if (ev->event_window != input_window) return 1; - if (!strcmp(ev->key, "Up")) - /* if (!strcmp(ev->key, "K")) */ + if (!strcmp(ev->key, "Up")) _evry_list_item_prev(s); else if (!strcmp(ev->key, "Down")) - /* else if (!strcmp(ev->key, "J")) */ _evry_list_item_next(s); else if (!strcmp(ev->key, "Right") && (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)) @@ -1043,11 +1030,9 @@ (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)) _evry_list_plugin_prev(s); else if (!strcmp(ev->key, "Right")) - /* else if (!strcmp(ev->key, "L")) */ - _evry_browse_item(selector); + _evry_browse_item(selector); else if (!strcmp(ev->key, "Left")) - /* else if (!strcmp(ev->key, "H")) */ - _evry_browse_back(selector); + _evry_browse_back(selector); else if ((!strcmp(ev->key, "Return")) && ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) || (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT))) @@ -1079,7 +1064,6 @@ ((strlen(s->input) < (INPUTLEN - strlen(ev->compose))))) { strcat(s->input, ev->compose); - /* _evry_update_timer(s); */ _evry_update(s); } return 1; @@ -1098,7 +1082,6 @@ { s->input[pos] = 0; _evry_update(s); - /* _evry_update_timer(s); */ } } } @@ -1110,7 +1093,7 @@ edje_object_signal_emit(list->o_main, "e,state,entry_show", "e"); else edje_object_signal_emit(list->o_main, "e,state,entry_hide", "e"); - + edje_object_part_text_set(win->o_main, "e.text.label", s->input); edje_object_part_text_set(list->o_main, "e.text.label", s->input); @@ -1120,7 +1103,7 @@ _evry_update(Evry_State *s) { _evry_update_text_label(s); - + if (update_timer) ecore_timer_del(update_timer); update_timer = ecore_timer_add(MATCH_LAG, _evry_update_timer, s); } @@ -1133,7 +1116,7 @@ _evry_list_clear_list(s); _evry_matches_update(selector); _evry_selector_update(selector); - _evry_list_update(selector->state); + _evry_list_update(selector->state); update_timer = NULL; return 0; @@ -1152,7 +1135,7 @@ static void _evry_plugin_action(Evry_Selector *sel, int finished) -{ +{ Evry_State *s_subject, *s_action, *s_object; s_subject = selectors[0]->state; @@ -1163,13 +1146,12 @@ if (update_timer) { - /* XXX what if an async plugin is selected */ if (!selector->state->plugin->async_query) { _evry_matches_update(selector); - _evry_selector_update(selector); + _evry_selector_update(selector); } - + ecore_timer_del(update_timer); update_timer = NULL; } @@ -1185,10 +1167,10 @@ it_object = selector->state->sel_item; if (act->type_in2 && !it_object) return; - + act->action(act, s_subject->sel_item, it_object, NULL); } - else + else { Evry_Item *it = s_action->sel_item; s_action->plugin->action(s_action->plugin, it, selector->state->input); @@ -1202,7 +1184,7 @@ if (s_object && s_object->plugin->action) s_object->plugin->action(s_object->plugin, s_object->sel_item, - s_object->input); + s_object->input); if (finished) evry_hide(); } @@ -1216,7 +1198,7 @@ Evas_Object *o; if (p->realize_items) p->realize_items(p, list->popup->evas); - + if (list->scroll_timer) { ecore_timer_del(list->scroll_timer); @@ -1229,16 +1211,16 @@ } if (!list->visible) return; - + list->scroll_align = 0; - + evas_event_freeze(list->popup->evas); e_box_freeze(list->o_list); EINA_LIST_FOREACH(p->items, l, it) { if (!it->o_bg) - { + { o = edje_object_add(list->popup->evas); it->o_bg = o; e_theme_edje_object_set(o, "base/theme/everything", @@ -1252,11 +1234,11 @@ * _evry_cb_item_mouse_out, it); */ evas_object_show(o); } - else + else { o = it->o_bg; } - + /* if (!it->o_icon && p->icon_get) p->icon_get(p, it, popup_list->evas); */ if (it->o_icon && edje_object_part_exists(o, "e.swallow.icons")) @@ -1264,7 +1246,7 @@ edje_object_part_swallow(o, "e.swallow.icons", it->o_icon); evas_object_show(it->o_icon); } - + edje_object_size_min_calc(o, &mw, &mh); e_box_pack_end(list->o_list, o); e_box_pack_options_set(o, 1, 1, 1, 0, 0.5, 0.5, mw, mh, 9999, mh); @@ -1281,7 +1263,7 @@ e_box_thaw(list->o_list); list->item_idler = ecore_idler_add(_evry_list_item_idler, p); - + e_box_min_size_get(list->o_list, NULL, &mh); evas_object_geometry_get(list->o_list, NULL, NULL, NULL, &h); if (mh <= h) @@ -1307,13 +1289,13 @@ if (!p->icon_get) goto end; e_box_freeze(list->o_list); - + EINA_LIST_FOREACH(p->items, l, it) { if (!it->o_icon) { it->o_icon = p->icon_get(p, it, list->popup->evas); - + if (it->o_icon) { edje_object_part_swallow(it->o_bg, "e.swallow.icons", it->o_icon); @@ -1426,11 +1408,11 @@ Eina_List *l; if (!it) return; - + for(l = s->plugin->items; l; l = l->next, i++) if (l->data == it) break; n = eina_list_count(s->plugin->items); - + e_box_min_size_get(list->o_list, NULL, &mh); evas_object_geometry_get(list->o_list, NULL, NULL, NULL, &h); @@ -1438,13 +1420,13 @@ /* printf("MAX %d %d %d\n", max_h, h, mh); * if (max_h != h) * evas_object_resize(list->o_list, max_w, max_h); */ - + if (i >= n || mh <= h) { e_box_align_set(list->o_list, 0.5, 0.0); return; } - + if (n > 1) { list->scroll_align_to = (double)i / (double)(n - 1); @@ -1551,17 +1533,17 @@ _evry_list_win_show(); return; } - + s->plugin_auto_selected = EINA_FALSE; s->item_auto_selected = EINA_FALSE; - + if (!s->sel_item) { _evry_list_item_sel(s, s->plugin->items->data); - _evry_selector_update(selector); + _evry_selector_update(selector); return; } - + EINA_LIST_FOREACH (s->plugin->items, l, it) { if (it == s->sel_item) @@ -1569,7 +1551,7 @@ if (l->next) { _evry_list_item_sel(s, l->next->data); - _evry_selector_update(selector); + _evry_selector_update(selector); } break; } @@ -1583,12 +1565,12 @@ Evry_Item *it; if (!s->plugin || !s->plugin->items) return; - + s->plugin_auto_selected = EINA_FALSE; s->item_auto_selected = EINA_FALSE; - + if (!s->sel_item) return; - + EINA_LIST_FOREACH (s->plugin->items, l, it) { if (it == s->sel_item) @@ -1612,10 +1594,10 @@ if (!p) return; if (list->visible) - { + { if (s->plugin != p) { - if (s->plugin) + if (s->plugin) edje_object_signal_emit(s->plugin->tab, "e,state,unselected", "e"); /* XXX tab_show ? -> see evry_plugin_async_update*/ @@ -1635,11 +1617,11 @@ { Eina_List *l; Evry_Plugin *p = NULL; - + if (!s->plugin) return; /* _evry_list_win_show(); */ - + l = eina_list_data_find_list(s->cur_plugins, s->plugin); if (l && l->next) @@ -1653,17 +1635,17 @@ _evry_list_clear_list(s); _evry_select_plugin(s, p); _evry_list_show_items(s, p); - _evry_selector_update(selector); + _evry_selector_update(selector); } } static void _evry_list_plugin_next_by_name(Evry_State *s, const char *key) -{ +{ Eina_List *l; Evry_Plugin *p, *first = NULL, *next = NULL; int found = 0; - + if (!s->plugin) return; EINA_LIST_FOREACH(s->cur_plugins, l, p) @@ -1684,14 +1666,14 @@ p = first; else p = NULL; - + if (p) { s->plugin_auto_selected = 0; _evry_list_clear_list(s); _evry_select_plugin(s, p); _evry_list_show_items(s, p); - _evry_selector_update(selector); + _evry_selector_update(selector); } } @@ -1700,11 +1682,11 @@ { Eina_List *l; Evry_Plugin *p = NULL; - + if (!s->plugin) return; /* _evry_list_win_show(); */ - + l = eina_list_data_find_list(s->cur_plugins, s->plugin); if (l && l->prev) @@ -1715,14 +1697,14 @@ if (s->plugin != l->data) p = l->data; } - + if (p) { s->plugin_auto_selected = 0; _evry_list_clear_list(s); _evry_select_plugin(s, p); _evry_list_show_items(s, p); - _evry_selector_update(selector); + _evry_selector_update(selector); } } @@ -1772,15 +1754,15 @@ { if (p->tab && !eina_list_data_find(s->cur_plugins, p)) { - e_box_unpack(p->tab); + e_box_unpack(p->tab); evas_object_del(p->tab); p->tab = NULL; } } - + /* show/update tabs of active plugins */ EINA_LIST_FOREACH(s->cur_plugins, l, p) - { + { _evry_list_tab_show(s, p); if (s->plugin == p) edje_object_signal_emit(p->tab, "e,state,selected", "e"); @@ -1830,7 +1812,7 @@ evas_object_show(o); e_box_pack_options_set(o, 1, 1, 0, 0, 0.5, 0.5, mw, mh, 9999, 9999); e_box_thaw(list->o_tabs); - + p->tab = o; } @@ -1868,11 +1850,11 @@ Evry_Action *act; Eina_List *l; Evry_Selector *sel = selectors[1]; - + _evry_plug_actions_cleanup(p); if (!it) return 0; - + const char *type = it->plugin->type_out; EINA_LIST_FOREACH(evry_conf->actions, l, act) @@ -1899,17 +1881,17 @@ char match1[128]; char match2[128]; int prio; - - if (p->items) + + if (p->items) { EINA_LIST_FREE(p->items, it) - evry_item_free(it); + evry_item_free(it); p->items = NULL; } snprintf(match1, sizeof(match1), "%s*", input); snprintf(match2, sizeof(match2), "*%s*", input); - + EINA_LIST_FOREACH(sel->actions, l, act) { if (input) @@ -1920,7 +1902,7 @@ prio = 2; else prio = 0; } - + if (!input || prio) { it = evry_item_new(p, act->name); @@ -1941,11 +1923,11 @@ { Evry_Item *it; Evry_Selector *sel = selectors[1]; - + EINA_LIST_FREE(p->items, it) - evry_item_free(it); + evry_item_free(it); p->items = NULL; - + if (sel->actions) eina_list_free(sel->actions); sel->actions = NULL; } @@ -1955,9 +1937,9 @@ { Evas_Object *o; Evry_Action *act = it->data[0]; - + if (!act) return NULL; - + if (act->icon_get) o = act->icon_get(act, e); else if (act->icon) @@ -1965,7 +1947,7 @@ o = e_icon_add(e); evry_icon_theme_set(o, act->icon); } - + return o; } @@ -2055,7 +2037,7 @@ { Eina_List *l; Evry_Plugin *plugin; - + EINA_LIST_FOREACH(s->cur_plugins, l, plugin) if (p == plugin) return; @@ -2067,7 +2049,7 @@ s->cur_plugins = eina_list_prepend_relative_list(s->cur_plugins, p, l); else s->cur_plugins = eina_list_append(s->cur_plugins, p); - + } EAPI void @@ -2075,7 +2057,7 @@ { Evry_State *s; Evry_Plugin *agg; - + if (!win) return; s = selector->state; @@ -2084,7 +2066,7 @@ if (!s || !eina_list_data_find(s->plugins, p)) return; agg = selector->aggregator; - + if (action == EVRY_ASYNC_UPDATE_ADD) { /* remove plugin and update selector. */ @@ -2093,7 +2075,7 @@ if (!eina_list_data_find(s->cur_plugins, p)) return; s->cur_plugins = eina_list_remove(s->cur_plugins, p); - + if (p == s->plugin) { s->plugin = NULL; @@ -2135,12 +2117,12 @@ evas_event_freeze(list->popup->evas); e_box_freeze(list->o_list); EINA_LIST_FOREACH(p->items, l, it) - if (it->o_bg) e_box_unpack(it->o_bg); + if (it->o_bg) e_box_unpack(it->o_bg); e_box_thaw(list->o_list); evas_event_thaw(list->popup->evas); _evry_list_show_items(s, p); - _evry_list_scroll_to(s, s->sel_item); + _evry_list_scroll_to(s, s->sel_item); } } } @@ -2171,10 +2153,10 @@ * { * Ecore_Event_Mouse_Button *ev; * Evry_State *s =state; - * + * * ev = event; * if (ev->event_window != input_window) return 1; - * + * * if (item_mouseover) * { * if (s->sel_item != item_mouseover) @@ -2188,18 +2170,18 @@ * { * evas_event_feed_mouse_up(popup_list->evas, ev->buttons, 0, ev->timestamp, NULL); * } - * + * * return 1; * } - * + * * static int * _evry_cb_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event) * { * Ecore_Event_Mouse_Button *ev; - * + * * ev = event; * if (ev->event_window != input_window) return 1; - * + * * if (item_mouseover) * { * if (ev->buttons == 1) @@ -2211,19 +2193,19 @@ * { * evas_event_feed_mouse_up(popup_list->evas, ev->buttons, 0, ev->timestamp, NULL); * } - * + * * return 1; * } - * + * * static int * _evry_cb_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event) * { * Ecore_Event_Mouse_Move *ev; * Evry_State *s =state; - * + * * ev = event; * if (ev->event_window != input_window) return 1; - * + * * if (!ev_last_is_mouse) * { * ev_last_is_mouse = 1; @@ -2238,52 +2220,52 @@ * } * } * } - * + * * evas_event_feed_mouse_move(popup_list->evas, ev->x - popup_list->x, * ev->y - popup_list->y, ev->timestamp, NULL); - * + * * return 1; * } - * + * * static int * _evry_cb_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event) * { * Ecore_Event_Mouse_Wheel *ev; - * + * * ev = event; * if (ev->event_window != input_window) return 1; - * + * * ev_last_is_mouse = 0; - * + * * if (ev->z < 0) /\* up *\/ * { * int i; - * + * * for (i = ev->z; i < 0; i++) _evry_list_item_prev(); * } * else if (ev->z > 0) /\* down *\/ * { * int i; - * + * * for (i = ev->z; i > 0; i--) _evry_list_item_next(); * } * return 1; * } - * + * * static void * _evry_cb_item_mouse_in(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) * { * Evry_State *s =state; - * + * * if (!ev_last_is_mouse) return; - * + * * item_mouseover = data; - * + * * if (s->sel_item) _evry_list_item_desel(s->sel_item); * if (!(s->sel_item = data)) return; * _evry_list_item_sel(s->sel_item); * } - * + * * static void * _evry_cb_item_mouse_out(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) * { @@ -2301,7 +2283,7 @@ * if (!strncmp(state->input, p1->trigger, strlen(p1->trigger))) * return 1; * } - * + * * return p1->config->priority - p2->config->priority; * } */ Modified: trunk/e/src/modules/everything/evry_config.c =================================================================== --- trunk/e/src/modules/everything/evry_config.c 2009-08-12 18:47:46 UTC (rev 41715) +++ trunk/e/src/modules/everything/evry_config.c 2009-08-12 19:00:25 UTC (rev 41716) @@ -1,4 +1,3 @@ - #include "e_mod_main.h" /* typedef struct _E_Config_Dialog_Data E_Config_Dialog_Data; */ @@ -12,7 +11,7 @@ * static int _object = type_object; */ -struct _E_Config_Dialog_Data +struct _E_Config_Dialog_Data { int width, height; @@ -29,14 +28,14 @@ EAPI E_Config_Dialog * -evry_config_dialog(E_Container *con, const char *params __UNUSED__) +evry_config_dialog(E_Container *con, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; - + if (e_config_dialog_find("E", "_config_everything_dialog")) return NULL; v = E_NEW(E_Config_Dialog_View, 1); - + v->create_cfdata = _create_data; v->free_cfdata = _free_data; v->basic.apply_cfdata = _basic_apply_data; @@ -51,11 +50,11 @@ } static void -_fill_data(E_Config_Dialog_Data *cfdata) +_fill_data(E_Config_Dialog_Data *cfdata) { Eina_List *l; Evry_Plugin *p; - + cfdata->scroll_animate = evry_conf->scroll_animate; cfdata->height = evry_conf->height; cfdata->width = evry_conf->width; @@ -66,14 +65,14 @@ else if (p->type == type_action) cfdata->p_action = eina_list_append(cfdata->p_action, p); else if (p->type == type_object) - cfdata->p_object = eina_list_append(cfdata->p_object, p); + cfdata->p_object = eina_list_append(cfdata->p_object, p); } static void * _create_data(E_Config_Dialog *cfd __UNUSED__) { E_Config_Dialog_Data *cfdata; - + cfdata = E_NEW(E_Config_Dialog_Data, 1); _fill_data(cfdata); return cfdata; @@ -85,7 +84,7 @@ eina_list_free(cfdata->p_subject); eina_list_free(cfdata->p_action); eina_list_free(cfdata->p_object); - + E_FREE(cfdata); } @@ -119,7 +118,7 @@ Evas_Coord w; Eina_List *l; Evry_Plugin *p; - + /* freeze evas, edje, and list widget */ evas = evas_object_evas_get(obj); evas_event_freeze(evas); @@ -150,7 +149,7 @@ { Evry_Plugin *p; int prio = 0; - + l1 = eina_list_nth_list(plugins, sel); l2 = eina_list_nth_list(plugins, sel + dir); @@ -159,7 +158,7 @@ l1->data = l2->data; l2->data = p; - _fill_list(plugins, list, 0); + _fill_list(plugins, list, 0); e_widget_ilist_selected_set(list, sel + dir); EINA_LIST_FOREACH(plugins, l1, p) @@ -185,7 +184,7 @@ Evas_Object *o, *of, *ob, *otb; otb = e_widget_toolbook_add(evas, 48 * e_scale, 48 * e_scale); - + o = e_widget_list_add(evas, 0, 0); of = e_widget_framelist_add(evas, _("General Settings"), 0); @@ -194,16 +193,16 @@ ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 300, 800, 5, 0, NULL, &(cfdata->width), 200); - e_widget_framelist_object_append(of, ob); + e_widget_framelist_object_append(of, ob); ob = e_widget_label_add(evas, _("Popup Height")); e_widget_framelist_object_append(of, ob); ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 200, 800, 5, 0, NULL, &(cfdata->height), 200); - e_widget_framelist_object_append(of, ob); + e_widget_framelist_object_append(of, ob); e_widget_list_object_append(o, of, 1, 1, 0.5); - + of = e_widget_framelist_add(evas, _("Scroll Settings"), 0); ob = e_widget_check_add(evas, _("Scroll Animate"), &(cfdata->scroll_animate)); @@ -265,10 +264,10 @@ cfdata->p_object); e_widget_framelist_object_append(of, o); e_widget_list_object_append(ob, of, 1, 1, 0.5); - + e_widget_toolbook_page_append(otb, NULL, _("Plugins"), ob, 0, 0, 0, 0, 0.5, 0.0); e_widget_toolbook_page_show(otb, 1); - + return otb; } Modified: trunk/e/src/modules/everything/evry_plug_apps.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_apps.c 2009-08-12 18:47:46 UTC (rev 41715) +++ trunk/e/src/modules/everything/evry_plug_apps.c 2009-08-12 19:00:25 UTC (rev 41716) @@ -25,7 +25,7 @@ { const char *mime; Inst *inst = NULL; - + if (it) { Eina_List *l; @@ -55,9 +55,9 @@ { inst = E_NEW(Inst, 1); } - + p->private = inst; - + return 1; } @@ -81,7 +81,7 @@ _cleanup(Evry_Plugin *p) { Inst *inst = p->private; - + _list_free(p); if (inst) @@ -91,7 +91,7 @@ efreet_desktop_free(desktop); EINA_LIST_FREE(inst->apps_all, desktop) efreet_desktop_free(desktop); - + E_FREE(inst); } @@ -106,12 +106,12 @@ Efreet_Desktop *d2; Inst *inst = p->private; int already_refd = 0; - + if (desktop) file = desktop->exec; if (!file) return 0; - + if (!desktop) { char match[4096]; @@ -161,7 +161,7 @@ it = evry_item_new(p, desktop->name); else it = evry_item_new(p, file); - + app = E_NEW(Evry_App, 1); app->desktop = desktop; app->file = file; @@ -178,12 +178,12 @@ { Efreet_Desktop *desktop; Eina_List *l; - + EINA_LIST_FOREACH(apps, l, desktop) { if (eina_list_count(p->items) > 99) continue; if (!desktop || !desktop->name || !desktop->exec) continue; - + if (e_util_glob_case_match(desktop->exec, m1)) _item_add(p, desktop, NULL, 1); else if (e_util_glob_case_match(desktop->name, m1)) @@ -193,7 +193,7 @@ { if (eina_list_count(p->items) > 99) continue; if (!desktop || !desktop->name || !desktop->exec) continue; - + if (e_util_glob_case_match(desktop->exec, m2)) _item_add(p, desktop, NULL, 2); else if (e_util_glob_case_match(desktop->name, m2)) @@ -240,7 +240,7 @@ if ((int)(t2 - t1)) return (int)(t2 - t1); - + // TODO compare exe strings? else return 0; } @@ -258,7 +258,7 @@ Inst *inst = p->private; inst->added = eina_hash_string_small_new(NULL); - + _list_free(p); if (input) @@ -289,16 +289,16 @@ if (input) { if (!inst->apps_all) - inst->apps_all = efreet_util_desktop_name_glob_list("*"); + inst->apps_all = efreet_util_desktop_name_glob_list("*"); - _add_desktop_list(p, inst->apps_all, match1, match2); + _add_desktop_list(p, inst->apps_all, match1, match2); } /* add exe history items */ else if (!p->items) { l = e_exehist_list_get(); EINA_LIST_FREE(l, file) - _item_add(p, NULL, file, 1); + _item_add(p, NULL, file, 1); } /* show 'Run Command' item */ @@ -311,14 +311,14 @@ if (input) { snprintf(match2, 4096, "%s", input); - + if (end = strchr(input, ' ')) { int len = (end - input) - 1; if (len >= 0) snprintf(match2, len, "%s", input); } - + EINA_LIST_FOREACH(exe_path, l, path) { snprintf(match1, 4096, "%s/%s", path, match2); @@ -326,10 +326,10 @@ { found = 1; break; - } + } } } - + if (found || p == p2) { it = evry_item_new(p, _("Run Command")); @@ -393,7 +393,7 @@ if (app->file && strlen(app->file) > 0) return 1; - + return 0; } @@ -405,21 +405,21 @@ Efreet_Desktop *desktop = NULL; Eina_List *files = NULL; char *exe = NULL; - + if (!it_app) return 0; - + app = it_app->data[0]; if (!app) return 0; - + zone = e_util_zone_current_get(e_manager_current_get()); - + if (app->desktop) { if (it_file && it_file->uri) files = eina_list_append(files, it_file->uri); e_exec(zone, app->desktop, NULL, files, "everything"); - + if (it_file && it_file->mime) e_exehist_mime_desktop_add(it_file->mime, app->desktop); @@ -436,7 +436,7 @@ snprintf(exe, len, "%s %s", app->file, it_file->uri); } else exe = (char *) app->file; - + e_exec(zone, NULL, exe, NULL, NULL); if (it_file && it_file->uri) @@ -457,7 +457,7 @@ { Inst *inst = p->private; if (inst->candidate) - return _app_action(it, inst->candidate); + return _app_action(it, inst->candidate); } static int @@ -489,11 +489,11 @@ e_user_homedir_get(), app->file); desktop = efreet_desktop_empty_new(eina_stringshare_add(buf)); /* XXX check if this gets freed by efreet*/ - desktop->exec = strdup(app->file); + desktop->exec = strdup(app->file); } e_desktop_edit(e_container_current_get(e_manager_current_get()), desktop); - + return 1; } @@ -507,7 +507,7 @@ if (app->file && strlen(app->file) > 0) return 1; - + return 0; } @@ -525,7 +525,7 @@ if (!it1) return 0; app = it1->data[0]; - + if (app->desktop) name = strdup(app->desktop->name); else @@ -534,7 +534,7 @@ if ((end = strchr(name, ' '))) name[end - name] = '\0'; - + for (i = 0; i < 10; i++) { snprintf(buf, 4096, "%s/.local/share/applications/%s-%d.desktop", @@ -548,24 +548,24 @@ } free(name); - + if (strlen(buf) == 0) return 0; - + if (!app->desktop) { desktop = efreet_desktop_empty_new(buf); desktop->exec = strdup(app->file); } - else + else { efreet_desktop_save_as(app->desktop, buf); /*XXX hackish - desktop is removed on save_as..*/ efreet_desktop_new(app->desktop->orig_path); - + desktop = efreet_desktop_new(buf); } - + e_desktop_edit(e_container_current_get(e_manager_current_get()), desktop); return 1; @@ -575,7 +575,7 @@ _init(void) { char *path, *p, *last; - + p1 = E_NEW(Evry_Plugin, 1); p1->name = "Applications"; p1->type = type_subject; @@ -609,7 +609,7 @@ act->check_item = &_exec_app_check_item; act->icon = "everything-launch"; evry_action_register(act); - + act1 = E_NEW(Evry_Action, 1); act1->name = "Open File..."; act1->type_in1 = "APPLICATION"; @@ -654,7 +654,7 @@ exe_path = eina_list_append(exe_path, strdup(last)); free(path); } - + return EINA_TRUE; } @@ -662,7 +662,7 @@ _shutdown(void) { char *str; - + evry_plugin_unregister(p1); evry_plugin_unregister(p2); evry_action_unregister(act); Modified: trunk/e/src/modules/everything/evry_plug_aspell.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_aspell.c 2009-08-12 18:47:46 UTC (rev 41715) +++ trunk/e/src/modules/everything/evry_plug_aspell.c 2009-08-12 19:00:25 UTC (rev 41716) @@ -293,26 +293,26 @@ * { * const char *label; * int len; - * + * * if (!it) return EVRY_ACTION_CONTINUE; - * + * * label = it->label; * len = eina_stringshare_strlen(label); - * + * * if (!ecore_x_selection_primary_set(clipboard_win, label, len)) * fprintf(stderr, "ASPELL cannot set primary selection to %#x '%s'\n", * clipboard_win, label); * if (!ecore_x_selection_clipboard_set(clipboard_win, label, len)) * fprintf(stderr, "ASPELL cannot set clipboard selection to %#x '%s'\n", * clipboard_win, label); - * + * * if (plugin->items) * { * Eina_List *l, *l_next; * Evry_Item *it2; - * + * * evry_plugin_async_update(plugin, EVRY_ASYNC_UPDATE_CLEAR); - * + * * EINA_LIST_FOREACH_SAFE(plugin->items, l, l_next, it2) * { * if (it == it2) continue; @@ -321,9 +321,9 @@ * E_FREE(it2); * } * } - * + * * evry_plugin_async_update(plugin, EVRY_ASYNC_UPDATE_ADD); - * + * * return EVRY_ACTION_FINISHED; * } */ Modified: trunk/e/src/modules/everything/evry_plug_border_act.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border_act.c 2009-08-12 18:47:46 UTC (rev 41715) +++ trunk/e/src/modules/everything/evry_plug_border_act.c 2009-08-12 19:00:25 UTC (rev 41716) @@ -99,14 +99,14 @@ else prio = 0; } - + if (!prio) return; - + it = evry_item_new(p, label); it->data[0] = action_cb; it->data[1] = (void *) eina_stringshare_add(icon); it->priority = prio; - + p->items = eina_list_prepend(p->items, it); } @@ -140,12 +140,12 @@ m1[0] = 0; m2[0] = 0; } - + _item_add(p, _("Switch To"), _act_cb_border_switch_to, "go-next", m1, m2); if (inst->border->iconic) _item_add(p, _("Uniconify"), _act_cb_border_unminimize, "window-minimize", m1, m2); - else + else _item_add(p, _("Iconify"), _act_cb_border_minimize, "window-minimize", m1, m2); if (!inst->border->fullscreen) @@ -179,7 +179,7 @@ { Evas_Object *o; - o = e_icon_add(e); + o = e_icon_add(e); evry_icon_theme_set(o, (const char *)it->data[1]); /* icon = edje_object_add(e); Modified: trunk/e/src/modules/everything/evry_plug_calc.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_calc.c 2009-08-12 18:47:46 UTC (rev 41715) +++ trunk/e/src/modules/everything/evry_plug_calc.c 2009-08-12 19:00:25 UTC (rev 41716) @@ -67,7 +67,7 @@ if (p->items->next) { it = p->items->data; - + EINA_LIST_FOREACH(p->items->next, l, it2) { if (!strcmp(it->label, it2->label)) @@ -97,7 +97,7 @@ _fetch(Evry_Plugin *p, const char *input) { char buf[1024]; - + if (history) { p->items = history; @@ -119,7 +119,7 @@ ecore_exe_send(exe, buf, strlen(buf)); error = 0; } - + return 1; } @@ -130,7 +130,7 @@ it = evry_item_new(p, result); if (!it) return; - + p->items = eina_list_prepend(p->items, it); } @@ -141,7 +141,7 @@ Ecore_Exe_Event_Data_Line *l; if (ev->exe != exe) return 1; - + evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_CLEAR); for (l = ev->lines; l && l->line; l++) Modified: trunk/e/src/modules/everything/evry_plug_clipboard.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_clipboard.c 2009-08-12 18:47:46 UTC (rev 41715) +++ trunk/e/src/modules/everything/evry_plug_clipboard.c 2009-08-12 19:00:25 UTC (rev 41716) @@ -22,7 +22,7 @@ { Ecore_X_Window win = ecore_x_window_new(0, 0, 0, 1, 1); if (!win) return EINA_FALSE; - + act = E_NEW(Evry_Action, 1); act->name = "Copy to Clipboard"; act->is_default = EINA_TRUE; @@ -33,7 +33,7 @@ evry_action_register(act); clipboard_win = win; - + return EINA_TRUE; } Modified: trunk/e/src/modules/everything/evry_plug_dir_browse.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-08-12 18:47:46 UTC (rev 41715) +++ trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-08-12 19:00:25 UTC (rev 41716) @@ -25,10 +25,10 @@ { Evry_Item *it = NULL; char buf[4096]; - + it = evry_item_new(p, file); if (!it) return NULL; - + snprintf(buf, sizeof(buf), "%s/%s", directory, file); it->uri = eina_stringshare_add(buf); @@ -41,7 +41,7 @@ const char *mime; if (it->mime) return; - + if ((e_util_glob_case_match(it->label, "*.desktop")) || (e_util_glob_case_match(it->label, "*.directory"))) { @@ -98,7 +98,7 @@ Evry_Item *it; if (!idler) return 0; - + EINA_LIST_FOREACH(s->items, l, it) { if (!it->mime) @@ -112,7 +112,7 @@ if (!s->command) { evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_CLEAR); - + if (eina_list_count(p->items) > 0) { p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort); @@ -120,14 +120,14 @@ } evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD); - + if (cnt > 0) { idler = NULL; return 0; } } - + return 1; } @@ -142,7 +142,7 @@ s = E_NEW(State, 1); s->directory = eina_stringshare_add(e_user_homedir_get()); p->items = NULL; - + files = ecore_file_ls(s->directory); EINA_LIST_FREE(files, file) @@ -156,7 +156,7 @@ } it = _item_add(p, s->directory, file); - + if (it) s->items = eina_list_append(s->items, it); @@ -170,7 +170,7 @@ stack = eina_list_prepend(stack, s); p->private = stack; - + return 1; } @@ -182,7 +182,7 @@ Eina_List *files; Evry_Item *it; Eina_List *stack = p->private; - + if (!it_file || !it_file->uri || !ecore_file_is_dir(it_file->uri)) return 0; @@ -204,7 +204,7 @@ } it = _item_add(p, s->directory, file); - + if (it) s->items = eina_list_append(s->items, it); @@ -226,9 +226,9 @@ State *s; Evry_Item *it; Eina_List *stack = p->private; - + if (!stack) return; - + s = stack->data; if (s->directory) eina_stringshare_del(s->directory); @@ -239,21 +239,21 @@ if (it->mime) eina_stringshare_del(it->mime); evry_item_free(it); } - + if (idler) { ecore_idler_del(idler); idler = NULL; } - + E_FREE(s); if (p->items) eina_list_free(p->items); p->items = NULL; - + stack = eina_list_remove_list(stack, stack); p->private = stack; - + if (stack) { s = stack->data; @@ -271,7 +271,7 @@ char match2[4096]; int cnt = 0; State *s = ((Eina_List *)p->private)->data; - + if (!s->command) { if (p->items) eina_list_free(p->items); @@ -291,7 +291,7 @@ s->cur = p->items; s->command = EINA_TRUE; return 1; - + } else if (!strncmp(input, "..", 2)) { @@ -301,9 +301,9 @@ int prio = 0; if (!strcmp(s->directory, "/")) return 0; - + snprintf(dir, 4096, "%s", s->directory); - end = strrchr(dir, '/'); + end = strrchr(dir, '/'); while (end != dir) { @@ -342,7 +342,7 @@ p->items = NULL; s->command = EINA_FALSE; } - + if (!directory) directory = s->directory; @@ -378,14 +378,14 @@ s->cur = p->items; return 1; } - + return 0; } static Evas_Object * _item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e) { - Evas_Object *o = NULL; + Evas_Object *o = NULL; char *icon_path; if (!it->mime) @@ -395,7 +395,7 @@ if (it->browseable) { - o = e_icon_add(e); + o = e_icon_add(e); evry_icon_theme_set(o, "folder"); } else @@ -409,11 +409,11 @@ } if (!o) { - o = e_icon_add(e); + o = e_icon_add(e); evry_icon_theme_set(o, "none"); } } - return o; + return o; } static Eina_Bool Modified: trunk/e/src/modules/everything/evry_plug_tracker.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-12 18:47:46 UTC (rev 41715) +++ trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-12 19:00:25 UTC (rev 41716) @@ -23,7 +23,7 @@ Inst *inst = p->private; inst->active = 0; - + if (!strcmp(it->plugin->type_out, "APPLICATION")) { Efreet_Desktop *desktop; @@ -40,10 +40,10 @@ if (!app->desktop || !app->desktop->mime_types) return 1; - + rdf_query[0] = '\0'; strcat(rdf_query, "<rdfq:Condition><rdfq:or>"); - + EINA_LIST_FOREACH(app->desktop->mime_types, l, mime) { if (!strcmp(mime, "x-directory/normal")) @@ -71,7 +71,7 @@ static void _item_add(Evry_Plugin *p, char *file, char *mime, int prio) { - Evry_Item *it; + Evry_Item *it; const char *filename; int folder = (!strcmp(mime, "Folder")); @@ -81,7 +81,7 @@ filename = ecore_file_file_get(file); if (!filename) return; - + it = evry_item_new(p, filename); it->priority = prio; it->uri = eina_stringshare_add(file); @@ -93,7 +93,7 @@ } else it->mime = eina_stringshare_add(mime); - + p->items = eina_list_append(p->items, it); } @@ -120,10 +120,10 @@ char *uri, *mime, *date; Evry_Plugin *p = data; Inst *inst = p->private; - + if (inst->active) inst->active--; if (inst->active) return; - + if (dbus_error_is_set(error)) { printf("Error: %s - %s\n", error->name, error->message); @@ -135,9 +135,9 @@ { dbus_message_iter_recurse(&array, &item); while(dbus_message_iter_get_arg_type(&item) == DBUS_TYPE_ARRAY) - { + { dbus_message_iter_recurse(&item, &iter); - + if (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_STRING) { dbus_message_iter_get_basic(&iter, &uri); @@ -149,13 +149,13 @@ /* dbus_message_iter_next(&iter); * dbus_message_iter_get_basic(&iter, &date); * printf("%s : %s\n", date, uri); */ - - if (uri && mime) _item_add(p, uri, mime, 1); + + if (uri && mime) _item_add(p, uri, mime, 1); } dbus_message_iter_next(&item); } } - + evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD); } @@ -173,7 +173,7 @@ char *search_text; char *fields[2]; char *keywords[1]; - char *sort_fields[1]; + char *sort_fields[1]; fields[0] = "File:Mime"; /* fields[1] = "File:Modified"; */ fields[1] = "File:Accessed"; @@ -188,22 +188,22 @@ if (!conn) return 0; - if (input && (strlen(input) > 2)) - { + if (input && (strlen(input) > 2)) + { search_text = malloc(sizeof(char) * strlen(input) + 3); sprintf(search_text, "*%s*", input); max_hits = 50; } else if (!p->begin && p->type == type_object) { - + sort_by_access = 1; search_text = ""; } else return 0; inst->active++; - + msg = dbus_message_new_method_call("org.freedesktop.Tracker", "/org/freedesktop/Tracker/Search", "org.freedesktop.Tracker.Search", @@ -236,10 +236,10 @@ { char *icon_path; Evas_Object *o = NULL; - + if (it->browseable) { - o = e_icon_add(e); + o = e_icon_add(e); evry_icon_theme_set(o, "folder"); } else @@ -253,7 +253,7 @@ } else { - o = e_icon_add(e); + o = e_icon_add(e); evry_icon_theme_set(o, "none"); } } @@ -265,7 +265,7 @@ { Evry_Plugin *p; Inst *inst; - + p = E_NEW(Evry_Plugin, 1); p->name = name; p->type = type; @@ -289,9 +289,9 @@ static Eina_Bool _init(void) -{ +{ conn = e_dbus_bus_get(DBUS_BUS_SESSION); - + if (!conn) return EINA_FALSE; _plugin_new("Folders", type_subject, "Folders", 20, 0); @@ -303,7 +303,7 @@ _plugin_new("Find Files", type_object, "Files", 20, 1); _plugin_new("Folders", type_object, "Folders", 20, 0); - + return EINA_TRUE; } @@ -312,11 +312,11 @@ { Inst *inst; Evry_Plugin *p; - + if (conn) e_dbus_connection_close(conn); EINA_LIST_FREE(plugins, p) - { + { evry_plugin_unregister(p); inst = p->private; if (inst->condition[0]) free(inst->condition); |
From: Enlightenment S. <no-...@en...> - 2009-08-12 19:14:57
|
Log: 'everything' module: dirbrowse refactor Author: jeffdameth Date: 2009-08-12 12:14:45 -0700 (Wed, 12 Aug 2009) New Revision: 41717 Modified: trunk/e/src/modules/everything/evry_plug_dir_browse.c Modified: trunk/e/src/modules/everything/evry_plug_dir_browse.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-08-12 19:00:25 UTC (rev 41716) +++ trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-08-12 19:14:45 UTC (rev 41717) @@ -131,16 +131,15 @@ return 1; } -static int -_begin(Evry_Plugin *p, const Evry_Item *it) +static void +_push_directory(Evry_Plugin *p, State *s) { - State *s; char *file; Eina_List *files; + Evry_Item *it; Eina_List *stack = p->private; - s = E_NEW(State, 1); - s->directory = eina_stringshare_add(e_user_homedir_get()); + /* previous states items are saved in s->items !*/ p->items = NULL; files = ecore_file_ls(s->directory); @@ -170,7 +169,17 @@ stack = eina_list_prepend(stack, s); p->private = stack; +} +static int +_begin(Evry_Plugin *p, const Evry_Item *item __UNUSED__) +{ + State *s; + + s = E_NEW(State, 1); + s->directory = eina_stringshare_add(e_user_homedir_get()); + _push_directory(p, s); + return 1; } @@ -178,46 +187,13 @@ _browse(Evry_Plugin *p, const Evry_Item *it_file) { State *s; - char *file; - Eina_List *files; - Evry_Item *it; - Eina_List *stack = p->private; if (!it_file || !it_file->uri || !ecore_file_is_dir(it_file->uri)) return 0; s = E_NEW(State, 1); s->directory = eina_stringshare_add(it_file->uri); - /* previous states items are saved in s->items !*/ - p->items = NULL; - - files = ecore_file_ls(s->directory); - - EINA_LIST_FREE(files, file) - { - it = NULL; - - if (file[0] == '.') - { - free(file); - continue; - } - - it = _item_add(p, s->directory, file); - - if (it) - s->items = eina_list_append(s->items, it); - - free(file); - } - - if (idler) - ecore_idler_del(idler); - - idler = ecore_idler_add(_dirbrowse_idler, p); - - stack = eina_list_prepend(stack, s); - p->private = stack; + _push_directory(p, s); } static void |
From: Enlightenment S. <no-...@en...> - 2009-08-12 20:26:40
|
Log: 'everything' module: core refactoring Author: jeffdameth Date: 2009-08-12 13:26:27 -0700 (Wed, 12 Aug 2009) New Revision: 41719 Modified: trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry_plug_dir_browse.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-12 20:08:41 UTC (rev 41718) +++ trunk/e/src/modules/everything/evry.c 2009-08-12 20:26:27 UTC (rev 41719) @@ -590,27 +590,16 @@ static void _evry_selector_activate(Evry_Selector *sel) { - if (selector && selector->state) + if (selector) { Evry_State *s = selector->state; Evry_Plugin *p; Eina_List *l; - _evry_list_clear_list(s); - edje_object_signal_emit(selector->o_main, "e,state,unselected", "e"); edje_object_part_text_set(selector->o_main, "e.text.plugin", ""); - if (update_timer) - { - if (s->plugin && !s->plugin->async_query) - { - _evry_matches_update(selector); - _evry_selector_update(selector); - } - ecore_timer_del(update_timer); - update_timer = NULL; - } + _evry_list_clear_list(s); EINA_LIST_FOREACH(selector->plugins, l, p) { @@ -940,7 +929,7 @@ _evry_list_clear_list(s); _evry_state_pop(sel); _evry_selector_update(sel); - sel->aggregator->fetch(sel->aggregator, NULL); + /* sel->aggregator->fetch(sel->aggregator, NULL); */ _evry_list_update(sel->state); _evry_update_text_label(sel->state); } @@ -950,6 +939,21 @@ { Evry_State *s = selector->state; + if (update_timer) + { + if ((s && !s->plugin->async_query) && + ((selector == selectors[0]) || + (selector == selectors[1]))) + { + _evry_list_clear_list(s); + _evry_matches_update(selector); + _evry_selector_update(selector); + } + + ecore_timer_del(update_timer); + update_timer = NULL; + } + if (selector == selectors[0]) { if (s->sel_item) @@ -961,36 +965,14 @@ if (s->plugin == action_selector) { - Evry_Action *act; - Evry_Selector *sel; - int w; + Evry_Action *act = s->sel_item->data[0]; - if (update_timer) - { - /* duplicate code: selector_activate, - plugin_action, update_timer !!! */ - if (!s->plugin->async_query) - { - _evry_list_clear_list(s); - _evry_matches_update(selector); - _evry_selector_update(selector); - } - ecore_timer_del(update_timer); - update_timer = NULL; - } - - act = s->sel_item->data[0]; - if (act && act->type_in2) { - - sel = selectors[2]; _evry_selector_objects_get(act->type_in2); - _evry_selector_update(sel); - + _evry_selector_update(selectors[2]); edje_object_signal_emit(win->o_main, "e,state,object_selector_show", "e"); - next_selector = 2; } } @@ -998,12 +980,14 @@ } else if (selector == selectors[2]) { - edje_object_signal_emit(win->o_main, - "e,state,object_selector_hide", "e"); + _evry_list_clear_list(s); while (selector->states) _evry_state_pop(selector); + edje_object_signal_emit(win->o_main, + "e,state,object_selector_hide", "e"); + _evry_selector_activate(selectors[0]); } } @@ -1117,6 +1101,7 @@ _evry_matches_update(selector); _evry_selector_update(selector); _evry_list_update(selector->state); + _evry_list_tabs_update(selector->state); update_timer = NULL; return 0; @@ -1146,7 +1131,8 @@ if (update_timer) { - if (!selector->state->plugin->async_query) + if ((selector->state->plugin) && + (!selector->state->plugin->async_query)) { _evry_matches_update(selector); _evry_selector_update(selector); @@ -2142,8 +2128,8 @@ _evry_list_clear_list(s); s->plugin = tmp; - s->cur_plugins = eina_list_remove(s->cur_plugins, p); - agg->fetch(agg, NULL); + /* s->cur_plugins = eina_list_remove(s->cur_plugins, p); + * agg->fetch(agg, NULL); */ } } Modified: trunk/e/src/modules/everything/evry_plug_dir_browse.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-08-12 20:08:41 UTC (rev 41718) +++ trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-08-12 20:26:27 UTC (rev 41719) @@ -194,6 +194,8 @@ s = E_NEW(State, 1); s->directory = eina_stringshare_add(it_file->uri); _push_directory(p, s); + + return 1; } static void |
From: Enlightenment S. <no-...@en...> - 2009-08-12 22:34:18
|
Log: 'everything' module: - added pasting from clipboard with ctrl+v - ctrl+u does not clear the trigger Author: jeffdameth Date: 2009-08-12 15:34:07 -0700 (Wed, 12 Aug 2009) New Revision: 41720 Modified: trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-12 20:26:27 UTC (rev 41719) +++ trunk/e/src/modules/everything/evry.c 2009-08-12 22:34:07 UTC (rev 41720) @@ -102,6 +102,8 @@ static int _evry_cb_key_down(void *data, int type, void *event); +static int _evry_cb_selection_notify(void *data, int type, void *event); + /* static int _evry_cb_mouse_down(void *data, int type, void *event); * static int _evry_cb_mouse_up(void *data, int type, void *event); * static int _evry_cb_mouse_move(void *data, int type, void *event); @@ -243,6 +245,11 @@ handlers = eina_list_append (handlers, ecore_event_handler_add (ECORE_EVENT_KEY_DOWN, _evry_cb_key_down, NULL)); + handlers = eina_list_append + (handlers, ecore_event_handler_add + (ECORE_X_EVENT_SELECTION_NOTIFY, + _evry_cb_selection_notify, win)); + /* handlers = eina_list_append * (handlers, ecore_event_handler_add * (ECORE_EVENT_MOUSE_BUTTON_DOWN, _evry_cb_mouse_down, NULL)); @@ -1039,16 +1046,22 @@ else if ((!strcmp(ev->key, "BackSpace")) || (!strcmp(ev->key, "Delete"))) _evry_backspace(s); + else if (!strcmp(ev->key, "v") && + (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) + ecore_x_selection_clipboard_request(win->popup->evas_win, + ECORE_X_SELECTION_TARGET_UTF8_STRING); else if ((ev->key) && (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) _evry_list_plugin_next_by_name(s, ev->key); else if ((ev->compose) && - (!(ev->modifiers & ECORE_EVENT_MODIFIER_ALT) || - (ev->modifiers & ECORE_EVENT_MODIFIER_WIN)) && - ((strlen(s->input) < (INPUTLEN - strlen(ev->compose))))) + (!(ev->modifiers & ECORE_EVENT_MODIFIER_ALT) || + (ev->modifiers & ECORE_EVENT_MODIFIER_WIN))) { - strcat(s->input, ev->compose); - _evry_update(s); + if (strlen(s->input) < (INPUTLEN - strlen(ev->compose))) + { + strcat(s->input, ev->compose); + _evry_update(s); + } } return 1; } @@ -1110,8 +1123,14 @@ static void _evry_clear(Evry_State *s) { - if (s->input[0] != 0) + if ((s->plugin->trigger && s->input) && + (!strncmp(s->plugin->trigger, s->input, strlen(s->plugin->trigger)))) { + s->input[strlen(s->plugin->trigger)] = 0; + _evry_update(s); + } + else if (s->input[0] != 0) + { s->input[0] = 0; _evry_update(s); edje_object_signal_emit(list->o_main, "e,state,entry_hide", "e"); @@ -1975,20 +1994,34 @@ Eina_List *l, *ll; Evry_Plugin *plugin; Evry_Item *it; - int cnt; + int cnt = 0; if (p->items) eina_list_free(p->items); p->items = NULL; EINA_LIST_FOREACH(s->cur_plugins, l, plugin) + cnt += eina_list_count(plugin->items); + + if (cnt <= 100) { - for (cnt = 0, ll = plugin->items; ll && cnt < 15; ll = ll->next, cnt++) + EINA_LIST_FOREACH(s->cur_plugins, l, plugin) { - it = ll->data; - p->items = eina_list_append(p->items, it); + EINA_LIST_FOREACH(plugin->items, ll, it) + p->items = eina_list_append(p->items, it); } } + else + { + EINA_LIST_FOREACH(s->cur_plugins, l, plugin) + { + for (cnt = 0, ll = plugin->items; ll && cnt < 15; ll = ll->next, cnt++) + { + it = ll->data; + p->items = eina_list_append(p->items, it); + } + } + } return 1; } @@ -2325,3 +2358,33 @@ return _evry_icon_fdo_set(obj, icon); } } + + +static int +_evry_cb_selection_notify(void *data, int type, void *event) +{ + Ecore_X_Event_Selection_Notify *ev; + Evry_State *s = selector->state; + + if (!s || (data != win)) return 1; + + ev = event; + if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) || + (ev->selection == ECORE_X_SELECTION_PRIMARY)) + { + if (strcmp(ev->target, ECORE_X_SELECTION_TARGET_UTF8_STRING) == 0) + { + Ecore_X_Selection_Data_Text *text_data; + + text_data = ev->data; + + if (strlen(s->input) < (INPUTLEN - strlen(text_data->text))) + { + strcat(s->input, text_data->text); + _evry_update(s); + } + } + } + + return 1; +} Modified: trunk/e/src/modules/everything/evry_plug_tracker.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-12 20:26:27 UTC (rev 41719) +++ trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-12 22:34:07 UTC (rev 41720) @@ -34,7 +34,7 @@ char rdf_query[32768]; int len = 0; - inst->service = "Files"; + /* inst->service = "Files"; */ if (inst->condition[0]) free (inst->condition); inst->condition = ""; @@ -281,6 +281,7 @@ inst->condition = ""; inst->service = service; inst->max_hits = max_hits; + inst->active = 0; p->private = inst; evry_plugin_register(p); plugins = eina_list_append(plugins, p); @@ -299,7 +300,7 @@ _plugin_new("Music", type_subject, "Music", 20, 0); _plugin_new("Videos", type_subject, "Videos", 20, 0); _plugin_new("Documents", type_subject, "Documents", 20, 0); - _plugin_new("Text", type_subject, "TextFiles", 20, 0); + /* _plugin_new("Text", type_subject, "TextFiles", 20, 0); */ _plugin_new("Find Files", type_object, "Files", 20, 1); _plugin_new("Folders", type_object, "Folders", 20, 0); |
From: Enlightenment S. <no-...@en...> - 2009-08-12 23:14:17
|
Log: 'everything' module: use primary selection instead of clipboard for pasting Author: jeffdameth Date: 2009-08-12 16:14:05 -0700 (Wed, 12 Aug 2009) New Revision: 41724 Modified: trunk/e/src/modules/everything/evry.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-12 23:04:26 UTC (rev 41723) +++ trunk/e/src/modules/everything/evry.c 2009-08-12 23:14:05 UTC (rev 41724) @@ -68,6 +68,7 @@ E_Popup *popup; Evas_Object *o_main; + Eina_Bool request_selection; /* E_Popup *input_win; */ }; @@ -1007,6 +1008,8 @@ /* ev_last_is_mouse = 0; * item_mouseover = NULL; */ + win->request_selection = EINA_FALSE; + ev = event; if (ev->event_window != input_window) return 1; @@ -1048,8 +1051,11 @@ _evry_backspace(s); else if (!strcmp(ev->key, "v") && (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) - ecore_x_selection_clipboard_request(win->popup->evas_win, - ECORE_X_SELECTION_TARGET_UTF8_STRING); + { + win->request_selection = EINA_TRUE; + ecore_x_selection_primary_request(win->popup->evas_win, + ECORE_X_SELECTION_TARGET_UTF8_STRING); + } else if ((ev->key) && (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) _evry_list_plugin_next_by_name(s, ev->key); @@ -2367,7 +2373,10 @@ Evry_State *s = selector->state; if (!s || (data != win)) return 1; + if (!win->request_selection) return 1; + win->request_selection = EINA_FALSE; + ev = event; if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) || (ev->selection == ECORE_X_SELECTION_PRIMARY)) @@ -2378,11 +2387,8 @@ text_data = ev->data; - if (strlen(s->input) < (INPUTLEN - strlen(text_data->text))) - { - strcat(s->input, text_data->text); - _evry_update(s); - } + strncat(s->input, text_data->text, (INPUTLEN - strlen(s->input)) - 1); + _evry_update(s); } } |
From: Enlightenment S. <no-...@en...> - 2009-08-13 02:45:16
|
Log: 'everything' module: fix seggie Author: jeffdameth Date: 2009-08-12 19:45:01 -0700 (Wed, 12 Aug 2009) New Revision: 41730 Modified: trunk/e/src/modules/everything/evry.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-13 01:52:00 UTC (rev 41729) +++ trunk/e/src/modules/everything/evry.c 2009-08-13 02:45:01 UTC (rev 41730) @@ -1129,7 +1129,7 @@ static void _evry_clear(Evry_State *s) { - if ((s->plugin->trigger && s->input) && + if ((s->plugin && s->plugin->trigger && s->input) && (!strncmp(s->plugin->trigger, s->input, strlen(s->plugin->trigger)))) { s->input[strlen(s->plugin->trigger)] = 0; |
From: Enlightenment S. <no-...@en...> - 2009-08-13 13:22:56
|
Log: 'everything' module: fix for async_update - more tracker hacks to give kind of partial word matching. waiting for tracker 0.7... Author: jeffdameth Date: 2009-08-13 06:22:44 -0700 (Thu, 13 Aug 2009) New Revision: 41734 Modified: trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-13 12:53:12 UTC (rev 41733) +++ trunk/e/src/modules/everything/evry.c 2009-08-13 13:22:44 UTC (rev 41734) @@ -2130,10 +2130,10 @@ } /* plugin is active */ - if ((s->plugin == p) || (s->plugin == agg)) + if ((!s->plugin) || (s->plugin == p) || (s->plugin == agg)) { + _evry_selector_update(selector); p = s->plugin; - _evry_selector_update(selector); if (list->visible) { Modified: trunk/e/src/modules/everything/evry_plug_tracker.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-13 12:53:12 UTC (rev 41733) +++ trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-13 13:22:44 UTC (rev 41734) @@ -1,7 +1,7 @@ #include "e.h" #include "e_mod_main.h" -/* TODO check if trackerd is running */ +/* TODO check if trackerd is running and version */ typedef struct _Inst Inst; @@ -11,6 +11,8 @@ char *condition; char *service; int max_hits; + const char *input; + const char *matched; }; static E_DBus_Connection *conn = NULL; @@ -34,7 +36,6 @@ char rdf_query[32768]; int len = 0; - /* inst->service = "Files"; */ if (inst->condition[0]) free (inst->condition); inst->condition = ""; @@ -68,7 +69,7 @@ return 1; } -static void +static Evry_Item * _item_add(Evry_Plugin *p, char *file, char *mime, int prio) { Evry_Item *it; @@ -76,13 +77,17 @@ int folder = (!strcmp(mime, "Folder")); /* folders are specifically searched */ - if (folder && p->begin) return; + if (folder && p->begin) + return NULL; filename = ecore_file_file_get(file); - if (!filename) return; + if (!filename) + return NULL; it = evry_item_new(p, filename); + if (!it) + return NULL; it->priority = prio; it->uri = eina_stringshare_add(file); @@ -94,7 +99,7 @@ else it->mime = eina_stringshare_add(mime); - p->items = eina_list_append(p->items, it); + return it; } @@ -104,6 +109,16 @@ Evry_Item *it; Inst *inst = p->private; + inst->active = 0; + + if (inst->input) + eina_stringshare_del(inst->input); + inst->input = NULL; + + if (inst->matched) + eina_stringshare_del(inst->matched); + inst->matched = NULL; + EINA_LIST_FREE(p->items, it) { if (it->mime) eina_stringshare_del(it->mime); @@ -113,23 +128,38 @@ p->items = NULL; } +static int +_cb_sort(const void *data1, const void *data2) +{ + const Evry_Item *it1, *it2; + + it1 = data1; + it2 = data2; + + return (it2->priority - it1->priority); +} + static void _dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error) { DBusMessageIter array, iter, item; char *uri, *mime, *date; + Evry_Item *it; + Eina_List *items = NULL; Evry_Plugin *p = data; Inst *inst = p->private; if (inst->active) inst->active--; - if (inst->active) return; if (dbus_error_is_set(error)) { + _cleanup(p); printf("Error: %s - %s\n", error->name, error->message); return; } + if (inst->active) return; + dbus_message_iter_init(msg, &array); if(dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_ARRAY) { @@ -146,16 +176,79 @@ dbus_message_iter_next(&iter); dbus_message_iter_get_basic(&iter, &mime); - /* dbus_message_iter_next(&iter); - * dbus_message_iter_get_basic(&iter, &date); - * printf("%s : %s\n", date, uri); */ + dbus_message_iter_next(&iter); + dbus_message_iter_get_basic(&iter, &date); - if (uri && mime) _item_add(p, uri, mime, 1); + if (uri && mime && date) + { + it = _item_add(p, uri, mime, atoi(date)); + if (it) + items = eina_list_append(items, it); + } } dbus_message_iter_next(&item); } } + if (items) + { + EINA_LIST_FREE(p->items, it) + { + if (it->mime) eina_stringshare_del(it->mime); + if (it->uri) eina_stringshare_del(it->uri); + evry_item_free(it); + } + p->items = items; + + if (inst->matched) + eina_stringshare_del(inst->matched); + inst->matched = eina_stringshare_add(inst->input); + } + else if (p->items && inst->input) + { + char input[128]; + char *pos = input; + + snprintf(input, 128, "%s", inst->input + (strlen(inst->matched) - 1)); + for (; *pos != '\0'; pos++) + if (isspace(*pos)) *pos = '*'; + + EINA_LIST_FREE(p->items, it) + { + if (e_util_glob_case_match(it->label, input)) + items = eina_list_append(items, it); + else + { + if (it->mime) eina_stringshare_del(it->mime); + if (it->uri) eina_stringshare_del(it->uri); + evry_item_free(it); + } + } + + p->items = items; + } + else + { + EINA_LIST_FREE(p->items, it) + { + if (it->mime) eina_stringshare_del(it->mime); + if (it->uri) eina_stringshare_del(it->uri); + evry_item_free(it); + } + p->items = NULL; + + if (inst->input) + eina_stringshare_del(inst->input); + inst->input = NULL; + + if (inst->matched) + eina_stringshare_del(inst->matched); + inst->matched = NULL; + } + + if (p->items) + p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort); + evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD); } @@ -175,16 +268,16 @@ char *keywords[1]; char *sort_fields[1]; fields[0] = "File:Mime"; - /* fields[1] = "File:Modified"; */ fields[1] = "File:Accessed"; keywords[0] = ""; - /* sort_fields[0] = "File:Modified"; */ sort_fields[0] = "File:Accessed"; char **_fields = fields; char **_keywords = keywords; char **_sort_fields = sort_fields; - _cleanup(p); + if (inst->input) + eina_stringshare_del(inst->input); + inst->input = NULL; if (!conn) return 0; @@ -193,10 +286,10 @@ search_text = malloc(sizeof(char) * strlen(input) + 3); sprintf(search_text, "*%s*", input); max_hits = 50; + inst->input = eina_stringshare_add(search_text); } - else if (!p->begin && p->type == type_object) + else if (!input && !p->begin && p->type == type_object) { - sort_by_access = 1; search_text = ""; } @@ -211,12 +304,15 @@ dbus_message_append_args(msg, DBUS_TYPE_INT32, &live_query_id, DBUS_TYPE_STRING, &inst->service, - DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &_fields, 1 + sort_by_access, + DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, + &_fields, 2, DBUS_TYPE_STRING, &search_text, - DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &_keywords, 0, + DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, + &_keywords, 0, DBUS_TYPE_STRING, &inst->condition, DBUS_TYPE_BOOLEAN, &sort_by_service, - DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &_sort_fields, sort_by_access, + DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, + &_sort_fields, sort_by_access, DBUS_TYPE_BOOLEAN, &sort_descending, DBUS_TYPE_INT32, &offset, DBUS_TYPE_INT32, &max_hits, |
From: Enlightenment S. <no-...@en...> - 2009-08-13 14:01:40
|
Log: 'everything' module: tracker: set plugin items NULL until tracker replied Author: jeffdameth Date: 2009-08-13 07:01:29 -0700 (Thu, 13 Aug 2009) New Revision: 41737 Modified: trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-13 13:57:22 UTC (rev 41736) +++ trunk/e/src/modules/everything/evry.c 2009-08-13 14:01:29 UTC (rev 41737) @@ -352,6 +352,9 @@ evry_item_free(Evry_Item *it) { if (it->label) eina_stringshare_del(it->label); + if (it->o_bg) evas_object_del(it->o_bg); + if (it->o_icon) evas_object_del(it->o_icon); + E_FREE(it); } Modified: trunk/e/src/modules/everything/evry_plug_tracker.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-13 13:57:22 UTC (rev 41736) +++ trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-13 14:01:29 UTC (rev 41737) @@ -13,6 +13,7 @@ int max_hits; const char *input; const char *matched; + Eina_List *items; }; static E_DBus_Connection *conn = NULL; @@ -126,6 +127,7 @@ evry_item_free(it); } p->items = NULL; + inst->items = NULL; } static int @@ -151,6 +153,8 @@ if (inst->active) inst->active--; + p->items = inst->items; + if (dbus_error_is_set(error)) { _cleanup(p); @@ -249,6 +253,7 @@ if (p->items) p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort); + inst->items = p->items; evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD); } @@ -279,8 +284,14 @@ eina_stringshare_del(inst->input); inst->input = NULL; - if (!conn) return 0; + if (!conn) + { + _cleanup(p); + return 0; + } + p->items = NULL; + if (input && (strlen(input) > 2)) { search_text = malloc(sizeof(char) * strlen(input) + 3); |
From: Enlightenment S. <no-...@en...> - 2009-08-13 22:42:57
|
Log: 'everything' module: use refcounters for Evry_Item... Author: jeffdameth Date: 2009-08-13 15:42:40 -0700 (Thu, 13 Aug 2009) New Revision: 41750 Modified: trunk/e/src/modules/everything/Evry.h trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry_plug_apps.c trunk/e/src/modules/everything/evry_plug_aspell.c trunk/e/src/modules/everything/evry_plug_border.c trunk/e/src/modules/everything/evry_plug_border_act.c trunk/e/src/modules/everything/evry_plug_calc.c trunk/e/src/modules/everything/evry_plug_config.c trunk/e/src/modules/everything/evry_plug_dir_browse.c trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/Evry.h =================================================================== --- trunk/e/src/modules/everything/Evry.h 2009-08-13 22:41:43 UTC (rev 41749) +++ trunk/e/src/modules/everything/Evry.h 2009-08-13 22:42:40 UTC (rev 41750) @@ -50,6 +50,8 @@ /* not to be set by plugin! */ Evas_Object *o_icon; Evas_Object *o_bg; + int ref; + void (*cb_free) (Evry_Item *item); }; struct _Evry_Plugin @@ -146,7 +148,7 @@ void evry_action_register(Evry_Action *act); void evry_action_unregister(Evry_Action *act); -Evry_Item *evry_item_new(Evry_Plugin *p, const char *label); +Evry_Item *evry_item_new(Evry_Plugin *p, const char *label, void (*cb_free) (Evry_Item *item)); void evry_item_free(Evry_Item *it); void evry_plugin_async_update(Evry_Plugin *plugin, int state); void evry_clear_input(void); Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-13 22:41:43 UTC (rev 41749) +++ trunk/e/src/modules/everything/evry.c 2009-08-13 22:42:40 UTC (rev 41750) @@ -39,6 +39,8 @@ candidates, the higher priority plugin is made current */ Eina_Bool plugin_auto_selected; Eina_Bool item_auto_selected; + + Eina_List *items; }; /* */ @@ -78,7 +80,6 @@ Evas_Object *o_main; Evas_Object *o_list; Evas_Object *o_tabs; - Eina_List *items; int ev_last_is_mouse; Evry_Item *item_mouseover; @@ -91,20 +92,7 @@ Eina_Bool visible; }; -/* struct _Evry_List_Item - * { - * Evry_Item *item; - * - * Evas_Object *o_icon; - * Evas_Object *o_bg; - * - * const char *label; - * }; */ - -static int _evry_cb_key_down(void *data, int type, void *event); -static int _evry_cb_selection_notify(void *data, int type, void *event); - /* static int _evry_cb_mouse_down(void *data, int type, void *event); * static int _evry_cb_mouse_up(void *data, int type, void *event); * static int _evry_cb_mouse_move(void *data, int type, void *event); @@ -173,6 +161,9 @@ static void _evry_plug_aggregator_cleanup(Evry_Plugin *p); static Evas_Object *_evry_plug_aggregator_item_icon_get(Evry_Plugin *p, const Evry_Item *it, Evas *e); +static int _evry_cb_key_down(void *data, int type, void *event); +static int _evry_cb_selection_notify(void *data, int type, void *event); + /* local subsystem globals */ static Evry_Window *win = NULL; static Evry_List_Window *list = NULL; @@ -299,6 +290,7 @@ ecore_timer_del(update_timer); update_timer = NULL; + list->visible = EINA_FALSE; _evry_selector_free(selectors[0]); _evry_selector_free(selectors[1]); _evry_selector_free(selectors[2]); @@ -334,8 +326,11 @@ } } + +/* static int item_cnt = 0; */ + Evry_Item * -evry_item_new(Evry_Plugin *p, const char *label) +evry_item_new(Evry_Plugin *p, const char *label, void (*cb_free) (Evry_Item *item)) { Evry_Item *it; @@ -345,19 +340,46 @@ it->plugin = p; if (label) it->label = eina_stringshare_add(label); + it->ref = 1; + + /* item_cnt++; */ + return it; } void evry_item_free(Evry_Item *it) { + if (!it) return; + + it->ref--; + + if (it->ref > 0) return; + + /* printf("%d, %d\t 0x%x 0x%x 0x%x free: %s\n", + * it->ref, item_cnt - 1, + * it->label, it->uri, it->mime, + * it->label); */ + /* item_cnt--; */ + + if (it->cb_free) it->cb_free(it); + if (it->label) eina_stringshare_del(it->label); + if (it->uri) eina_stringshare_del(it->uri); + if (it->mime) eina_stringshare_del(it->mime); + if (it->o_bg) evas_object_del(it->o_bg); if (it->o_icon) evas_object_del(it->o_icon); E_FREE(it); } +void +_evry_item_ref(Evry_Item *it) +{ + it->ref++; +} + static Evry_List_Window * _evry_list_win_new(E_Zone *zone) { @@ -380,7 +402,6 @@ e_object_del(E_OBJECT(popup)); return NULL; } - list_win->popup = popup; evas_event_freeze(popup->evas); @@ -411,9 +432,6 @@ evas_object_show(o); list_win->o_tabs = o; - /* edje_object_signal_callback_add(list_win->o_main, "e,state,list_shown", "e", - * _evry_list_cb_list_shown, NULL); */ - evas_event_thaw(popup->evas); return list_win; @@ -575,21 +593,15 @@ evas_object_del(sel->o_main); if (list->visible && (sel == selector)) - { - _evry_list_clear_list(sel->state); - } + _evry_list_clear_list(sel->state); - EINA_LIST_FREE(sel->states, s) + while (sel->states) + _evry_state_pop(sel); + + EINA_LIST_FREE(sel->plugins, p) { - free(s->input); - - EINA_LIST_FREE(s->plugins, p) - { - p->cleanup(p); - if (p->tab) evas_object_del(p->tab); - p->tab = NULL; - } - E_FREE(s); + if (p->tab) evas_object_del(p->tab); + p->tab = NULL; } _evry_plug_aggregator_free(sel->aggregator); @@ -610,8 +622,6 @@ edje_object_signal_emit(selector->o_main, "e,state,unselected", "e"); edje_object_part_text_set(selector->o_main, "e.text.plugin", ""); - _evry_list_clear_list(s); - EINA_LIST_FOREACH(selector->plugins, l, p) { e_box_unpack(p->tab); @@ -689,20 +699,15 @@ if (s) { - if (s->cur_plugins) - { - /* get first plugin */ - if ((!s->plugin) || (!eina_list_data_find(s->cur_plugins, s->plugin))) - _evry_select_plugin(s, s->cur_plugins->data); - } - else - { - s->plugin = NULL; - s->sel_item = NULL; - } + it = s->sel_item; + + if (!s->plugin && it) + _evry_list_item_desel(s, NULL); + else if (it && !eina_list_data_find_list(s->plugin->items, it)) + _evry_list_item_desel(s, NULL); it = s->sel_item; - + if (s->plugin && (!it || s->item_auto_selected)) { /* get first item */ @@ -747,10 +752,12 @@ _evry_list_update(Evry_State *s) { if (!list->visible) return; + + _evry_list_clear_list(s); + _evry_list_tabs_update(s); + if (!s->plugin) return; - _evry_list_clear_list(s); - _evry_list_tabs_update(s); _evry_list_show_items(s, s->plugin); _evry_list_scroll_to(s, s->sel_item); } @@ -866,8 +873,6 @@ s->input = malloc(INPUTLEN); s->input[0] = 0; s->plugins = plugins; - s->cur_plugins = NULL; - s->sel_item = NULL; s->plugin_auto_selected = 1; sel->states = eina_list_prepend(sel->states, s); @@ -880,12 +885,17 @@ _evry_state_pop(Evry_Selector *sel) { Evry_Plugin *p; + Evry_State *s; - free(sel->state->input); - EINA_LIST_FREE(sel->state->plugins, p) + s = sel->state; + + _evry_list_item_desel(s, NULL); + + free(s->input); + EINA_LIST_FREE(s->plugins, p) p->cleanup(p); - E_FREE(sel->state); + E_FREE(s); sel->states = eina_list_remove_list(sel->states, sel->states); @@ -939,8 +949,9 @@ _evry_list_clear_list(s); _evry_state_pop(sel); + + sel->aggregator->fetch(sel->aggregator, NULL); _evry_selector_update(sel); - /* sel->aggregator->fetch(sel->aggregator, NULL); */ _evry_list_update(sel->state); _evry_update_text_label(sel->state); } @@ -1121,7 +1132,6 @@ { Evry_State *s = data; /* XXX pass selector as data? */ - _evry_list_clear_list(s); _evry_matches_update(selector); _evry_selector_update(selector); _evry_list_update(selector->state); @@ -1213,6 +1223,8 @@ int mw, mh, h; Evas_Object *o; + if (!p) return; + if (p->realize_items) p->realize_items(p, list->popup->evas); if (list->scroll_timer) @@ -1235,7 +1247,9 @@ EINA_LIST_FOREACH(p->items, l, it) { - if (!it->o_bg) + o = it->o_bg; + + if (!o) { o = edje_object_add(list->popup->evas); it->o_bg = o; @@ -1248,25 +1262,19 @@ * _evry_cb_item_mouse_in, it); * evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT, * _evry_cb_item_mouse_out, it); */ - evas_object_show(o); } - else - { - o = it->o_bg; - } - /* if (!it->o_icon && p->icon_get) p->icon_get(p, it, popup_list->evas); */ - + edje_object_size_min_calc(o, &mw, &mh); + e_box_pack_end(list->o_list, o); + e_box_pack_options_set(o, 1, 1, 1, 0, 0.5, 0.5, mw, mh, 9999, mh); + evas_object_show(o); + if (it->o_icon && edje_object_part_exists(o, "e.swallow.icons")) { edje_object_part_swallow(o, "e.swallow.icons", it->o_icon); evas_object_show(it->o_icon); } - edje_object_size_min_calc(o, &mw, &mh); - e_box_pack_end(list->o_list, o); - e_box_pack_options_set(o, 1, 1, 1, 0, 0.5, 0.5, mw, mh, 9999, mh); - if (it == s->sel_item) { edje_object_signal_emit(it->o_bg, "e,state,selected", "e"); @@ -1275,6 +1283,9 @@ if (it->browseable) edje_object_signal_emit(it->o_bg, "e,state,arrow_show", "e"); } + + _evry_item_ref(it); + s->items = eina_list_append(s->items, it); } e_box_thaw(list->o_list); @@ -1292,7 +1303,42 @@ _evry_list_tab_scroll_to(s, p); } +static void +_evry_list_clear_list(Evry_State *s) +{ + Evry_Item *it; + if (list->item_idler) + { + ecore_idler_del(list->item_idler); + list->item_idler = NULL; + } + + if (s && s->items) + { + evas_event_freeze(list->popup->evas); + e_box_freeze(list->o_list); + EINA_LIST_FREE(s->items, it) + { + if (it->o_bg) + { + e_box_unpack(it->o_bg); + evas_object_hide(it->o_bg); + } + + if (it->o_icon) + evas_object_hide(it->o_icon); + + evry_item_free(it); + } + s->items = NULL; + } + + e_box_thaw(list->o_list); + evas_event_thaw(list->popup->evas); + /* } */ +} + static int _evry_list_item_idler(void *data) { @@ -1340,7 +1386,6 @@ if (s->cur_plugins) eina_list_free(s->cur_plugins); s->cur_plugins = NULL; - s->sel_item = NULL; if (s->input) { @@ -1377,7 +1422,7 @@ has_items = p->fetch(p, s->input); } - if ((has_items && eina_list_count(p->items) > 0) || (sel->states->next)) + if (has_items || sel->states->next) s->cur_plugins = eina_list_append(s->cur_plugins, p); } @@ -1386,37 +1431,17 @@ sel->aggregator->fetch(sel->aggregator, NULL); s->cur_plugins = eina_list_prepend(s->cur_plugins, sel->aggregator); } + else + sel->aggregator->cleanup(sel->aggregator); } + + if (s->plugin && !eina_list_data_find_list(s->cur_plugins, s->plugin)) + s->plugin = NULL; + + _evry_select_plugin(s, s->plugin); } -static void -_evry_list_clear_list(Evry_State *s) -{ - Evry_Item *it; - Eina_List *l; - if (list->item_idler) - { - ecore_idler_del(list->item_idler); - list->item_idler = NULL; - } - - if (s && s->plugin && s->plugin->items) - { - evas_event_freeze(list->popup->evas); - e_box_freeze(list->o_list); - EINA_LIST_FOREACH(s->plugin->items, l, it) - { - if (it->o_bg) evas_object_del(it->o_bg); - it->o_bg = NULL; - if (it->o_icon) evas_object_del(it->o_icon); - it->o_icon = NULL; - } - e_box_thaw(list->o_list); - evas_event_thaw(list->popup->evas); - } -} - static void _evry_list_scroll_to(Evry_State *s, Evry_Item *it) { @@ -1506,10 +1531,22 @@ static void _evry_list_item_desel(Evry_State *s, Evry_Item *it) -{ - edje_object_signal_emit(it->o_bg, "e,state,unselected", "e"); - if (it->o_icon) - edje_object_signal_emit(it->o_icon, "e,state,unselected", "e"); +{ + if (s->sel_item) + { + it = s->sel_item; + + if (list->visible) + { + if (it->o_bg) + edje_object_signal_emit(it->o_bg, "e,state,unselected", "e"); + if (it->o_icon) + edje_object_signal_emit(it->o_icon, "e,state,unselected", "e"); + } + + evry_item_free(it); + s->sel_item = NULL; + } } static void @@ -1517,21 +1554,21 @@ { if (s->sel_item == it) return; - if (list->visible && selector->state == s) + _evry_list_item_desel(s, NULL); + + if (list->visible) { - if (s->sel_item) - _evry_list_item_desel(s, s->sel_item); - - edje_object_signal_emit(it->o_bg, "e,state,selected", "e"); + if (it->o_bg) + edje_object_signal_emit(it->o_bg, "e,state,selected", "e"); if (it->o_icon) edje_object_signal_emit(it->o_icon, "e,state,selected", "e"); - if (it->browseable) edje_object_signal_emit(it->o_bg, "e,state,arrow_show", "e"); - - _evry_list_scroll_to(s, it); + if (s == selector->state) + _evry_list_scroll_to(s, it); } - + + _evry_item_ref(it); s->sel_item = it; } @@ -1606,24 +1643,24 @@ static void _evry_select_plugin(Evry_State *s, Evry_Plugin *p) { - if (!p) p = s->plugin; - if (!p) return; + if (!s || !s->cur_plugins) return; + + if (!p && s->cur_plugins) + { + p = s->cur_plugins->data; + } - if (list->visible) + if (p && list->visible) { - if (s->plugin != p) - { - if (s->plugin) - edje_object_signal_emit(s->plugin->tab, "e,state,unselected", "e"); + if (s->plugin && s->plugin != p) + edje_object_signal_emit(s->plugin->tab, "e,state,unselected", "e"); - /* XXX tab_show ? -> see evry_plugin_async_update*/ - edje_object_signal_emit(p->tab, "e,state,selected", "e"); - } + edje_object_signal_emit(p->tab, "e,state,selected", "e"); } - if (s->plugin != p) + if ((p || !s->plugin) && s->plugin != p) { - s->sel_item = NULL; + _evry_list_item_desel(s, NULL); s->plugin = p; } } @@ -1921,7 +1958,7 @@ if (!input || prio) { - it = evry_item_new(p, act->name); + it = evry_item_new(p, act->name, NULL); it->priority = prio; it->data[0] = act; @@ -1942,6 +1979,7 @@ EINA_LIST_FREE(p->items, it) evry_item_free(it); + p->items = NULL; if (sel->actions) eina_list_free(sel->actions); @@ -2007,9 +2045,8 @@ Evry_Item *it; int cnt = 0; - if (p->items) - eina_list_free(p->items); - p->items = NULL; + EINA_LIST_FREE(p->items, it) + evry_item_free(it); EINA_LIST_FOREACH(s->cur_plugins, l, plugin) cnt += eina_list_count(plugin->items); @@ -2019,7 +2056,10 @@ EINA_LIST_FOREACH(s->cur_plugins, l, plugin) { EINA_LIST_FOREACH(plugin->items, ll, it) - p->items = eina_list_append(p->items, it); + { + _evry_item_ref(it); + p->items = eina_list_append(p->items, it); + } } } else @@ -2029,6 +2069,7 @@ for (cnt = 0, ll = plugin->items; ll && cnt < 15; ll = ll->next, cnt++) { it = ll->data; + _evry_item_ref(it); p->items = eina_list_append(p->items, it); } } @@ -2049,7 +2090,11 @@ static void _evry_plug_aggregator_cleanup(Evry_Plugin *p) { - if (p->items) eina_list_free(p->items); + Evry_Item *it; + + EINA_LIST_FREE(p->items, it) + evry_item_free(it); + p->items = NULL; } @@ -2079,7 +2124,6 @@ s->cur_plugins = eina_list_prepend_relative_list(s->cur_plugins, p, l); else s->cur_plugins = eina_list_append(s->cur_plugins, p); - } void @@ -2091,70 +2135,56 @@ if (!win) return; s = selector->state; - + agg = selector->aggregator; + /* received data from a plugin of the current selector ? */ if (!s || !eina_list_data_find(s->plugins, p)) return; - agg = selector->aggregator; - if (action == EVRY_ASYNC_UPDATE_ADD) { - /* remove plugin and update selector. */ if (!p->items) { + /* remove plugin and update selector. */ if (!eina_list_data_find(s->cur_plugins, p)) return; s->cur_plugins = eina_list_remove(s->cur_plugins, p); - if (p == s->plugin) - { - s->plugin = NULL; - _evry_selector_update(selector); - } + if (s->plugin == p) + _evry_select_plugin(s, NULL); } else { /* add plugin to current plugins*/ _evry_plugin_list_insert(s, p); - /* update aggregator */ - if (eina_list_count(s->cur_plugins) > 1) + if (!s->plugin || !eina_list_data_find_list(s->cur_plugins, s->plugin)) + _evry_select_plugin(s, NULL); + } + + /* update aggregator */ + if (eina_list_count(s->cur_plugins) > 1) + { + agg->fetch(agg, NULL); + + /* add aggregator */ + if (!(s->cur_plugins->data == agg)) { - if (s->plugin == agg) - _evry_list_clear_list(s); + s->cur_plugins = eina_list_prepend(s->cur_plugins, agg); - agg->fetch(agg, NULL); - - /* add aggregator */ - if (!(s->cur_plugins->data == agg)) - { - s->cur_plugins = eina_list_prepend(s->cur_plugins, agg); - _evry_list_clear_list(s); - s->plugin = agg; - } + if (s->plugin_auto_selected) + _evry_select_plugin(s, agg); } + } - /* plugin is active */ - if ((!s->plugin) || (s->plugin == p) || (s->plugin == agg)) - { - _evry_selector_update(selector); - p = s->plugin; + /* plugin is visible */ + if ((s->plugin == p) || (s->plugin == agg)) + { + _evry_selector_update(selector); + p = s->plugin; - if (list->visible) - { - Eina_List *l; - Evry_Item *it; - evas_event_freeze(list->popup->evas); - e_box_freeze(list->o_list); - EINA_LIST_FOREACH(p->items, l, it) - if (it->o_bg) e_box_unpack(it->o_bg); - e_box_thaw(list->o_list); - evas_event_thaw(list->popup->evas); - - _evry_list_show_items(s, p); - _evry_list_scroll_to(s, s->sel_item); - } - } + _evry_list_clear_list(s); + _evry_list_show_items(s, p); + _evry_list_scroll_to(s, s->sel_item); } /* plugin box was updated: realign */ @@ -2164,20 +2194,91 @@ _evry_list_tab_scroll_to(s, s->plugin); } } - else if (action == EVRY_ASYNC_UPDATE_CLEAR) +} + + +/* taken from e_utils. just changed 48 to 72.. we need + evry_icon_theme_set(Evas_Object *obj, const char *icon, + size:small, mid, large) imo */ +static int +_evry_icon_theme_set(Evas_Object *obj, const char *icon) +{ + const char *file; + char buf[4096]; + + if ((!icon) || (!icon[0])) return 0; + snprintf(buf, sizeof(buf), "e/icons/%s", icon); + file = e_theme_edje_file_get("base/theme/icons", buf); + if (file[0]) { - Evry_Plugin *tmp = s->plugin; + e_icon_file_edje_set(obj, file, buf); + return 1; + } + return 0; +} - s->plugin = p; - _evry_list_clear_list(s); - s->plugin = tmp; +static int +_evry_icon_fdo_set(Evas_Object *obj, const char *icon) +{ + char *path = NULL; + unsigned int size; - /* s->cur_plugins = eina_list_remove(s->cur_plugins, p); - * agg->fetch(agg, NULL); */ + if ((!icon) || (!icon[0])) return 0; + size = e_util_icon_size_normalize(72 * e_scale); + path = efreet_icon_path_find(e_config->icon_theme, icon, size); + if (!path) return 0; + e_icon_file_set(obj, path); + E_FREE(path); + return 1; +} + +EAPI int +evry_icon_theme_set(Evas_Object *obj, const char *icon) +{ + if (e_config->icon_theme_overrides) + { + if (_evry_icon_fdo_set(obj, icon)) + return 1; + return _evry_icon_theme_set(obj, icon); } + else + { + if (_evry_icon_theme_set(obj, icon)) + return 1; + return _evry_icon_fdo_set(obj, icon); + } } +static int +_evry_cb_selection_notify(void *data, int type, void *event) +{ + Ecore_X_Event_Selection_Notify *ev; + Evry_State *s = selector->state; + if (!s || (data != win)) return 1; + if (!win->request_selection) return 1; + + win->request_selection = EINA_FALSE; + + ev = event; + if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) || + (ev->selection == ECORE_X_SELECTION_PRIMARY)) + { + if (strcmp(ev->target, ECORE_X_SELECTION_TARGET_UTF8_STRING) == 0) + { + Ecore_X_Selection_Data_Text *text_data; + + text_data = ev->data; + + strncat(s->input, text_data->text, (INPUTLEN - strlen(s->input)) - 1); + _evry_update(s); + } + } + + return 1; +} + + /* static int * _evry_cb_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event) * { @@ -2316,86 +2417,3 @@ * * return p1->config->priority - p2->config->priority; * } */ - - -/* taken from e_utils. just changed 48 to 72.. we need - evry_icon_theme_set(Evas_Object *obj, const char *icon, - size:small, mid, large) imo */ -static int -_evry_icon_theme_set(Evas_Object *obj, const char *icon) -{ - const char *file; - char buf[4096]; - - if ((!icon) || (!icon[0])) return 0; - snprintf(buf, sizeof(buf), "e/icons/%s", icon); - file = e_theme_edje_file_get("base/theme/icons", buf); - if (file[0]) - { - e_icon_file_edje_set(obj, file, buf); - return 1; - } - return 0; -} - -static int -_evry_icon_fdo_set(Evas_Object *obj, const char *icon) -{ - char *path = NULL; - unsigned int size; - - if ((!icon) || (!icon[0])) return 0; - size = e_util_icon_size_normalize(72 * e_scale); - path = efreet_icon_path_find(e_config->icon_theme, icon, size); - if (!path) return 0; - e_icon_file_set(obj, path); - E_FREE(path); - return 1; -} - -EAPI int -evry_icon_theme_set(Evas_Object *obj, const char *icon) -{ - if (e_config->icon_theme_overrides) - { - if (_evry_icon_fdo_set(obj, icon)) - return 1; - return _evry_icon_theme_set(obj, icon); - } - else - { - if (_evry_icon_theme_set(obj, icon)) - return 1; - return _evry_icon_fdo_set(obj, icon); - } -} - - -static int -_evry_cb_selection_notify(void *data, int type, void *event) -{ - Ecore_X_Event_Selection_Notify *ev; - Evry_State *s = selector->state; - - if (!s || (data != win)) return 1; - if (!win->request_selection) return 1; - - win->request_selection = EINA_FALSE; - - ev = event; - if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) || - (ev->selection == ECORE_X_SELECTION_PRIMARY)) - { - if (strcmp(ev->target, ECORE_X_SELECTION_TARGET_UTF8_STRING) == 0) - { - Ecore_X_Selection_Data_Text *text_data; - - text_data = ev->data; - - strncat(s->input, text_data->text, (INPUTLEN - strlen(s->input)) - 1); - _evry_update(s); - } - } - - return 1; -} Modified: trunk/e/src/modules/everything/evry_plug_apps.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_apps.c 2009-08-13 22:41:43 UTC (rev 41749) +++ trunk/e/src/modules/everything/evry_plug_apps.c 2009-08-13 22:42:40 UTC (rev 41750) @@ -64,19 +64,23 @@ _list_free(Evry_Plugin *p) { Evry_Item *it; - Evry_App *app; EINA_LIST_FREE(p->items, it) - { - app = it->data[0]; - if (app->file) eina_stringshare_del(app->file); - if (app->desktop) efreet_desktop_free(app->desktop); - E_FREE(app); - evry_item_free(it); - } + evry_item_free(it); } static void +_item_free(Evry_Item *it) +{ + Evry_App *app; + + app = it->data[0]; + if (app->file) eina_stringshare_del(app->file); + if (app->desktop) efreet_desktop_free(app->desktop); + E_FREE(app); +} + +static void _cleanup(Evry_Plugin *p) { Inst *inst = p->private; @@ -157,9 +161,9 @@ } if (desktop) - it = evry_item_new(p, desktop->name); + it = evry_item_new(p, desktop->name, &_item_free); else - it = evry_item_new(p, file); + it = evry_item_new(p, file, &_item_free); app = E_NEW(Evry_App, 1); app->desktop = desktop; @@ -331,7 +335,7 @@ if (found || p == p2) { - it = evry_item_new(p, _("Run Command")); + it = evry_item_new(p, _("Run Command"), &_item_free); app = E_NEW(Evry_App, 1); if (input) app->file = eina_stringshare_add(input); @@ -342,7 +346,7 @@ p->items = eina_list_append(p->items, it); snprintf(match1, 4096, "xterm -hold -e %s", input); - it = evry_item_new(p, _("Run in Terminal")); + it = evry_item_new(p, _("Run in Terminal"), &_item_free); app = E_NEW(Evry_App, 1); if (input) app->file = eina_stringshare_add(match1); Modified: trunk/e/src/modules/everything/evry_plug_aspell.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_aspell.c 2009-08-13 22:41:43 UTC (rev 41749) +++ trunk/e/src/modules/everything/evry_plug_aspell.c 2009-08-13 22:42:40 UTC (rev 41750) @@ -81,7 +81,7 @@ { Evry_Item *it; - it = evry_item_new(p, NULL); + it = evry_item_new(p, NULL, NULL); if (!it) return; it->priority = prio; it->label = eina_stringshare_add_length(word, word_size); Modified: trunk/e/src/modules/everything/evry_plug_border.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border.c 2009-08-13 22:41:43 UTC (rev 41749) +++ trunk/e/src/modules/everything/evry_plug_border.c 2009-08-13 22:42:40 UTC (rev 41750) @@ -9,7 +9,7 @@ { Evry_Item *it; - it = evry_item_new(p, e_border_name_get(bd)); + it = evry_item_new(p, e_border_name_get(bd), NULL); /* e_object_ref(E_OBJECT(bd)); */ it->data[0] = bd; Modified: trunk/e/src/modules/everything/evry_plug_border_act.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border_act.c 2009-08-13 22:41:43 UTC (rev 41749) +++ trunk/e/src/modules/everything/evry_plug_border_act.c 2009-08-13 22:42:40 UTC (rev 41750) @@ -85,6 +85,12 @@ } static void +_item_free(Evry_Item *it) +{ + if (it->data[1]) eina_stringshare_del((const char *)it->data[1]); +} + +static void _item_add(Evry_Plugin *p, const char *label, void (*action_cb) (E_Border *bd), const char *icon, char *m1, char *m2) { Evry_Item *it; @@ -102,7 +108,7 @@ if (!prio) return; - it = evry_item_new(p, label); + it = evry_item_new(p, label, &_item_free); it->data[0] = action_cb; it->data[1] = (void *) eina_stringshare_add(icon); it->priority = prio; @@ -116,10 +122,7 @@ Evry_Item *it; EINA_LIST_FREE(p->items, it) - { - if (it->data[1]) eina_stringshare_del((const char *)it->data[1]); - evry_item_free(it); - } + evry_item_free(it); } static int Modified: trunk/e/src/modules/everything/evry_plug_calc.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_calc.c 2009-08-13 22:41:43 UTC (rev 41749) +++ trunk/e/src/modules/everything/evry_plug_calc.c 2009-08-13 22:42:40 UTC (rev 41750) @@ -128,7 +128,7 @@ { Evry_Item *it; - it = evry_item_new(p, result); + it = evry_item_new(p, result, NULL); if (!it) return; p->items = eina_list_prepend(p->items, it); @@ -213,7 +213,10 @@ { Evry_Item *it; - EINA_LIST_FREE(p->items, it) + /* EINA_LIST_FREE(p->items, it) + * evry_item_free(it); */ + + EINA_LIST_FREE(history, it) evry_item_free(it); evry_plugin_unregister(p); Modified: trunk/e/src/modules/everything/evry_plug_config.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_config.c 2009-08-13 22:41:43 UTC (rev 41749) +++ trunk/e/src/modules/everything/evry_plug_config.c 2009-08-13 22:42:40 UTC (rev 41750) @@ -18,7 +18,7 @@ { Evry_Item *it; - it = evry_item_new(p, eci->label); + it = evry_item_new(p, eci->label, NULL); it->data[0] = eci; it->priority = prio; Modified: trunk/e/src/modules/everything/evry_plug_dir_browse.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-08-13 22:41:43 UTC (rev 41749) +++ trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-08-13 22:42:40 UTC (rev 41750) @@ -26,7 +26,7 @@ Evry_Item *it = NULL; char buf[4096]; - it = evry_item_new(p, file); + it = evry_item_new(p, file, NULL); if (!it) return NULL; snprintf(buf, sizeof(buf), "%s/%s", directory, file); @@ -111,7 +111,7 @@ if (!s->command) { - evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_CLEAR); + /* evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_CLEAR); */ if (eina_list_count(p->items) > 0) { @@ -212,11 +212,7 @@ if (s->directory) eina_stringshare_del(s->directory); EINA_LIST_FREE(s->items, it) - { - if (it->uri) eina_stringshare_del(it->uri); - if (it->mime) eina_stringshare_del(it->mime); - evry_item_free(it); - } + evry_item_free(it); if (idler) { @@ -261,7 +257,7 @@ /* XXX free s->items? */ if (!strncmp(input, "/", 1)) { - it = evry_item_new(p, "/"); + it = evry_item_new(p, "/", NULL); if (!it) return 0; it->uri = eina_stringshare_add("/"); p->items = eina_list_append(p->items, it); @@ -286,7 +282,7 @@ { tmp = strdup(dir); snprintf(dir, (end - dir) + 1, "%s", tmp); - it = evry_item_new(p, dir); + it = evry_item_new(p, dir, NULL); if (!it) return 0; /* free stuff !!!*/ it->uri = eina_stringshare_add(dir); it->priority = prio; @@ -296,7 +292,7 @@ prio--; } - it = evry_item_new(p, "/"); + it = evry_item_new(p, "/", NULL); if (!it) return 0; it->uri = eina_stringshare_add("/"); it->priority = prio; @@ -311,11 +307,8 @@ if (s->command) { EINA_LIST_FREE(p->items, it) - { - if (it->uri) eina_stringshare_del(it->uri); - if (it->mime) eina_stringshare_del(it->mime); - evry_item_free(it); - } + evry_item_free(it); + p->items = NULL; s->command = EINA_FALSE; } Modified: trunk/e/src/modules/everything/evry_plug_tracker.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-13 22:41:43 UTC (rev 41749) +++ trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-13 22:42:40 UTC (rev 41750) @@ -86,7 +86,7 @@ if (!filename) return NULL; - it = evry_item_new(p, filename); + it = evry_item_new(p, filename, NULL); if (!it) return NULL; it->priority = prio; @@ -103,7 +103,6 @@ return it; } - static void _cleanup(Evry_Plugin *p) { @@ -120,14 +119,11 @@ eina_stringshare_del(inst->matched); inst->matched = NULL; - EINA_LIST_FREE(p->items, it) - { - if (it->mime) eina_stringshare_del(it->mime); - if (it->uri) eina_stringshare_del(it->uri); - evry_item_free(it); - } - p->items = NULL; + EINA_LIST_FREE(inst->items, it) + evry_item_free(it); + inst->items = NULL; + p->items = NULL; } static int @@ -153,8 +149,6 @@ if (inst->active) inst->active--; - p->items = inst->items; - if (dbus_error_is_set(error)) { _cleanup(p); @@ -196,49 +190,56 @@ if (items) { - EINA_LIST_FREE(p->items, it) - { - if (it->mime) eina_stringshare_del(it->mime); - if (it->uri) eina_stringshare_del(it->uri); - evry_item_free(it); - } + EINA_LIST_FREE(inst->items, it) + evry_item_free(it); + + items = eina_list_sort(items, eina_list_count(items), _cb_sort); + inst->items = items; p->items = items; if (inst->matched) eina_stringshare_del(inst->matched); - inst->matched = eina_stringshare_add(inst->input); + if (inst->input) + inst->matched = eina_stringshare_add(inst->input); + else + inst->matched = NULL; } - else if (p->items && inst->input) + else if (inst->items && inst->input) { char input[128]; char *pos = input; + int len_matched = strlen(inst->matched); + int len_input = strlen(inst->input); + Eina_List *l; - snprintf(input, 128, "%s", inst->input + (strlen(inst->matched) - 1)); - for (; *pos != '\0'; pos++) - if (isspace(*pos)) *pos = '*'; - - EINA_LIST_FREE(p->items, it) + if (len_input > len_matched) { - if (e_util_glob_case_match(it->label, input)) - items = eina_list_append(items, it); + p->items = NULL; + + snprintf(input, 128, "*%s*", inst->input + len_matched); + for (; *pos != '\0'; pos++) + if (isspace(*pos)) *pos = '*'; + + EINA_LIST_FOREACH(inst->items, l, it) + if (e_util_glob_case_match(it->label, input)) + p->items = eina_list_append(p->items, it); + + if (inst->matched) + eina_stringshare_del(inst->matched); + if (inst->input) + inst->matched = eina_stringshare_add(inst->input); else - { - if (it->mime) eina_stringshare_del(it->mime); - if (it->uri) eina_stringshare_del(it->uri); - evry_item_free(it); - } + inst->matched = NULL; } - - p->items = items; + else + p->items = inst->items; } else { - EINA_LIST_FREE(p->items, it) - { - if (it->mime) eina_stringshare_del(it->mime); - if (it->uri) eina_stringshare_del(it->uri); - evry_item_free(it); - } + EINA_LIST_FREE(inst->items, it) + evry_item_free(it); + + inst->items = NULL; p->items = NULL; if (inst->input) @@ -250,10 +251,6 @@ inst->matched = NULL; } - if (p->items) - p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort); - - inst->items = p->items; evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD); } @@ -290,14 +287,12 @@ return 0; } - p->items = NULL; - if (input && (strlen(input) > 2)) { + inst->input = eina_stringshare_add(input); search_text = malloc(sizeof(char) * strlen(input) + 3); sprintf(search_text, "*%s*", input); max_hits = 50; - inst->input = eina_stringshare_add(search_text); } else if (!input && !p->begin && p->type == type_object) { @@ -335,6 +330,8 @@ if (input && (strlen(input) > 2)) free(search_text); + if (p->items) return 1; + return 0; } @@ -407,8 +404,7 @@ _plugin_new("Music", type_subject, "Music", 20, 0); _plugin_new("Videos", type_subject, "Videos", 20, 0); _plugin_new("Documents", type_subject, "Documents", 20, 0); - /* _plugin_new("Text", type_subject, "TextFiles", 20, 0); */ - + _plugin_new("Find Files", type_object, "Files", 20, 1); _plugin_new("Folders", type_object, "Folders", 20, 0); |
From: Enlightenment S. <no-...@en...> - 2009-08-14 09:36:04
|
Log: 'everything' module: cleanups Author: jeffdameth Date: 2009-08-14 02:35:51 -0700 (Fri, 14 Aug 2009) New Revision: 41755 Modified: trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry_plug_aspell.c trunk/e/src/modules/everything/evry_plug_border.c trunk/e/src/modules/everything/evry_plug_calc.c trunk/e/src/modules/everything/evry_plug_dir_browse.c trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-14 08:34:52 UTC (rev 41754) +++ trunk/e/src/modules/everything/evry.c 2009-08-14 09:35:51 UTC (rev 41755) @@ -93,13 +93,6 @@ }; -/* static int _evry_cb_mouse_down(void *data, int type, void *event); - * static int _evry_cb_mouse_up(void *data, int type, void *event); - * static int _evry_cb_mouse_move(void *data, int type, void *event); - * static int _evry_cb_mouse_wheel(void *data, int type, void *event); - * static void _evry_cb_item_mouse_in(void *data, Evas *evas, Evas_Object *obj, void *event_info); - * static void _evry_cb_item_mouse_out(void *data, Evas *evas, Evas_Object *obj, void *event_info); */ - static void _evry_matches_update(Evry_Selector *sel); static void _evry_plugin_action(Evry_Selector *sel, int finished); static void _evry_backspace(Evry_State *s); @@ -113,6 +106,7 @@ static void _evry_browse_item(Evry_Selector *sel); static void _evry_browse_back(Evry_Selector *sel); static void _evry_selectors_switch(void); +static void _evry_plugin_list_insert(Evry_State *s, Evry_Plugin *p); static Evry_Window *_evry_window_new(E_Zone *zone); static void _evry_window_free(Evry_Window *win); @@ -148,6 +142,7 @@ static int _evry_list_item_idler(void *data); static int _evry_plug_actions_init(void); +static void _evry_plug_actions_free(void); static int _evry_plug_actions_begin(Evry_Plugin *p, const Evry_Item *it); static int _evry_plug_actions_fetch(Evry_Plugin *p, const char *input); static void _evry_plug_actions_cleanup(Evry_Plugin *p); @@ -164,6 +159,13 @@ static int _evry_cb_key_down(void *data, int type, void *event); static int _evry_cb_selection_notify(void *data, int type, void *event); +/* static int _evry_cb_mouse_down(void *data, int type, void *event); + * static int _evry_cb_mouse_up(void *data, int type, void *event); + * static int _evry_cb_mouse_move(void *data, int type, void *event); + * static int _evry_cb_mouse_wheel(void *data, int type, void *event); + * static void _evry_cb_item_mouse_in(void *data, Evas *evas, Evas_Object *obj, void *event_info); + * static void _evry_cb_item_mouse_out(void *data, Evas *evas, Evas_Object *obj, void *event_info); */ + /* local subsystem globals */ static Evry_Window *win = NULL; static Evry_List_Window *list = NULL; @@ -186,8 +188,8 @@ int evry_shutdown(void) { - // TODO free action_selector evry_hide(); + _evry_plug_actions_free(); return 1; } @@ -307,7 +309,6 @@ EINA_LIST_FREE(handlers, ev) ecore_event_handler_del(ev); - handlers = NULL; ecore_x_window_free(input_window); e_grabinput_release(input_window, input_window); @@ -343,7 +344,7 @@ it->ref = 1; /* item_cnt++; */ - + return it; } @@ -359,7 +360,7 @@ /* printf("%d, %d\t 0x%x 0x%x 0x%x free: %s\n", * it->ref, item_cnt - 1, * it->label, it->uri, it->mime, - * it->label); */ + * it->label); */ /* item_cnt--; */ if (it->cb_free) it->cb_free(it); @@ -370,7 +371,7 @@ if (it->o_bg) evas_object_del(it->o_bg); if (it->o_icon) evas_object_del(it->o_icon); - + E_FREE(it); } @@ -380,6 +381,79 @@ it->ref++; } +void +evry_plugin_async_update(Evry_Plugin *p, int action) +{ + Evry_State *s; + Evry_Plugin *agg; + + if (!win) return; + + s = selector->state; + agg = selector->aggregator; + + /* received data from a plugin of the current selector ? */ + if (!s || !eina_list_data_find(s->plugins, p)) return; + + if (action == EVRY_ASYNC_UPDATE_ADD) + { + if (!p->items) + { + /* remove plugin */ + if (!eina_list_data_find(s->cur_plugins, p)) return; + + s->cur_plugins = eina_list_remove(s->cur_plugins, p); + + if (s->plugin == p) + _evry_select_plugin(s, NULL); + } + else + { + /* add plugin to current plugins*/ + _evry_plugin_list_insert(s, p); + + if (!s->plugin || !eina_list_data_find_list(s->cur_plugins, s->plugin)) + _evry_select_plugin(s, NULL); + } + + /* update aggregator */ + if (eina_list_count(s->cur_plugins) > 1) + { + agg->fetch(agg, NULL); + + /* add aggregator */ + if (!(s->cur_plugins->data == agg)) + { + s->cur_plugins = eina_list_prepend(s->cur_plugins, agg); + + if (s->plugin_auto_selected) + _evry_select_plugin(s, agg); + } + } + + /* plugin is visible */ + if ((s->plugin == p) || (s->plugin == agg)) + { + _evry_selector_update(selector); + p = s->plugin; + + _evry_list_clear_list(s); + _evry_list_show_items(s, p); + _evry_list_scroll_to(s, s->sel_item); + } + + /* plugin box was updated: realign */ + if (s->plugin) + { + _evry_list_tabs_update(s); + _evry_list_tab_scroll_to(s, s->plugin); + } + } +} + + +/* local subsystem functions */ + static Evry_List_Window * _evry_list_win_new(E_Zone *zone) { @@ -597,7 +671,7 @@ while (sel->states) _evry_state_pop(sel); - + EINA_LIST_FREE(sel->plugins, p) { if (p->tab) evas_object_del(p->tab); @@ -695,28 +769,23 @@ _evry_selector_update(Evry_Selector *sel) { Evry_State *s = sel->state; - Evry_Item *it = NULL; + Evry_Item *it = s->sel_item; - if (s) - { - it = s->sel_item; - - if (!s->plugin && it) - _evry_list_item_desel(s, NULL); - else if (it && !eina_list_data_find_list(s->plugin->items, it)) - _evry_list_item_desel(s, NULL); + if (!s->plugin && it) + _evry_list_item_desel(s, NULL); + else if (it && !eina_list_data_find_list(s->plugin->items, it)) + _evry_list_item_desel(s, NULL); - it = s->sel_item; - - if (s->plugin && (!it || s->item_auto_selected)) + it = s->sel_item; + + if (s->plugin && (!it || s->item_auto_selected)) + { + /* get first item */ + if (s->plugin->items) { - /* get first item */ - if (s->plugin->items) - { - it = s->plugin->items->data; - s->item_auto_selected = EINA_TRUE; - _evry_list_item_sel(s, it); - } + it = s->plugin->items->data; + s->item_auto_selected = EINA_TRUE; + _evry_list_item_sel(s, it); } } @@ -743,8 +812,8 @@ if (sel == selectors[0]) { - _evry_selector_actions_get(it); - _evry_selector_update(selectors[1]); + if (_evry_selector_actions_get(it)) + _evry_selector_update(selectors[1]); } } @@ -754,7 +823,7 @@ if (!list->visible) return; _evry_list_clear_list(s); - _evry_list_tabs_update(s); + _evry_list_tabs_update(s); if (!s->plugin) return; @@ -799,11 +868,7 @@ while (sel->state) _evry_state_pop(sel); - if (!it) - { - _evry_state_new(sel, plugins); - return 1; - } + if (!it) return 0; EINA_LIST_FOREACH(sel->plugins, l, p) { @@ -873,7 +938,6 @@ s->input = malloc(INPUTLEN); s->input[0] = 0; s->plugins = plugins; - s->plugin_auto_selected = 1; sel->states = eina_list_prepend(sel->states, s); sel->state = s; @@ -888,10 +952,11 @@ Evry_State *s; s = sel->state; - + _evry_list_item_desel(s, NULL); - + free(s->input); + EINA_LIST_FREE(s->plugins, p) p->cleanup(p); @@ -930,6 +995,7 @@ if (plugins) { + _evry_list_win_show(); _evry_state_new(sel, plugins); _evry_matches_update(sel); _evry_selector_update(sel); @@ -1224,7 +1290,7 @@ Evas_Object *o; if (!p) return; - + if (p->realize_items) p->realize_items(p, list->popup->evas); if (list->scroll_timer) @@ -1248,7 +1314,7 @@ EINA_LIST_FOREACH(p->items, l, it) { o = it->o_bg; - + if (!o) { o = edje_object_add(list->popup->evas); @@ -1268,7 +1334,7 @@ e_box_pack_end(list->o_list, o); e_box_pack_options_set(o, 1, 1, 1, 0, 0.5, 0.5, mw, mh, 9999, mh); evas_object_show(o); - + if (it->o_icon && edje_object_part_exists(o, "e.swallow.icons")) { edje_object_part_swallow(o, "e.swallow.icons", it->o_icon); @@ -1325,15 +1391,14 @@ e_box_unpack(it->o_bg); evas_object_hide(it->o_bg); } - + if (it->o_icon) evas_object_hide(it->o_icon); evry_item_free(it); } - s->items = NULL; } - + e_box_thaw(list->o_list); evas_event_thaw(list->popup->evas); /* } */ @@ -1354,17 +1419,17 @@ EINA_LIST_FOREACH(p->items, l, it) { - if (!it->o_icon) - { - it->o_icon = p->icon_get(p, it, list->popup->evas); + if (it->o_icon) continue; - if (it->o_icon) - { - edje_object_part_swallow(it->o_bg, "e.swallow.icons", it->o_icon); - evas_object_show(it->o_icon); - cnt--; - } + it->o_icon = p->icon_get(p, it, list->popup->evas); + + if (it->o_icon) + { + edje_object_part_swallow(it->o_bg, "e.swallow.icons", it->o_icon); + evas_object_show(it->o_icon); + cnt--; } + if (cnt == 0) break; } e_box_thaw(list->o_list); @@ -1382,25 +1447,23 @@ Evry_State *s = sel->state; Evry_Plugin *p; Eina_List *l; - Eina_Bool has_items = EINA_FALSE; + Eina_Bool has_items; - if (s->cur_plugins) eina_list_free(s->cur_plugins); - s->cur_plugins = NULL; + EINA_LIST_FREE(s->cur_plugins, p); if (s->input) { EINA_LIST_FOREACH(s->plugins, l, p) { /* input matches plugin trigger? */ - if (p->trigger) + if (!p->trigger) continue; + + if ((strlen(s->input) >= strlen(p->trigger)) && + (!strncmp(s->input, p->trigger, strlen(p->trigger)))) { - if ((strlen(s->input) >= strlen(p->trigger)) && - (!strncmp(s->input, p->trigger, strlen(p->trigger)))) - { - s->cur_plugins = eina_list_append(s->cur_plugins, p); - has_items = p->fetch(p, s->input); - break; - } + s->cur_plugins = eina_list_append(s->cur_plugins, p); + p->fetch(p, s->input); + break; } } } @@ -1434,10 +1497,10 @@ else sel->aggregator->cleanup(sel->aggregator); } - + if (s->plugin && !eina_list_data_find_list(s->cur_plugins, s->plugin)) s->plugin = NULL; - + _evry_select_plugin(s, s->plugin); } @@ -1531,7 +1594,7 @@ static void _evry_list_item_desel(Evry_State *s, Evry_Item *it) -{ +{ if (s->sel_item) { it = s->sel_item; @@ -1543,7 +1606,7 @@ if (it->o_icon) edje_object_signal_emit(it->o_icon, "e,state,unselected", "e"); } - + evry_item_free(it); s->sel_item = NULL; } @@ -1567,7 +1630,7 @@ if (s == selector->state) _evry_list_scroll_to(s, it); } - + _evry_item_ref(it); s->sel_item = it; } @@ -1644,10 +1707,11 @@ _evry_select_plugin(Evry_State *s, Evry_Plugin *p) { if (!s || !s->cur_plugins) return; - + if (!p && s->cur_plugins) { p = s->cur_plugins->data; + s->plugin_auto_selected = EINA_TRUE; } if (p && list->visible) @@ -1684,7 +1748,7 @@ if (p) { - s->plugin_auto_selected = 0; + s->plugin_auto_selected = EINA_FALSE; _evry_list_clear_list(s); _evry_select_plugin(s, p); _evry_list_show_items(s, p); @@ -1722,7 +1786,7 @@ if (p) { - s->plugin_auto_selected = 0; + s->plugin_auto_selected = EINA_FALSE; _evry_list_clear_list(s); _evry_select_plugin(s, p); _evry_list_show_items(s, p); @@ -1753,7 +1817,7 @@ if (p) { - s->plugin_auto_selected = 0; + s->plugin_auto_selected = EINA_FALSE; _evry_list_clear_list(s); _evry_select_plugin(s, p); _evry_list_show_items(s, p); @@ -1897,6 +1961,16 @@ return 1; } +static void +_evry_plug_actions_free(void) +{ + Evry_Plugin *p = action_selector; + + eina_stringshare_del(p->config->name); + E_FREE(p->config); + E_FREE(p); +} + static int _evry_plug_actions_begin(Evry_Plugin *p, const Evry_Item *it) { @@ -1939,7 +2013,6 @@ { EINA_LIST_FREE(p->items, it) evry_item_free(it); - p->items = NULL; } snprintf(match1, sizeof(match1), "%s*", input); @@ -1979,8 +2052,6 @@ EINA_LIST_FREE(p->items, it) evry_item_free(it); - - p->items = NULL; if (sel->actions) eina_list_free(sel->actions); sel->actions = NULL; @@ -2094,8 +2165,6 @@ EINA_LIST_FREE(p->items, it) evry_item_free(it); - - p->items = NULL; } static Evas_Object * @@ -2126,77 +2195,7 @@ s->cur_plugins = eina_list_append(s->cur_plugins, p); } -void -evry_plugin_async_update(Evry_Plugin *p, int action) -{ - Evry_State *s; - Evry_Plugin *agg; - if (!win) return; - - s = selector->state; - agg = selector->aggregator; - - /* received data from a plugin of the current selector ? */ - if (!s || !eina_list_data_find(s->plugins, p)) return; - - if (action == EVRY_ASYNC_UPDATE_ADD) - { - if (!p->items) - { - /* remove plugin and update selector. */ - if (!eina_list_data_find(s->cur_plugins, p)) return; - - s->cur_plugins = eina_list_remove(s->cur_plugins, p); - - if (s->plugin == p) - _evry_select_plugin(s, NULL); - } - else - { - /* add plugin to current plugins*/ - _evry_plugin_list_insert(s, p); - - if (!s->plugin || !eina_list_data_find_list(s->cur_plugins, s->plugin)) - _evry_select_plugin(s, NULL); - } - - /* update aggregator */ - if (eina_list_count(s->cur_plugins) > 1) - { - agg->fetch(agg, NULL); - - /* add aggregator */ - if (!(s->cur_plugins->data == agg)) - { - s->cur_plugins = eina_list_prepend(s->cur_plugins, agg); - - if (s->plugin_auto_selected) - _evry_select_plugin(s, agg); - } - } - - /* plugin is visible */ - if ((s->plugin == p) || (s->plugin == agg)) - { - _evry_selector_update(selector); - p = s->plugin; - - _evry_list_clear_list(s); - _evry_list_show_items(s, p); - _evry_list_scroll_to(s, s->sel_item); - } - - /* plugin box was updated: realign */ - if (s->plugin) - { - _evry_list_tabs_update(s); - _evry_list_tab_scroll_to(s, s->plugin); - } - } -} - - /* taken from e_utils. just changed 48 to 72.. we need evry_icon_theme_set(Evas_Object *obj, const char *icon, size:small, mid, large) imo */ Modified: trunk/e/src/modules/everything/evry_plug_aspell.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_aspell.c 2009-08-14 08:34:52 UTC (rev 41754) +++ trunk/e/src/modules/everything/evry_plug_aspell.c 2009-08-14 09:35:51 UTC (rev 41755) @@ -126,7 +126,6 @@ _clear_list(Evry_Plugin *plugin) { Evry_Item *it; - evry_plugin_async_update(plugin, EVRY_ASYNC_UPDATE_CLEAR); EINA_LIST_FREE(plugin->items, it) evry_item_free(it); } @@ -287,45 +286,6 @@ return 1; } -/* static int - * _action(Evry_Plugin *plugin, Evry_Item *it, const char *input __UNUSED__) - * { - * const char *label; - * int len; - * - * if (!it) return EVRY_ACTION_CONTINUE; - * - * label = it->label; - * len = eina_stringshare_strlen(label); - * - * if (!ecore_x_selection_primary_set(clipboard_win, label, len)) - * fprintf(stderr, "ASPELL cannot set primary selection to %#x '%s'\n", - * clipboard_win, label); - * if (!ecore_x_selection_clipboard_set(clipboard_win, label, len)) - * fprintf(stderr, "ASPELL cannot set clipboard selection to %#x '%s'\n", - * clipboard_win, label); - * - * if (plugin->items) - * { - * Eina_List *l, *l_next; - * Evry_Item *it2; - * - * evry_plugin_async_update(plugin, EVRY_ASYNC_UPDATE_CLEAR); - * - * EINA_LIST_FOREACH_SAFE(plugin->items, l, l_next, it2) - * { - * if (it == it2) continue; - * plugin->items = eina_list_remove_list(plugin->items, l); - * eina_stringshare_del(it2->label); - * E_FREE(it2); - * } - * } - * - * evry_plugin_async_update(plugin, EVRY_ASYNC_UPDATE_ADD); - * - * return EVRY_ACTION_FINISHED; - * } */ - static void _cleanup(Evry_Plugin *plugin) { @@ -381,7 +341,6 @@ p->base.async_query = 1; p->base.begin = _begin; p->base.fetch = _fetch; - /* p->base.action = _action; */ p->base.cleanup = _cleanup; evry_plugin_register(&p->base); Modified: trunk/e/src/modules/everything/evry_plug_border.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border.c 2009-08-14 08:34:52 UTC (rev 41754) +++ trunk/e/src/modules/everything/evry_plug_border.c 2009-08-14 09:35:51 UTC (rev 41755) @@ -1,17 +1,32 @@ -#include "Evry.h" +#include "e.h" +#include "e_mod_main.h" - static Evry_Plugin *p; static void +_cleanup(Evry_Plugin *p) +{ + Evry_Item *it; + + EINA_LIST_FREE(p->items, it) + evry_item_free(it); +} + +static void +_item_free(Evry_Item *it) +{ + if (it->data[0]) e_object_unref(E_OBJECT(it->data[0])); +} + +static void _item_add(Evry_Plugin *p, E_Border *bd, int prio) { Evry_Item *it; - it = evry_item_new(p, e_border_name_get(bd), NULL); - - /* e_object_ref(E_OBJECT(bd)); */ + it = evry_item_new(p, e_border_name_get(bd), &_item_free); + + e_object_ref(E_OBJECT(bd)); it->data[0] = bd; it->priority = prio; @@ -30,26 +45,14 @@ return (it1->priority - it2->priority); } -static void -_cleanup(Evry_Plugin *p) -{ - Evry_Item *it; - - EINA_LIST_FREE(p->items, it) - { - /* if (it->data[0]) e_object_unref(E_OBJECT(it->data[0])); */ - evry_item_free(it); - } -} - static int _fetch(Evry_Plugin *p, const char *input) { E_Manager *man; E_Zone *zone; - char match1[4096]; - char match2[4096]; + char m1[128]; + char m2[128]; E_Border *bd; E_Border_List *bl; @@ -60,8 +63,8 @@ if (input) { - snprintf(match1, sizeof(match1), "%s*", input); - snprintf(match2, sizeof(match2), "*%s*", input); + snprintf(m1, sizeof(m1), "%s*", input); + snprintf(m2, sizeof(m2), "*%s*", input); } bl = e_container_border_list_first(e_container_current_get(man)); @@ -72,21 +75,21 @@ if (!input) _item_add(p, bd, 1); else if (bd->client.icccm.name && - e_util_glob_case_match(bd->client.icccm.name, match1)) + e_util_glob_case_match(bd->client.icccm.name, m1)) _item_add(p, bd, 1); - else if (e_util_glob_case_match(e_border_name_get(bd), match1)) + else if (e_util_glob_case_match(e_border_name_get(bd), m1)) _item_add(p, bd, 1); else if (bd->client.icccm.name && - e_util_glob_case_match(bd->client.icccm.name, match2)) + e_util_glob_case_match(bd->client.icccm.name, m2)) _item_add(p, bd, 2); - else if (e_util_glob_case_match(e_border_name_get(bd), match2)) + else if (e_util_glob_case_match(e_border_name_get(bd), m2)) _item_add(p, bd, 2); else if (bd->desktop) { - if (e_util_glob_case_match(bd->desktop->exec, match1)) + if (e_util_glob_case_match(bd->desktop->name, m1)) _item_add(p, bd, 1); - else if (e_util_glob_case_match(bd->desktop->name, match1)) - _item_add(p, bd, 1); + else if (e_util_glob_case_match(bd->desktop->name, m2)) + _item_add(p, bd, 2); } } } @@ -125,14 +128,14 @@ found = i; } } - + e_icon_data_set(o, bd->client.netwm.icons[found].data, bd->client.netwm.icons[found].width, bd->client.netwm.icons[found].height); e_icon_alpha_set(o, 1); return o; } - + if (!o) o = e_border_icon_add(bd, e); @@ -149,7 +152,6 @@ p->type_out = "BORDER"; p->need_query = 0; p->fetch = &_fetch; - /* p->action = &_action; */ p->cleanup = &_cleanup; p->icon_get = &_item_icon_get; evry_plugin_register(p); Modified: trunk/e/src/modules/everything/evry_plug_calc.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_calc.c 2009-08-14 08:34:52 UTC (rev 41754) +++ trunk/e/src/modules/everything/evry_plug_calc.c 2009-08-14 09:35:51 UTC (rev 41755) @@ -6,7 +6,7 @@ static int _cb_error(void *data, int type, void *event); static int _cb_del(void *data, int type, void *event); -static Evry_Plugin *p; +static Evry_Plugin *p1; static Ecore_Exe *exe = NULL; static Eina_List *history = NULL; static Ecore_Event_Handler *data_handler = NULL; @@ -16,9 +16,11 @@ static int error = 0; + static int -_begin(Evry_Plugin *p, const Evry_Item *it __UNUSED__) +_begin(Evry_Plugin *p, const Evry_Item *item __UNUSED__) { + Evry_Item *it; data_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _cb_data, p); error_handler = ecore_event_handler_add(ECORE_EXE_EVENT_ERROR, _cb_error, p); @@ -30,6 +32,21 @@ ECORE_EXE_PIPE_ERROR | ECORE_EXE_PIPE_ERROR_LINE_BUFFERED, NULL); + if (history) + { + const char *result; + + EINA_LIST_FREE(history, result) + { + it = evry_item_new(p, result, NULL); + p->items = eina_list_prepend(p->items, it); + eina_stringshare_del(result); + } + } + + it = evry_item_new(p, "0", NULL); + p->items = eina_list_prepend(p->items, it); + return !!exe; } @@ -40,10 +57,13 @@ int items = 10; EINA_LIST_FREE(p->items, it) - if (items-- > 0) - history = eina_list_append(history, it); - else evry_item_free(it); + { + if (items-- > 0) + history = eina_list_prepend(history, eina_stringshare_add(it->label)); + evry_item_free(it); + } + ecore_event_handler_del(data_handler); ecore_event_handler_del(error_handler); ecore_event_handler_del(del_handler); @@ -56,37 +76,32 @@ static int _action(Evry_Plugin *p, const Evry_Item *it, const char *input __UNUSED__) { - if (p->items) + Eina_List *l; + Evry_Item *it2; + + /* remove duplicates */ + if (p->items->next) { - Eina_List *l; - Evry_Item *it2; + it = p->items->data; - evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_CLEAR); - - /* remove duplicates */ - if (p->items->next) + EINA_LIST_FOREACH(p->items->next, l, it2) { - it = p->items->data; + if (!strcmp(it->label, it2->label)) + break; + it2 = NULL; + } - EINA_LIST_FOREACH(p->items->next, l, it2) - { - if (!strcmp(it->label, it2->label)) - break; - it2 = NULL; - } - - if (it2) - { - p->items = eina_list_remove(p->items, it2); - if (it2->label) eina_stringshare_del(it2->label); - E_FREE(it2); - } + if (it2) + { + p->items = eina_list_remove(p->items, it2); + evry_item_free(it2); } + } - it = p->items->data; + it = p->items->data; - _item_add(p, (char *) it->label, 1); - } + it2 = evry_item_new(p, it->label, NULL); + p->items = eina_list_prepend(p->items, it2); evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD); @@ -98,13 +113,6 @@ { char buf[1024]; - if (history) - { - p->items = history; - history = NULL; - } - - if (!strncmp(input, "=scale=", 7)) snprintf(buf, 1024, "%s\n", input + (strlen(p->trigger))); else @@ -123,38 +131,24 @@ return 1; } -static void -_item_add(Evry_Plugin *p, char *result, int prio) -{ - Evry_Item *it; - - it = evry_item_new(p, result, NULL); - if (!it) return; - - p->items = eina_list_prepend(p->items, it); -} - static int -_cb_data(void *data __UNUSED__, int type __UNUSED__, void *event) +_cb_data(void *data, int type __UNUSED__, void *event) { Ecore_Exe_Event_Data *ev = event; Ecore_Exe_Event_Data_Line *l; + Evry_Plugin *p = data; + Evry_Item *it; if (ev->exe != exe) return 1; - evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_CLEAR); - - for (l = ev->lines; l && l->line; l++) + if (ev->lines) { - if (p->items) - { - Evry_Item *it = p->items->data; - if (it->label) - eina_stringshare_del(it->label); - it->label = eina_stringshare_add(l->line); - } - else - _item_add(p, l->line, 1); + it = p->items->data; + p->items = eina_list_remove(p->items, it); + evry_item_free(it); + + it = evry_item_new(p, ev->lines->line, NULL); + p->items = eina_list_prepend(p->items, it); } evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD); @@ -190,20 +184,20 @@ static Eina_Bool _init(void) { - p = E_NEW(Evry_Plugin, 1); - p->name = "Calculator"; - p->type = type_subject; - p->type_in = "NONE"; - p->type_out = "TEXT"; - p->trigger = "="; - p->icon = "accessories-calculator"; - p->need_query = 0; - p->async_query = 1; - p->begin = &_begin; - p->fetch = &_fetch; - p->action = &_action; - p->cleanup = &_cleanup; - evry_plugin_register(p); + p1 = E_NEW(Evry_Plugin, 1); + p1->name = "Calculator"; + p1->type = type_subject; + p1->type_in = "NONE"; + p1->type_out = "TEXT"; + p1->trigger = "="; + p1->icon = "accessories-calculator"; + p1->need_query = 0; + p1->async_query = 1; + p1->begin = &_begin; + p1->fetch = &_fetch; + p1->action = &_action; + p1->cleanup = &_cleanup; + evry_plugin_register(p1); return EINA_TRUE; } @@ -212,15 +206,13 @@ _shutdown(void) { Evry_Item *it; + char *result; - /* EINA_LIST_FREE(p->items, it) - * evry_item_free(it); */ + EINA_LIST_FREE(history, result) + eina_stringshare_del(result); - EINA_LIST_FREE(history, it) - evry_item_free(it); - - evry_plugin_unregister(p); - E_FREE(p); + evry_plugin_unregister(p1); + E_FREE(p1); } Modified: trunk/e/src/modules/everything/evry_plug_dir_browse.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-08-14 08:34:52 UTC (rev 41754) +++ trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-08-14 09:35:51 UTC (rev 41755) @@ -257,6 +257,8 @@ /* XXX free s->items? */ if (!strncmp(input, "/", 1)) { + if (s->command) return 1; + it = evry_item_new(p, "/", NULL); if (!it) return 0; it->uri = eina_stringshare_add("/"); @@ -273,6 +275,8 @@ char *tmp; int prio = 0; + if (s->command) return 1; + if (!strcmp(s->directory, "/")) return 0; snprintf(dir, 4096, "%s", s->directory); @@ -309,7 +313,6 @@ EINA_LIST_FREE(p->items, it) evry_item_free(it); - p->items = NULL; s->command = EINA_FALSE; } Modified: trunk/e/src/modules/everything/evry_plug_tracker.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-14 08:34:52 UTC (rev 41754) +++ trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-14 09:35:51 UTC (rev 41755) @@ -122,7 +122,6 @@ EINA_LIST_FREE(inst->items, it) evry_item_free(it); - inst->items = NULL; p->items = NULL; } @@ -239,9 +238,6 @@ EINA_LIST_FREE(inst->items, it) evry_item_free(it); - inst->items = NULL; - p->items = NULL; - if (inst->input) eina_stringshare_del(inst->input); inst->input = NULL; @@ -249,6 +245,8 @@ if (inst->matched) eina_stringshare_del(inst->matched); inst->matched = NULL; + + p->items = NULL; } evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD); @@ -404,7 +402,7 @@ _plugin_new("Music", type_subject, "Music", 20, 0); _plugin_new("Videos", type_subject, "Videos", 20, 0); _plugin_new("Documents", type_subject, "Documents", 20, 0); - + _plugin_new("Find Files", type_object, "Files", 20, 1); _plugin_new("Folders", type_object, "Folders", 20, 0); |
From: Enlightenment S. <no-...@en...> - 2009-08-14 14:44:30
|
Log: 'everything' module: added evry_fuzzy_match to replace e_util_glob_match which also gives a weight fo the results. now the items in 'All' list are nicely sorted. Author: jeffdameth Date: 2009-08-14 07:44:18 -0700 (Fri, 14 Aug 2009) New Revision: 41764 Modified: trunk/e/src/modules/everything/Evry.h trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry_plug_apps.c trunk/e/src/modules/everything/evry_plug_border.c trunk/e/src/modules/everything/evry_plug_border_act.c trunk/e/src/modules/everything/evry_plug_calc.c trunk/e/src/modules/everything/evry_plug_config.c trunk/e/src/modules/everything/evry_plug_dir_browse.c trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/Evry.h =================================================================== --- trunk/e/src/modules/everything/Evry.h 2009-08-14 14:30:56 UTC (rev 41763) +++ trunk/e/src/modules/everything/Evry.h 2009-08-14 14:44:18 UTC (rev 41764) @@ -32,22 +32,27 @@ struct _Evry_Item { - Evry_Plugin *plugin; - + /* label to show for this item */ const char *label; const char *uri; const char *mime; + /* item can be browsed, e.g. folders */ Eina_Bool browseable; /* these are only for internally use by plugins */ - /* used e.g. as pointer for item data (Efreet_Desktop) or */ - /* for internal stuff, like priority hints for sorting, etc */ + /* used e.g. as pointer for item data (Efreet_Desktop) */ void *data[4]; + + /* priority hints for sorting */ int priority; - /* not to be set by plugin! */ + /* store value of fuzzy match with input */ + int fuzzy_match; + + /* do not set by plugin! */ + Evry_Plugin *plugin; Evas_Object *o_icon; Evas_Object *o_bg; int ref; @@ -153,3 +158,6 @@ void evry_plugin_async_update(Evry_Plugin *plugin, int state); void evry_clear_input(void); int evry_icon_theme_set(Evas_Object *obj, const char *icon); + +int evry_fuzzy_match(const char *str, const char *match); + Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-14 14:30:56 UTC (rev 41763) +++ trunk/e/src/modules/everything/evry.c 2009-08-14 14:44:18 UTC (rev 41764) @@ -10,6 +10,7 @@ */ #define INPUTLEN 40 #define MATCH_LAG 0.33 +#define MAX_FUZZ 200 typedef struct _Evry_State Evry_State; @@ -419,7 +420,7 @@ /* update aggregator */ if (eina_list_count(s->cur_plugins) > 1) { - agg->fetch(agg, NULL); + agg->fetch(agg, s->input); /* add aggregator */ if (!(s->cur_plugins->data == agg)) @@ -451,7 +452,54 @@ } } +int +evry_fuzzy_match(const char *str, const char *match) +{ + const char *p, *m; + char mc; + unsigned int cnt = 1; + unsigned int pos = 0; + unsigned int last = 0; + if (!match || !match[0] || !str || !str[0]) return 0; + + for (m = match; *m != 0; m++) + { + mc = tolower(*m); + + for (p = str; *p != 0 && *m != 0; p++) + { + if (tolower(*p) == mc) + { + cnt += cnt * (pos - last); + last = pos; + m++; + mc = tolower(*m); + } + else pos++; + + if (cnt > MAX_FUZZ) return 0; + + if (isspace(mc) && strchr(p, ' ')) + break; + } + + /* search next word */ + if (isspace(mc)) + { + pos = last = 0; + /* add some weight */ + cnt += pos; + } + else break; + } + + if (*m == 0) + return cnt; + else + return 0; +} + /* local subsystem functions */ static Evry_List_Window * @@ -1016,7 +1064,7 @@ _evry_list_clear_list(s); _evry_state_pop(sel); - sel->aggregator->fetch(sel->aggregator, NULL); + sel->aggregator->fetch(sel->aggregator, sel->state->input); _evry_selector_update(sel); _evry_list_update(sel->state); _evry_update_text_label(sel->state); @@ -1491,7 +1539,7 @@ if (eina_list_count(s->cur_plugins) > 1) { - sel->aggregator->fetch(sel->aggregator, NULL); + sel->aggregator->fetch(sel->aggregator, s->input); s->cur_plugins = eina_list_prepend(s->cur_plugins, sel->aggregator); } else @@ -1933,7 +1981,27 @@ p->tab = o; } +static int +_evry_fuzzy_sort_cb(const void *data1, const void *data2) +{ + const Evry_Item *it1 = data1; + const Evry_Item *it2 = data2; + if (it1->fuzzy_match && !it2->fuzzy_match) + return -1; + + if (!it1->fuzzy_match && it2->fuzzy_match) + return 1; + + if (it1->fuzzy_match - it2->fuzzy_match) + return (it1->fuzzy_match - it2->fuzzy_match); + + if (it1->plugin->config->priority - it2->plugin->config->priority) + return (it1->plugin->config->priority - it2->plugin->config->priority); + + return (it1->priority - it2->priority); +} + /* action selector plugin: provides list of actions registered for candidate types provided by current plugin */ static int @@ -2005,40 +2073,28 @@ Eina_List *l; Evry_Item *it; Evry_Selector *sel = selectors[1]; - char match1[128]; - char match2[128]; - int prio; + int fuzz = 0; - if (p->items) - { - EINA_LIST_FREE(p->items, it) - evry_item_free(it); - } + EINA_LIST_FREE(p->items, it) + evry_item_free(it); - snprintf(match1, sizeof(match1), "%s*", input); - snprintf(match2, sizeof(match2), "*%s*", input); - EINA_LIST_FOREACH(sel->actions, l, act) { if (input) - { - if (e_util_glob_case_match(act->name, match1)) - prio = 1; - else if (e_util_glob_case_match(act->name, match2)) - prio = 2; - else prio = 0; - } + fuzz = evry_fuzzy_match(act->name, input); - if (!input || prio) + if (!input || fuzz) { it = evry_item_new(p, act->name, NULL); - it->priority = prio; + it->fuzzy_match = fuzz; it->data[0] = act; - p->items = eina_list_append(p->items, it); } } + if (input) + p->items = eina_list_sort(p->items, eina_list_count(p->items), _evry_fuzzy_sort_cb); + if (p->items) return 1; return 0; @@ -2106,8 +2162,9 @@ E_FREE(p); } + static int -_evry_plug_aggregator_fetch(Evry_Plugin *p, const char *input __UNUSED__) +_evry_plug_aggregator_fetch(Evry_Plugin *p, const char *input) { Evry_Selector *selector = p->private; Evry_State *s = selector->state; @@ -2115,6 +2172,8 @@ Evry_Plugin *plugin; Evry_Item *it; int cnt = 0; + int fuzzy; + Eina_List *items = NULL; EINA_LIST_FREE(p->items, it) evry_item_free(it); @@ -2122,30 +2181,48 @@ EINA_LIST_FOREACH(s->cur_plugins, l, plugin) cnt += eina_list_count(plugin->items); - if (cnt <= 100) + + if (input[0]) { EINA_LIST_FOREACH(s->cur_plugins, l, plugin) { EINA_LIST_FOREACH(plugin->items, ll, it) { - _evry_item_ref(it); - p->items = eina_list_append(p->items, it); + if (!it->fuzzy_match) + it->fuzzy_match = evry_fuzzy_match(it->label, input); + + if (it->fuzzy_match) + { + _evry_item_ref(it); + items = eina_list_append(items, it); + p->items = eina_list_append(p->items, it); + } } } } - else + + if (!input[0] || eina_list_count(items) < 20) { EINA_LIST_FOREACH(s->cur_plugins, l, plugin) - { - for (cnt = 0, ll = plugin->items; ll && cnt < 15; ll = ll->next, cnt++) - { - it = ll->data; - _evry_item_ref(it); - p->items = eina_list_append(p->items, it); - } - } + { + for (cnt = 0, ll = plugin->items; ll && cnt < 15; ll = ll->next, cnt++) + { + if (!items || !eina_list_data_find_list(items, ll->data)) + { + it = ll->data; + _evry_item_ref(it); + it->fuzzy_match = 0; + p->items = eina_list_append(p->items, it); + } + } + } } + eina_list_free(items); + + if (input[0]) + p->items = eina_list_sort(p->items, eina_list_count(p->items), _evry_fuzzy_sort_cb); + return 1; } Modified: trunk/e/src/modules/everything/evry_plug_apps.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_apps.c 2009-08-14 14:30:56 UTC (rev 41763) +++ trunk/e/src/modules/everything/evry_plug_apps.c 2009-08-14 14:44:18 UTC (rev 41764) @@ -177,38 +177,22 @@ } static void -_add_desktop_list(Evry_Plugin *p, Eina_List *apps, char *m1, char *m2) +_add_desktop_list(Evry_Plugin *p, Eina_List *apps, const char *input) { Efreet_Desktop *desktop; Eina_List *l; + int fuzz; EINA_LIST_FOREACH(apps, l, desktop) { - if (eina_list_count(p->items) > 99) continue; + if (eina_list_count(p->items) > 199) continue; if (!desktop || !desktop->name || !desktop->exec) continue; - if (e_util_glob_case_match(desktop->exec, m1)) - _item_add(p, desktop, NULL, 1); - else if (e_util_glob_case_match(desktop->name, m1)) - _item_add(p, desktop, NULL, 1); + if (fuzz = evry_fuzzy_match(desktop->exec, input)) + _item_add(p, desktop, NULL, fuzz); + else if (fuzz = evry_fuzzy_match(desktop->name, input)) + _item_add(p, desktop, NULL, fuzz); } - EINA_LIST_FOREACH(apps, l, desktop) - { - if (eina_list_count(p->items) > 99) continue; - if (!desktop || !desktop->name || !desktop->exec) continue; - - if (e_util_glob_case_match(desktop->exec, m2)) - _item_add(p, desktop, NULL, 2); - else if (e_util_glob_case_match(desktop->name, m2)) - _item_add(p, desktop, NULL, 2); - /* else if (desktop->comment) - * { - * if (e_util_glob_case_match(desktop->comment, m1)) - * _item_add(p, desktop, NULL, 3); - * else if (e_util_glob_case_match(desktop->comment, m2)) - * _item_add(p, desktop, NULL, 4); - * } */ - } } static int @@ -264,37 +248,47 @@ _list_free(p); - if (input) - { - snprintf(match1, sizeof(match1), "%s*", input); - snprintf(match2, sizeof(match2), "*%s*", input); - } - /* add apps for a given mimetype */ if (p->type == type_action) { if (input) { - _add_desktop_list(p, inst->apps_mime, match1, match2); + _add_desktop_list(p, inst->apps_mime, input); } else { EINA_LIST_FOREACH(inst->apps_mime, l, desktop) _item_add(p, desktop, NULL, 1); } - - if (input) - EINA_LIST_FOREACH(p->items, l, it) - it->priority += 2; } /* add apps matching input */ if (input) { if (!inst->apps_all) - inst->apps_all = efreet_util_desktop_name_glob_list("*"); + { + Eina_List *apps = NULL; + Eina_List *stuff; + Eina_List *l, *ll; - _add_desktop_list(p, inst->apps_all, match1, match2); + apps = efreet_util_desktop_name_glob_list("*"); + stuff = efreet_util_desktop_category_list("Screensaver"); + + EINA_LIST_FOREACH(stuff, l, desktop) + { + ll = eina_list_data_find_list(apps, desktop); + if (ll) + { + efreet_desktop_free(desktop); + apps = eina_list_remove_list(apps, ll); + } + /* efreet_desktop_free(desktop); */ + } + + inst->apps_all = apps; + } + + _add_desktop_list(p, inst->apps_all, input); } /* add exe history items */ else if (!p->items) @@ -362,7 +356,11 @@ if (p->items) { + int prio; p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort); + EINA_LIST_FOREACH(p->items, l, it) + it->priority = prio++; + return 1; } Modified: trunk/e/src/modules/everything/evry_plug_border.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border.c 2009-08-14 14:30:56 UTC (rev 41763) +++ trunk/e/src/modules/everything/evry_plug_border.c 2009-08-14 14:44:18 UTC (rev 41764) @@ -20,7 +20,7 @@ } static void -_item_add(Evry_Plugin *p, E_Border *bd, int prio) +_item_add(Evry_Plugin *p, E_Border *bd, int fuzz, int *prio) { Evry_Item *it; @@ -28,8 +28,11 @@ e_object_ref(E_OBJECT(bd)); it->data[0] = bd; - it->priority = prio; + it->fuzzy_match = fuzz; + it->priority = *prio; + *prio = *prio - 1; + p->items = eina_list_append(p->items, it); } @@ -37,10 +40,11 @@ static int _cb_sort(const void *data1, const void *data2) { - const Evry_Item *it1, *it2; + const Evry_Item *it1 = data1; + const Evry_Item *it2 = data2; - it1 = data1; - it2 = data2; + if (it1->fuzzy_match - it2->fuzzy_match) + return (it1->fuzzy_match - it2->fuzzy_match); return (it1->priority - it2->priority); } @@ -50,54 +54,41 @@ { E_Manager *man; E_Zone *zone; - - char m1[128]; - char m2[128]; E_Border *bd; E_Border_List *bl; + int fuzz; + int prio = 0; _cleanup(p); man = e_manager_current_get(); zone = e_util_zone_current_get(man); - if (input) - { - snprintf(m1, sizeof(m1), "%s*", input); - snprintf(m2, sizeof(m2), "*%s*", input); - } - bl = e_container_border_list_first(e_container_current_get(man)); while ((bd = e_container_border_list_next(bl))) { if (zone == bd->zone) { if (!input) - _item_add(p, bd, 1); - else if (bd->client.icccm.name && - e_util_glob_case_match(bd->client.icccm.name, m1)) - _item_add(p, bd, 1); - else if (e_util_glob_case_match(e_border_name_get(bd), m1)) - _item_add(p, bd, 1); - else if (bd->client.icccm.name && - e_util_glob_case_match(bd->client.icccm.name, m2)) - _item_add(p, bd, 2); - else if (e_util_glob_case_match(e_border_name_get(bd), m2)) - _item_add(p, bd, 2); + _item_add(p, bd, 0, &prio); + else if ((bd->client.icccm.name) && + (fuzz = evry_fuzzy_match(bd->client.icccm.name, input))) + _item_add(p, bd, fuzz, &prio); + else if ((fuzz = evry_fuzzy_match(e_border_name_get(bd), input))) + _item_add(p, bd, fuzz, &prio); else if (bd->desktop) { - if (e_util_glob_case_match(bd->desktop->name, m1)) - _item_add(p, bd, 1); - else if (e_util_glob_case_match(bd->desktop->name, m2)) - _item_add(p, bd, 2); + if ((fuzz = evry_fuzzy_match(bd->desktop->name, input))) + _item_add(p, bd, fuzz, &prio); } } } e_container_border_list_free(bl); - if (eina_list_count(p->items) > 0) + if (p->items) { p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort); + return 1; } Modified: trunk/e/src/modules/everything/evry_plug_border_act.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border_act.c 2009-08-14 14:30:56 UTC (rev 41763) +++ trunk/e/src/modules/everything/evry_plug_border_act.c 2009-08-14 14:44:18 UTC (rev 41764) @@ -76,12 +76,10 @@ static int _cb_sort(const void *data1, const void *data2) { - const Evry_Item *it1, *it2; + const Evry_Item *it1 = data1; + const Evry_Item *it2 = data2; - it1 = data1; - it2 = data2; - - return (it1->priority - it2->priority); + return (it1->fuzzy_match - it2->fuzzy_match); } static void @@ -91,27 +89,20 @@ } static void -_item_add(Evry_Plugin *p, const char *label, void (*action_cb) (E_Border *bd), const char *icon, char *m1, char *m2) +_item_add(Evry_Plugin *p, const char *label, void (*action_cb) (E_Border *bd), const char *icon, const char *input) { Evry_Item *it; - int prio = 1; + int fuzz = 1; - if (m1[0] && m2[0]) - { - if (e_util_glob_case_match(label, m1)) - prio = 1; - else if (e_util_glob_case_match(label, m2)) - prio = 2; - else - prio = 0; - } + if (input) + fuzz = evry_fuzzy_match(label, input); - if (!prio) return; + if (!fuzz) return; it = evry_item_new(p, label, &_item_free); it->data[0] = action_cb; it->data[1] = (void *) eina_stringshare_add(icon); - it->priority = prio; + it->fuzzy_match = fuzz; p->items = eina_list_prepend(p->items, it); } @@ -126,37 +117,23 @@ } static int -_fetch(Evry_Plugin *p, const char *input __UNUSED__) +_fetch(Evry_Plugin *p, const char *input) { - char m1[128]; - char m2[128]; - _cleanup(p); - if (input) - { - snprintf(m1, sizeof(m1), "%s*", input); - snprintf(m2, sizeof(m2), "*%s*", input); - } - else - { - m1[0] = 0; - m2[0] = 0; - } + _item_add(p, _("Switch To"), _act_cb_border_switch_to, "go-next", input); - _item_add(p, _("Switch To"), _act_cb_border_switch_to, "go-next", m1, m2); - if (inst->border->iconic) - _item_add(p, _("Uniconify"), _act_cb_border_unminimize, "window-minimize", m1, m2); + _item_add(p, _("Uniconify"), _act_cb_border_unminimize, "window-minimize", input); else - _item_add(p, _("Iconify"), _act_cb_border_minimize, "window-minimize", m1, m2); + _item_add(p, _("Iconify"), _act_cb_border_minimize, "window-minimize", input); if (!inst->border->fullscreen) - _item_add(p, _("Fullscreen"), _act_cb_border_fullscreen, "view-fullscreen", m1, m2); + _item_add(p, _("Fullscreen"), _act_cb_border_fullscreen, "view-fullscreen", input); else - _item_add(p, _("Unfullscreen"), _act_cb_border_fullscreen, "view-restore", m1, m2); + _item_add(p, _("Unfullscreen"), _act_cb_border_fullscreen, "view-restore", input); - _item_add(p, _("Close"), _act_cb_border_close, "window-close", m1, m2); + _item_add(p, _("Close"), _act_cb_border_close, "window-close", input); if (eina_list_count(p->items) > 0) { Modified: trunk/e/src/modules/everything/evry_plug_calc.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_calc.c 2009-08-14 14:30:56 UTC (rev 41763) +++ trunk/e/src/modules/everything/evry_plug_calc.c 2009-08-14 14:44:18 UTC (rev 41764) @@ -56,6 +56,12 @@ Evry_Item *it; int items = 10; + if (p->items) + { + evry_item_free(p->items->data); + p->items = eina_list_remove_list(p->items, p->items); + } + EINA_LIST_FREE(p->items, it) { if (items-- > 0) Modified: trunk/e/src/modules/everything/evry_plug_config.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_config.c 2009-08-14 14:30:56 UTC (rev 41763) +++ trunk/e/src/modules/everything/evry_plug_config.c 2009-08-14 14:44:18 UTC (rev 41764) @@ -14,13 +14,14 @@ } static void -_item_add(Evry_Plugin *p, E_Configure_It *eci, int prio) +_item_add(Evry_Plugin *p, E_Configure_It *eci, int fuzz, int prio) { Evry_Item *it; it = evry_item_new(p, eci->label, NULL); it->data[0] = eci; it->priority = prio; + it->fuzzy_match = fuzz; p->items = eina_list_append(p->items, it); } @@ -28,46 +29,38 @@ static int _cb_sort(const void *data1, const void *data2) { - const Evry_Item *it1, *it2; + const Evry_Item *it1 = data1; + const Evry_Item *it2 = data2; - it1 = data1; - it2 = data2; + if (it1->fuzzy_match - it2->fuzzy_match) + return (it1->fuzzy_match - it2->fuzzy_match); - /* TODO sort by name? */ return (it1->priority - it2->priority); } static int _fetch(Evry_Plugin *p, const char *input) { - char match1[128]; - char match2[128]; Eina_List *l, *ll; E_Configure_Cat *ecat; E_Configure_It *eci; + int fuzz; _cleanup(p); - snprintf(match1, sizeof(match1), "%s*", input); - snprintf(match2, sizeof(match2), "*%s*", input); - EINA_LIST_FOREACH(e_configure_registry, l, ecat) { if ((ecat->pri < 0) || (!ecat->items)) continue; if (!strcmp(ecat->cat, "system")) continue; - + EINA_LIST_FOREACH(ecat->items, ll, eci) { if (eci->pri >= 0) { - if (e_util_glob_case_match(eci->label, match1)) - _item_add(p, eci, 1); - else if (e_util_glob_case_match(eci->label, match2)) - _item_add(p, eci, 2); - else if (e_util_glob_case_match(ecat->label, match1)) - _item_add(p, eci, 3); - else if (e_util_glob_case_match(ecat->label, match2)) - _item_add(p, eci, 4); + if (fuzz = evry_fuzzy_match(eci->label, input)) + _item_add(p, eci, fuzz, 0); + else if (fuzz = evry_fuzzy_match(ecat->label, input)) + _item_add(p, eci, fuzz, 1); } } } @@ -116,7 +109,7 @@ EINA_LIST_FOREACH(e_configure_registry, l, ecat) { if (found) break; - + EINA_LIST_FOREACH(ecat->items, ll, eci2) { if (eci == eci2) Modified: trunk/e/src/modules/everything/evry_plug_dir_browse.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-08-14 14:30:56 UTC (rev 41763) +++ trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-08-14 14:44:18 UTC (rev 41764) @@ -77,15 +77,19 @@ static int _cb_sort(const void *data1, const void *data2) { - const Evry_Item *it1, *it2; + const Evry_Item *it1 = data1; + const Evry_Item *it2 = data2; - it1 = data1; - it2 = data2; + if (it1->browseable && !it2->browseable) + return -1; - if (it2->priority - it1->priority) - return (it2->priority - it1->priority); - else - return strcasecmp(it1->label, it2->label); + if (!it1->browseable && it2->browseable) + return 1; + + if (it1->fuzzy_match - it2->fuzzy_match) + return (it1->fuzzy_match - it2->fuzzy_match); + + return strcasecmp(it1->label, it2->label); } static int @@ -111,8 +115,6 @@ if (!s->command) { - /* evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_CLEAR); */ - if (eina_list_count(p->items) > 0) { p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort); @@ -240,8 +242,6 @@ { Evry_Item *it; Eina_List *l; - char match1[4096]; - char match2[4096]; int cnt = 0; State *s = ((Eina_List *)p->private)->data; @@ -316,21 +316,15 @@ s->command = EINA_FALSE; } - if (input) - { - snprintf(match1, sizeof(match1), "%s*", input); - snprintf(match2, sizeof(match2), "*%s*", input); - } - EINA_LIST_FOREACH(s->items, l, it) { if (input) { - if (e_util_glob_case_match(it->label, match1)) - it->priority = 1 + (it->browseable ? 1 : 0); - else if (e_util_glob_case_match(it->label, match2)) - it->priority = (it->browseable ? 1 : 0); - else it = NULL; + int fuzz; + if ((fuzz = evry_fuzzy_match(it->label, input))) + it->priority = fuzz; + else + it = NULL; } if (it) Modified: trunk/e/src/modules/everything/evry_plug_tracker.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-14 14:30:56 UTC (rev 41763) +++ trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-14 14:44:18 UTC (rev 41764) @@ -96,6 +96,7 @@ { it->browseable = EINA_TRUE; it->mime = eina_stringshare_add("x-directory/normal"); + it->priority = 1; } else it->mime = eina_stringshare_add(mime); @@ -205,8 +206,6 @@ } else if (inst->items && inst->input) { - char input[128]; - char *pos = input; int len_matched = strlen(inst->matched); int len_input = strlen(inst->input); Eina_List *l; @@ -215,12 +214,8 @@ { p->items = NULL; - snprintf(input, 128, "*%s*", inst->input + len_matched); - for (; *pos != '\0'; pos++) - if (isspace(*pos)) *pos = '*'; - EINA_LIST_FOREACH(inst->items, l, it) - if (e_util_glob_case_match(it->label, input)) + if (evry_fuzzy_match(it->label, (inst->input + len_matched))) p->items = eina_list_append(p->items, it); if (inst->matched) |
From: Enlightenment S. <no-...@en...> - 2009-08-14 15:33:32
|
Log: 'everything' module: - use border focus stack instead of border list - border ref/unref seems not to work here. todo: handle border remove events Author: jeffdameth Date: 2009-08-14 08:33:13 -0700 (Fri, 14 Aug 2009) New Revision: 41765 Modified: trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry_plug_border.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-14 14:44:18 UTC (rev 41764) +++ trunk/e/src/modules/everything/evry.c 2009-08-14 15:33:13 UTC (rev 41765) @@ -471,7 +471,7 @@ { if (tolower(*p) == mc) { - cnt += cnt * (pos - last); + cnt += cnt * (pos - last) * 10; last = pos; m++; mc = tolower(*m); @@ -480,7 +480,7 @@ if (cnt > MAX_FUZZ) return 0; - if (isspace(mc) && strchr(p, ' ')) + if (isspace(mc) && !strchr(p, ' ')) break; } @@ -513,7 +513,8 @@ x = (zone->w / 2) - (win->popup->w / 3); y = (zone->h / 2); - popup = e_popup_new(zone, x + 50, y - 4, /*XXX get from theme ?*/ + /* TODO get offsets from theme */ + popup = e_popup_new(zone, x + 50, y - 4, win->popup->w * 2/3 - 100, evry_conf->height); if (!popup) return NULL; Modified: trunk/e/src/modules/everything/evry_plug_border.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border.c 2009-08-14 14:44:18 UTC (rev 41764) +++ trunk/e/src/modules/everything/evry_plug_border.c 2009-08-14 15:33:13 UTC (rev 41765) @@ -3,6 +3,7 @@ static Evry_Plugin *p; +/* TODO handle border remove events */ static void _cleanup(Evry_Plugin *p) @@ -16,7 +17,7 @@ static void _item_free(Evry_Item *it) { - if (it->data[0]) e_object_unref(E_OBJECT(it->data[0])); + /* if (it->data[0]) e_object_unref(E_OBJECT(it->data[0])); */ } static void @@ -26,17 +27,16 @@ it = evry_item_new(p, e_border_name_get(bd), &_item_free); - e_object_ref(E_OBJECT(bd)); + /* e_object_ref(E_OBJECT(bd)); */ it->data[0] = bd; it->fuzzy_match = fuzz; it->priority = *prio; - *prio = *prio - 1; + *prio += 1; p->items = eina_list_append(p->items, it); } -/* TODO sort by focus history and name? */ static int _cb_sort(const void *data1, const void *data2) { @@ -52,20 +52,17 @@ static int _fetch(Evry_Plugin *p, const char *input) { - E_Manager *man; E_Zone *zone; E_Border *bd; - E_Border_List *bl; + Eina_List *l; int fuzz; int prio = 0; _cleanup(p); - man = e_manager_current_get(); - zone = e_util_zone_current_get(man); + zone = e_util_zone_current_get(e_manager_current_get()); - bl = e_container_border_list_first(e_container_current_get(man)); - while ((bd = e_container_border_list_next(bl))) + EINA_LIST_FOREACH(e_border_focus_stack_get(), l, bd) { if (zone == bd->zone) { @@ -83,7 +80,6 @@ } } } - e_container_border_list_free(bl); if (p->items) { |
From: Enlightenment S. <no-...@en...> - 2009-08-14 16:18:37
|
Log: 'everything' module: fuzzy_match fixes Author: jeffdameth Date: 2009-08-14 09:18:25 -0700 (Fri, 14 Aug 2009) New Revision: 41766 Modified: trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry_plug_border.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-14 15:33:13 UTC (rev 41765) +++ trunk/e/src/modules/everything/evry.c 2009-08-14 16:18:25 UTC (rev 41766) @@ -460,6 +460,7 @@ unsigned int cnt = 1; unsigned int pos = 0; unsigned int last = 0; + unsigned char first; if (!match || !match[0] || !str || !str[0]) return 0; @@ -467,17 +468,23 @@ { mc = tolower(*m); + first = 0; + for (p = str; *p != 0 && *m != 0; p++) { if (tolower(*p) == mc) { - cnt += cnt * (pos - last) * 10; + cnt += pos + (pos - last) * 10; last = pos; m++; mc = tolower(*m); + first = 1; } else pos++; + if (!first) + last = pos; + if (cnt > MAX_FUZZ) return 0; if (isspace(mc) && !strchr(p, ' ')) Modified: trunk/e/src/modules/everything/evry_plug_border.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border.c 2009-08-14 15:33:13 UTC (rev 41765) +++ trunk/e/src/modules/everything/evry_plug_border.c 2009-08-14 16:18:25 UTC (rev 41766) @@ -55,7 +55,6 @@ E_Zone *zone; E_Border *bd; Eina_List *l; - int fuzz; int prio = 0; _cleanup(p); @@ -68,15 +67,28 @@ { if (!input) _item_add(p, bd, 0, &prio); - else if ((bd->client.icccm.name) && - (fuzz = evry_fuzzy_match(bd->client.icccm.name, input))) - _item_add(p, bd, fuzz, &prio); - else if ((fuzz = evry_fuzzy_match(e_border_name_get(bd), input))) - _item_add(p, bd, fuzz, &prio); - else if (bd->desktop) + else { - if ((fuzz = evry_fuzzy_match(bd->desktop->name, input))) - _item_add(p, bd, fuzz, &prio); + int fuzz, min; + + min = evry_fuzzy_match(e_border_name_get(bd), input); + + if (bd->client.icccm.name) + { + fuzz = evry_fuzzy_match(bd->client.icccm.name, input); + if (!min || fuzz < min) + min = fuzz; + } + + if (bd->desktop) + { + fuzz = evry_fuzzy_match(bd->desktop->name, input); + if (!min || fuzz < min) + min = fuzz; + } + + if (min) + _item_add(p, bd, min, &prio); } } } |
From: Enlightenment S. <no-...@en...> - 2009-08-14 16:28:14
|
Log: 'everything' module: fix bug in tracker plugin Author: jeffdameth Date: 2009-08-14 09:28:00 -0700 (Fri, 14 Aug 2009) New Revision: 41767 Modified: trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-14 16:18:25 UTC (rev 41766) +++ trunk/e/src/modules/everything/evry.c 2009-08-14 16:28:00 UTC (rev 41767) @@ -462,7 +462,7 @@ unsigned int last = 0; unsigned char first; - if (!match || !match[0] || !str || !str[0]) return 0; + if (!match || !str) return 0; for (m = match; *m != 0; m++) { Modified: trunk/e/src/modules/everything/evry_plug_tracker.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-14 16:18:25 UTC (rev 41766) +++ trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-14 16:28:00 UTC (rev 41767) @@ -206,7 +206,7 @@ } else if (inst->items && inst->input) { - int len_matched = strlen(inst->matched); + int len_matched = (inst->matched ? strlen(inst->matched) : 0); int len_input = strlen(inst->input); Eina_List *l; |
From: Enlightenment S. <no-...@en...> - 2009-08-14 16:40:16
|
Log: 'everything' module: ok one another Author: jeffdameth Date: 2009-08-14 09:40:07 -0700 (Fri, 14 Aug 2009) New Revision: 41768 Modified: trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/evry_plug_tracker.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-14 16:28:00 UTC (rev 41767) +++ trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-14 16:40:07 UTC (rev 41768) @@ -204,7 +204,7 @@ else inst->matched = NULL; } - else if (inst->items && inst->input) + else if (inst->items && inst->input && strlen(inst->input) > 0) { int len_matched = (inst->matched ? strlen(inst->matched) : 0); int len_input = strlen(inst->input); |
From: Enlightenment S. <no-...@en...> - 2009-08-14 18:55:47
|
Log: 'everything' module: some more optimizations for fuzzy matching Author: jeffdameth Date: 2009-08-14 11:55:35 -0700 (Fri, 14 Aug 2009) New Revision: 41774 Modified: trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry_plug_apps.c trunk/e/src/modules/everything/evry_plug_border.c trunk/e/src/modules/everything/evry_plug_border_act.c trunk/e/src/modules/everything/evry_plug_config.c trunk/e/src/modules/everything/evry_plug_dir_browse.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-14 17:48:49 UTC (rev 41773) +++ trunk/e/src/modules/everything/evry.c 2009-08-14 18:55:35 UTC (rev 41774) @@ -461,13 +461,13 @@ unsigned int pos = 0; unsigned int last = 0; unsigned char first; - + unsigned int spaces = 0; + if (!match || !str) return 0; for (m = match; *m != 0; m++) { mc = tolower(*m); - first = 0; for (p = str; *p != 0 && *m != 0; p++) @@ -497,6 +497,7 @@ pos = last = 0; /* add some weight */ cnt += pos; + } else break; } @@ -1107,7 +1108,7 @@ { int next_selector = 0; - if (s->plugin == action_selector) + if (s->sel_item && s->sel_item->plugin == action_selector) { Evry_Action *act = s->sel_item->data[0]; @@ -1306,7 +1307,7 @@ if (!s_subject->sel_item || !s_action->sel_item) return; - if (s_action->plugin == action_selector) + if (s_action->sel_item->plugin == action_selector) { Evry_Action *act = s_action->sel_item->data[0]; Evry_Item *it_object = NULL; @@ -2081,7 +2082,7 @@ Eina_List *l; Evry_Item *it; Evry_Selector *sel = selectors[1]; - int fuzz = 0; + int match = 0; EINA_LIST_FREE(p->items, it) evry_item_free(it); @@ -2089,12 +2090,12 @@ EINA_LIST_FOREACH(sel->actions, l, act) { if (input) - fuzz = evry_fuzzy_match(act->name, input); + match = evry_fuzzy_match(act->name, input); - if (!input || fuzz) + if (!input || match) { it = evry_item_new(p, act->name, NULL); - it->fuzzy_match = fuzz; + it->fuzzy_match = match; it->data[0] = act; p->items = eina_list_append(p->items, it); } @@ -2180,7 +2181,6 @@ Evry_Plugin *plugin; Evry_Item *it; int cnt = 0; - int fuzzy; Eina_List *items = NULL; EINA_LIST_FREE(p->items, it) Modified: trunk/e/src/modules/everything/evry_plug_apps.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_apps.c 2009-08-14 17:48:49 UTC (rev 41773) +++ trunk/e/src/modules/everything/evry_plug_apps.c 2009-08-14 18:55:35 UTC (rev 41774) @@ -16,6 +16,7 @@ static Evry_Action *act1; static Evry_Action *act2; static Evry_Action *act3; +static Evry_Action *act4; static Eina_List *exe_path = NULL; @@ -102,7 +103,7 @@ } static int -_item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio) +_item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int match) { Evry_Item *it; Evry_App *app; @@ -169,7 +170,7 @@ app->desktop = desktop; app->file = file; it->data[0] = app; - it->priority = prio; + it->fuzzy_match = match; p->items = eina_list_append(p->items, it); @@ -181,34 +182,32 @@ { Efreet_Desktop *desktop; Eina_List *l; - int fuzz; + int m1, m2, min; EINA_LIST_FOREACH(apps, l, desktop) { if (eina_list_count(p->items) > 199) continue; - if (!desktop || !desktop->name || !desktop->exec) continue; + if (!desktop->name || !desktop->exec) continue; - if (fuzz = evry_fuzzy_match(desktop->exec, input)) - _item_add(p, desktop, NULL, fuzz); - else if (fuzz = evry_fuzzy_match(desktop->name, input)) - _item_add(p, desktop, NULL, fuzz); + m1 = evry_fuzzy_match(desktop->exec, input); + m2 = evry_fuzzy_match(desktop->name, input); + + if (!m1 || (m2 && m2 < m1)) + m1 = m2; + + if (m1) _item_add(p, desktop, NULL, m1); } } static int _cb_sort(const void *data1, const void *data2) { - const Evry_Item *it1, *it2; + const Evry_Item *it1 = data1; + const Evry_Item *it2 = data2; Evry_App *app1, *app2; const char *e1, *e2; double t1, t2; - - it1 = data1; - it2 = data2; - - if (it1->priority - it2->priority) - return (it1->priority - it2->priority); - + app1 = it1->data[0]; app2 = it2->data[0]; @@ -228,6 +227,15 @@ if ((int)(t2 - t1)) return (int)(t2 - t1); + if (it1->fuzzy_match && !it2->fuzzy_match) + return -1; + + if (!it1->fuzzy_match && it2->fuzzy_match) + return 1; + + if (it1->fuzzy_match - it2->fuzzy_match) + return (it1->fuzzy_match - it2->fuzzy_match); + // TODO compare exe strings? else return 0; } @@ -394,7 +402,24 @@ if (app->file && strlen(app->file) > 0) return 1; + + return 0; +} +static int +_exec_border_check_item(Evry_Action *act __UNUSED__, const Evry_Item *it) +{ + E_Border *bd = it->data[0]; + E_OBJECT_CHECK_RETURN(bd, 0); + E_OBJECT_TYPE_CHECK_RETURN(bd, E_BORDER_TYPE, 0); + + if ((bd->desktop && bd->desktop->exec) && + ((strstr(bd->desktop->exec, "%u")) || + (strstr(bd->desktop->exec, "%U")) || + (strstr(bd->desktop->exec, "%f")) || + (strstr(bd->desktop->exec, "%F")))) + return 1; + return 0; } @@ -454,6 +479,19 @@ } static int +_exec_border_action(Evry_Action *act, const Evry_Item *it1, const Evry_Item *it2, const char *input) +{ + Evry_Item *it = E_NEW(Evry_Item, 1); + Evry_App *app = E_NEW(Evry_App, 1); + E_Border *bd = it1->data[0]; + + app->desktop = bd->desktop; + it->data[0] = app; + + return _app_action(it, it2); +} + +static int _open_with_action(Evry_Plugin *p, const Evry_Item *it, const char *input __UNUSED__) { Inst *inst = p->private; @@ -636,6 +674,15 @@ act3->icon = "everything-launch"; evry_action_register(act3); + act4 = E_NEW(Evry_Action, 1); + act4->name = "Open File..."; + act4->type_in1 = "BORDER"; + act4->type_in2 = "FILE"; + act4->action = &_exec_border_action; + act4->check_item = &_exec_border_check_item; + act4->icon = "everything-launch"; + evry_action_register(act4); + /* taken from e_exebuf.c */ path = getenv("PATH"); if (path) @@ -676,6 +723,7 @@ E_FREE(act1); E_FREE(act2); E_FREE(act3); + E_FREE(act4); EINA_LIST_FREE(exe_path, str) free(str); Modified: trunk/e/src/modules/everything/evry_plug_border.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border.c 2009-08-14 17:48:49 UTC (rev 41773) +++ trunk/e/src/modules/everything/evry_plug_border.c 2009-08-14 18:55:35 UTC (rev 41774) @@ -21,7 +21,7 @@ } static void -_item_add(Evry_Plugin *p, E_Border *bd, int fuzz, int *prio) +_item_add(Evry_Plugin *p, E_Border *bd, int match, int *prio) { Evry_Item *it; @@ -29,7 +29,7 @@ /* e_object_ref(E_OBJECT(bd)); */ it->data[0] = bd; - it->fuzzy_match = fuzz; + it->fuzzy_match = match; it->priority = *prio; *prio += 1; @@ -56,7 +56,8 @@ E_Border *bd; Eina_List *l; int prio = 0; - + int m1, m2; + _cleanup(p); zone = e_util_zone_current_get(e_manager_current_get()); @@ -69,26 +70,24 @@ _item_add(p, bd, 0, &prio); else { - int fuzz, min; + m1 = evry_fuzzy_match(e_border_name_get(bd), input); - min = evry_fuzzy_match(e_border_name_get(bd), input); - if (bd->client.icccm.name) { - fuzz = evry_fuzzy_match(bd->client.icccm.name, input); - if (!min || fuzz < min) - min = fuzz; + m2 = evry_fuzzy_match(bd->client.icccm.name, input); + if (!m1 || (m2 && m2 < m1)) + m1 = m2; } if (bd->desktop) { - fuzz = evry_fuzzy_match(bd->desktop->name, input); - if (!min || fuzz < min) - min = fuzz; + m2 = evry_fuzzy_match(bd->desktop->name, input); + if (!m1 || (m2 && m2 < m1)) + m1 = m2; } - if (min) - _item_add(p, bd, min, &prio); + if (m1) + _item_add(p, bd, m1, &prio); } } } Modified: trunk/e/src/modules/everything/evry_plug_border_act.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border_act.c 2009-08-14 17:48:49 UTC (rev 41773) +++ trunk/e/src/modules/everything/evry_plug_border_act.c 2009-08-14 18:55:35 UTC (rev 41774) @@ -92,17 +92,17 @@ _item_add(Evry_Plugin *p, const char *label, void (*action_cb) (E_Border *bd), const char *icon, const char *input) { Evry_Item *it; - int fuzz = 1; + int match = 1; if (input) - fuzz = evry_fuzzy_match(label, input); + match = evry_fuzzy_match(label, input); - if (!fuzz) return; + if (!match) return; it = evry_item_new(p, label, &_item_free); it->data[0] = action_cb; it->data[1] = (void *) eina_stringshare_add(icon); - it->fuzzy_match = fuzz; + it->fuzzy_match = match; p->items = eina_list_prepend(p->items, it); } Modified: trunk/e/src/modules/everything/evry_plug_config.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_config.c 2009-08-14 17:48:49 UTC (rev 41773) +++ trunk/e/src/modules/everything/evry_plug_config.c 2009-08-14 18:55:35 UTC (rev 41774) @@ -14,14 +14,14 @@ } static void -_item_add(Evry_Plugin *p, E_Configure_It *eci, int fuzz, int prio) +_item_add(Evry_Plugin *p, E_Configure_It *eci, int match, int prio) { Evry_Item *it; it = evry_item_new(p, eci->label, NULL); it->data[0] = eci; it->priority = prio; - it->fuzzy_match = fuzz; + it->fuzzy_match = match; p->items = eina_list_append(p->items, it); } @@ -44,7 +44,7 @@ Eina_List *l, *ll; E_Configure_Cat *ecat; E_Configure_It *eci; - int fuzz; + int match; _cleanup(p); @@ -57,10 +57,10 @@ { if (eci->pri >= 0) { - if (fuzz = evry_fuzzy_match(eci->label, input)) - _item_add(p, eci, fuzz, 0); - else if (fuzz = evry_fuzzy_match(ecat->label, input)) - _item_add(p, eci, fuzz, 1); + if (match = evry_fuzzy_match(eci->label, input)) + _item_add(p, eci, match, 0); + else if (match = evry_fuzzy_match(ecat->label, input)) + _item_add(p, eci, match, 1); } } } Modified: trunk/e/src/modules/everything/evry_plug_dir_browse.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-08-14 17:48:49 UTC (rev 41773) +++ trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-08-14 18:55:35 UTC (rev 41774) @@ -320,9 +320,9 @@ { if (input) { - int fuzz; - if ((fuzz = evry_fuzzy_match(it->label, input))) - it->priority = fuzz; + int match; + if ((match = evry_fuzzy_match(it->label, input))) + it->priority = match; else it = NULL; } |
From: Enlightenment S. <no-...@en...> - 2009-08-14 23:31:10
|
Log: 'everything' module: - fix action selector update when no subject item exists - better weights from fuzzy matching - apps: combine launch time with fuzy weight for sorting - aggregator: eruse priority from plugins for sorting Author: jeffdameth Date: 2009-08-14 16:30:54 -0700 (Fri, 14 Aug 2009) New Revision: 41779 Modified: trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry_plug_apps.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-14 21:03:09 UTC (rev 41778) +++ trunk/e/src/modules/everything/evry.c 2009-08-14 23:30:54 UTC (rev 41779) @@ -10,7 +10,7 @@ */ #define INPUTLEN 40 #define MATCH_LAG 0.33 -#define MAX_FUZZ 200 +#define MAX_FUZZ 150 typedef struct _Evry_State Evry_State; @@ -456,13 +456,13 @@ evry_fuzzy_match(const char *str, const char *match) { const char *p, *m; - char mc; + char mc, pc; unsigned int cnt = 1; unsigned int pos = 0; unsigned int last = 0; unsigned char first; - unsigned int spaces = 0; - + unsigned int min = 0; + if (!match || !str) return 0; for (m = match; *m != 0; m++) @@ -472,9 +472,35 @@ for (p = str; *p != 0 && *m != 0; p++) { - if (tolower(*p) == mc) + pc = tolower(*p); + + /* new word of string begins */ + if ((cnt > 1) && (isspace(pc)) && (!isspace(mc))) { - cnt += pos + (pos - last) * 10; + /* remember count */ + if (!min) + min = cnt; + else if (cnt < min) + min = cnt; + + p++; + + /* search match in next word */ + if (*p != 0) + { + cnt = pos; + last = pos; + first = 0; + m = match; + mc = tolower(*m); + pc = tolower(*p); + } + else break; + } + + if (pc == mc) + { + cnt += pos + (pos - last) * 20; last = pos; m++; mc = tolower(*m); @@ -491,7 +517,7 @@ break; } - /* search next word */ + /* search next word of match */ if (isspace(mc)) { pos = last = 0; @@ -502,6 +528,9 @@ else break; } + if (min && min < cnt) + cnt = min; + if (*m == 0) return cnt; else @@ -826,23 +855,28 @@ _evry_selector_update(Evry_Selector *sel) { Evry_State *s = sel->state; - Evry_Item *it = s->sel_item; + Evry_Item *it = NULL; - if (!s->plugin && it) - _evry_list_item_desel(s, NULL); - else if (it && !eina_list_data_find_list(s->plugin->items, it)) - _evry_list_item_desel(s, NULL); + if (s) + { + it = s->sel_item; - it = s->sel_item; + if (!s->plugin && it) + _evry_list_item_desel(s, NULL); + else if (it && !eina_list_data_find_list(s->plugin->items, it)) + _evry_list_item_desel(s, NULL); - if (s->plugin && (!it || s->item_auto_selected)) - { - /* get first item */ - if (s->plugin->items) + it = s->sel_item; + + if (s->plugin && (!it || s->item_auto_selected)) { - it = s->plugin->items->data; - s->item_auto_selected = EINA_TRUE; - _evry_list_item_sel(s, it); + /* get first item */ + if (s->plugin->items) + { + it = s->plugin->items->data; + s->item_auto_selected = EINA_TRUE; + _evry_list_item_sel(s, it); + } } } @@ -869,8 +903,8 @@ if (sel == selectors[0]) { - if (_evry_selector_actions_get(it)) - _evry_selector_update(selectors[1]); + _evry_selector_actions_get(it); + _evry_selector_update(selectors[1]); } } @@ -1996,6 +2030,10 @@ const Evry_Item *it1 = data1; const Evry_Item *it2 = data2; + if ((it1->plugin == it2->plugin) && + (it1->priority - it2->priority)) + return (it1->priority - it2->priority); + if (it1->fuzzy_match && !it2->fuzzy_match) return -1; @@ -2218,6 +2256,7 @@ if (!items || !eina_list_data_find_list(items, ll->data)) { it = ll->data; + _evry_item_ref(it); it->fuzzy_match = 0; p->items = eina_list_append(p->items, it); Modified: trunk/e/src/modules/everything/evry_plug_apps.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_apps.c 2009-08-14 21:03:09 UTC (rev 41778) +++ trunk/e/src/modules/everything/evry_plug_apps.c 2009-08-14 23:30:54 UTC (rev 41779) @@ -207,7 +207,7 @@ Evry_App *app1, *app2; const char *e1, *e2; double t1, t2; - + app1 = it1->data[0]; app2 = it2->data[0]; @@ -224,19 +224,21 @@ t1 = e_exehist_newest_run_get(e1); t2 = e_exehist_newest_run_get(e2); - if ((int)(t2 - t1)) - return (int)(t2 - t1); - if (it1->fuzzy_match && !it2->fuzzy_match) return -1; if (!it1->fuzzy_match && it2->fuzzy_match) return 1; + t1 = t1 / (double)it1->fuzzy_match; + t2 = t2 / (double)it2->fuzzy_match; + + if ((int)(t2 - t1)) + return (int)(t2 - t1); + if (it1->fuzzy_match - it2->fuzzy_match) return (it1->fuzzy_match - it2->fuzzy_match); - // TODO compare exe strings? else return 0; } @@ -364,7 +366,7 @@ if (p->items) { - int prio; + int prio = 0; p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort); EINA_LIST_FOREACH(p->items, l, it) it->priority = prio++; @@ -402,7 +404,7 @@ if (app->file && strlen(app->file) > 0) return 1; - + return 0; } @@ -487,7 +489,7 @@ app->desktop = bd->desktop; it->data[0] = app; - + return _app_action(it, it2); } |
From: Enlightenment S. <no-...@en...> - 2009-08-14 23:51:07
|
Log: 'everything' module: small fix for fuzzy match Author: jeffdameth Date: 2009-08-14 16:50:48 -0700 (Fri, 14 Aug 2009) New Revision: 41780 Modified: trunk/e/src/modules/everything/evry.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-14 23:30:54 UTC (rev 41779) +++ trunk/e/src/modules/everything/evry.c 2009-08-14 23:50:48 UTC (rev 41780) @@ -462,10 +462,14 @@ unsigned int last = 0; unsigned char first; unsigned int min = 0; + unsigned int spaces = 1; if (!match || !str) return 0; for (m = match; *m != 0; m++) + if (isspace(*m)) spaces++; + + for (m = match; *m != 0, spaces > 0; m++, spaces--) { mc = tolower(*m); first = 0; @@ -475,7 +479,7 @@ pc = tolower(*p); /* new word of string begins */ - if ((cnt > 1) && (isspace(pc)) && (!isspace(mc))) + if ((cnt > 1) && (isspace(pc)) && (!pc != mc)) { /* remember count */ if (!min) |
From: Enlightenment S. <no-...@en...> - 2009-08-15 00:36:38
|
Log: whitespaces-- Author: jeffdameth Date: 2009-08-14 17:36:24 -0700 (Fri, 14 Aug 2009) New Revision: 41783 Modified: trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/evry_plug_tracker.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-15 00:31:22 UTC (rev 41782) +++ trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-15 00:36:24 UTC (rev 41783) @@ -148,7 +148,7 @@ Eina_List *items = NULL; Evry_Plugin *p = data; Inst *inst = p->private; - + if (inst->active) inst->active--; if (dbus_error_is_set(error)) @@ -193,14 +193,14 @@ if (p->items) eina_list_free(p->items); p->items = NULL; - + if (items) { Eina_List *l; EINA_LIST_FREE(inst->items, it) evry_item_free(it); - + items = eina_list_sort(items, eina_list_count(items), _cb_sort); inst->items = items; @@ -218,7 +218,7 @@ (strlen(inst->input) > strlen(inst->matched))) { Eina_List *l; - + EINA_LIST_FOREACH(inst->items, l, it) if (evry_fuzzy_match(it->label, (inst->input + strlen(inst->matched)))) p->items = eina_list_append(p->items, it); @@ -290,7 +290,7 @@ _cleanup(p); return 0; } - + inst->active++; msg = dbus_message_new_method_call("org.freedesktop.Tracker", |
From: Enlightenment S. <no-...@en...> - 2009-08-15 00:49:11
|
Log: 'everything' module: tracker: when no candidates can be fetched clear list directly Author: jeffdameth Date: 2009-08-14 17:31:22 -0700 (Fri, 14 Aug 2009) New Revision: 41782 Modified: trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/evry_plug_tracker.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-15 00:03:40 UTC (rev 41781) +++ trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-15 00:31:22 UTC (rev 41782) @@ -123,6 +123,8 @@ EINA_LIST_FREE(inst->items, it) evry_item_free(it); + if (p->items) + eina_list_free(p->items); p->items = NULL; } @@ -146,7 +148,7 @@ Eina_List *items = NULL; Evry_Plugin *p = data; Inst *inst = p->private; - + if (inst->active) inst->active--; if (dbus_error_is_set(error)) @@ -188,15 +190,23 @@ } } + if (p->items) + eina_list_free(p->items); + p->items = NULL; + if (items) { + Eina_List *l; + EINA_LIST_FREE(inst->items, it) evry_item_free(it); - + items = eina_list_sort(items, eina_list_count(items), _cb_sort); inst->items = items; - p->items = items; + EINA_LIST_FOREACH(inst->items, l, it) + p->items = eina_list_append(p->items, it); + if (inst->matched) eina_stringshare_del(inst->matched); if (inst->input) @@ -204,29 +214,14 @@ else inst->matched = NULL; } - else if (inst->items && inst->input && strlen(inst->input) > 0) + else if (inst->items && inst->input && inst->matched && + (strlen(inst->input) > strlen(inst->matched))) { - int len_matched = (inst->matched ? strlen(inst->matched) : 0); - int len_input = strlen(inst->input); Eina_List *l; - - if (len_input > len_matched) - { - p->items = NULL; - - EINA_LIST_FOREACH(inst->items, l, it) - if (evry_fuzzy_match(it->label, (inst->input + len_matched))) - p->items = eina_list_append(p->items, it); - - if (inst->matched) - eina_stringshare_del(inst->matched); - if (inst->input) - inst->matched = eina_stringshare_add(inst->input); - else - inst->matched = NULL; - } - else - p->items = inst->items; + + EINA_LIST_FOREACH(inst->items, l, it) + if (evry_fuzzy_match(it->label, (inst->input + strlen(inst->matched)))) + p->items = eina_list_append(p->items, it); } else { @@ -240,8 +235,6 @@ if (inst->matched) eina_stringshare_del(inst->matched); inst->matched = NULL; - - p->items = NULL; } evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD); @@ -283,8 +276,8 @@ if (input && (strlen(input) > 2)) { inst->input = eina_stringshare_add(input); - search_text = malloc(sizeof(char) * strlen(input) + 3); - sprintf(search_text, "*%s*", input); + search_text = malloc(sizeof(char) * strlen(input) + 1); + sprintf(search_text, "%s", input); max_hits = 50; } else if (!input && !p->begin && p->type == type_object) @@ -292,8 +285,12 @@ sort_by_access = 1; search_text = ""; } - else return 0; - + else + { + _cleanup(p); + return 0; + } + inst->active++; msg = dbus_message_new_method_call("org.freedesktop.Tracker", |
From: Enlightenment S. <no-...@en...> - 2009-08-15 18:09:24
|
Log: 'everything' module: rewrote evry_fuzzy_match Author: jeffdameth Date: 2009-08-15 11:09:13 -0700 (Sat, 15 Aug 2009) New Revision: 41790 Modified: trunk/e/src/modules/everything/evry.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-15 11:54:35 UTC (rev 41789) +++ trunk/e/src/modules/everything/evry.c 2009-08-15 18:09:13 UTC (rev 41790) @@ -457,92 +457,143 @@ int evry_fuzzy_match(const char *str, const char *match) { - const char *p, *m; + const char *p, *m, *next; char mc, pc; - unsigned int cnt = 1; - unsigned int pos = 0; + int sum = 0; + unsigned int last = 0; - unsigned char first; + unsigned int offset = 0; unsigned int min = 0; - unsigned int spaces = 1; + unsigned char first = 0; + /* words in match */ + unsigned int words = 1; + unsigned int word = 0; + unsigned int word_min[64]; + if (!match || !str) return 0; - for (m = match; *m != 0; m++) - if (isspace(*m)) spaces++; - - for (m = match; *m != 0, spaces > 0; m++, spaces--) + if ((match[0] == 0) || + (match[1] == 0)) return 0; + + word_min[0] = MAX_FUZZ; + + for (m = match; *m != 0 && *(m+1) != 0; m++) { + if (isspace(*m) && !isspace(*(m+1))) + { + word_min[words] = MAX_FUZZ; + words++; + } + } + + p = next = str; + m = match; + + for (word = 0; word < words && p && *p != 0;) + { + /* reset match */ + if (word == 0) m = match; + + /* end of matching */ + if (*m == 0) break; + mc = tolower(*m); + + offset = 0; + last = 0; + min = 1; first = 0; - for (p = str; *p != 0 && *m != 0; p++) + /* match current word of string against current match */ + for (p = next; *p != 0; p++) { pc = tolower(*p); - /* new word of string begins */ - if ((cnt > 1) && (isspace(pc)) && (!pc != mc)) + if (isspace(pc)) { - /* remember count */ - if (!min) - min = cnt; - else if (cnt < min) - min = cnt; - - p++; - - /* search match in next word */ - if (*p != 0) + if (word < words - 1) { - cnt = pos; - last = pos; - first = 0; - m = match; - mc = tolower(*m); - pc = tolower(*p); + /* test next match */ + for (; (*m != 0) && !isspace(*m); m++); + for (; (*m != 0) && isspace(*m); m++); + word++; + break; } - else break; + else + { + /* go to next word */ + for (; (*p != 0) && isspace(*p); p++); + next = p; + word = 0; + break; + } } - if (pc == mc) + /* current char matches? */ + if (pc != mc) { - cnt += pos + (pos - last) * 20; - last = pos; - m++; - mc = tolower(*m); - first = 1; + offset++; + continue; } - else pos++; + /* first offset of match in word */ if (!first) - last = pos; + { + last = offset; + first = 1; + } - if (cnt > MAX_FUZZ) return 0; + min += offset + (offset - last) * 10; + last = offset; - if (isspace(mc) && !strchr(p, ' ')) - break; + /* try next char of match */ + m++; + if (*m != 0 && !isspace(*m)) + { + mc = tolower(*m); + continue; + } + + /* end of match store min weight of match */ + if (min < word_min[word]) + word_min[word] = min; + + if (word < words - 1) + { + /* test next match */ + for (; (*m != 0) && isspace(*m); m++); + word++; + break; + } + else + { + /* go to next word */ + for (; (*p != 0) && !isspace(*p); p++); + for (; (*p != 0) && isspace(*p); p++); + next = p; + word = 0; + break; + } } + } - /* search next word of match */ - if (isspace(mc)) + for (word = 0; word < words; word++) + { + if (word_min[word] >= MAX_FUZZ) { - pos = last = 0; - /* add some weight */ - cnt += pos; - + sum = 0; + break; } - else break; + sum += word_min[word]; } + /* if (sum) + * printf("min %d >> %s - %s\n", sum, match, str); */ - if (min && min < cnt) - cnt = min; - - if (*m == 0) - return cnt; - else - return 0; + return sum; } + /* local subsystem functions */ static Evry_List_Window * |
From: Enlightenment S. <no-...@en...> - 2009-08-15 18:18:41
|
Log: 'everything' module: fuzzy_match: remove white spaces at the beginning Author: jeffdameth Date: 2009-08-15 11:18:27 -0700 (Sat, 15 Aug 2009) New Revision: 41791 Modified: trunk/e/src/modules/everything/evry.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-15 18:09:13 UTC (rev 41790) +++ trunk/e/src/modules/everything/evry.c 2009-08-15 18:18:27 UTC (rev 41791) @@ -473,11 +473,12 @@ if (!match || !str) return 0; - if ((match[0] == 0) || - (match[1] == 0)) return 0; - word_min[0] = MAX_FUZZ; + /* remove white spaces at the beginning */ + for (; (*match != 0) && isspace(*match); match++); + for (; (*str != 0) && isspace(*str); str++); + for (m = match; *m != 0 && *(m+1) != 0; m++) { if (isspace(*m) && !isspace(*(m+1))) @@ -490,7 +491,7 @@ p = next = str; m = match; - for (word = 0; word < words && p && *p != 0;) + for (word = 0; word < words && *p != 0;) { /* reset match */ if (word == 0) m = match; @@ -555,7 +556,7 @@ continue; } - /* end of match store min weight of match */ + /* end of match: store min weight of match */ if (min < word_min[word]) word_min[word] = min; |
From: Enlightenment S. <no-...@en...> - 2009-08-15 20:12:18
|
Log: 'everything' module: - fuzz<_match fix: match last word of 'string' with every word in 'match' - dont fetch new items when only space was added - apps: cleanup Author: jeffdameth Date: 2009-08-15 13:12:04 -0700 (Sat, 15 Aug 2009) New Revision: 41794 Modified: trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry_plug_apps.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-15 18:24:58 UTC (rev 41793) +++ trunk/e/src/modules/everything/evry.c 2009-08-15 20:12:04 UTC (rev 41794) @@ -97,7 +97,7 @@ static void _evry_matches_update(Evry_Selector *sel); static void _evry_plugin_action(Evry_Selector *sel, int finished); static void _evry_backspace(Evry_State *s); -static void _evry_update(Evry_State *s); +static void _evry_update(Evry_State *s, int fetch); static void _evry_clear(Evry_State *s); static int _evry_update_timer(void *data); static Evry_State *_evry_state_new(Evry_Selector *sel, Eina_List *plugins); @@ -473,25 +473,25 @@ if (!match || !str) return 0; - word_min[0] = MAX_FUZZ; - /* remove white spaces at the beginning */ for (; (*match != 0) && isspace(*match); match++); for (; (*str != 0) && isspace(*str); str++); - + + /* count words in match */ + word_min[0] = MAX_FUZZ; for (m = match; *m != 0 && *(m+1) != 0; m++) { - if (isspace(*m) && !isspace(*(m+1))) - { - word_min[words] = MAX_FUZZ; - words++; - } + if (isspace(*m) && !isspace(*(m+1))) + { + word_min[words] = MAX_FUZZ; + words++; + } } - p = next = str; + next = str; m = match; - for (word = 0; word < words && *p != 0;) + for (word = 0; word < words && *next != 0; ) { /* reset match */ if (word == 0) m = match; @@ -500,18 +500,16 @@ if (*m == 0) break; mc = tolower(*m); - offset = 0; last = 0; min = 1; first = 0; /* match current word of string against current match */ - for (p = next; *p != 0; p++) + for (p = next; *next != 0; p++) { - pc = tolower(*p); /* new word of string begins */ - if (isspace(pc)) + if (*p == 0 || isspace(*p)) { if (word < words - 1) { @@ -531,6 +529,8 @@ } } + pc = tolower(*p); + /* current char matches? */ if (pc != mc) { @@ -567,7 +567,7 @@ word++; break; } - else + else if(*p != 0) { /* go to next word */ for (; (*p != 0) && !isspace(*p); p++); @@ -576,6 +576,11 @@ word = 0; break; } + else + { + next = p; + break; + } } } @@ -1301,7 +1306,10 @@ if (strlen(s->input) < (INPUTLEN - strlen(ev->compose))) { strcat(s->input, ev->compose); - _evry_update(s); + if (isspace(*ev->compose)) + _evry_update(s, 0); + else + _evry_update(s, 1); } } return 1; @@ -1319,7 +1327,7 @@ if ((pos < len) && (pos >= 0)) { s->input[pos] = 0; - _evry_update(s); + _evry_update(s, 1); } } } @@ -1338,12 +1346,15 @@ } static void -_evry_update(Evry_State *s) +_evry_update(Evry_State *s, int fetch) { _evry_update_text_label(s); - if (update_timer) ecore_timer_del(update_timer); - update_timer = ecore_timer_add(MATCH_LAG, _evry_update_timer, s); + if (fetch) + { + if (update_timer) ecore_timer_del(update_timer); + update_timer = ecore_timer_add(MATCH_LAG, _evry_update_timer, s); + } } static int @@ -1367,12 +1378,12 @@ (!strncmp(s->plugin->trigger, s->input, strlen(s->plugin->trigger)))) { s->input[strlen(s->plugin->trigger)] = 0; - _evry_update(s); + _evry_update(s, 1); } else if (s->input[0] != 0) { s->input[0] = 0; - _evry_update(s); + _evry_update(s, 1); edje_object_signal_emit(list->o_main, "e,state,entry_hide", "e"); } } @@ -2486,7 +2497,7 @@ text_data = ev->data; strncat(s->input, text_data->text, (INPUTLEN - strlen(s->input)) - 1); - _evry_update(s); + _evry_update(s, 1); } } Modified: trunk/e/src/modules/everything/evry_plug_apps.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_apps.c 2009-08-15 18:24:58 UTC (rev 41793) +++ trunk/e/src/modules/everything/evry_plug_apps.c 2009-08-15 20:12:04 UTC (rev 41794) @@ -248,8 +248,6 @@ Eina_List *l; Efreet_Desktop *desktop; char *file; - char match1[4096]; - char match2[4096]; Evry_Item *it; Evry_App *app; Inst *inst = p->private; @@ -312,24 +310,26 @@ if (input || p == p2) { int found = 0; - char *path; char *end; - + char *dir; + char cmd[1024]; + char path[1024]; + if (input) { - snprintf(match2, 4096, "%s", input); + snprintf(cmd, sizeof(cmd), "%s", input); if (end = strchr(input, ' ')) { - int len = (end - input) - 1; + int len = (end - input) + 1; if (len >= 0) - snprintf(match2, len, "%s", input); + snprintf(cmd, len, "%s", input); } - EINA_LIST_FOREACH(exe_path, l, path) + EINA_LIST_FOREACH(exe_path, l, dir) { - snprintf(match1, 4096, "%s/%s", path, match2); - if (ecore_file_exists(match1)) + snprintf(path, sizeof(path), "%s/%s", dir, cmd); + if (ecore_file_exists(path)) { found = 1; break; @@ -346,18 +346,18 @@ else app->file = eina_stringshare_add(""); it->data[0] = app; - it->priority = 99; + it->priority = 9999; p->items = eina_list_append(p->items, it); - snprintf(match1, 4096, "xterm -hold -e %s", input); + snprintf(cmd, sizeof(cmd), "xterm -hold -e %s", input); it = evry_item_new(p, _("Run in Terminal"), &_item_free); app = E_NEW(Evry_App, 1); if (input) - app->file = eina_stringshare_add(match1); + app->file = eina_stringshare_add(cmd); else app->file = eina_stringshare_add(""); it->data[0] = app; - it->priority = 100; + it->priority = 1000; p->items = eina_list_append(p->items, it); } } |
From: Enlightenment S. <no-...@en...> - 2009-08-16 00:42:32
|
Log: 'everything' module: cleanups Author: jeffdameth Date: 2009-08-15 17:13:56 -0700 (Sat, 15 Aug 2009) New Revision: 41796 Modified: trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry_plug_apps.c trunk/e/src/modules/everything/evry_plug_calc.c trunk/e/src/modules/everything/evry_plug_clipboard.c trunk/e/src/modules/everything/evry_plug_config.c trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-15 23:53:23 UTC (rev 41795) +++ trunk/e/src/modules/everything/evry.c 2009-08-16 00:13:56 UTC (rev 41796) @@ -153,7 +153,6 @@ static Evry_Plugin *_evry_plug_aggregator_new(void); static void _evry_plug_aggregator_free(Evry_Plugin *p); -static int _evry_plug_aggregator_begin(Evry_Plugin *p, const Evry_Item *it); static int _evry_plug_aggregator_fetch(Evry_Plugin *p, const char *input); static int _evry_plug_aggregator_action(Evry_Plugin *p, const Evry_Item *item, const char *input); static void _evry_plug_aggregator_cleanup(Evry_Plugin *p); @@ -483,8 +482,7 @@ { if (isspace(*m) && !isspace(*(m+1))) { - word_min[words] = MAX_FUZZ; - words++; + word_min[words++] = MAX_FUZZ; } } @@ -541,6 +539,7 @@ /* first offset of match in word */ if (!first) { + offset *= 10; last = offset; first = 1; } @@ -808,7 +807,6 @@ static void _evry_selector_free(Evry_Selector *sel) { - Evry_State *s; Evry_Plugin *p; if (sel->o_icon) @@ -838,7 +836,6 @@ { if (selector) { - Evry_State *s = selector->state; Evry_Plugin *p; Eina_List *l; @@ -1360,7 +1357,6 @@ static int _evry_update_timer(void *data) { - Evry_State *s = data; /* XXX pass selector as data? */ _evry_matches_update(selector); _evry_selector_update(selector); @@ -1611,7 +1607,7 @@ Evry_State *s = sel->state; Evry_Plugin *p; Eina_List *l; - Eina_Bool has_items; + Eina_Bool has_items = EINA_FALSE; EINA_LIST_FREE(s->cur_plugins, p); @@ -1672,7 +1668,7 @@ static void _evry_list_scroll_to(Evry_State *s, Evry_Item *it) { - int n, h, mh, i = 0, max_w, max_h; + int n, h, mh, i = 0; Eina_List *l; if (!it) return; @@ -1870,9 +1866,6 @@ static void _evry_list_item_first(Evry_State *s) { - Eina_List *l; - Evry_Item *it; - if (!s->plugin || !s->plugin->items) return; s->plugin_auto_selected = EINA_FALSE; @@ -1885,9 +1878,6 @@ static void _evry_list_item_last(Evry_State *s) { - Eina_List *l; - Evry_Item *it; - if (!s->plugin || !s->plugin->items) return; s->plugin_auto_selected = EINA_FALSE; @@ -2266,7 +2256,7 @@ static Evas_Object * _evry_plug_actions_item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e) { - Evas_Object *o; + Evas_Object *o = NULL; Evry_Action *act = it->data[0]; if (!act) return NULL; Modified: trunk/e/src/modules/everything/evry_plug_apps.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_apps.c 2009-08-15 23:53:23 UTC (rev 41795) +++ trunk/e/src/modules/everything/evry_plug_apps.c 2009-08-16 00:13:56 UTC (rev 41796) @@ -28,7 +28,6 @@ if (it) { - Eina_List *l; Efreet_Desktop *desktop; if (!it->uri) return 0; @@ -182,7 +181,7 @@ { Efreet_Desktop *desktop; Eina_List *l; - int m1, m2, min; + int m1, m2; EINA_LIST_FOREACH(apps, l, desktop) { @@ -319,7 +318,7 @@ { snprintf(cmd, sizeof(cmd), "%s", input); - if (end = strchr(input, ' ')) + if ((end = strchr(input, ' '))) { int len = (end - input) + 1; if (len >= 0) @@ -430,7 +429,6 @@ { E_Zone *zone; Evry_App *app = NULL; - Efreet_Desktop *desktop = NULL; Eina_List *files = NULL; char *exe = NULL; @@ -499,6 +497,8 @@ Inst *inst = p->private; if (inst->candidate) return _app_action(it, inst->candidate); + + return 0; } static int Modified: trunk/e/src/modules/everything/evry_plug_calc.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_calc.c 2009-08-15 23:53:23 UTC (rev 41795) +++ trunk/e/src/modules/everything/evry_plug_calc.c 2009-08-16 00:13:56 UTC (rev 41796) @@ -1,7 +1,6 @@ #include "Evry.h" -static void _item_add(Evry_Plugin *p, char *output, int prio); static int _cb_data(void *data, int type, void *event); static int _cb_error(void *data, int type, void *event); static int _cb_del(void *data, int type, void *event); @@ -141,7 +140,6 @@ _cb_data(void *data, int type __UNUSED__, void *event) { Ecore_Exe_Event_Data *ev = event; - Ecore_Exe_Event_Data_Line *l; Evry_Plugin *p = data; Evry_Item *it; @@ -211,7 +209,6 @@ static void _shutdown(void) { - Evry_Item *it; char *result; EINA_LIST_FREE(history, result) Modified: trunk/e/src/modules/everything/evry_plug_clipboard.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_clipboard.c 2009-08-15 23:53:23 UTC (rev 41795) +++ trunk/e/src/modules/everything/evry_plug_clipboard.c 2009-08-16 00:13:56 UTC (rev 41796) @@ -9,6 +9,8 @@ { ecore_x_selection_primary_set(clipboard_win, it->label, strlen(it->label)); ecore_x_selection_clipboard_set(clipboard_win, it->label, strlen(it->label)); + + return 1; } static int Modified: trunk/e/src/modules/everything/evry_plug_config.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_config.c 2009-08-15 23:53:23 UTC (rev 41795) +++ trunk/e/src/modules/everything/evry_plug_config.c 2009-08-16 00:13:56 UTC (rev 41796) @@ -57,9 +57,9 @@ { if (eci->pri >= 0) { - if (match = evry_fuzzy_match(eci->label, input)) + if ((match = evry_fuzzy_match(eci->label, input))) _item_add(p, eci, match, 0); - else if (match = evry_fuzzy_match(ecat->label, input)) + else if ((match = evry_fuzzy_match(ecat->label, input))) _item_add(p, eci, match, 1); } } Modified: trunk/e/src/modules/everything/evry_plug_tracker.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-15 23:53:23 UTC (rev 41795) +++ trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-16 00:13:56 UTC (rev 41796) @@ -29,7 +29,6 @@ if (!strcmp(it->plugin->type_out, "APPLICATION")) { - Efreet_Desktop *desktop; Eina_List *l; const char *mime; Evry_App *app = it->data[0]; |