From 309efa42986cbd14e290852e61f74c5b7676a991 Mon Sep 17 00:00:00 2001 From: Jaime Thomas Date: Mon, 23 Jun 2008 01:56:25 +0000 Subject: [PATCH] Fix some stuff, including sort when data is dragged in --- .../ecdb/trunk/src/ecdb_filelist_custom.c | 14 +++++----- experimental/ecdb/trunk/src/ecdb_gui.c | 27 +++++++++---------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/experimental/ecdb/trunk/src/ecdb_filelist_custom.c b/experimental/ecdb/trunk/src/ecdb_filelist_custom.c index 18dca29e..d0f6b3ee 100644 --- a/experimental/ecdb/trunk/src/ecdb_filelist_custom.c +++ b/experimental/ecdb/trunk/src/ecdb_filelist_custom.c @@ -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); diff --git a/experimental/ecdb/trunk/src/ecdb_gui.c b/experimental/ecdb/trunk/src/ecdb_gui.c index be3fb5d7..32895dd5 100644 --- a/experimental/ecdb/trunk/src/ecdb_gui.c +++ b/experimental/ecdb/trunk/src/ecdb_gui.c @@ -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); }