forked from enlightenment/enlightenment
e17/evry: exebuf name some variables by what they do
- fix segv in config dialog. did e_widget change? i beleive e_widget_entry_add(e, &(page->trigger)) must have always set page->trigger to be not null ... just in case there are other places where this was not chacked before SVN revision: 78793
This commit is contained in:
parent
0532cb78fd
commit
ab50d227c2
|
@ -165,7 +165,7 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
||||||
|
|
||||||
if (pc)
|
if (pc)
|
||||||
{
|
{
|
||||||
if (cfdata->page[i].trigger[0])
|
if (cfdata->page[i].trigger && cfdata->page[i].trigger[0])
|
||||||
eina_stringshare_replace(&pc->trigger, cfdata->page[i].trigger);
|
eina_stringshare_replace(&pc->trigger, cfdata->page[i].trigger);
|
||||||
else
|
else
|
||||||
eina_stringshare_replace(&pc->trigger, NULL);
|
eina_stringshare_replace(&pc->trigger, NULL);
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
* #define DBG(...) ERR(__VA_ARGS__) */
|
* #define DBG(...) ERR(__VA_ARGS__) */
|
||||||
|
|
||||||
#define MAX_ITEMS 200
|
#define MAX_ITEMS 200
|
||||||
|
#define MAX_EXE 50
|
||||||
|
#define DEFAULT_MATCH_PRIORITY 15
|
||||||
|
#define PREFIX_MATCH_PRIORITY 11
|
||||||
|
|
||||||
typedef struct _Plugin Plugin;
|
typedef struct _Plugin Plugin;
|
||||||
typedef struct _Module_Config Module_Config;
|
typedef struct _Module_Config Module_Config;
|
||||||
|
@ -233,11 +236,11 @@ _fetch_exe(Evry_Plugin *plugin, const char *input)
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
Evry_Item *eit;
|
Evry_Item *eit;
|
||||||
History_Types *ht;
|
History_Types *ht;
|
||||||
unsigned int len = (input ? strlen(input) : 0);
|
unsigned int input_len = (input ? strlen(input) : 0);
|
||||||
double max = 0.0;
|
double max = 0.0;
|
||||||
const char *tmp, *file = NULL;
|
const char *tmp, *first_match = NULL;
|
||||||
unsigned int min = 0, cnt = 0, end = len, tmp_len;
|
unsigned int min = 0, cnt = 0, end = input_len;
|
||||||
unsigned int query = (len >= (unsigned int)plugin->config->min_query);
|
Eina_Bool query = (input_len >= (unsigned int)plugin->config->min_query);
|
||||||
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
||||||
|
|
||||||
p->input = input;
|
p->input = input;
|
||||||
|
@ -247,45 +250,49 @@ _fetch_exe(Evry_Plugin *plugin, const char *input)
|
||||||
|
|
||||||
if (input)
|
if (input)
|
||||||
{
|
{
|
||||||
|
const char *cmd;
|
||||||
|
|
||||||
|
// begin of arguments (end of executable part)
|
||||||
if ((tmp = strchr(input, ' ')))
|
if ((tmp = strchr(input, ' ')))
|
||||||
end = tmp - input;
|
end = tmp - input;
|
||||||
|
|
||||||
if ((!exe_list) && (!exe_scan_idler))
|
if ((!exe_list) && (!exe_scan_idler))
|
||||||
_scan_executables();
|
_scan_executables();
|
||||||
|
|
||||||
EINA_LIST_FOREACH (exe_list, l, tmp)
|
EINA_LIST_FOREACH (exe_list, l, cmd)
|
||||||
{
|
{
|
||||||
tmp_len = strlen(tmp);
|
unsigned int cmd_len = strlen(cmd);
|
||||||
|
|
||||||
if ((end < len) && (tmp_len > end))
|
if ((end < input_len) && (cmd_len > end))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!strncmp(input, tmp, end))
|
if (!strncmp(input, cmd, end))
|
||||||
{
|
{
|
||||||
if (query && (cnt++ < 50) && (len != tmp_len))
|
if (query && (cnt++ < MAX_EXE) && (input_len != cmd_len))
|
||||||
_item_exe_add(p, tmp, 15);
|
_item_exe_add(p, cmd, DEFAULT_MATCH_PRIORITY);
|
||||||
|
|
||||||
if ((!min) || (tmp_len < min))
|
if ((!min) || (cmd_len < min))
|
||||||
{
|
{
|
||||||
min = tmp_len;
|
min = cmd_len;
|
||||||
file = tmp;
|
first_match = cmd;
|
||||||
}
|
}
|
||||||
if ((!query) && (tmp_len == len))
|
|
||||||
|
if ((!query) && (cmd_len == input_len))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file)
|
if (first_match)
|
||||||
{
|
{
|
||||||
GET_ITEM(it, p->command);
|
GET_ITEM(it, p->command);
|
||||||
|
|
||||||
if (strlen(file) < len)
|
if (strlen(first_match) < input_len)
|
||||||
file = input;
|
first_match = input;
|
||||||
|
|
||||||
EVRY_ITEM_LABEL_SET(it, file);
|
EVRY_ITEM_LABEL_SET(it, first_match);
|
||||||
IF_RELEASE(p->command->file);
|
IF_RELEASE(p->command->file);
|
||||||
p->command->file = eina_stringshare_ref(it->label);
|
p->command->file = eina_stringshare_ref(it->label);
|
||||||
it->fuzzy_match = 11; // prefix match
|
it->fuzzy_match = PREFIX_MATCH_PRIORITY;
|
||||||
EVRY_PLUGIN_ITEM_APPEND(p, it);
|
EVRY_PLUGIN_ITEM_APPEND(p, it);
|
||||||
evry->item_changed(it, 0, 0);
|
evry->item_changed(it, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -294,7 +301,7 @@ _fetch_exe(Evry_Plugin *plugin, const char *input)
|
||||||
EINA_LIST_FOREACH (plugin->items, l, eit)
|
EINA_LIST_FOREACH (plugin->items, l, eit)
|
||||||
{
|
{
|
||||||
evry->history_item_usage_set(eit, input, NULL);
|
evry->history_item_usage_set(eit, input, NULL);
|
||||||
if (input && (eit->usage > max) && !strncmp(input, eit->label, len))
|
if (input && (eit->usage > max) && !strncmp(input, eit->label, input_len))
|
||||||
max = eit->usage;
|
max = eit->usage;
|
||||||
}
|
}
|
||||||
EVRY_ITEM(p->command)->usage = (max * 2.0);
|
EVRY_ITEM(p->command)->usage = (max * 2.0);
|
||||||
|
|
Loading…
Reference in New Issue