From: Enlightenment S. <no-...@en...> - 2009-08-16 08:37:11
|
Log: 'everything' module: - added 'send to current desk' border action - fuzzy match cosmetic - strip off path from desktop->exec for matching. now '/' shows dir browser as first entry :) - wider list popup - open file with apps that only support x-directoy as mimetype strips off filename Author: jeffdameth Date: 2009-08-16 01:36:56 -0700 (Sun, 16 Aug 2009) New Revision: 41812 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 Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-16 07:56:56 UTC (rev 41811) +++ trunk/e/src/modules/everything/evry.c 2009-08-16 08:36:56 UTC (rev 41812) @@ -183,7 +183,7 @@ evry_init(void) { _evry_plug_actions_init(); - + return 1; } @@ -192,6 +192,7 @@ { evry_hide(); _evry_plug_actions_free(); + return 1; } @@ -457,7 +458,6 @@ evry_fuzzy_match(const char *str, const char *match) { const char *p, *m, *next; - char mc, pc; int sum = 0; unsigned int last = 0; @@ -489,7 +489,7 @@ next = str; m = match; - for (word = 0; word < words && *next != 0; ) + for (word = 0; (word < words) && (*next != 0);) { /* reset match */ if (word == 0) m = match; @@ -497,7 +497,6 @@ /* end of matching */ if (*m == 0) break; - mc = tolower(*m); offset = 0; last = 0; min = 1; @@ -507,7 +506,7 @@ for (p = next; *next != 0; p++) { /* new word of string begins */ - if (*p == 0 || isspace(*p)) + if ((*p == 0) || isspace(*p)) { if (word < words - 1) { @@ -527,10 +526,8 @@ } } - pc = tolower(*p); - /* current char matches? */ - if (pc != mc) + if (tolower(*p) != tolower(*m)) { offset++; continue; @@ -548,13 +545,10 @@ last = offset; /* try next char of match */ - m++; - if (*m != 0 && !isspace(*m)) - { - mc = tolower(*m); - continue; - } + if (*(++m) != 0 && !isspace(*m)) + continue; + /* end of match: store min weight of match */ if (min < word_min[word]) word_min[word] = min; @@ -613,8 +607,8 @@ y = (zone->h / 2); /* TODO get offsets from theme */ - popup = e_popup_new(zone, x + 50, y - 4, - win->popup->w * 2/3 - 100, + popup = e_popup_new(zone, x + 30, y - 4, + win->popup->w * 2/3 - 60, evry_conf->height); if (!popup) return NULL; Modified: trunk/e/src/modules/everything/evry_plug_apps.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_apps.c 2009-08-16 07:56:56 UTC (rev 41811) +++ trunk/e/src/modules/everything/evry_plug_apps.c 2009-08-16 08:36:56 UTC (rev 41812) @@ -188,7 +188,10 @@ if (eina_list_count(p->items) > 199) continue; if (!desktop->name || !desktop->exec) continue; - m1 = evry_fuzzy_match(desktop->exec, input); + char *exec = strrchr(desktop->exec, '/'); + if (!exec++ || !exec) exec = desktop->exec; + + m1 = evry_fuzzy_match(exec, input); m2 = evry_fuzzy_match(desktop->name, input); if (!m1 || (m2 && m2 < m1)) @@ -313,7 +316,7 @@ char *dir; char cmd[1024]; char path[1024]; - + if (input) { snprintf(cmd, sizeof(cmd), "%s", input); @@ -441,15 +444,48 @@ if (app->desktop) { - if (it_file && it_file->uri) - files = eina_list_append(files, it_file->uri); + if (it_file) + { + Eina_List *l; + char *mime; + char *path = NULL; + int open_folder = 0; - e_exec(zone, app->desktop, NULL, files, "everything"); + if (!it_file->browseable) + { + EINA_LIST_FOREACH(app->desktop->mime_types, l, mime) + { + if (!strcmp(mime, "x-directory/normal")) + { + open_folder = 1; + break; + } + } + } - if (it_file && it_file->mime) - e_exehist_mime_desktop_add(it_file->mime, app->desktop); + if (open_folder) + { + path = ecore_file_dir_get(it_file->uri); + files = eina_list_append(files, path); + } + else + { + files = eina_list_append(files, it_file->uri); + } - if (files) eina_list_free(files); + e_exec(zone, app->desktop, NULL, files, NULL); + + if (it_file && it_file->mime && !open_folder) + e_exehist_mime_desktop_add(it_file->mime, app->desktop); + + if (files) + eina_list_free(files); + + if (open_folder && path) + free(path); + } + else + e_exec(zone, app->desktop, NULL, NULL, "everything"); } else if (app->file) { @@ -601,8 +637,7 @@ else { efreet_desktop_save_as(app->desktop, buf); - /*XXX hackish - desktop is removed on save_as..*/ - efreet_desktop_new(app->desktop->orig_path); + /* efreet_desktop_new(app->desktop->orig_path); */ desktop = efreet_desktop_new(buf); } @@ -657,7 +692,7 @@ act1->type_in2 = "FILE"; act1->action = &_exec_app_action; act1->check_item = &_exec_app_check_item; - act1->icon = "everything-launch"; + act1->icon = "document-open"; evry_action_register(act1); act2 = E_NEW(Evry_Action, 1); Modified: trunk/e/src/modules/everything/evry_plug_border.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border.c 2009-08-16 07:56:56 UTC (rev 41811) +++ trunk/e/src/modules/everything/evry_plug_border.c 2009-08-16 08:36:56 UTC (rev 41812) @@ -57,7 +57,7 @@ Eina_List *l; int prio = 0; int m1, m2; - + _cleanup(p); zone = e_util_zone_current_get(e_manager_current_get()); Modified: trunk/e/src/modules/everything/evry_plug_border_act.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border_act.c 2009-08-16 07:56:56 UTC (rev 41811) +++ trunk/e/src/modules/everything/evry_plug_border_act.c 2009-08-16 08:36:56 UTC (rev 41812) @@ -35,6 +35,28 @@ } static void +_act_cb_border_to_desktop(E_Border *bd) +{ + E_Zone *zone; + E_Desk *desk; + zone = e_util_zone_current_get(e_manager_current_get()); + desk = e_desk_current_get(zone); + + e_border_desk_set(bd, desk); + + if (bd->shaded) + e_border_unshade(bd, E_DIRECTION_UP); + + if (bd->iconic) + e_border_uniconify(bd); + else + e_border_raise(bd); + + /* e_border_focus_set(bd, 1, 1); */ + e_border_focus_set_with_pointer(bd); +} + +static void _act_cb_border_fullscreen(E_Border *bd) { if (!bd->fullscreen) @@ -119,21 +141,44 @@ static int _fetch(Evry_Plugin *p, const char *input) { + E_Zone *zone; + E_Desk *desk; + + zone = e_util_zone_current_get(e_manager_current_get()); + desk = e_desk_current_get(zone); + _cleanup(p); - _item_add(p, _("Switch To"), _act_cb_border_switch_to, "go-next", input); + _item_add(p, _("Switch to Window"), + _act_cb_border_switch_to, + "go-next", input); + if (desk != inst->border->desk) + _item_add(p, _("Send to Deskop"), + _act_cb_border_to_desktop, + "go-previous", input); + if (inst->border->iconic) - _item_add(p, _("Uniconify"), _act_cb_border_unminimize, "window-minimize", input); + _item_add(p, _("Uniconify"), + _act_cb_border_unminimize, + "window-minimize", input); else - _item_add(p, _("Iconify"), _act_cb_border_minimize, "window-minimize", input); + _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", input); + _item_add(p, _("Fullscreen"), + _act_cb_border_fullscreen, + "view-fullscreen", input); else - _item_add(p, _("Unfullscreen"), _act_cb_border_fullscreen, "view-restore", input); + _item_add(p, _("Unfullscreen"), + _act_cb_border_fullscreen, + "view-restore", input); - _item_add(p, _("Close"), _act_cb_border_close, "window-close", input); + _item_add(p, _("Close"), + _act_cb_border_close, + "window-close", input); if (eina_list_count(p->items) > 0) { @@ -162,9 +207,6 @@ o = e_icon_add(e); evry_icon_theme_set(o, (const char *)it->data[1]); - /* icon = edje_object_add(e); - * e_theme_edje_object_set(icon, "base/theme/borders", (const char *)it->data[1]); */ - return o; } |