forked from enlightenment/enlightenment
- fix bug in edd creation, metadata works now.
SVN revision: 18414
This commit is contained in:
parent
2f3a16acdc
commit
e4f6eb08cd
|
@ -3,26 +3,6 @@
|
||||||
*/
|
*/
|
||||||
#include "e.h"
|
#include "e.h"
|
||||||
|
|
||||||
#define NEWD(str, typ) \
|
|
||||||
eet_data_descriptor_new(str, sizeof(typ), \
|
|
||||||
(void *(*) (void *))evas_list_next, \
|
|
||||||
(void *(*) (void *, void *))evas_list_append, \
|
|
||||||
(void *(*) (void *))evas_list_data, \
|
|
||||||
(void *(*) (void *))evas_list_free, \
|
|
||||||
(void (*) (void *, int (*) (void *, const char *, void *, void *), void *))evas_hash_foreach, \
|
|
||||||
(void *(*) (void *, const char *, void *))evas_hash_add, \
|
|
||||||
(void (*) (void *))evas_hash_free)
|
|
||||||
|
|
||||||
#define FREED(eed) \
|
|
||||||
if (eed) \
|
|
||||||
{ \
|
|
||||||
eet_data_descriptor_free((eed)); \
|
|
||||||
(eed) = NULL; \
|
|
||||||
}
|
|
||||||
#define NEWI(str, it, type) \
|
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_e_fm_icon_meta_edd, E_Fm_Icon_Metadata, str, it, type)
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _E_Smart_Data E_Smart_Data;
|
typedef struct _E_Smart_Data E_Smart_Data;
|
||||||
|
|
||||||
struct _E_Smart_Data
|
struct _E_Smart_Data
|
||||||
|
@ -82,13 +62,6 @@ static Eet_Data_Descriptor *_e_fm_icon_meta_edd = NULL;
|
||||||
int
|
int
|
||||||
e_fm_icon_init(void)
|
e_fm_icon_init(void)
|
||||||
{
|
{
|
||||||
_e_fm_icon_meta_edd = NEWD("E_Fm_Icon_Metadata", E_Fm_Icon_Metadata);
|
|
||||||
NEWI("x", x, EET_T_INT);
|
|
||||||
NEWI("y", y, EET_T_INT);
|
|
||||||
NEWI("w", w, EET_T_INT);
|
|
||||||
NEWI("h", h, EET_T_INT);
|
|
||||||
NEWI("nm", name, EET_T_STRING);
|
|
||||||
|
|
||||||
event_handlers = evas_list_append(event_handlers,
|
event_handlers = evas_list_append(event_handlers,
|
||||||
ecore_event_handler_add(ECORE_EVENT_EXE_EXIT,
|
ecore_event_handler_add(ECORE_EVENT_EXE_EXIT,
|
||||||
_e_fm_icon_thumb_cb_exe_exit,
|
_e_fm_icon_thumb_cb_exe_exit,
|
||||||
|
@ -99,7 +72,6 @@ e_fm_icon_init(void)
|
||||||
int
|
int
|
||||||
e_fm_icon_shutdown(void)
|
e_fm_icon_shutdown(void)
|
||||||
{
|
{
|
||||||
FREED(_e_fm_icon_meta_edd);
|
|
||||||
while (event_handlers)
|
while (event_handlers)
|
||||||
{
|
{
|
||||||
ecore_event_handler_del(event_handlers->data);
|
ecore_event_handler_del(event_handlers->data);
|
||||||
|
|
|
@ -73,7 +73,7 @@ int E_EVENT_FM_DIRECTORY_CHANGE;
|
||||||
#define NEWI(str, it, type) \
|
#define NEWI(str, it, type) \
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_e_fm_dir_meta_edd, E_Fm_Dir_Metadata, str, it, type)
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_e_fm_dir_meta_edd, E_Fm_Dir_Metadata, str, it, type)
|
||||||
#define NEWL(str, it, type) \
|
#define NEWL(str, it, type) \
|
||||||
EET_DATA_DESCRIPTOR_ADD_LIST(_e_fm_icon_meta_edd, E_Fm_Dir_Metadata, str, it, type)
|
EET_DATA_DESCRIPTOR_ADD_LIST(_e_fm_dir_meta_edd, E_Fm_Dir_Metadata, str, it, type)
|
||||||
|
|
||||||
typedef struct _E_Fm_Smart_Data E_Fm_Smart_Data;
|
typedef struct _E_Fm_Smart_Data E_Fm_Smart_Data;
|
||||||
typedef struct _E_Fm_Icon E_Fm_Icon;
|
typedef struct _E_Fm_Icon E_Fm_Icon;
|
||||||
|
@ -165,6 +165,7 @@ struct _E_Fm_Smart_Data
|
||||||
Evas_List *event_handlers;
|
Evas_List *event_handlers;
|
||||||
|
|
||||||
Evas_List *files;
|
Evas_List *files;
|
||||||
|
Evas_List *files_raw;
|
||||||
Ecore_File_Monitor *monitor;
|
Ecore_File_Monitor *monitor;
|
||||||
E_Fm_Arrange arrange;
|
E_Fm_Arrange arrange;
|
||||||
|
|
||||||
|
@ -1424,16 +1425,44 @@ _e_fm_menu_refresh_cb(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
static void
|
static void
|
||||||
_e_fm_dir_set(E_Fm_Smart_Data *sd, const char *dir)
|
_e_fm_dir_set(E_Fm_Smart_Data *sd, const char *dir)
|
||||||
{
|
{
|
||||||
Evas_List *l;
|
Evas_List *l;
|
||||||
|
Ecore_List *list;
|
||||||
|
Ecore_Sheap *heap;
|
||||||
|
char *f;
|
||||||
|
int type;
|
||||||
|
DIR *dir2;
|
||||||
|
struct dirent *dp;
|
||||||
E_Event_Fm_Reconfigure *ev;
|
E_Event_Fm_Reconfigure *ev;
|
||||||
E_Event_Fm_Directory_Change *ev2;
|
E_Event_Fm_Directory_Change *ev2;
|
||||||
DIR *dir2;
|
|
||||||
|
|
||||||
if (!dir) return;
|
if (!dir) return;
|
||||||
if ((sd->dir) && (!strcmp(sd->dir, dir))) return;
|
if ((sd->dir) && (!strcmp(sd->dir, dir))) return;
|
||||||
|
|
||||||
if (!(dir2 = opendir(dir))) return;
|
if (!(dir2 = opendir(dir))) return;
|
||||||
|
|
||||||
|
type = E_FM_FILE_TYPE_NORMAL;
|
||||||
|
list = ecore_list_new();
|
||||||
|
ecore_list_set_free_cb(list, free);
|
||||||
|
/* TODO: use sorting function here */
|
||||||
|
heap = ecore_sheap_new(ECORE_COMPARE_CB(strcmp), ecore_list_nodes(list));
|
||||||
|
while(dp = readdir(dir2))
|
||||||
|
{
|
||||||
|
if ((!strcmp(dp->d_name, ".") || (!strcmp (dp->d_name, "..")))) continue;
|
||||||
|
if ((dp->d_name[0] == '.') && (!(type & E_FM_FILE_TYPE_HIDDEN))) continue;
|
||||||
|
f = strdup(dp->d_name);
|
||||||
|
ecore_list_append(list, f);
|
||||||
|
}
|
||||||
|
closedir(dir2);
|
||||||
|
|
||||||
|
heap = ecore_sheap_new(ECORE_COMPARE_CB(strcasecmp), ecore_list_nodes(list));
|
||||||
|
while ((f = ecore_list_remove_first(list)))
|
||||||
|
ecore_sheap_insert(heap, f);
|
||||||
|
|
||||||
|
while ((f = ecore_sheap_extract(heap)))
|
||||||
|
sd->files_raw = evas_list_append(sd->files_raw, f);
|
||||||
|
|
||||||
|
ecore_sheap_destroy(heap);
|
||||||
|
|
||||||
if (sd->dir) free (sd->dir);
|
if (sd->dir) free (sd->dir);
|
||||||
sd->dir = strdup(dir);
|
sd->dir = strdup(dir);
|
||||||
|
|
||||||
|
@ -1457,8 +1486,6 @@ _e_fm_dir_set(E_Fm_Smart_Data *sd, const char *dir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Reset position */
|
/* Reset position */
|
||||||
sd->position = 0.0;
|
sd->position = 0.0;
|
||||||
|
|
||||||
|
@ -1520,8 +1547,6 @@ _e_fm_dir_files_get(void *data)
|
||||||
int i;
|
int i;
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
/* FIXME: This needs to be passed in to decide what file types to show */
|
|
||||||
type = E_FM_FILE_TYPE_NORMAL;
|
|
||||||
i = 0;
|
i = 0;
|
||||||
sd = data;
|
sd = data;
|
||||||
|
|
||||||
|
@ -1529,15 +1554,14 @@ _e_fm_dir_files_get(void *data)
|
||||||
|
|
||||||
while (i < 2)
|
while (i < 2)
|
||||||
{
|
{
|
||||||
dir_entry = readdir(sd->dir2);
|
char *f;
|
||||||
if(!dir_entry)
|
|
||||||
break;
|
|
||||||
if ((!strcmp(dir_entry->d_name, ".") || (!strcmp (dir_entry->d_name, "..")))) continue;
|
|
||||||
if ((dir_entry->d_name[0] == '.') && (!(type & E_FM_FILE_TYPE_HIDDEN))) continue;
|
|
||||||
|
|
||||||
|
if(!sd->files_raw)
|
||||||
|
break;
|
||||||
|
f = sd->files_raw->data;
|
||||||
icon = E_NEW(E_Fm_Icon, 1);
|
icon = E_NEW(E_Fm_Icon, 1);
|
||||||
if (!icon) continue;
|
if (!icon) continue;
|
||||||
snprintf(path, sizeof(path), "%s/%s", sd->dir, dir_entry->d_name);
|
snprintf(path, sizeof(path), "%s/%s", sd->dir, f);
|
||||||
icon->file = e_fm_file_new(path);
|
icon->file = e_fm_file_new(path);
|
||||||
if (!icon->file)
|
if (!icon->file)
|
||||||
{
|
{
|
||||||
|
@ -1559,6 +1583,7 @@ _e_fm_dir_files_get(void *data)
|
||||||
e_icon_layout_icon_callbacks_set(icon->icon_object, e_fm_icon_appear_cb, e_fm_icon_disappear_cb, NULL);
|
e_icon_layout_icon_callbacks_set(icon->icon_object, e_fm_icon_appear_cb, e_fm_icon_disappear_cb, NULL);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
|
sd->files_raw = evas_list_remove_list(sd->files_raw, sd->files_raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
e_icon_layout_thaw(sd->layout);
|
e_icon_layout_thaw(sd->layout);
|
||||||
|
@ -1566,28 +1591,8 @@ _e_fm_dir_files_get(void *data)
|
||||||
e_icon_layout_virtual_size_get(sd->layout, &sd->child.w, &sd->child.h);
|
e_icon_layout_virtual_size_get(sd->layout, &sd->child.w, &sd->child.h);
|
||||||
evas_object_smart_callback_call(sd->object, "changed", NULL);
|
evas_object_smart_callback_call(sd->object, "changed", NULL);
|
||||||
|
|
||||||
if(!dir_entry) {
|
if(!sd->files_raw) {
|
||||||
closedir(sd->dir2);
|
|
||||||
|
|
||||||
sd->files = evas_list_sort(sd->files,
|
|
||||||
evas_list_count(sd->files),
|
|
||||||
_e_fm_files_sort_name_cb);
|
|
||||||
// e_icon_layout_sort(sd->layout, _e_fm_files_sort_layout_name_cb);
|
|
||||||
|
|
||||||
|
|
||||||
e_icon_layout_freeze(sd->layout);
|
|
||||||
e_icon_layout_reset(sd->layout);
|
|
||||||
|
|
||||||
for(l = sd->files; l; l = l->next)
|
|
||||||
{
|
|
||||||
icon = l->data;
|
|
||||||
e_icon_layout_pack(sd->layout, icon->icon_object);
|
|
||||||
e_icon_layout_icon_callbacks_set(icon->icon_object, e_fm_icon_appear_cb, e_fm_icon_disappear_cb, NULL);
|
|
||||||
}
|
|
||||||
e_icon_layout_thaw(sd->layout);
|
|
||||||
|
|
||||||
sd->timer = NULL;
|
sd->timer = NULL;
|
||||||
|
|
||||||
if(!sd->meta)
|
if(!sd->meta)
|
||||||
{
|
{
|
||||||
printf("Generating Meta!\n");
|
printf("Generating Meta!\n");
|
||||||
|
@ -3237,8 +3242,6 @@ _e_fm_dir_meta_load(E_Fm_Smart_Data *sd)
|
||||||
E_Fm_Icon_Metadata *im;
|
E_Fm_Icon_Metadata *im;
|
||||||
|
|
||||||
im = l->data;
|
im = l->data;
|
||||||
printf("loading %s\n", im->name);
|
|
||||||
m->files = evas_list_append(m->files, im);
|
|
||||||
m->files_hash = evas_hash_add(m->files_hash, im->name, im);
|
m->files_hash = evas_hash_add(m->files_hash, im->name, im);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3255,6 +3258,7 @@ _e_fm_dir_meta_generate(E_Fm_Smart_Data *sd)
|
||||||
|
|
||||||
if (!sd->dir) return 0;
|
if (!sd->dir) return 0;
|
||||||
m = calloc(1, sizeof(E_Fm_Dir_Metadata));
|
m = calloc(1, sizeof(E_Fm_Dir_Metadata));
|
||||||
|
m->files = NULL;
|
||||||
if (!m) return 0;
|
if (!m) return 0;
|
||||||
_e_fm_dir_meta_fill(m, sd);
|
_e_fm_dir_meta_fill(m, sd);
|
||||||
for (l = sd->files; l; l = l->next)
|
for (l = sd->files; l; l = l->next)
|
||||||
|
@ -3266,7 +3270,6 @@ _e_fm_dir_meta_generate(E_Fm_Smart_Data *sd)
|
||||||
im = e_fm_icon_meta_generate(icon->icon_object);
|
im = e_fm_icon_meta_generate(icon->icon_object);
|
||||||
if (im)
|
if (im)
|
||||||
{
|
{
|
||||||
printf("adding %s\n", im->name);
|
|
||||||
m->files = evas_list_append(m->files, im);
|
m->files = evas_list_append(m->files, im);
|
||||||
m->files_hash = evas_hash_add(m->files_hash, icon->file->name, im);
|
m->files_hash = evas_hash_add(m->files_hash, icon->file->name, im);
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,16 +214,20 @@ e_icon_layout_pack(Evas_Object *obj, Evas_Object *child)
|
||||||
li->x, li->y, li->w, li->h))
|
li->x, li->y, li->w, li->h))
|
||||||
{
|
{
|
||||||
li->appear_func(obj, li->data);
|
li->appear_func(obj, li->data);
|
||||||
|
/*
|
||||||
printf("appear! %d %d %d %d - %d %d %d %d\n",sd->viewport.x, sd->viewport.y,
|
printf("appear! %d %d %d %d - %d %d %d %d\n",sd->viewport.x, sd->viewport.y,
|
||||||
sd->viewport.w, sd->viewport.h,
|
sd->viewport.w, sd->viewport.h,
|
||||||
li->x, li->y, li->w, li->h);
|
li->x, li->y, li->w, li->h);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
li->disappear_func(obj, li->data);
|
li->disappear_func(obj, li->data);
|
||||||
|
/*
|
||||||
printf("disappear! %d %d %d %d - %d %d %d %d\n",sd->viewport.x, sd->viewport.y,
|
printf("disappear! %d %d %d %d - %d %d %d %d\n",sd->viewport.x, sd->viewport.y,
|
||||||
sd->viewport.w, sd->viewport.h,
|
sd->viewport.w, sd->viewport.h,
|
||||||
li->x, li->y, li->w, li->h);
|
li->x, li->y, li->w, li->h);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -458,17 +462,20 @@ _e_icon_layout_smart_reconfigure(E_Smart_Data *sd)
|
||||||
sd->viewport.w, sd->viewport.h,
|
sd->viewport.w, sd->viewport.h,
|
||||||
li->x, li->y, li->w, li->h))
|
li->x, li->y, li->w, li->h))
|
||||||
{
|
{
|
||||||
printf("appear! %d %d %d %d - %d %d %d %d\n",sd->viewport.x, sd->viewport.y,
|
/* printf("appear! %d %d %d %d - %d %d %d %d\n",sd->viewport.x, sd->viewport.y,
|
||||||
sd->viewport.w, sd->viewport.h,
|
sd->viewport.w, sd->viewport.h,
|
||||||
li->x, li->y, li->w, li->h);
|
li->x, li->y, li->w, li->h);
|
||||||
|
*/
|
||||||
li->appear_func(obj, li->data);
|
li->appear_func(obj, li->data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
li->disappear_func(obj, li->data);
|
li->disappear_func(obj, li->data);
|
||||||
|
/*
|
||||||
printf("disappear! %d %d %d %d - %d %d %d %d\n",sd->viewport.x, sd->viewport.y,
|
printf("disappear! %d %d %d %d - %d %d %d %d\n",sd->viewport.x, sd->viewport.y,
|
||||||
sd->viewport.w, sd->viewport.h,
|
sd->viewport.w, sd->viewport.h,
|
||||||
li->x, li->y, li->w, li->h);
|
li->x, li->y, li->w, li->h);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_e_icon_layout_smart_move_resize_item(li);
|
_e_icon_layout_smart_move_resize_item(li);
|
||||||
|
@ -656,17 +663,21 @@ _e_icon_layout_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
|
||||||
sd->viewport.w, sd->viewport.h,
|
sd->viewport.w, sd->viewport.h,
|
||||||
ox + dx, oy + dy, li->w, li->h))
|
ox + dx, oy + dy, li->w, li->h))
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
printf("appear! %d %d %d %d - %d %d %d %d\n",sd->viewport.x, sd->viewport.y,
|
printf("appear! %d %d %d %d - %d %d %d %d\n",sd->viewport.x, sd->viewport.y,
|
||||||
sd->viewport.w, sd->viewport.h,
|
sd->viewport.w, sd->viewport.h,
|
||||||
li->x, li->y, li->w, li->h);
|
li->x, li->y, li->w, li->h);
|
||||||
|
*/
|
||||||
li->appear_func(li->obj, li->data);
|
li->appear_func(li->obj, li->data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
li->disappear_func(li->obj, li->data);
|
li->disappear_func(li->obj, li->data);
|
||||||
|
/*
|
||||||
printf("disappear! %d %d %d %d - %d %d %d %d\n",sd->viewport.x, sd->viewport.y,
|
printf("disappear! %d %d %d %d - %d %d %d %d\n",sd->viewport.x, sd->viewport.y,
|
||||||
sd->viewport.w, sd->viewport.h,
|
sd->viewport.w, sd->viewport.h,
|
||||||
ox + dx, oy + dy, li->w, li->h);
|
ox + dx, oy + dy, li->w, li->h);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue