Adjust the custom filelist accordingly to the API break.

This commit is contained in:
Jaime Thomas 2009-01-27 23:57:26 +00:00
parent 078aa6a1c2
commit b09a2101cd

View File

@ -6,9 +6,11 @@ static void ecdb_custom_filelist_cb_clicked(Ewl_Widget *w, void *ev,
void *data); void *data);
static void ecdb_custom_filelist_cb_key_down(Ewl_Widget *w, void *ev, static void ecdb_custom_filelist_cb_key_down(Ewl_Widget *w, void *ev,
void *data); void *data);
static Ewl_Widget *ecdb_custom_filelist_view_widget_fetch(void *data, static Ewl_Widget *ecdb_custom_filelist_cb_widget_fetch(unsigned int col,
unsigned int row, unsigned int column, void *pr_data);
void *private_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, static void *ecdb_custom_filelist_model_data_fetch(void *data, unsigned int row,
unsigned int column); unsigned int column);
@ -35,8 +37,10 @@ ecdb_custom_filelist_new(void)
ecdb_custom_filelist_model_data_unref); ecdb_custom_filelist_model_data_unref);
ewl_model_data_fetch_set(EWL_FILELIST(ret)->model, ewl_model_data_fetch_set(EWL_FILELIST(ret)->model,
ecdb_custom_filelist_model_data_fetch); ecdb_custom_filelist_model_data_fetch);
ewl_view_widget_fetch_set(EWL_FILELIST(ret)->view, ewl_view_widget_constructor_set(EWL_FILELIST(ret)->view,
ecdb_custom_filelist_view_widget_fetch); 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, ewl_callback_append(ret, EWL_CALLBACK_DND_DATA_RECEIVED,
ecdb_custom_filelist_dnd_dropped_cb, NULL); ecdb_custom_filelist_dnd_dropped_cb, NULL);
em->ewl_dnd_candidates = eina_list_append(em->ewl_dnd_candidates, ret); 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); return strdup(file->name);
} }
static Ewl_Widget * static Ewl_Widget *ecdb_custom_filelist_cb_widget_fetch(
ecdb_custom_filelist_view_widget_fetch(void *data, unsigned int row __UNUSED__, unsigned int col __UNUSED__,
unsigned int column, void *private_data) void *pr_data __UNUSED__)
{ {
Ewl_Widget *ret; Ewl_Widget *ret;
const char *img = NULL, *stock, *filename;
/* Create icon */
ret = ewl_icon_simple_new(); ret = ewl_icon_simple_new();
ewl_icon_constrain_set(EWL_ICON(ret), EWL_ICON_SIZE_MEDIUM); ewl_icon_constrain_set(EWL_ICON(ret), EWL_ICON_SIZE_MEDIUM);
ewl_box_orientation_set(EWL_BOX(ret), EWL_ORIENTATION_HORIZONTAL); ewl_box_orientation_set(EWL_BOX(ret), EWL_ORIENTATION_HORIZONTAL);
ewl_object_alignment_set(EWL_OBJECT(ret), EWL_FLAG_ALIGN_LEFT); ewl_object_alignment_set(EWL_OBJECT(ret), EWL_FLAG_ALIGN_LEFT);
/* Get and set data into icon */ return ret;
if (column == 0) }
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); stock = ewl_filelist_stock_icon_get(data);
img = ewl_icon_theme_icon_path_get(stock, EWL_ICON_SIZE_MEDIUM); img = ewl_icon_theme_icon_path_get(stock, EWL_ICON_SIZE_MEDIUM);
if (img) 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); filename = ecore_file_file_get(data);
ewl_icon_label_set(EWL_ICON(ret), filename); ewl_icon_label_set(EWL_ICON(w), filename);
} }
else else
{ {
ewl_icon_label_set(EWL_ICON(ret), data); ewl_icon_label_set(EWL_ICON(w), data);
} }
FREE(data); FREE(data);
return ret;
} }