diff --git a/experimental/ecdb/trunk/src/ecdb.c b/experimental/ecdb/trunk/src/ecdb.c index 6aba9ea0..1c7a63c7 100644 --- a/experimental/ecdb/trunk/src/ecdb.c +++ b/experimental/ecdb/trunk/src/ecdb.c @@ -14,6 +14,12 @@ main(int argc, char **argv) { int ret = 0; + if (!eina_init()) + { + printf("Cannot initialize Eina!\n"); + return 1; + } + /* Do I really need all of these? */ if (!ecore_init()) { @@ -150,6 +156,7 @@ SHUTDOWN: ecore_shutdown(); edje_shutdown(); efreet_shutdown(); + eina_shutdown(); printf("Program Done\n"); return ret; @@ -162,7 +169,6 @@ ecdb_setup(void) em = calloc(1, sizeof(Ecdb_Main)); em->drives = NULL; em->drop_object = NULL; - em->dnd_candidates = ecore_list_new(); if (!ecore_file_mkdir("/tmp/ecdb")) { diff --git a/experimental/ecdb/trunk/src/ecdb.h b/experimental/ecdb/trunk/src/ecdb.h index f34d0a17..d8c19b7d 100644 --- a/experimental/ecdb/trunk/src/ecdb.h +++ b/experimental/ecdb/trunk/src/ecdb.h @@ -34,8 +34,8 @@ struct _Ecdb_Main { char theme_path[PATH_MAX]; Ecore_Evas *main_win_ee; - Ecore_List *drives; - Ecore_List *dnd_candidates; + Eina_List *drives; + Eina_List *dnd_candidates; Evas_Object *drop_object; }; diff --git a/experimental/ecdb/trunk/src/ecdb_burn.c b/experimental/ecdb/trunk/src/ecdb_burn.c index b2b1fa7e..a7a258ee 100644 --- a/experimental/ecdb/trunk/src/ecdb_burn.c +++ b/experimental/ecdb/trunk/src/ecdb_burn.c @@ -6,8 +6,8 @@ struct Burn_Data { BurnDisc *disc; BurnSession *session; - Ecore_List *sources; - Ecore_List *tracks; + Eina_List *sources; + Eina_List *tracks; Ecdb_Project *proj; }; @@ -16,8 +16,8 @@ int ecdb_burn_project_init(Ecdb_Burn_Project *proj); int ecdb_erase_project_init(Ecdb_Erase_Project *proj); static void ecdb_burn_progress_handler(void *data, void *buffer, unsigned int nbyte); -void ecdb_sources_list_free(void *data); -void ecdb_tracks_list_free(void *data); +void ecdb_sources_list_free(Eina_List *list); +void ecdb_tracks_list_free(Eina_List *list); Ecdb_Burn_Project * @@ -91,10 +91,6 @@ ecdb_burn_project(Ecdb_Burn_Project *proj) return FALSE; } data->proj = ECDB_PROJECT(proj); - data->sources = ecore_list_new(); - data->tracks = ecore_list_new(); - ecore_list_free_cb_set(data->sources, ecdb_sources_list_free); - ecore_list_free_cb_set(data->tracks, ecdb_tracks_list_free); if (proj->burn_mode != BURN_AUDIO) padding = 300*1024; @@ -112,8 +108,8 @@ ecdb_burn_project(Ecdb_Burn_Project *proj) printf("Failed to add any files to burn disc!\n"); burn_session_free(data->session); burn_disc_free(data->disc); - ecore_list_destroy(data->sources); - ecore_list_destroy(data->tracks); + ecdb_sources_list_free(data->sources); + ecdb_tracks_list_free(data->tracks); FREE(data); return ECDB_ERROR_IMAGE_CREATE; } @@ -123,15 +119,15 @@ ecdb_burn_project(Ecdb_Burn_Project *proj) printf("Error: Cannot attach source object to track object!\n"); burn_session_free(data->session); burn_disc_free(data->disc); - ecore_list_destroy(data->sources); - ecore_list_destroy(data->tracks); + ecdb_sources_list_free(data->sources); + ecdb_tracks_list_free(data->tracks); FREE(data); return ECDB_ERROR_SOURCE_ATTACH; } burn_session_add_track(data->session, track, BURN_POS_END); - ecore_list_append(data->sources, source); - ecore_list_append(data->tracks, track); + data->sources = eina_list_append(data->sources, source); + data->tracks = eina_list_append(data->tracks, track); opts = burn_write_opts_new(ECDB_PROJECT(proj)->drive->tangible[0].drive); burn_write_opts_set_perform_opc(opts, proj->opc); @@ -153,8 +149,8 @@ ecdb_burn_project(Ecdb_Burn_Project *proj) burn_session_free(data->session); burn_disc_free(data->disc); burn_write_opts_free(opts); - ecore_list_destroy(data->sources); - ecore_list_destroy(data->tracks); + ecdb_sources_list_free(data->sources); + ecdb_tracks_list_free(data->tracks); FREE(proj); return ECDB_ERROR_WRITE_MODE; } @@ -271,8 +267,8 @@ ecdb_burn_finished(void *data, int type, void *event) proj = data; printf("Freeing source and tracks\n"); - ecore_list_destroy(proj->sources); - ecore_list_destroy(proj->tracks); + ecdb_sources_list_free(proj->sources); + ecdb_tracks_list_free(proj->tracks); printf("Freeing session and disc\n"); burn_session_free(proj->session); @@ -302,13 +298,25 @@ ecdb_burn_finished(void *data, int type, void *event) } void -ecdb_sources_list_free(void *data) +ecdb_sources_list_free(Eina_List *list) { - burn_source_free(data); + Eina_List *l; + void *data; + + EINA_LIST_FOREACH(list, l, data) + burn_source_free(data); + + list = eina_list_free(list); } void -ecdb_tracks_list_free(void *data) +ecdb_tracks_list_free(Eina_List *list) { - burn_track_free(data); + Eina_List *l; + void *data; + + EINA_LIST_FOREACH(list, l, data) + burn_track_free(data); + + list = eina_list_free(list); } diff --git a/experimental/ecdb/trunk/src/ecdb_drives.c b/experimental/ecdb/trunk/src/ecdb_drives.c index 57861e6a..dd1b97db 100644 --- a/experimental/ecdb/trunk/src/ecdb_drives.c +++ b/experimental/ecdb/trunk/src/ecdb_drives.c @@ -1,8 +1,6 @@ /* vim: set sw=3 ts=3 sts=3 expandtab: */ #include "ecdb.h" -void ecdb_drive_info_free_cb(void *data); - int ecdb_aquire_drive_info(void) { @@ -14,12 +12,9 @@ ecdb_aquire_drive_info(void) ret = 0; if (em->drives) { - ecore_list_destroy(em->drives); + ecdb_drive_info_list_free(em->drives); } - em->drives = ecore_list_new(); - ecore_list_free_cb_set(em->drives, ecdb_drive_info_free_cb); - while (!ret) { ret = burn_drive_scan(&drives_current, &drive_num); @@ -76,7 +71,7 @@ ecdb_aquire_drive_info(void) } burn_drive_free_speedlist(&speeds); - ecore_list_append(em->drives, drive); + em->drives = eina_list_append(em->drives, drive); } burn_drive_info_free(drives_current); @@ -85,30 +80,35 @@ ecdb_aquire_drive_info(void) } void -ecdb_drive_info_free_cb(void *data) +ecdb_drive_info_list_free(Eina_List *list) { Ecdb_Drive_Info *info; + Eina_List *l; - info = data; + EINA_LIST_FOREACH(list, l, info) + { + FREE(info->read_speeds); + FREE(info->write_speeds); + FREE(info->vendor); + FREE(info->product); + FREE(info->revision); + FREE(info->location); + FREE(info->profile_name); + FREE(info); + } - FREE(info->read_speeds); - FREE(info->write_speeds); - FREE(info->vendor); - FREE(info->product); - FREE(info->revision); - FREE(info->location); - FREE(info->profile_name); - FREE(info); + list = eina_list_free(list); } void ecdb_print_drive_info(void) { + Eina_List *l; Ecdb_Drive_Info *drive; int j, i, h; - ecore_list_first_goto(em->drives); - while ((drive = ecore_list_next(em->drives))) + em->drives = eina_list_nth_list(em->drives, 0); + EINA_LIST_FOREACH(em->drives, l, drive) { printf("Vendor: %s, Product: %s, Revision: %s, " "Location: %s\n", @@ -153,7 +153,7 @@ ecdb_aquire_drive(Ecdb_Project *proj, unsigned int idx) Ecdb_Drive_Info *info; char adr[BURN_DRIVE_ADR_LEN]; - info = ecore_list_index_goto(em->drives, idx); + info = eina_list_nth(em->drives, idx); if (burn_drive_convert_fs_adr(info->location, adr) <= 0) { printf("Error: Address doesn't provide cd burner!\n"); diff --git a/experimental/ecdb/trunk/src/ecdb_drives.h b/experimental/ecdb/trunk/src/ecdb_drives.h index 1aac3b39..f752a049 100644 --- a/experimental/ecdb/trunk/src/ecdb_drives.h +++ b/experimental/ecdb/trunk/src/ecdb_drives.h @@ -5,5 +5,6 @@ int ecdb_aquire_drive_info(void); void ecdb_print_drive_info(void); int ecdb_aquire_drive(Ecdb_Project *proj, unsigned int idx); +void ecdb_drive_info_list_free(Eina_List *list); #endif diff --git a/experimental/ecdb/trunk/src/ecdb_filelist_custom.c b/experimental/ecdb/trunk/src/ecdb_filelist_custom.c index d30f5fde..db1d71b1 100644 --- a/experimental/ecdb/trunk/src/ecdb_filelist_custom.c +++ b/experimental/ecdb/trunk/src/ecdb_filelist_custom.c @@ -109,12 +109,7 @@ ecdb_custom_filelist_directory_new(Ecdb_Source *parent) struct stat st; int nf = 0, nd = 0, i = 0; - Ecore_List *files, *dirs; - - files = ecore_list_new(); - dirs = ecore_list_new(); - ecore_list_free_cb_set(files, ECORE_FREE_CB(free_file)); - ecore_list_free_cb_set(dirs, ECORE_FREE_CB(free_file)); + Eina_List *files = NULL, *dirs = NULL; if (!parent) { @@ -138,13 +133,12 @@ ecdb_custom_filelist_directory_new(Ecdb_Source *parent) if (src->dir) { - ecore_list_append(dirs, file); + dirs = eina_list_append(dirs, file); nd++; } - else { - ecore_list_append(files, file); + files = eina_list_append(files, file); nf++; } @@ -152,8 +146,6 @@ ecdb_custom_filelist_directory_new(Ecdb_Source *parent) } dir = calloc(1, sizeof(Ewl_Filelist_Directory)); - dir->files = ecore_list_new(); - dir->dirs = ecore_list_new(); dir->rfiles = files; dir->rdirs = dirs; dir->num_dirs = nd; @@ -165,55 +157,63 @@ ecdb_custom_filelist_directory_new(Ecdb_Source *parent) } static void -free_file(Ewl_Filelist_File *file) +ecdb_files_list_free(Eina_List *list) { - eina_stringshare_del(file->name); - FREE(file); + Eina_List *l; + Ewl_Filelist_File *file; + + EINA_LIST_FOREACH(list, l, file) + { + eina_stringshare_del(file->name); + FREE(file); + } + list = eina_list_free(list); } static void ecdb_custom_filelist_model_filter(Ewl_Filelist_Directory *dir) { Ewl_Filelist_File *file; + Eina_List *l; int nd, nf; - ecore_list_clear(dir->files); - ecore_list_clear(dir->dirs); + dir->files = eina_list_free(dir->files); + dir->dirs = eina_list_free(dir->dirs); nd = nf = 0; if (!dir->show_dot) { - ecore_list_first_goto(dir->rfiles); - while ((file = ecore_list_next(dir->rfiles))) + dir->rfiles = eina_list_nth_list(dir->rfiles, 0); + EINA_LIST_FOREACH(dir->rfiles, l, file) { if (ecore_file_file_get(file->name)[0] != '.') { - ecore_list_append(dir->files, file); + dir->files = eina_list_append(dir->files, file); nf++; } } - ecore_list_first_goto(dir->rdirs); - while ((file = ecore_list_next(dir->rdirs))) + dir->rdirs = eina_list_nth_list(dir->files, 0); + EINA_LIST_FOREACH(dir->rdirs, l, file) { if (ecore_file_file_get(file->name)[0] != '.') { - ecore_list_append(dir->dirs, file); + dir->dirs = eina_list_append(dir->dirs, file); nd++; } } } else { - ecore_list_first_goto(dir->rfiles); - while ((file = ecore_list_next(dir->rfiles))) + dir->rfiles = eina_list_nth_list(dir->rfiles, 0); + EINA_LIST_FOREACH(dir->rfiles, l, file) { - ecore_list_append(dir->files, file); + dir->files = eina_list_append(dir->files, file); nf++; } - ecore_list_first_goto(dir->rdirs); - while ((file = ecore_list_next(dir->rdirs))) + dir->rdirs = eina_list_nth_list(dir->rdirs, 0); + EINA_LIST_FOREACH(dir->rdirs, l, file) { - ecore_list_append(dir->dirs, file); + dir->dirs = eina_list_append(dir->dirs, file); nd++; } } @@ -228,10 +228,10 @@ ecdb_custom_filelist_model_data_unref(void *data) Ewl_Filelist_Directory *dir; dir = data; - ecore_list_destroy(dir->files); - ecore_list_destroy(dir->dirs); - ecore_list_destroy(dir->rfiles); - ecore_list_destroy(dir->rdirs); + ecdb_files_list_free(dir->files); + ecdb_files_list_free(dir->dirs); + ecdb_files_list_free(dir->rfiles); + ecdb_files_list_free(dir->rdirs); FREE(dir); return TRUE; } @@ -250,12 +250,12 @@ ecdb_custom_filelist_model_data_fetch(void *data, unsigned int row, /* Check if in dirs or files list */ if (row < fld->num_dirs) { - file = ecore_list_index_goto(fld->dirs, row); + file = eina_list_nth(fld->dirs, row); } else { i = (row - fld->num_dirs); - file = ecore_list_index_goto(fld->files, i); + file = eina_list_nth(fld->files, i); } if (column == 1) ret = ewl_filelist_size_get(file->size); @@ -341,12 +341,12 @@ ecdb_custom_filelist_selected_file_get(Ewl_Filelist *fl) data = EWL_SELECTION(idx)->data; if (idx->row < data->num_dirs) { - file = ecore_list_index_goto(data->dirs, idx->row); + file = eina_list_nth(data->dirs, idx->row); } else { i = (idx->row - data->num_dirs); - file = ecore_list_index_goto(data->files, i); + file = eina_list_nth(data->files, i); } FREE(idx); diff --git a/experimental/ecdb/trunk/src/ecdb_gui.c b/experimental/ecdb/trunk/src/ecdb_gui.c index 821391e4..0929c048 100644 --- a/experimental/ecdb/trunk/src/ecdb_gui.c +++ b/experimental/ecdb/trunk/src/ecdb_gui.c @@ -869,7 +869,7 @@ ecdb_burn_image_page_show(void) } else if (!strcmp("ecdb/entry", wtype[i])) { - ecore_list_append(em->dnd_candidates, b); + em->dnd_candidates = eina_list_append(em->dnd_candidates, b); evas_object_data_set(b, "dnd_call_func", ecdb_dnd_entry_dnd_set); } } diff --git a/experimental/ecdb/trunk/src/ecdb_misc.c b/experimental/ecdb/trunk/src/ecdb_misc.c index 5ae2c15a..0bb47ea7 100644 --- a/experimental/ecdb/trunk/src/ecdb_misc.c +++ b/experimental/ecdb/trunk/src/ecdb_misc.c @@ -43,11 +43,11 @@ ecdb_shutdown(void *data, int type, void *event) { if (em->drives) { - ecore_list_destroy(em->drives); + ecdb_drive_info_list_free(em->drives); } if (em->dnd_candidates) { - ecore_list_destroy(em->dnd_candidates); + eina_list_free(em->dnd_candidates); } FREE(em); @@ -181,6 +181,7 @@ ecdb_button_icon_swallow(Evas *e, Evas_Object *b, const char *iname) int ecdb_dnd_position(void *data, int type, void *event) { + Eina_List *l; Ecore_X_Event_Xdnd_Position *ev; Evas_Object *o; Ecore_X_Rectangle rect; @@ -194,8 +195,8 @@ ecdb_dnd_position(void *data, int type, void *event) ecore_evas_geometry_get(em->main_win_ee, &window_x, &window_y, &window_w, &window_h); - ecore_list_first_goto(em->dnd_candidates); - while ((o = ecore_list_next(em->dnd_candidates))) + em->dnd_candidates = eina_list_nth_list(em->dnd_candidates, 0); + EINA_LIST_FOREACH(em->dnd_candidates, l, o) { if (evas_object_visible_get(o)) {