forked from enlightenment/enlightenment
'everything' apps shift/ctrl+tab insert appname + space now
SVN revision: 48022
This commit is contained in:
parent
aa81c1f503
commit
d0fbe9424e
|
@ -664,6 +664,30 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
_complete(Evry_Plugin *plugin, const Evry_Item *it, char **input)
|
||||||
|
{
|
||||||
|
ITEM_APP(app, it);
|
||||||
|
|
||||||
|
char buf[128];
|
||||||
|
|
||||||
|
if (app->desktop)
|
||||||
|
{
|
||||||
|
char *space = strchr(app->desktop->exec, ' ');
|
||||||
|
|
||||||
|
snprintf(buf, sizeof(buf), "%s ", app->desktop->exec);
|
||||||
|
if (space)
|
||||||
|
buf[1 + space - app->desktop->exec] = '\0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
snprintf(buf, sizeof(buf), "%s ", app->file);
|
||||||
|
|
||||||
|
*input = strdup(buf);
|
||||||
|
|
||||||
|
return EVRY_COMPLETE_INPUT;
|
||||||
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e)
|
_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e)
|
||||||
{
|
{
|
||||||
|
@ -887,6 +911,7 @@ module_init(void)
|
||||||
p1 = E_NEW(Plugin, 1);
|
p1 = E_NEW(Plugin, 1);
|
||||||
evry_plugin_new(EVRY_PLUGIN(p1), "Applications", type_subject, "", "APPLICATION", 0, NULL, NULL,
|
evry_plugin_new(EVRY_PLUGIN(p1), "Applications", type_subject, "", "APPLICATION", 0, NULL, NULL,
|
||||||
_begin, _cleanup, _fetch, NULL, _icon_get, _free_plugin);
|
_begin, _cleanup, _fetch, NULL, _icon_get, _free_plugin);
|
||||||
|
EVRY_PLUGIN(p1)->complete = &_complete;
|
||||||
|
|
||||||
p2 = E_NEW(Plugin, 1);
|
p2 = E_NEW(Plugin, 1);
|
||||||
evry_plugin_new(EVRY_PLUGIN(p2), "Open With...", type_action, "FILE", "", 0, NULL, NULL,
|
evry_plugin_new(EVRY_PLUGIN(p2), "Open With...", type_action, "FILE", "", 0, NULL, NULL,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "e.h"
|
#include "e.h"
|
||||||
|
|
||||||
#define EVRY_API_VERSION 1
|
#define EVRY_API_VERSION 2
|
||||||
|
|
||||||
|
|
||||||
#define EVRY_ACTION_OTHER 0
|
#define EVRY_ACTION_OTHER 0
|
||||||
|
@ -14,6 +14,10 @@
|
||||||
#define EVRY_ASYNC_UPDATE_CLEAR 1
|
#define EVRY_ASYNC_UPDATE_CLEAR 1
|
||||||
#define EVRY_ASYNC_UPDATE_REFRESH 2
|
#define EVRY_ASYNC_UPDATE_REFRESH 2
|
||||||
|
|
||||||
|
#define EVRY_COMPLETE_NONE 0
|
||||||
|
#define EVRY_COMPLETE_INPUT 1
|
||||||
|
#define EVRY_COMPLETE_BROWSE 2
|
||||||
|
|
||||||
#define VIEW_MODE_LIST 0
|
#define VIEW_MODE_LIST 0
|
||||||
#define VIEW_MODE_DETAIL 1
|
#define VIEW_MODE_DETAIL 1
|
||||||
#define VIEW_MODE_THUMB 2
|
#define VIEW_MODE_THUMB 2
|
||||||
|
@ -184,7 +188,10 @@ struct _Evry_Plugin
|
||||||
/* only used when plugin is of type_action */
|
/* only used when plugin is of type_action */
|
||||||
int (*action) (Evry_Plugin *p, const Evry_Item *item);
|
int (*action) (Evry_Plugin *p, const Evry_Item *item);
|
||||||
|
|
||||||
/* int (*complete) (Evry_Plugin *p, const Evry_Item *item, char *input); */
|
/* try to complete current item:
|
||||||
|
return: EVRY_COMPLETE_INPUT when input was changed
|
||||||
|
return: EVRY_COMPLETE_BROWSE to browse item */
|
||||||
|
int (*complete) (Evry_Plugin *p, const Evry_Item *item, char **input);
|
||||||
|
|
||||||
/* handle key events: return 1 when key is handled by plugin */
|
/* handle key events: return 1 when key is handled by plugin */
|
||||||
int (*cb_key_down) (Evry_Plugin *p, const Ecore_Event_Key *ev);
|
int (*cb_key_down) (Evry_Plugin *p, const Ecore_Event_Key *ev);
|
||||||
|
|
|
@ -1373,11 +1373,28 @@ _evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||||
(ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)) &&
|
(ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)) &&
|
||||||
(!strcmp(key, "Tab")))))
|
(!strcmp(key, "Tab")))))
|
||||||
{
|
{
|
||||||
/* int action = 0;
|
int action = 0;
|
||||||
* if (s->plugin->complete)
|
char *input = NULL;
|
||||||
* action = s->plugin->complete(s->plugin, s->cur_item, &s->input); */
|
Evry_Item *it = s->cur_item;
|
||||||
|
|
||||||
|
evry_item_ref(it);
|
||||||
|
|
||||||
|
if (it->plugin->complete)
|
||||||
|
action = it->plugin->complete(it->plugin, it, &input);
|
||||||
|
else
|
||||||
evry_browse_item(selector);
|
evry_browse_item(selector);
|
||||||
|
|
||||||
|
if (action == EVRY_COMPLETE_INPUT)
|
||||||
|
{
|
||||||
|
snprintf(s->input, INPUTLEN, "%s", input);
|
||||||
|
_evry_update_text_label(s);
|
||||||
|
_evry_cb_update_timer(selector);
|
||||||
|
evry_item_select(s, it);
|
||||||
|
}
|
||||||
|
|
||||||
|
E_FREE(input);
|
||||||
|
|
||||||
|
evry_item_free(it);
|
||||||
}
|
}
|
||||||
else if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) &&
|
else if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) &&
|
||||||
(!strcmp(key, "Delete") || !strcmp(key, "Insert")))
|
(!strcmp(key, "Delete") || !strcmp(key, "Insert")))
|
||||||
|
|
|
@ -50,6 +50,11 @@ _cb_sort(const void *data1, const void *data2)
|
||||||
const Evry_Item *it1 = data1;
|
const Evry_Item *it1 = data1;
|
||||||
const Evry_Item *it2 = data2;
|
const Evry_Item *it2 = data2;
|
||||||
|
|
||||||
|
if (it1->selected)
|
||||||
|
return -1;
|
||||||
|
if (it2->selected)
|
||||||
|
return 1;
|
||||||
|
|
||||||
if (it1->usage && it2->usage)
|
if (it1->usage && it2->usage)
|
||||||
return (it1->usage > it2->usage ? -1 : 1);
|
return (it1->usage > it2->usage ? -1 : 1);
|
||||||
if (it1->usage && !it2->usage)
|
if (it1->usage && !it2->usage)
|
||||||
|
|
|
@ -194,6 +194,13 @@ evry_fuzzy_match(const char *str, const char *match)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sum > 0)
|
||||||
|
{
|
||||||
|
/* exact match ? */
|
||||||
|
if (strlen(str) != m_len)
|
||||||
|
sum += 10;
|
||||||
|
}
|
||||||
|
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue