forked from enlightenment/enlightenment
'everything' fix mimetype bug in file history
- added helper to check item type SVN revision: 48096
This commit is contained in:
parent
c30b76da87
commit
71f4bb7947
|
@ -310,6 +310,31 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it)
|
|||
return EVRY_PLUGIN(p);
|
||||
}
|
||||
|
||||
static int
|
||||
_hist_add(Evry_Plugin *plugin, Evry_Item_File *file)
|
||||
{
|
||||
Eina_List *l;
|
||||
History_Item *hi;
|
||||
History_Entry *he;
|
||||
|
||||
he = eina_hash_find(evry_hist->subjects, file->path);
|
||||
|
||||
if (!he) return 0;
|
||||
|
||||
EINA_LIST_FOREACH(he->items, l, hi)
|
||||
{
|
||||
if (hi->type != plugin->type_out)
|
||||
continue;
|
||||
|
||||
if (hi->data)
|
||||
eina_stringshare_del(hi->data);
|
||||
|
||||
hi->data = eina_stringshare_ref(file->mime);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_cleanup(Evry_Plugin *plugin)
|
||||
{
|
||||
|
@ -328,8 +353,11 @@ _cleanup(Evry_Plugin *plugin)
|
|||
eina_stringshare_del(p->directory);
|
||||
|
||||
EINA_LIST_FREE(p->files, file)
|
||||
evry_item_free(EVRY_ITEM(file));
|
||||
|
||||
{
|
||||
_hist_add(plugin, file);
|
||||
evry_item_free(EVRY_ITEM(file));
|
||||
}
|
||||
|
||||
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
||||
|
||||
if (p->input)
|
||||
|
@ -383,10 +411,13 @@ _hist_items_add_cb(const Eina_Hash *hash, const void *key, void *data, void *fda
|
|||
|
||||
evry_util_file_detail_set(file);
|
||||
|
||||
if ((!strcmp(file->mime, "inode/directory")) ||
|
||||
(!strcmp(file->mime, "inode/mount-point")))
|
||||
EVRY_ITEM(file)->browseable = EINA_TRUE;
|
||||
|
||||
if (file->mime)
|
||||
{
|
||||
if ((!strcmp(file->mime, "inode/directory")) ||
|
||||
(!strcmp(file->mime, "inode/mount-point")))
|
||||
EVRY_ITEM(file)->browseable = EINA_TRUE;
|
||||
}
|
||||
/* else */
|
||||
/* if (ecore_file_is_dir(file->path))
|
||||
* EVRY_ITEM(file)->browseable = EINA_TRUE; */
|
||||
|
||||
|
@ -556,35 +587,6 @@ _open_term_action(Evry_Action *act)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
_action(Evry_Plugin *plugin, const Evry_Item *it)
|
||||
{
|
||||
ITEM_FILE(file, it);
|
||||
Eina_List *l;
|
||||
History_Item *hi;
|
||||
History_Entry *he;
|
||||
|
||||
he = eina_hash_find(evry_hist->subjects, file->path);
|
||||
printf("acn\n");
|
||||
|
||||
if (!he) return 0;
|
||||
|
||||
EINA_LIST_FOREACH(he->items, l, hi)
|
||||
{
|
||||
if (hi->type != plugin->type_out)
|
||||
continue;
|
||||
|
||||
if (hi->data)
|
||||
eina_stringshare_del(hi->data);
|
||||
|
||||
printf("added\n");
|
||||
hi->data = eina_stringshare_ref(file->mime);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static Eina_Bool
|
||||
module_init(void)
|
||||
{
|
||||
|
@ -594,8 +596,6 @@ module_init(void)
|
|||
p1 = EVRY_PLUGIN_NEW(NULL, "Files", type_subject, "FILE", "FILE",
|
||||
_begin, _cleanup, _fetch, _icon_get, NULL);
|
||||
|
||||
EVRY_PLUGIN(p1)->action = &_action;
|
||||
|
||||
p2 = EVRY_PLUGIN_NEW(NULL, "Files", type_object, "FILE", "FILE",
|
||||
_begin, _cleanup, _fetch, _icon_get, NULL);
|
||||
|
||||
|
|
|
@ -396,6 +396,7 @@ EAPI void evry_list_win_hide(void);
|
|||
EAPI Evry_Item *evry_item_new(Evry_Item *base, Evry_Plugin *p, const char *label, void (*cb_free) (Evry_Item *item));
|
||||
EAPI void evry_item_free(Evry_Item *it);
|
||||
EAPI void evry_item_ref(Evry_Item *it);
|
||||
EAPI int evry_item_type_check(const Evry_Item *it, const char *type);
|
||||
EAPI void evry_plugin_async_update(Evry_Plugin *plugin, int state);
|
||||
EAPI void evry_clear_input(void);
|
||||
|
||||
|
|
|
@ -346,6 +346,15 @@ evry_item_free(Evry_Item *it)
|
|||
E_FREE(it);
|
||||
}
|
||||
|
||||
EAPI int
|
||||
evry_item_type_check(const Evry_Item *it, const char *type)
|
||||
{
|
||||
if (it && it->plugin && it->plugin->type_out)
|
||||
return (!strcmp(it->plugin->type_out, type));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Evry_Selector *
|
||||
_evry_selector_for_plugin_get(Evry_Plugin *p)
|
||||
{
|
||||
|
|
|
@ -12,16 +12,16 @@ evry_util_file_detail_set(Evry_Item_File *file)
|
|||
{
|
||||
const char *path;
|
||||
|
||||
if (EVRY_ITEM(file)->detail)
|
||||
return;
|
||||
|
||||
if (!home_dir)
|
||||
{
|
||||
home_dir = e_user_homedir_get();
|
||||
home_dir_len = strlen(home_dir);
|
||||
}
|
||||
|
||||
/* if (!EVRY_ITEM(file)->browseable) */
|
||||
path = ecore_file_dir_get(file->path);
|
||||
/* else
|
||||
* path = file->path; */
|
||||
|
||||
if (path && !strncmp(path, home_dir, home_dir_len))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue