diff --git a/ecdb/trunk/src/ecdb_filelist_custom.c b/ecdb/trunk/src/ecdb_filelist_custom.c index 6e8aa6d..131e494 100644 --- a/ecdb/trunk/src/ecdb_filelist_custom.c +++ b/ecdb/trunk/src/ecdb_filelist_custom.c @@ -6,9 +6,11 @@ static void ecdb_custom_filelist_cb_clicked(Ewl_Widget *w, void *ev, void *data); static void ecdb_custom_filelist_cb_key_down(Ewl_Widget *w, void *ev, void *data); -static Ewl_Widget *ecdb_custom_filelist_view_widget_fetch(void *data, - unsigned int row, unsigned int column, - void *private_data); +static Ewl_Widget *ecdb_custom_filelist_cb_widget_fetch(unsigned int col, + void *pr_data); +static void ecdb_custom_filelist_cb_widget_assign(Ewl_Widget *w, void *data, + unsigned int row, unsigned int col, + void *pr_data); static void *ecdb_custom_filelist_model_data_fetch(void *data, unsigned int row, unsigned int column); @@ -35,8 +37,10 @@ ecdb_custom_filelist_new(void) ecdb_custom_filelist_model_data_unref); ewl_model_data_fetch_set(EWL_FILELIST(ret)->model, ecdb_custom_filelist_model_data_fetch); - ewl_view_widget_fetch_set(EWL_FILELIST(ret)->view, - ecdb_custom_filelist_view_widget_fetch); + ewl_view_widget_constructor_set(EWL_FILELIST(ret)->view, + ecdb_custom_filelist_cb_widget_fetch); + ewl_view_widget_assign_set(EWL_FILELIST(ret)->view, + ecdb_custom_filelist_cb_widget_assign); ewl_callback_append(ret, EWL_CALLBACK_DND_DATA_RECEIVED, ecdb_custom_filelist_dnd_dropped_cb, NULL); em->ewl_dnd_candidates = eina_list_append(em->ewl_dnd_candidates, ret); @@ -385,37 +389,42 @@ ecdb_custom_filelist_selected_file_get(Ewl_Filelist *fl) return strdup(file->name); } -static Ewl_Widget * -ecdb_custom_filelist_view_widget_fetch(void *data, unsigned int row __UNUSED__, - unsigned int column, void *private_data) +static Ewl_Widget *ecdb_custom_filelist_cb_widget_fetch( + unsigned int col __UNUSED__, + void *pr_data __UNUSED__) { Ewl_Widget *ret; - const char *img = NULL, *stock, *filename; - /* Create icon */ ret = ewl_icon_simple_new(); ewl_icon_constrain_set(EWL_ICON(ret), EWL_ICON_SIZE_MEDIUM); ewl_box_orientation_set(EWL_BOX(ret), EWL_ORIENTATION_HORIZONTAL); ewl_object_alignment_set(EWL_OBJECT(ret), EWL_FLAG_ALIGN_LEFT); - /* Get and set data into icon */ - if (column == 0) + return ret; +} + +static void ecdb_custom_filelist_cb_widget_assign(Ewl_Widget *w, void *data, + unsigned int row __UNUSED__, + unsigned int col, void *pr_data) +{ + const char *img = NULL, *stock, *filename; + + if (col == 0) { stock = ewl_filelist_stock_icon_get(data); img = ewl_icon_theme_icon_path_get(stock, EWL_ICON_SIZE_MEDIUM); if (img) { - ewl_icon_image_set(EWL_ICON(ret), img, NULL); + ewl_icon_image_set(EWL_ICON(w), img, NULL); } filename = ecore_file_file_get(data); - ewl_icon_label_set(EWL_ICON(ret), filename); + ewl_icon_label_set(EWL_ICON(w), filename); } else { - ewl_icon_label_set(EWL_ICON(ret), data); - } - + ewl_icon_label_set(EWL_ICON(w), data); + } + FREE(data); - return ret; }