Fix some stuff, including sort when data is dragged in

This commit is contained in:
Jaime Thomas 2008-06-23 01:56:25 +00:00
parent 5ade76e2f8
commit 309efa4298
2 changed files with 21 additions and 20 deletions

View File

@ -54,6 +54,8 @@ ecdb_custom_filelist_dnd_dropped_cb(Ewl_Widget *w, void *ev,
/* Cheap and dirty hax */
/* XXX FIXME XXX */
path = strdup(&files[i][7]);
if (!ecore_file_exists(path))
break;
child = ecdb_source_new();
ecdb_source_data_set(child, path);
ecdb_source_child_append(parent, child);
@ -61,6 +63,12 @@ ecdb_custom_filelist_dnd_dropped_cb(Ewl_Widget *w, void *ev,
}
ecdb_custom_filelist_directory_set(EWL_FILELIST(w), parent);
/* And filter it here -- a bit of a hack */
ewl_filelist_model_data_sort(ewl_mvc_data_get
(EWL_MVC(EWL_FILELIST(w)->controller)),
0, EWL_SORT_DIRECTION_ASCENDING);
ewl_mvc_dirty_set(EWL_MVC(EWL_FILELIST(w)->controller), TRUE);
}
void
@ -76,7 +84,6 @@ ecdb_custom_filelist_directory_set(Ewl_Filelist *fl, Ecdb_Source *src)
data = ecdb_custom_filelist_directory_new(src);
ewl_mvc_data_set(EWL_MVC(fl->controller), data);
ewl_mvc_dirty_set(EWL_MVC(fl->controller), TRUE);
ev_data.response = EWL_FILELIST_EVENT_DIR_CHANGE;
ewl_callback_call_with_event_data(EWL_WIDGET(fl),
EWL_CALLBACK_VALUE_CHANGED, &ev_data);
@ -109,11 +116,6 @@ ecdb_custom_filelist_directory_new(Ecdb_Source *parent)
while ((src = parent->children[i]))
{
if (!ecore_file_exists(src->dst))
{
printf("File doesn't exist: %s\n", src->dst);
break;
}
file = calloc(1, sizeof(Ewl_Filelist_File));
file->name = ecore_string_instance(src->dst);

View File

@ -234,23 +234,22 @@ static void
_filter_change_cb(Ewl_Widget *w, void *ev, void *data)
{
char *filter;
Ewl_Filelist_Filter *f;
/* Fix this is ewl at some point */
f = ewl_filelist_filter_get(EWL_FILELIST(data));
if (f)
{
FREE(f->extension);
FREE(f);
}
Ewl_Filelist_Filter *old, *new;
filter = ewl_text_text_get(EWL_TEXT(w));
f = calloc(1, sizeof(Ewl_Filelist_Filter));
if (!f)
new = calloc(1, sizeof(Ewl_Filelist_Filter));
if (!new)
return;
new->extension = filter;
f->mime_list = NULL;
f->extension = filter;
ewl_filelist_filter_set(EWL_FILELIST(data), f);
/* Fix this is ewl at some point */
old = ewl_filelist_filter_get(EWL_FILELIST(data));
if (old)
{
FREE(old->extension);
FREE(old);
}
ewl_filelist_filter_set(EWL_FILELIST(data), new);
}