- get correct path uris

- fix browse item action missed one case
- fix segv in selector_item_update when state has no plugin


SVN revision: 48838
This commit is contained in:
Hannes Janetzek 2010-05-14 03:11:03 +00:00
parent 57a9bdc2ed
commit 111b5b95c1
2 changed files with 70 additions and 40 deletions

View File

@ -1035,7 +1035,8 @@ _evry_selector_item_update(Evry_Selector *sel)
}
}
if (!(sel->o_icon) && (EVRY_ITEM(s->plugin)->icon))
if (!(sel->o_icon) && s->plugin &&
(EVRY_ITEM(s->plugin)->icon))
{
o = evry_icon_theme_get(EVRY_ITEM(s->plugin)->icon, win->popup->evas);
if (o)
@ -1304,7 +1305,10 @@ evry_browse_item(Evry_Selector *sel)
continue;
if ((pp = p->browse(p, it)))
plugins = eina_list_append(plugins, pp);
{
plugins = eina_list_append(plugins, pp);
}
}
/* FIXME this is a special case for actions */
@ -1347,6 +1351,11 @@ evry_browse_item(Evry_Selector *sel)
_evry_matches_update(sel, 1);
s = new_state;
}
else
{
_evry_matches_update(sel, 1);
s = new_state;
}
_evry_selector_update(sel);
@ -1372,7 +1381,7 @@ evry_browse_back(Evry_Selector *sel)
Evry_State *s = sel->state;
DBG("%p", sel);
if (!s || !sel->states->next)
return 0;
@ -1474,27 +1483,27 @@ _evry_input_complete(Evry_State *s)
evry_item_free(it);
E_FREE(input);
return 1;
}
static int
_evry_cheat_history(Evry_State *s, int promote, int delete)
{
History_Entry *he;
History_Item *hi;
Eina_List *l, *ll;
Evry_Item *it = s->cur_item;
if (!(he = eina_hash_find(evry_hist->subjects, (it->id ? it->id : it->label))))
return 1;
EINA_LIST_FOREACH_SAFE(he->items, l, ll, hi)
{
if (hi->plugin != it->plugin->name)
continue;
if (delete)
{
if (hi->input)
@ -1504,7 +1513,7 @@ _evry_cheat_history(Evry_State *s, int promote, int delete)
if (hi->context)
eina_stringshare_del(hi->context);
E_FREE(hi);
he->items = eina_list_remove_list(he->items, l);
}
else if (promote)
@ -1658,7 +1667,7 @@ _evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
int promote = (!strcmp(key, "Insert"));
_evry_cheat_history(s, promote, delete);
}
else if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)
{
@ -1838,7 +1847,7 @@ _evry_clear(Evry_Selector *sel)
if (!list->visible && evry_conf->hide_input)
edje_object_signal_emit(list->o_main, "e,state,entry_hide", "e");
return 1;
}
@ -1861,14 +1870,14 @@ static int
_evry_action_do(Evry_Action *act)
{
Evry_Event_Action_Performed *ev;
if (act->action(act))
{
ev = E_NEW(Evry_Event_Action_Performed, 1);
ev->action = eina_stringshare_ref(act->name);
ev->it1 = act->it1.item;
ev->it2 = act->it2.item;
if (ev->it1)
EVRY_ITEM_REF(ev->it1);
if (ev->it2)

View File

@ -272,7 +272,7 @@ evry_items_sort_func(const void *data1, const void *data2)
if ((act1->it1.type == act1->it1.item->type) &&
(act2->it1.type != act2->it1.item->type))
return -1;
if ((act1->it1.type != act1->it1.item->type) &&
(act2->it1.type == act2->it1.item->type))
return 1;
@ -505,7 +505,7 @@ _file_icon_get(Evry_Item *it, Evas *e)
{
return evry_icon_theme_get("folder", e);
}
if (it->icon)
{
o = e_icon_add(e);
@ -515,7 +515,7 @@ _file_icon_get(Evry_Item *it, Evas *e)
o = NULL;
}
}
if ((!o) && (!it->icon) && file->mime &&
((!strncmp(file->mime, "image/", 6)) ||
(!strncmp(file->mime, "video/", 6)) ||
@ -528,13 +528,13 @@ _file_icon_get(Evry_Item *it, Evas *e)
"%s/.thumbnails/normal/%s.png",
e_user_homedir_get(), sum);
free(sum);
if (ecore_file_exists(thumb_buf))
it->icon = eina_stringshare_add(thumb_buf);
else
it->icon = eina_stringshare_add("");
}
if ((!o) && file->mime)
o = evry_icon_mime_get(file->mime, e);
@ -594,7 +594,7 @@ evry_util_exec_app(const Evry_Item *it_app, const Evry_Item *it_file)
{
if (!mime)
continue;
if (!strcmp(mime, "x-directory/normal"))
open_folder = 1;
@ -717,24 +717,45 @@ evry_util_url_unescape(const char *string, int length)
static Eina_Bool
_isalnum(unsigned char in)
{
switch (in) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case 'a': case 'b': case 'c': case 'd': case 'e':
case 'f': case 'g': case 'h': case 'i': case 'j':
case 'k': case 'l': case 'm': case 'n': case 'o':
case 'p': case 'q': case 'r': case 's': case 't':
case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
case 'A': case 'B': case 'C': case 'D': case 'E':
case 'F': case 'G': case 'H': case 'I': case 'J':
case 'K': case 'L': case 'M': case 'N': case 'O':
case 'P': case 'Q': case 'R': case 'S': case 'T':
case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z':
return EINA_TRUE;
default:
break;
}
return EINA_FALSE;
switch (in)
{
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case 'a': case 'b': case 'c': case 'd': case 'e':
case 'f': case 'g': case 'h': case 'i': case 'j':
case 'k': case 'l': case 'm': case 'n': case 'o':
case 'p': case 'q': case 'r': case 's': case 't':
case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
case 'A': case 'B': case 'C': case 'D': case 'E':
case 'F': case 'G': case 'H': case 'I': case 'J':
case 'K': case 'L': case 'M': case 'N': case 'O':
case 'P': case 'Q': case 'R': case 'S': case 'T':
case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z':
return EINA_TRUE;
default:
break;
}
return EINA_FALSE;
}
/* FIXME there seem to be too many ways of not following a standard.
find out which is the most popular */
static Eina_Bool
_isuric(unsigned char in)
{
switch (in)
{
case '/': case '.': case '(': case ')': case '-':
case '~': case '\'': case '_': case '@': case '+':
/* case ';': case ':':
* case '&': case '=': case '$': case ',':
* case '.': case '!':
* case '\'': */
return EINA_TRUE;
default:
break;
}
return EINA_FALSE;
}
char *
@ -758,7 +779,7 @@ _evry_util_url_escape(const char *string, int inlength, int path)
in = *string;
if (_isalnum(in) ||
(path && ispunct(in)))
(path && _isuric(in)))
{
/* just copy this */
ns[strindex++]=in;
@ -829,7 +850,7 @@ evry_file_url_get(Evry_Item_File *file)
{
char buf[PATH_MAX];
char *escaped;
if (file->url)
return file->url;
@ -847,7 +868,7 @@ evry_file_url_get(Evry_Item_File *file)
return file->url;
}
return NULL;
}