Rid some useless eina_list_free calls, proper ecdb_source usage in filelist and burn data gui, and update to new EWL API.

This commit is contained in:
Jaime Thomas 2009-03-18 01:26:39 +00:00
parent d03a494200
commit 07c7330027
8 changed files with 64 additions and 24 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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)

View File

@ -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

View File

@ -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]))
{

View File

@ -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;

View File

@ -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;

View File

@ -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);