From c1b7f757742a38c1d2187871ff48bb2af65c8675 Mon Sep 17 00:00:00 2001 From: Jaime Thomas Date: Wed, 18 Mar 2009 01:26:39 +0000 Subject: [PATCH] Rid some useless eina_list_free calls, proper ecdb_source usage in filelist and burn data gui, and update to new EWL API. --- experimental/ecdb/trunk/src/ecdb_burn.c | 4 -- .../ecdb/trunk/src/ecdb_burn_data_gui.c | 7 +-- .../ecdb/trunk/src/ecdb_config_dialog.c | 6 +-- experimental/ecdb/trunk/src/ecdb_drives.c | 5 +- .../ecdb/trunk/src/ecdb_filelist_custom.c | 9 ++-- experimental/ecdb/trunk/src/ecdb_image.c | 54 +++++++++++++++++-- experimental/ecdb/trunk/src/ecdb_misc.c | 2 +- experimental/ecdb/trunk/src/ecdb_projects.c | 1 + 8 files changed, 64 insertions(+), 24 deletions(-) diff --git a/experimental/ecdb/trunk/src/ecdb_burn.c b/experimental/ecdb/trunk/src/ecdb_burn.c index 4ea9a408..f2cbbb76 100644 --- a/experimental/ecdb/trunk/src/ecdb_burn.c +++ b/experimental/ecdb/trunk/src/ecdb_burn.c @@ -299,8 +299,6 @@ ecdb_sources_list_free(Eina_List *list) EINA_LIST_FREE(list, data) burn_source_free(data); - - list = eina_list_free(list); } void @@ -310,6 +308,4 @@ ecdb_tracks_list_free(Eina_List *list) EINA_LIST_FREE(list, data) burn_track_free(data); - - list = eina_list_free(list); } diff --git a/experimental/ecdb/trunk/src/ecdb_burn_data_gui.c b/experimental/ecdb/trunk/src/ecdb_burn_data_gui.c index 1725b80d..b5918251 100644 --- a/experimental/ecdb/trunk/src/ecdb_burn_data_gui.c +++ b/experimental/ecdb/trunk/src/ecdb_burn_data_gui.c @@ -88,7 +88,7 @@ _update_capacity(Ewl_Widget *w, void *ev_info, void *data) proj = evas_object_data_get(page->data, "proj"); base_proj = ECDB_PROJECT(proj); - src = data; + src = ECDB_BURN(proj)->files; /* Find our topmost source */ while ((src) && (src->parent)) @@ -158,7 +158,6 @@ _button_cb_begin(void *data, Evas_Object *obj __UNUSED__, else ECDB_BURN(proj)->speed = speed; - ECDB_BURN(proj)->files = ewl_widget_data_get(proj->filelist, "source"); while (ECDB_BURN(proj)->files->parent) ECDB_BURN(proj)->files = ECDB_BURN(proj)->files->parent; @@ -564,6 +563,7 @@ ecdb_burn_data_page_show(Ecdb_Page *page) } embed = ewl_embed_new(); + ewl_embed_dnd_aware_remove(EWL_EMBED(embed)); ewl_object_fill_policy_set(EWL_OBJECT(embed), EWL_FLAG_FILL_ALL); proj->filelist_swallow = ewl_embed_canvas_set(EWL_EMBED(embed), evas_object_evas_get(bp->drive_combo), @@ -575,6 +575,7 @@ ecdb_burn_data_page_show(Ecdb_Page *page) ewl_container_child_append(EWL_CONTAINER(embed), proj->filelist); ewl_callback_append(proj->filelist, ECDB_FILELIST_SIZE_CHANGED, _update_capacity, page); + ewl_widget_data_set(proj->filelist, "src", bup->files); ewl_widget_show(proj->filelist); /* Add a delete callback so we can correctly free data that won't get @@ -723,7 +724,7 @@ ecdb_burn_data_cleanup(Ecdb_Page *page) edje_object_signal_emit(page->data, "ecdb,burn_data,done", "ecdb"); filelist = proj->filelist; - src = ewl_widget_data_get(filelist, "source"); + src = ewl_widget_data_get(filelist, "src"); while (src->parent) src = src->parent; diff --git a/experimental/ecdb/trunk/src/ecdb_config_dialog.c b/experimental/ecdb/trunk/src/ecdb_config_dialog.c index 37248680..a98596ad 100644 --- a/experimental/ecdb/trunk/src/ecdb_config_dialog.c +++ b/experimental/ecdb/trunk/src/ecdb_config_dialog.c @@ -123,7 +123,7 @@ ecdb_config_dialog_show(void) ewl_button_label_set(EWL_BUTTON(o), "Use scaling?"); ewl_container_child_append(EWL_CONTAINER(border_box), o); ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT); - ewl_checkbutton_checked_set(EWL_CHECKBUTTON(o), use_scale); + ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(o), use_scale); ewl_widget_show(o); ewl_callback_append(o, EWL_CALLBACK_CLICKED, use_scale_cb, l); @@ -451,8 +451,6 @@ combo_cb(Ewl_Widget *w, void *event __UNUSED__, void *data) EINA_LIST_FREE(data, str) free(str); - - eina_list_free(data); } static void @@ -460,7 +458,7 @@ use_scale_cb(Ewl_Widget *w, void *event __UNUSED__, void *data) { int use_scale; - use_scale = ewl_checkbutton_is_checked(EWL_CHECKBUTTON(w)); + use_scale = ewl_togglebutton_checked_get(EWL_TOGGLEBUTTON(w)); ecore_config_boolean_set("use_scale", use_scale); if (use_scale) diff --git a/experimental/ecdb/trunk/src/ecdb_drives.c b/experimental/ecdb/trunk/src/ecdb_drives.c index d2627b31..2ee684ed 100644 --- a/experimental/ecdb/trunk/src/ecdb_drives.c +++ b/experimental/ecdb/trunk/src/ecdb_drives.c @@ -89,9 +89,8 @@ void ecdb_drive_info_list_free(Eina_List *list) { Ecdb_Drive_Info *info; - Eina_List *l; - EINA_LIST_FOREACH(list, l, info) + EINA_LIST_FREE(list, info) { FREE(info->read_speeds); FREE(info->write_speeds); @@ -102,8 +101,6 @@ ecdb_drive_info_list_free(Eina_List *list) eina_stringshare_del(info->profile_name); FREE(info); } - - list = eina_list_free(list); } void diff --git a/experimental/ecdb/trunk/src/ecdb_filelist_custom.c b/experimental/ecdb/trunk/src/ecdb_filelist_custom.c index 5ad7925b..1db37636 100644 --- a/experimental/ecdb/trunk/src/ecdb_filelist_custom.c +++ b/experimental/ecdb/trunk/src/ecdb_filelist_custom.c @@ -33,6 +33,7 @@ ecdb_custom_filelist_new(void) return NULL; } + /* Ouch, this took forever to find */ ewl_model_data_unref_set(EWL_FILELIST(ret)->model, ecdb_custom_filelist_model_data_unref); ewl_model_data_fetch_set(EWL_FILELIST(ret)->model, @@ -64,7 +65,7 @@ ecdb_custom_filelist_dnd_dropped_cb(Ewl_Widget *w, void *ev, /* Get the parent, find the path of the file(s) dropped * and add them as children to parent */ - parent = ewl_widget_data_get(w, "source"); + parent = ewl_widget_data_get(w, "src"); for (i = 0; i < dnd->len; i++) { @@ -114,7 +115,7 @@ ecdb_custom_filelist_directory_set(Ewl_Filelist *fl, Ecdb_Source *src) EWL_CALLBACK_VALUE_CHANGED, &ev_data); /* Set the source as needed for file operations */ - ewl_widget_data_set(EWL_WIDGET(fl), "source", src); + ewl_widget_data_set(EWL_WIDGET(fl), "src", src); } } @@ -313,7 +314,7 @@ ecdb_custom_filelist_cb_key_down(Ewl_Widget *w, void *ev, void *data) if (!strcmp(kd->base.keyname, "Delete")) { file = ecdb_custom_filelist_selected_file_get(fl); - parent = ewl_widget_data_get(EWL_WIDGET(fl), "source"); + parent = ewl_widget_data_get(EWL_WIDGET(fl), "src"); for (i = 0; (child = parent->children[i]); i++) { @@ -350,7 +351,7 @@ ecdb_custom_filelist_cb_clicked(Ewl_Widget *w, void *ev, void *data) file = ecdb_custom_filelist_selected_file_get(fl); - parent = ewl_widget_data_get(EWL_WIDGET(fl), "source"); + parent = ewl_widget_data_get(EWL_WIDGET(fl), "src"); i = 0; while ((child = parent->children[i])) { diff --git a/experimental/ecdb/trunk/src/ecdb_image.c b/experimental/ecdb/trunk/src/ecdb_image.c index 170aedfb..5a4e3a0b 100644 --- a/experimental/ecdb/trunk/src/ecdb_image.c +++ b/experimental/ecdb/trunk/src/ecdb_image.c @@ -45,7 +45,10 @@ ecdb_source_destroy(Ecdb_Source *src) Ecdb_Source *child; if (!src) + { + EINA_ERROR_PWARN("srs NULL!\n"); return; + } /* free the non-recursive stuff */ if (src->dst) @@ -98,6 +101,12 @@ ecdb_source_add_directory_recursive(Ecdb_Source *parent) char path[PATH_MAX]; char *src; + if (!parent) + { + EINA_ERROR_PWARN("parent NULL!\n"); + return; + } + files = ecore_file_ls(parent->dst); EINA_LIST_FREE(files, src) @@ -108,7 +117,6 @@ ecdb_source_add_directory_recursive(Ecdb_Source *parent) ecdb_source_child_append(parent, child); FREE(src); } - files = eina_list_free(files); } void @@ -117,6 +125,18 @@ ecdb_source_child_append(Ecdb_Source *src, Ecdb_Source *child) long long orig, diff; Ecdb_Source *p; + if (!src) + { + EINA_ERROR_PWARN("src NULL!\n"); + return; + } + + if (!child) + { + EINA_ERROR_PWARN("child NULL!\n"); + return; + } + if (src == child) { EINA_ERROR_PWARN("Trying to make a parent of itself!\n"); @@ -158,6 +178,18 @@ ecdb_source_child_remove(Ecdb_Source *src, Ecdb_Source *child) Ecdb_Source *s; int i, cidx, f; + if (!src) + { + EINA_ERROR_PWARN("src NULL!\n"); + return; + } + + if (!child) + { + EINA_ERROR_PWARN("child NULL!\n"); + return; + } + if (src == child) { EINA_ERROR_PWARN("Trying to remove oneself\n"); @@ -202,12 +234,20 @@ ecdb_source_add_children_rec(Ecdb_Source *parent, IsoImage *image) { IsoDir *cd = NULL; Ecdb_Source *cs; - int i; + int i = 0; - if ((!parent) || (!image)) + if (!parent) + { + EINA_ERROR_PWARN("parent NULL!\n"); return; + } + + if (!image) + { + EINA_ERROR_PWARN("image NULL!\n"); + return; + } - i = 0; while ((cs = parent->children[i])) { if (cs->dir) @@ -244,6 +284,12 @@ ecdb_image_project(Ecdb_Burn_Project *bp) BurnSource *data_src, *fifo_src; Ecdb_Data_Project *proj; + if (!bp) + { + EINA_ERROR_PWARN("bp NULL!\n"); + return NULL; + } + if ((!bp->files) || (!bp->files->num_children)) { return NULL; diff --git a/experimental/ecdb/trunk/src/ecdb_misc.c b/experimental/ecdb/trunk/src/ecdb_misc.c index 52fe5276..a613dbba 100644 --- a/experimental/ecdb/trunk/src/ecdb_misc.c +++ b/experimental/ecdb/trunk/src/ecdb_misc.c @@ -246,7 +246,7 @@ ecdb_dnd_selection(void *data, int type, void *event) call_func(em->evas_drop_object, files); } } - else + else if (em->ewl_drop_object) { Ewl_Event_Dnd_Data_Received ewl_ev; diff --git a/experimental/ecdb/trunk/src/ecdb_projects.c b/experimental/ecdb/trunk/src/ecdb_projects.c index beeeb822..a3734ffe 100644 --- a/experimental/ecdb/trunk/src/ecdb_projects.c +++ b/experimental/ecdb/trunk/src/ecdb_projects.c @@ -55,6 +55,7 @@ ecdb_burn_project_new(void) proj = calloc(1, sizeof(Ecdb_Burn_Project)); if (!proj) return NULL; + if (!ecdb_burn_project_init(proj)) { FREE(proj);