forked from enlightenment/enlightenment
- convert path to correct urls
- use .cache/thumbnails when available for pdf, video and faster image loading - fix history sort issue with apps -... SVN revision: 48772
This commit is contained in:
parent
1d3d622e21
commit
eb77076200
|
@ -559,12 +559,11 @@ evry_plugin_new(Evry_Plugin *base, const char *name, const char *label,
|
||||||
it = evry_item_new(EVRY_ITEM(p), NULL, label, NULL, _evry_plugin_free);
|
it = evry_item_new(EVRY_ITEM(p), NULL, label, NULL, _evry_plugin_free);
|
||||||
it->plugin = p;
|
it->plugin = p;
|
||||||
it->browseable = EINA_TRUE;
|
it->browseable = EINA_TRUE;
|
||||||
|
it->type = EVRY_TYPE_PLUGIN;
|
||||||
p->base.icon = icon;
|
|
||||||
p->base.type = EVRY_TYPE_PLUGIN;
|
|
||||||
|
|
||||||
if (item_type)
|
if (item_type)
|
||||||
p->base.subtype = item_type;
|
it->subtype = item_type;
|
||||||
|
if (icon)
|
||||||
|
it->icon = eina_stringshare_add(icon);
|
||||||
|
|
||||||
p->name = eina_stringshare_add(name);
|
p->name = eina_stringshare_add(name);
|
||||||
p->begin = begin;
|
p->begin = begin;
|
||||||
|
|
|
@ -407,10 +407,11 @@ evry_item_free(Evry_Item *it)
|
||||||
item_cnt--;
|
item_cnt--;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (it->label) eina_stringshare_del(it->label);
|
IF_RELEASE(it->label);
|
||||||
if (it->id) eina_stringshare_del(it->id);
|
IF_RELEASE(it->id);
|
||||||
if (it->context) eina_stringshare_del(it->context);
|
IF_RELEASE(it->context);
|
||||||
if (it->detail) eina_stringshare_del(it->detail);
|
IF_RELEASE(it->detail);
|
||||||
|
IF_RELEASE(it->icon);
|
||||||
|
|
||||||
if (it->free)
|
if (it->free)
|
||||||
it->free(it);
|
it->free(it);
|
||||||
|
@ -543,7 +544,7 @@ evry_plugin_update(Evry_Plugin *p, int action)
|
||||||
|
|
||||||
if (!win) return;
|
if (!win) return;
|
||||||
|
|
||||||
DBG("plugin: %s", p->name);
|
printf("plugin: %s\n", p->name);
|
||||||
|
|
||||||
sel = _evry_selector_for_plugin_get(p);
|
sel = _evry_selector_for_plugin_get(p);
|
||||||
if (!sel || !sel->state) return;
|
if (!sel || !sel->state) return;
|
||||||
|
@ -578,6 +579,8 @@ evry_plugin_update(Evry_Plugin *p, int action)
|
||||||
_evry_plugin_select(s, NULL);
|
_evry_plugin_select(s, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!p->config || p->config->aggregate)
|
||||||
|
{
|
||||||
/* update aggregator */
|
/* update aggregator */
|
||||||
if ((eina_list_count(s->cur_plugins) > 1 ) ||
|
if ((eina_list_count(s->cur_plugins) > 1 ) ||
|
||||||
/* add aggregator for actions */
|
/* add aggregator for actions */
|
||||||
|
@ -602,6 +605,7 @@ evry_plugin_update(Evry_Plugin *p, int action)
|
||||||
s->cur_plugins = eina_list_remove(s->cur_plugins, agg);
|
s->cur_plugins = eina_list_remove(s->cur_plugins, agg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (s->sel_items)
|
if (s->sel_items)
|
||||||
eina_list_free(s->sel_items);
|
eina_list_free(s->sel_items);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "evry_types.h"
|
#include "evry_types.h"
|
||||||
|
|
||||||
#define EVRY_API_VERSION 19
|
#define EVRY_API_VERSION 20
|
||||||
|
|
||||||
#define EVRY_ACTION_OTHER 0
|
#define EVRY_ACTION_OTHER 0
|
||||||
#define EVRY_ACTION_FINISHED 1
|
#define EVRY_ACTION_FINISHED 1
|
||||||
|
@ -167,7 +167,6 @@ struct _Evry_API
|
||||||
|
|
||||||
#define EVRY_ITEM_DATA_INT_SET(_item, _data) ((Evry_Item *)_item)->data = (void*)(long) _data
|
#define EVRY_ITEM_DATA_INT_SET(_item, _data) ((Evry_Item *)_item)->data = (void*)(long) _data
|
||||||
#define EVRY_ITEM_DATA_INT_GET(_item) (long) ((Evry_Item *)_item)->data
|
#define EVRY_ITEM_DATA_INT_GET(_item) (long) ((Evry_Item *)_item)->data
|
||||||
#define EVRY_ITEM_ICON_SET(_item, _icon) ((Evry_Item *)_item)->icon = _icon
|
|
||||||
|
|
||||||
#define EVRY_ITEM_DETAIL_SET(_it, _detail) \
|
#define EVRY_ITEM_DETAIL_SET(_it, _detail) \
|
||||||
if (EVRY_ITEM(_it)->detail) eina_stringshare_del(EVRY_ITEM(_it)->detail); \
|
if (EVRY_ITEM(_it)->detail) eina_stringshare_del(EVRY_ITEM(_it)->detail); \
|
||||||
|
@ -181,6 +180,10 @@ struct _Evry_API
|
||||||
if (EVRY_ITEM(_it)->context) eina_stringshare_del(EVRY_ITEM(_it)->context); \
|
if (EVRY_ITEM(_it)->context) eina_stringshare_del(EVRY_ITEM(_it)->context); \
|
||||||
EVRY_ITEM(_it)->context = eina_stringshare_add(_context);
|
EVRY_ITEM(_it)->context = eina_stringshare_add(_context);
|
||||||
|
|
||||||
|
#define EVRY_ITEM_ICON_SET(_it, _icon) \
|
||||||
|
if (EVRY_ITEM(_it)->icon) eina_stringshare_del(EVRY_ITEM(_it)->icon); \
|
||||||
|
EVRY_ITEM(_it)->icon = eina_stringshare_add(_icon);
|
||||||
|
|
||||||
#define CHECK_TYPE(_item, _type) \
|
#define CHECK_TYPE(_item, _type) \
|
||||||
(((Evry_Item *)_item)->type && ((Evry_Item *)_item)->type == _type)
|
(((Evry_Item *)_item)->type && ((Evry_Item *)_item)->type == _type)
|
||||||
|
|
||||||
|
|
|
@ -292,6 +292,9 @@ evry_history_item_add(Evry_Item *it, const char *ctxt, const char *input)
|
||||||
{
|
{
|
||||||
id = (it->id ? it->id : it->label);
|
id = (it->id ? it->id : it->label);
|
||||||
ht = evry_history_types_get(it->type);
|
ht = evry_history_types_get(it->type);
|
||||||
|
if (!ht)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
he = eina_hash_find(ht->types, id);
|
he = eina_hash_find(ht->types, id);
|
||||||
|
|
||||||
if (!he)
|
if (!he)
|
||||||
|
@ -376,6 +379,9 @@ evry_history_item_usage_set(Evry_Item *it, const char *input, const char *ctxt)
|
||||||
{
|
{
|
||||||
ht = evry_history_types_get(it->type);
|
ht = evry_history_types_get(it->type);
|
||||||
|
|
||||||
|
if (!ht)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (!(he = eina_hash_find(ht->types, (it->id ? it->id : it->label))))
|
if (!(he = eina_hash_find(ht->types, (it->id ? it->id : it->label))))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -404,7 +410,6 @@ evry_history_item_usage_set(Evry_Item *it, const char *input, const char *ctxt)
|
||||||
|
|
||||||
if (!hi) return 0;
|
if (!hi) return 0;
|
||||||
|
|
||||||
|
|
||||||
if (evry_conf->history_sort_mode == 0)
|
if (evry_conf->history_sort_mode == 0)
|
||||||
{
|
{
|
||||||
if (!input || !hi->input)
|
if (!input || !hi->input)
|
||||||
|
|
|
@ -247,7 +247,9 @@ evry_action_new(const char *name, const char *label,
|
||||||
int (*check_item) (Evry_Action *act, const Evry_Item *it))
|
int (*check_item) (Evry_Action *act, const Evry_Item *it))
|
||||||
{
|
{
|
||||||
Evry_Action *act = EVRY_ITEM_NEW(Evry_Action, _base_plug, label, NULL, _action_free_cb);
|
Evry_Action *act = EVRY_ITEM_NEW(Evry_Action, _base_plug, label, NULL, _action_free_cb);
|
||||||
act->base.icon = icon;
|
|
||||||
|
if (icon)
|
||||||
|
act->base.icon = eina_stringshare_add(icon);
|
||||||
|
|
||||||
act->name = eina_stringshare_add(name);
|
act->name = eina_stringshare_add(name);
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ _add_item(Plugin *p, Eina_List *items, Evry_Item *it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
evry_item_ref(it);
|
|
||||||
items = eina_list_append(items, it);
|
items = eina_list_append(items, it);
|
||||||
EVRY_PLUGIN_ITEM_APPEND(p, it);
|
EVRY_PLUGIN_ITEM_APPEND(p, it);
|
||||||
|
|
||||||
|
@ -207,7 +206,10 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EINA_LIST_FOREACH(items, l, it)
|
/* EINA_LIST_FOREACH(items, l, it)
|
||||||
* printf("%d %1.20f %s\n", it->fuzzy_match, it->usage, it->label); */
|
* {
|
||||||
|
* if(CHECK_TYPE(it, EVRY_TYPE_FILE))
|
||||||
|
* printf("%d %1.20f %s\n", it->fuzzy_match, it->usage, it->label);
|
||||||
|
* } */
|
||||||
|
|
||||||
if (items) eina_list_free(items);
|
if (items) eina_list_free(items);
|
||||||
if (lp) eina_list_free(lp);
|
if (lp) eina_list_free(lp);
|
||||||
|
@ -216,8 +218,11 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
|
|
||||||
EINA_LIST_FOREACH_SAFE(p->base.items, l, ll, it)
|
EINA_LIST_FOREACH_SAFE(p->base.items, l, ll, it)
|
||||||
{
|
{
|
||||||
if (cnt++ < MAX_ITEMS) continue;
|
if (cnt++ < MAX_ITEMS)
|
||||||
evry_item_free(it);
|
{
|
||||||
|
evry_item_ref(it);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
p->base.items = eina_list_remove_list(p->base.items, l);
|
p->base.items = eina_list_remove_list(p->base.items, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,8 +101,6 @@ _thumb_gen(void *data, Evas_Object *obj, void *event_info)
|
||||||
static int
|
static int
|
||||||
_check_item(const Evry_Item *it)
|
_check_item(const Evry_Item *it)
|
||||||
{
|
{
|
||||||
if (it->type != EVRY_TYPE_FILE) return 0;
|
|
||||||
|
|
||||||
GET_FILE(file, it);
|
GET_FILE(file, it);
|
||||||
|
|
||||||
if (!evry_file_path_get(file) || !file->mime) return 0;
|
if (!evry_file_path_get(file) || !file->mime) return 0;
|
||||||
|
@ -132,21 +130,26 @@ _thumb_idler(void *data)
|
||||||
evas_object_show(it->image);
|
evas_object_show(it->image);
|
||||||
}
|
}
|
||||||
else it->have_thumb = EINA_TRUE;
|
else it->have_thumb = EINA_TRUE;
|
||||||
|
|
||||||
/* dirbrowse fetches the mimetype for icon_get */
|
|
||||||
if (!it->get_thumb && _check_item(it->item))
|
|
||||||
it->get_thumb = EINA_TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (it->get_thumb && !it->thumb && !(it->have_thumb || it->do_thumb))
|
if ((CHECK_TYPE(it->item, EVRY_TYPE_FILE)) &&
|
||||||
|
((!it->thumb && !(it->have_thumb || it->do_thumb)) &&
|
||||||
|
(it->get_thumb || _check_item(it->item) ||
|
||||||
|
(it->item->icon && it->item->icon[0]))))
|
||||||
{
|
{
|
||||||
|
it->get_thumb = EINA_TRUE;
|
||||||
|
|
||||||
it->thumb = e_thumb_icon_add(sd->view->evas);
|
it->thumb = e_thumb_icon_add(sd->view->evas);
|
||||||
|
|
||||||
GET_FILE(file, it->item);
|
GET_FILE(file, it->item);
|
||||||
|
|
||||||
evas_object_smart_callback_add(it->thumb, "e_thumb_gen", _thumb_gen, it);
|
evas_object_smart_callback_add(it->thumb, "e_thumb_gen", _thumb_gen, it);
|
||||||
|
|
||||||
|
if (it->item->icon && it->item->icon[0])
|
||||||
|
e_thumb_icon_file_set(it->thumb, it->item->icon, NULL);
|
||||||
|
else
|
||||||
e_thumb_icon_file_set(it->thumb, file->path, NULL);
|
e_thumb_icon_file_set(it->thumb, file->path, NULL);
|
||||||
|
|
||||||
e_thumb_icon_size_set(it->thumb, it->w, it->h);
|
e_thumb_icon_size_set(it->thumb, it->w, it->h);
|
||||||
e_thumb_icon_begin(it->thumb);
|
e_thumb_icon_begin(it->thumb);
|
||||||
it->do_thumb = EINA_TRUE;
|
it->do_thumb = EINA_TRUE;
|
||||||
|
@ -571,9 +574,6 @@ _pan_item_add(Evas_Object *obj, Evry_Item *item)
|
||||||
it->item = item;
|
it->item = item;
|
||||||
it->changed = EINA_TRUE;
|
it->changed = EINA_TRUE;
|
||||||
|
|
||||||
/* if (_check_item(item))
|
|
||||||
* it->get_thumb = EINA_TRUE; */
|
|
||||||
|
|
||||||
evry_item_ref(item);
|
evry_item_ref(item);
|
||||||
|
|
||||||
_e_smart_reconfigure(obj);
|
_e_smart_reconfigure(obj);
|
||||||
|
@ -1009,9 +1009,6 @@ _view_update(Evry_View *view, int slide)
|
||||||
{
|
{
|
||||||
v_items = eina_list_append(v_items, v_it->item);
|
v_items = eina_list_append(v_items, v_it->item);
|
||||||
|
|
||||||
/* if (_check_item(v_it->item))
|
|
||||||
* v_it->get_thumb = EINA_TRUE; */
|
|
||||||
|
|
||||||
if (v_it->visible && v_it->changed)
|
if (v_it->visible && v_it->changed)
|
||||||
update = EINA_TRUE;
|
update = EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,6 +187,9 @@ struct _Evry_Plugin
|
||||||
'configure' button in everything config */
|
'configure' button in everything config */
|
||||||
const char *config_path;
|
const char *config_path;
|
||||||
|
|
||||||
|
/* set theme file to fetch icons from */
|
||||||
|
const char *theme_path;
|
||||||
|
|
||||||
/* not to be set by plugin! */
|
/* not to be set by plugin! */
|
||||||
Plugin_Config *config;
|
Plugin_Config *config;
|
||||||
unsigned int request;
|
unsigned int request;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
static const char *home_dir = NULL;
|
static const char *home_dir = NULL;
|
||||||
static int home_dir_len;
|
static int home_dir_len;
|
||||||
static char dir_buf[1024];
|
static char dir_buf[1024];
|
||||||
|
static char thumb_buf[4096];
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
evry_util_file_detail_set(Evry_Item_File *file)
|
evry_util_file_detail_set(Evry_Item_File *file)
|
||||||
|
@ -68,7 +69,8 @@ evry_fuzzy_match(const char *str, const char *match)
|
||||||
unsigned int m_min[MAX_WORDS];
|
unsigned int m_min[MAX_WORDS];
|
||||||
unsigned int m_len = 0;
|
unsigned int m_len = 0;
|
||||||
|
|
||||||
if (!match || !str) return 0;
|
if (!match || !str || !match[0] || !str[0])
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* remove white spaces at the beginning */
|
/* remove white spaces at the beginning */
|
||||||
for (; (*match != 0) && isspace(*match); match++);
|
for (; (*match != 0) && isspace(*match); match++);
|
||||||
|
@ -278,11 +280,17 @@ evry_items_sort_func(const void *data1, const void *data2)
|
||||||
|
|
||||||
/* sort context specific actions before
|
/* sort context specific actions before
|
||||||
general actions */
|
general actions */
|
||||||
if (act1->remember_context && !act2->remember_context)
|
if (act1->remember_context)
|
||||||
|
{
|
||||||
|
if (!act2->remember_context)
|
||||||
return -1;
|
return -1;
|
||||||
if (!act1->remember_context && act2->remember_context)
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (act2->remember_context)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* if (it1->type == EVRY_TYPE_PLUGIN &&
|
/* if (it1->type == EVRY_TYPE_PLUGIN &&
|
||||||
* it2->type != EVRY_TYPE_PLUGIN)
|
* it2->type != EVRY_TYPE_PLUGIN)
|
||||||
|
@ -488,14 +496,46 @@ evry_icon_mime_get(const char *mime, Evas *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_file_icon_get(const Evry_Item *it, Evas *e)
|
_file_icon_get(Evry_Item *it, Evas *e)
|
||||||
{
|
{
|
||||||
Evas_Object *o = NULL;
|
Evas_Object *o = NULL;
|
||||||
GET_FILE(file, it);
|
GET_FILE(file, it);
|
||||||
|
|
||||||
if (it->browseable)
|
if (it->browseable)
|
||||||
o = evry_icon_theme_get("folder", e);
|
{
|
||||||
else if (file->mime)
|
return evry_icon_theme_get("folder", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (it->icon)
|
||||||
|
{
|
||||||
|
o = e_icon_add(e);
|
||||||
|
if (!e_icon_file_set(o, it->icon))
|
||||||
|
{
|
||||||
|
evas_object_del(o);
|
||||||
|
o = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((!o) && (!it->icon) && file->mime &&
|
||||||
|
((!strncmp(file->mime, "image/", 6)) ||
|
||||||
|
(!strncmp(file->mime, "video/", 6)) ||
|
||||||
|
(!strncmp(file->mime, "application/pdf", 15))) &&
|
||||||
|
(evry_file_url_get(file)))
|
||||||
|
{
|
||||||
|
char *sum = evry_util_md5_sum(file->url);
|
||||||
|
|
||||||
|
snprintf(thumb_buf, sizeof(thumb_buf),
|
||||||
|
"%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);
|
o = evry_icon_mime_get(file->mime, e);
|
||||||
|
|
||||||
if (!o)
|
if (!o)
|
||||||
|
@ -509,16 +549,16 @@ evry_util_icon_get(Evry_Item *it, Evas *e)
|
||||||
{
|
{
|
||||||
Evas_Object *o = NULL;
|
Evas_Object *o = NULL;
|
||||||
|
|
||||||
if (it->icon_get)
|
if (CHECK_TYPE(it, EVRY_TYPE_FILE))
|
||||||
|
o = _file_icon_get(it, e);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!o && it->icon_get)
|
||||||
o = it->icon_get(it, e);
|
o = it->icon_get(it, e);
|
||||||
|
|
||||||
if (!o && it->icon)
|
if (!o && it->icon)
|
||||||
o = evry_icon_theme_get(it->icon, e);
|
o = evry_icon_theme_get(it->icon, e);
|
||||||
|
}
|
||||||
if (CHECK_TYPE(it, EVRY_TYPE_FILE))
|
|
||||||
o = _file_icon_get(it, e);
|
|
||||||
|
|
||||||
/* TODO default type: files, apps */
|
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
@ -641,9 +681,11 @@ evry_util_url_unescape(const char *string, int length)
|
||||||
if( !ns )
|
if( !ns )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
while(--alloc > 0) {
|
while(--alloc > 0)
|
||||||
|
{
|
||||||
in = *string;
|
in = *string;
|
||||||
if(('%' == in) && ISXDIGIT(string[1]) && ISXDIGIT(string[2])) {
|
if(('%' == in) && ISXDIGIT(string[1]) && ISXDIGIT(string[2]))
|
||||||
|
{
|
||||||
/* this is two hexadecimal digits following a '%' */
|
/* this is two hexadecimal digits following a '%' */
|
||||||
char hexstr[3];
|
char hexstr[3];
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
@ -692,9 +734,8 @@ _isalnum(unsigned char in)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME option to not escape '/' */
|
char *
|
||||||
EAPI char *
|
_evry_util_url_escape(const char *string, int inlength, int path)
|
||||||
evry_util_url_escape(const char *string, int inlength)
|
|
||||||
{
|
{
|
||||||
size_t alloc = (inlength?(size_t)inlength:strlen(string))+1;
|
size_t alloc = (inlength?(size_t)inlength:strlen(string))+1;
|
||||||
char *ns;
|
char *ns;
|
||||||
|
@ -709,24 +750,30 @@ evry_util_url_escape(const char *string, int inlength)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
length = alloc-1;
|
length = alloc-1;
|
||||||
while(length--) {
|
while(length--)
|
||||||
|
{
|
||||||
in = *string;
|
in = *string;
|
||||||
|
|
||||||
if (_isalnum(in)) {
|
if (_isalnum(in) ||
|
||||||
|
(path && ispunct(in)))
|
||||||
|
{
|
||||||
/* just copy this */
|
/* just copy this */
|
||||||
ns[strindex++]=in;
|
ns[strindex++]=in;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* encode it */
|
/* encode it */
|
||||||
newlen += 2; /* the size grows with two, since this'll become a %XX */
|
newlen += 2; /* the size grows with two, since this'll become a %XX */
|
||||||
if(newlen > alloc) {
|
if(newlen > alloc)
|
||||||
|
{
|
||||||
alloc *= 2;
|
alloc *= 2;
|
||||||
testing_ptr = realloc(ns, alloc);
|
testing_ptr = realloc(ns, alloc);
|
||||||
if(!testing_ptr) {
|
if(!testing_ptr)
|
||||||
|
{
|
||||||
free( ns );
|
free( ns );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
ns = testing_ptr;
|
ns = testing_ptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -741,6 +788,13 @@ evry_util_url_escape(const char *string, int inlength)
|
||||||
return ns;
|
return ns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI char *
|
||||||
|
evry_util_url_escape(const char *string, int inlength)
|
||||||
|
{
|
||||||
|
_evry_util_url_escape(string, inlength, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
EAPI const char*
|
EAPI const char*
|
||||||
evry_file_path_get(Evry_Item_File *file)
|
evry_file_path_get(Evry_Item_File *file)
|
||||||
{
|
{
|
||||||
|
@ -771,6 +825,7 @@ EAPI const char*
|
||||||
evry_file_url_get(Evry_Item_File *file)
|
evry_file_url_get(Evry_Item_File *file)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
char *escaped;
|
||||||
|
|
||||||
if (file->url)
|
if (file->url)
|
||||||
return file->url;
|
return file->url;
|
||||||
|
@ -778,13 +833,19 @@ evry_file_url_get(Evry_Item_File *file)
|
||||||
if (!file->path)
|
if (!file->path)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "file://%s", file->path);
|
escaped = _evry_util_url_escape(file->path, 0, 1);
|
||||||
|
|
||||||
/* FIXME escape ? */
|
if (escaped)
|
||||||
|
{
|
||||||
|
snprintf(buf, sizeof(buf), "file://%s", escaped);
|
||||||
|
E_FREE(escaped);
|
||||||
|
|
||||||
file->url = eina_stringshare_add(buf);
|
file->url = eina_stringshare_add(buf);
|
||||||
|
|
||||||
return file->url;
|
return file->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue