Enlightenment CVS committal Author : onefang Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_apps.c e_apps.h e_int_config_apps.c Log Message: Make app deleting work. Sometimes the crude method is the best. =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_apps.c,v retrieving revision 1.156 retrieving revision 1.157 diff -u -3 -r1.156 -r1.157 --- e_apps.c 31 Aug 2006 00:50:57 -0000 1.156 +++ e_apps.c 31 Aug 2006 02:21:00 -0000 1.157 @@ -813,6 +813,87 @@ } EAPI void +e_app_remove_from_order(E_App *a) +{ + Evas_List *l; + char buf[PATH_MAX]; + + if (!a) return; + if (!a->parent) return; + + a->parent->subapps = evas_list_remove(a->parent->subapps, a); + _e_app_save_order(a->parent); + snprintf(buf, sizeof(buf), "%s/.eap.cache.cfg", a->parent->path); + ecore_file_unlink(buf); + _e_app_change(a, E_APP_DEL); + a->parent = NULL; + e_object_unref(E_OBJECT(a)); +} + + +EAPI void +e_app_remove_file_from_order(const char *order, const char *file) +{ + char buf[4096]; + Evas_List *list = NULL, *l; + int ret = 0; + FILE *f; + +printf("E_APP_REMOVE_FILE_FROM_ORDER(%s, %s)\n", order, file); + snprintf(buf, sizeof(buf), "%s/.order", order); +printf("E_APP_REMOVE_FILE_FROM_ORDER(%s, %s) - %s\n", order, file, buf); + if (!ecore_file_exists(buf)) return; +printf("E_APP_REMOVE_FILE_FROM_ORDER(%s, %s) - EXISTS\n", order, file); + f = fopen(buf, "rb"); + if (!f) return; +printf("E_APP_REMOVE_FILE_FROM_ORDER(%s, %s) - OPENED FOR READING\n", order, file); + + while (fgets(buf, sizeof(buf), f)) + { + int len; + + len = strlen(buf); + if (len > 0) + { + if (buf[len - 1] == '\n') + { + buf[len - 1] = 0; + len--; + } +printf("E_APP_REMOVE_FILE_FROM_ORDER(%s, %s) - %s == %s\n", order, file, buf, file); + if (strcmp(buf, file) != 0) + list = evas_list_append(list, strdup(buf)); + } + } + fclose(f); + +printf("E_APP_REMOVE_FILE_FROM_ORDER(%s, %s) - READ\n", order, file); + snprintf(buf, sizeof(buf), "%s/.order", order); + ecore_file_unlink(buf); +printf("E_APP_REMOVE_FILE_FROM_ORDER(%s, %s) - DELETED\n", order, file); + f = fopen(buf, "wb"); + if (!f) return; +printf("E_APP_REMOVE_FILE_FROM_ORDER(%s, %s) - OPENED FOR WRITING\n", order, file); + for (l = list; l; l = l->next) + { + char *text; + + text = l->data; + fprintf(f, "%s\n", text); + free(text); + } + fclose(f); + evas_list_free(list); + +printf("E_APP_REMOVE_FILE_FROM_ORDER(%s, %s) - WRITTEN\n", order, file); + snprintf(buf, sizeof(buf), "%s/.eap.cache.cfg", order); + ecore_file_unlink(buf); +printf("E_APP_REMOVE_FILE_FROM_ORDER(%s, %s) - CACHE NUKED\n", order, file); + + return; +} + +EAPI void e_app_change_callback_add(void (*func) (void *data, E_App *a, E_App_Change ch), void *data) { E_App_Callback *cb; =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_apps.h,v retrieving revision 1.35 retrieving revision 1.36 diff -u -3 -r1.35 -r1.36 --- e_apps.h 16 Aug 2006 09:37:14 -0000 1.35 +++ e_apps.h 31 Aug 2006 02:21:00 -0000 1.36 @@ -112,6 +112,8 @@ EAPI void e_app_files_prepend_relative (Evas_List *files, E_App *before); EAPI void e_app_files_append (Evas_List *files, E_App *parent); EAPI void e_app_remove (E_App *a); +EAPI void e_app_remove_from_order (E_App *a); +EAPI void e_app_remove_file_from_order (const char *order, const char *file); EAPI void e_app_change_callback_add (void (*func) (void *data, E_App *a, E_App_Change ch), void *data); EAPI void e_app_change_callback_del (void (*func) (void *data, E_App *a, E_App_Change ch), void *data); =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_int_config_apps.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- e_int_config_apps.c 31 Aug 2006 00:50:57 -0000 1.11 +++ e_int_config_apps.c 31 Aug 2006 02:21:00 -0000 1.12 @@ -249,6 +249,8 @@ E_Config_Dialog_Data *cfdata; Evas_List *l; E_Fm2_Icon_Info *ici; + const char *realpath; + char buf[4096]; cfdata = data1; if (!cfdata->gui.o_fm_all) return; @@ -258,6 +260,9 @@ if (!l) return; ici = l->data; evas_list_free(l); + +#if 0 + /* This just isn't working, lets try the crude method instead. */ for (l = cfdata->parent_all->subapps; l; l = l->next) { E_App *a2; @@ -271,6 +276,17 @@ break; } } +#else + realpath = e_fm2_real_path_get(cfdata->gui.o_fm_all); + if (!strcmp(realpath, "/")) + snprintf(buf, sizeof(buf), "/%s", ici->file); + else + snprintf(buf, sizeof(buf), "%s/%s", realpath, ici->file); + ecore_file_unlink(buf); + snprintf(buf, sizeof(buf), "%s/.eap.cache.cfg", realpath); + ecore_file_unlink(buf); + e_fm2_refresh(cfdata->gui.o_fm_all); +#endif } static void @@ -279,15 +295,19 @@ E_Config_Dialog_Data *cfdata; Evas_List *l; E_Fm2_Icon_Info *ici; + const char *realpath; cfdata = data1; if (!cfdata->gui.o_fm) return; - if (!cfdata->parent) return; l = e_fm2_selected_list_get(cfdata->gui.o_fm); if (!l) return; ici = l->data; evas_list_free(l); + +#if 0 + /* This just isn't working, lets try the crude method instead. */ + if (!cfdata->parent) return; for (l = cfdata->parent->subapps; l; l = l->next) { E_App *a2; @@ -296,11 +316,16 @@ if ((a2->deleted) || ((a2->orig) && (a2->orig->deleted))) continue; if (!strcmp(ecore_file_get_file(a2->path), ecore_file_get_file(ici->file))) { - e_app_remove(a2); + e_app_remove_from_order(a2); e_fm2_refresh(cfdata->gui.o_fm); break; } } +#else + realpath = e_fm2_real_path_get(cfdata->gui.o_fm); + e_app_remove_file_from_order(realpath, ecore_file_get_file(ici->file)); + e_fm2_refresh(cfdata->gui.o_fm); +#endif } static void ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs