Enlightenment CVS committal Author : raster Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_fm.c e_fm_main.c e_fwin.c e_zone.c Log Message: work on the fm - no more segv if no Desktop dir - i hope =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_fm.c,v retrieving revision 1.169 retrieving revision 1.170 diff -u -3 -r1.169 -r1.170 --- e_fm.c 16 May 2007 11:20:04 -0000 1.169 +++ e_fm.c 20 May 2007 08:41:35 -0000 1.170 @@ -526,6 +526,12 @@ sd->custom_theme = evas_stringshare_add(path); else sd->custom_theme = NULL; + _e_fm2_theme_edje_object_set(sd, sd->drop, "base/theme/fileman", + "e/fileman/list/drop_between"); + _e_fm2_theme_edje_object_set(sd, sd->drop_in, "base/theme/fileman", + "e/fileman/list/drop_in"); + _e_fm2_theme_edje_object_set(sd, sd->overlay, "base/theme/fileman", + "e/fileman/overlay"); } EAPI void @@ -1890,10 +1896,12 @@ if (!strcmp(path, "/")) { PRT("%s/Desktop", s); + ecore_file_mkpath(buf); } else { PRT("%s/Desktop-%s", s, path); + ecore_file_mkpath(buf); } } else if (CMP("dvd") || CMP("dvd-*")) { @@ -6502,7 +6510,6 @@ { if (sd->custom_theme) { - /* FIXME: need a way of caching what elements are and are not in the custom theme */ if (edje_object_file_set(o, sd->custom_theme, group)) return 1; } if (sd->custom_theme) =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_fm_main.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- e_fm_main.c 6 May 2007 16:23:11 -0000 1.14 +++ e_fm_main.c 20 May 2007 08:41:36 -0000 1.15 @@ -36,9 +36,11 @@ #define DEF_SYNC_NUM 8 #define DEF_ROUND_TRIP 0.05 #define DEF_ROUND_TRIP_TOLERANCE 0.01 +#define DEF_MOD_BACKOFF 0.2 typedef struct _E_Dir E_Dir; typedef struct _E_Fop E_Fop; +typedef struct _E_Mod E_Mod; struct _E_Dir { @@ -53,6 +55,9 @@ int sync; double sync_time; int sync_num; + Evas_List *recent_mods; + Ecore_Timer *recent_clean; + unsigned char cleaning : 1; }; struct _E_Fop @@ -69,6 +74,16 @@ void *data; }; +struct _E_Mod +{ + const char *path; + double timestamp; + unsigned char add : 1; + unsigned char del : 1; + unsigned char mod : 1; + unsigned char done : 1; +}; + /* local subsystem functions */ static int _e_ipc_init(void); static int _e_ipc_cb_server_add(void *data, int type, void *event); @@ -76,12 +91,13 @@ static int _e_ipc_cb_server_data(void *data, int type, void *event); static void _e_cb_file_monitor(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path); +static int _e_cb_recent_clean(void *data); -static void _e_file_add_mod(int id, const char *path, int op, int listing); -static void _e_file_add(int id, const char *path, int listing); -static void _e_file_del(int id, const char *path); -static void _e_file_mod(int id, const char *path); -static void _e_file_mon_dir_del(int id, const char *path); +static void _e_file_add_mod(E_Dir *ed, const char *path, int op, int listing); +static void _e_file_add(E_Dir *ed, const char *path, int listing); +static void _e_file_del(E_Dir *ed, const char *path); +static void _e_file_mod(E_Dir *ed, const char *path); +static void _e_file_mon_dir_del(E_Dir *ed, const char *path); static void _e_file_mon_list_sync(E_Dir *ed); static int _e_cb_file_mon_list_idler(void *data); @@ -91,6 +107,7 @@ static int _e_cb_fop_cp_idler(void *data); static char *_e_str_list_remove(Evas_List **list, char *str); static void _e_path_fix_order(const char *path, const char *rel, int rel_to, int x, int y); +static void _e_dir_del(E_Dir *ed); /* local subsystem globals */ static Ecore_Ipc_Server *_e_ipc_server = NULL; @@ -224,9 +241,13 @@ dir = opendir(e->data); if (!dir) { + E_Dir ted; + /* we can't open the dir - tell E the dir is deleted as * we can't look in it */ - _e_file_mon_dir_del(e->ref, e->data); + memset(&ted, 0, sizeof(E_Dir)); + ted.id = e->ref; + _e_file_mon_dir_del(&ted, e->data); } else { @@ -244,13 +265,11 @@ { /* if no previous monitoring dir exists - this one * becomes the master monitor enty */ - printf("MON %s\n", ed->dir); ed->mon = ecore_file_monitor_add(ed->dir, _e_cb_file_monitor, ed); ed->mon_ref = 1; } else { - printf("REF ORIG\n"); /* an existing monitor exists - ref it up */ ed->mon_real = ped; ped->mon_ref++; @@ -296,6 +315,7 @@ files = f2; } } + ed->fq = files; /* FIXME: if .order file- load it, sort all items int it * that are in files then just append whatever is left in * alphabetical order @@ -314,14 +334,13 @@ else snprintf(buf, sizeof(buf), "%s/.order", (char *)e->data); if (evas_list_count(files) == 1) - _e_file_add(ed->id, buf, 2); + _e_file_add(ed, buf, 2); else - _e_file_add(ed->id, buf, 1); + _e_file_add(ed, buf, 1); } /* send empty file - indicate empty dir */ - if (!files) _e_file_add(ed->id, "", 2); + if (!files) _e_file_add(ed, "", 2); /* and in an idler - list files, statting them etc. */ - ed->fq = files; ed->idler = ecore_idler_add(_e_cb_file_mon_list_idler, ed); ed->sync_num = DEF_SYNC_NUM; } @@ -343,56 +362,24 @@ * real one */ if (ed->mon_real) { - printf("UNREF ORIG\n"); /* unref original monitor node */ ed->mon_real->mon_ref--; if (ed->mon_real->mon_ref == 0) { - printf("FREE ORIG\n"); /* original is at 0 ref - free it */ - evas_stringshare_del(ed->mon_real->dir); - if (ed->mon_real->idler) - ecore_idler_del(ed->mon_real->idler); - while (ed->mon_real->fq) - { - free(ed->mon_real->fq->data); - ed->mon_real->fq = evas_list_remove_list(ed->mon_real->fq, ed->mon_real->fq); - } - free(ed->mon_real); + _e_dir_del(ed->mon_real); ed->mon_real = NULL; } - printf("FREE THIS\n"); /* free this node */ - evas_stringshare_del(ed->dir); - if (ed->idler) ecore_idler_del(ed->idler); - while (ed->fq) - { - free(ed->fq->data); - ed->fq = evas_list_remove_list(ed->fq, ed->fq); - } - free(ed); + _e_dir_del(ed); } /* this is a core monitoring node - remove ref */ else { - printf("UNREF\n"); ed->mon_ref--; /* we are the last ref - free */ - if (ed->mon_ref == 0) - { - printf("UNMON %s\n", ed->dir); - ecore_file_monitor_del(ed->mon); - evas_stringshare_del(ed->dir); - if (ed->idler) ecore_idler_del(ed->idler); - while (ed->fq) - { - free(ed->fq->data); - ed->fq = evas_list_remove_list(ed->fq, ed->fq); - } - free(ed); - } + if (ed->mon_ref == 0) _e_dir_del(ed); } - printf("REMOVE FROM LIST\n"); /* remove from dirs list anyway */ _e_dirs = evas_list_remove_list(_e_dirs, l); break; @@ -593,17 +580,13 @@ if ((event == ECORE_FILE_EVENT_CREATED_FILE) || (event == ECORE_FILE_EVENT_CREATED_DIRECTORY)) { - printf("CREATE %s\n", path); rp = ecore_file_realpath(dir); for (l = _e_dirs; l; l = l->next) { ed = l->data; drp = ecore_file_realpath(ed->dir); if (!strcmp(rp, drp)) - { - printf("file add %s\n", path); - _e_file_add(ed->id, path, 0); - } + _e_file_add(ed, path, 0); free(drp); } free(rp); @@ -611,14 +594,13 @@ else if ((event == ECORE_FILE_EVENT_DELETED_FILE) || (event == ECORE_FILE_EVENT_DELETED_DIRECTORY)) { - printf("DEL %s\n", path); rp = ecore_file_realpath(dir); for (l = _e_dirs; l; l = l->next) { ed = l->data; drp = ecore_file_realpath(ed->dir); if (!strcmp(rp, drp)) - _e_file_del(ed->id, path); + _e_file_del(ed, path); } free(rp); } @@ -630,7 +612,7 @@ ed = l->data; drp = ecore_file_realpath(ed->dir); if (!strcmp(rp, drp)) - _e_file_mod(ed->id, path); + _e_file_mod(ed, path); } free(rp); } @@ -642,15 +624,46 @@ ed = l->data; drp = ecore_file_realpath(ed->dir); if (!strcmp(rp, drp)) - _e_file_mon_dir_del(ed->id, path); + _e_file_mon_dir_del(ed, path); } free(rp); } free(dir); } +static int +_e_cb_recent_clean(void *data) +{ + E_Dir *ed; + Evas_List *l, *pl; + E_Mod *m; + double t_now; + + ed = data; + ed->cleaning = 1; + t_now = ecore_time_get(); + for (l = ed->recent_mods; l;) + { + m = l->data; + pl = l; + l = l->next; + if ((m->mod) && ((t_now - m->timestamp) >= DEF_MOD_BACKOFF)) + { + ed->recent_mods = evas_list_remove_list(ed->recent_mods, pl); + if (!m->done) _e_file_add_mod(ed, m->path, 5, 0); + evas_stringshare_del(m->path); + free(m); + } + } + ed->cleaning = 0; + if (ed->recent_mods) return 1; + ed->recent_clean = NULL; + return 0; +} + + static void -_e_file_add_mod(int id, const char *path, int op, int listing) +_e_file_add_mod(E_Dir *ed, const char *path, int op, int listing) { struct stat st; char *lnk = NULL, *rlnk = NULL; @@ -661,7 +674,46 @@ * * stat_info[stat size] + broken_link[1] + path[n]\0 + lnk[n]\0 + rlnk[n]\0 */ [sizeof(struct stat) + 1 + 4096 + 4096 + 4096]; - + + /* FIXME: handle BACKOFF */ + if ((!listing) && (op == 5) && (!ed->cleaning)) /* 5 == mod */ + { + Evas_List *l; + E_Mod *m; + double t_now; + int skip = 0; + + t_now = ecore_time_get(); + for (l = ed->recent_mods; l; l = l->next) + { + m = l->data; + if ((m->mod) && (!strcmp(m->path, path))) + { + if ((t_now - m->timestamp) < DEF_MOD_BACKOFF) + { + m->done = 0; + skip = 1; + } + } + } + if (!skip) + { + m = calloc(1, sizeof(E_Mod)); + m->path = evas_stringshare_add(path); + m->mod = 1; + m->done = 1; + m->timestamp = t_now; + ed->recent_mods = evas_list_append(ed->recent_mods, m); + } + if ((!ed->recent_clean) && (ed->recent_mods)) + ed->recent_clean = ecore_timer_add(DEF_MOD_BACKOFF, _e_cb_recent_clean, ed); + if (skip) + { +// printf("SKIP MOD %s %3.3f\n", path, t_now); + return; + } + } +// printf("MOD %s %3.3f\n", path, ecore_time_get()); lnk = ecore_file_readlink(path); if (stat(path, &st) == -1) { @@ -694,40 +746,50 @@ p += strlen(rlnk) + 1; bsz = p - buf; - ecore_ipc_server_send(_e_ipc_server, 6/*E_IPC_DOMAIN_FM*/, op, 0, id, + ecore_ipc_server_send(_e_ipc_server, 6/*E_IPC_DOMAIN_FM*/, op, 0, ed->id, listing, buf, bsz); if (lnk) free(lnk); if (rlnk) free(rlnk); } static void -_e_file_add(int id, const char *path, int listing) +_e_file_add(E_Dir *ed, const char *path, int listing) { - _e_file_add_mod(id, path, 3, listing);/*file add*/ + if (!listing) + { + /* FIXME: handle BACKOFF */ + } + _e_file_add_mod(ed, path, 3, listing);/*file add*/ } static void -_e_file_del(int id, const char *path) +_e_file_del(E_Dir *ed, const char *path) { + { + /* FIXME: handle BACKOFF */ + } ecore_ipc_server_send(_e_ipc_server, 6/*E_IPC_DOMAIN_FM*/, 4/*file del*/, - 0, id, 0, (void *)path, strlen(path) + 1); + 0, ed->id, 0, (void *)path, strlen(path) + 1); } static void -_e_file_mod(int id, const char *path) +_e_file_mod(E_Dir *ed, const char *path) { - _e_file_add_mod(id, path, 5, 0);/*file change*/ + { + /* FIXME: handle BACKOFF */ + } + _e_file_add_mod(ed, path, 5, 0);/*file change*/ } static void -_e_file_mon_dir_del(int id, const char *path) +_e_file_mon_dir_del(E_Dir *ed, const char *path) { ecore_ipc_server_send(_e_ipc_server, 6/*E_IPC_DOMAIN_FM*/, 6/*mon dir del*/, - 0, id, 0, (void *)path, strlen(path) + 1); + 0, ed->id, 0, (void *)path, strlen(path) + 1); } static void @@ -764,9 +826,9 @@ if ((!ed->fq->next) || ((!strcmp(ed->fq->next->data, ".order")) && (!ed->fq->next->next))) - _e_file_add(ed->id, buf, 2); + _e_file_add(ed, buf, 2); else - _e_file_add(ed->id, buf, 1); + _e_file_add(ed, buf, 1); } free(file); ed->fq = evas_list_remove_list(ed->fq, ed->fq); @@ -1158,14 +1220,12 @@ if (!strcmp(f, rel)) return; d = ecore_file_get_dir(path); if (!d) return; - printf("_e_path_fix_order(%s, %s, %i, %i, %i)\n", path, rel, rel_to, x, y); snprintf(buf, sizeof(buf), "%s/.order", d); if (ecore_file_exists(buf)) { FILE *fh; Evas_List *files = NULL, *l; - printf(".order exists\n"); fh = fopen(buf, "r"); if (fh) { @@ -1186,7 +1246,6 @@ { if (!strcmp(l->data, f)) { - printf("REMOVE\n"); free(l->data); files = evas_list_remove_list(files, l); break; @@ -1197,7 +1256,6 @@ { if (!strcmp(l->data, rel)) { - printf("INSERT %s\n", (char *)l->data); if (rel_to == 2) /* replace */ { free(l->data); @@ -1220,7 +1278,6 @@ { while (files) { - printf("W %s\n", (char *)files->data); fprintf(fh, "%s\n", (char *)files->data); free(files->data); files = evas_list_remove_list(files, files); @@ -1229,4 +1286,28 @@ } } free(d); +} + +static void +_e_dir_del(E_Dir *ed) +{ + evas_stringshare_del(ed->dir); + if (ed->idler) ecore_idler_del(ed->idler); + if (ed->recent_clean) + ecore_timer_del(ed->recent_clean); + while (ed->recent_mods) + { + E_Mod *m; + + m = ed->recent_mods->data; + evas_stringshare_del(m->path); + free(m); + ed->recent_mods = evas_list_remove_list(ed->recent_mods, ed->recent_mods); + } + while (ed->fq) + { + free(ed->fq->data); + ed->fq = evas_list_remove_list(ed->fq, ed->fq); + } + free(ed); } =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_fwin.c,v retrieving revision 1.44 retrieving revision 1.45 diff -u -3 -r1.44 -r1.45 --- e_fwin.c 13 May 2007 13:03:40 -0000 1.44 +++ e_fwin.c 20 May 2007 08:41:36 -0000 1.45 @@ -225,16 +225,6 @@ if (!fwin) return NULL; fwin->zone = zone; fwins = evas_list_append(fwins, fwin); -/* - e_win_resize_callback_set(fwin->win, _e_fwin_cb_resize); - fwin->win->data = fwin; - - o = edje_object_add(e_win_evas_get(fwin->win)); - e_theme_edje_object_set(o, "base/theme/fileman", - "e/fileman/window/main"); - evas_object_show(o); - fwin->bg_obj = o; -*/ o = e_fm2_add(zone->container->bg_evas); fwin->fm_obj = o; @@ -294,7 +284,7 @@ * to specify the .edj files to get the list and icon theme stuff from */ e_scrollframe_custom_theme_set(o, "base/theme/fileman", - "e/fileman/scrollframe/default"); + "e/fileman/scrollframe/desktop"); evas_object_data_set(fwin->fm_obj, "fwin", fwin); e_scrollframe_extern_pan_set(o, fwin->fm_obj, _e_fwin_pan_set, @@ -307,39 +297,17 @@ evas_object_resize(fwin->scrollframe_obj, fwin->zone->w, fwin->zone->h); evas_object_show(o); -/* - o = edje_object_add(e_win_evas_get(fwin->win)); - edje_object_part_swallow(fwin->bg_obj, "e.swallow.bg", o); - evas_object_pass_events_set(o, 1); - fwin->under_obj = o; - - o = edje_object_add(e_win_evas_get(fwin->win)); - edje_object_part_swallow(e_scrollframe_edje_object_get(fwin->scrollframe_obj), "e.swallow.overlay", o); - evas_object_pass_events_set(o, 1); - fwin->over_obj = o; - */ - e_fm2_window_object_set(fwin->fm_obj, E_OBJECT(fwin->zone)); evas_object_focus_set(fwin->fm_obj, 1); e_fm2_path_set(fwin->fm_obj, dev, path); -/* - snprintf(buf, sizeof(buf), "_fwin::/%s", e_fm2_real_path_get(fwin->fm_obj)); - e_win_name_class_set(fwin->win, "E", buf); - */ file = ecore_file_get_file(e_fm2_real_path_get(fwin->fm_obj)); if (file) snprintf(buf, sizeof(buf), "%s", file); else snprintf(buf, sizeof(buf), "%s", e_fm2_real_path_get(fwin->fm_obj)); -/* - e_win_title_set(fwin->win, buf); - e_win_size_min_set(fwin->win, 24, 24); - e_win_resize(fwin->win, 280, 200); - e_win_show(fwin->win); - */ return fwin; } =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_zone.c,v retrieving revision 1.117 retrieving revision 1.118 diff -u -3 -r1.117 -r1.118 --- e_zone.c 13 May 2007 23:23:56 -0000 1.117 +++ e_zone.c 20 May 2007 08:41:36 -0000 1.118 @@ -657,9 +657,21 @@ } static void +_e_zone_cb_fwin_del(void *obj) +{ + E_Zone *zone; + + zone = (E_Zone *)e_object_data_get(E_OBJECT(obj)); + if (!zone) return; + zone->bg_fwin = NULL; +} + +static void _e_zone_fm_add(E_Zone *zone, const char *dev, const char *path) { zone->bg_fwin = e_fwin_zone_new(zone, dev, path); + e_object_data_set(E_OBJECT(zone->bg_fwin), zone); + e_object_del_attach_func_set(E_OBJECT(zone->bg_fwin), _e_zone_cb_fwin_del); } static void ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs