Enlightenment CVS committal

Author  : jethomas
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        Ewl.h Makefile.am ewl_enums.h ewl_filedialog.c 
        ewl_filedialog.h ewl_filelist.c ewl_filelist.h 
        ewl_filelist_model.c ewl_filepicker.c ewl_filepicker.h 
        ewl_tree2_view_freebox.c 
Added Files:
        ewl_filelist_view.c ewl_filelist_view.h 
Removed Files:
        ewl_filelist_column.c ewl_filelist_column.h 
        ewl_filelist_icon.c ewl_filelist_icon.h ewl_filelist_list.c 
        ewl_filelist_list.h ewl_filelist_tree.c ewl_filelist_tree.h 


Log Message:

Move file selector over to using mvc, fix bug #250

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/Ewl.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -3 -r1.32 -r1.33
--- Ewl.h       4 Nov 2007 23:28:03 -0000       1.32
+++ Ewl.h       14 Nov 2007 20:07:58 -0000      1.33
@@ -334,10 +334,7 @@
 
 #include <ewl_filelist.h>
 #include <ewl_filelist_model.h>
-#include <ewl_filelist_list.h>
-#include <ewl_filelist_icon.h>
-#include <ewl_filelist_column.h>
-#include <ewl_filelist_tree.h>
+#include <ewl_filelist_view.h>
 #include <ewl_filepicker.h>
 #include <ewl_filedialog.h>
 
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/Makefile.am,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -3 -r1.55 -r1.56
--- Makefile.am 4 Nov 2007 23:28:03 -0000       1.55
+++ Makefile.am 14 Nov 2007 20:07:58 -0000      1.56
@@ -42,10 +42,7 @@
        ewl_floater.h \
        ewl_filelist.h \
        ewl_filelist_model.h \
-       ewl_filelist_tree.h\
-       ewl_filelist_list.h\
-       ewl_filelist_icon.h \
-       ewl_filelist_column.h \
+       ewl_filelist_view.h \
        ewl_filepicker.h \
        ewl_filedialog.h \
        ewl_freebox.h \
@@ -131,10 +128,7 @@
        ewl_floater.c \
        ewl_filelist.c \
        ewl_filelist_model.c \
-       ewl_filelist_tree.c \
-       ewl_filelist_list.c \
-       ewl_filelist_icon.c \
-       ewl_filelist_column.c \
+       ewl_filelist_view.c \
        ewl_filepicker.c \
        ewl_filedialog.c \
        ewl_freebox.c \
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_enums.h,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -3 -r1.83 -r1.84
--- ewl_enums.h 11 Nov 2007 02:12:36 -0000      1.83
+++ ewl_enums.h 14 Nov 2007 20:07:58 -0000      1.84
@@ -598,7 +598,9 @@
 {
        EWL_FILELIST_EVENT_DIR_CHANGE,
        EWL_FILELIST_EVENT_SELECTION_CHANGE,
-       EWL_FILELIST_EVENT_FILE_SELECTED
+       EWL_FILELIST_EVENT_FILE_SELECTED,
+       EWL_FILELIST_EVENT_MULTI_TRUE,
+       EWL_FILELIST_EVENT_MULTI_FALSE
 };
 
 /**
@@ -857,6 +859,23 @@
  * The Ewl_Thumbnail_Size
  */
 typedef enum Ewl_Thumbnail_Size Ewl_Thumbnail_Size;
+
+/*
+ * @enum Ewl_Filelist_View
+ * The view used in the filelist
+ */
+enum Ewl_Filelist_View
+{
+       EWL_FILELIST_VIEW_ICON, /**< Uses freebox view of tree */
+       EWL_FILELIST_VIEW_LIST, /**< Normal tree with no expansions */
+       EWL_FILELIST_VIEW_TREE, /**< Normal tree with expansions */
+       EWL_FILELIST_VIEW_COLUMN, /**< A custom column view */
+};
+
+/**
+ * The Ewl_Filelist_View
+ */
+typedef enum Ewl_Filelist_View Ewl_Filelist_View;
 
 /**
  * @}
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filedialog.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -3 -r1.39 -r1.40
--- ewl_filedialog.c    12 Nov 2007 22:42:22 -0000      1.39
+++ ewl_filedialog.c    14 Nov 2007 20:07:58 -0000      1.40
@@ -2,10 +2,6 @@
 #include "ewl_base.h"
 #include "ewl_filedialog.h"
 #include "ewl_filepicker.h"
-#include "ewl_filelist_column.h"
-#include "ewl_filelist_icon.h"
-#include "ewl_filelist_list.h"
-#include "ewl_filelist_tree.h"
 #include "ewl_menu.h"
 #include "ewl_context_menu.h"
 #include "ewl_macros.h"
@@ -168,11 +164,10 @@
  * @brief Set the view to be used for displaying the files in the dialog
  */
 void
-ewl_filedialog_list_view_set(Ewl_Filedialog *fd, Ewl_View *view)
+ewl_filedialog_list_view_set(Ewl_Filedialog *fd, Ewl_Filelist_View view)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(fd);
-       DCHECK_PARAM_PTR(view);
        DCHECK_TYPE(fd, EWL_FILEDIALOG_TYPE);
 
        ewl_filepicker_list_view_set(EWL_FILEPICKER(fd->fp), view);
@@ -185,7 +180,7 @@
  * @return Returns the Ewl_View set on this file dialog
  * @brief Retrieve the file list view used in this file dialog
  */
-Ewl_View *
+Ewl_Filelist_View *
 ewl_filedialog_list_view_get(Ewl_Filedialog *fd)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
@@ -258,8 +253,8 @@
 ewl_filedialog_multiselect_get(Ewl_Filedialog *fd)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR_RET(fd, 0);
-       DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, 0);
+       DCHECK_PARAM_PTR_RET(fd, FALSE);
+       DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, FALSE);
 
        DRETURN_INT(ewl_filepicker_multiselect_get(EWL_FILEPICKER(fd->fp)),
                                                        DLEVEL_STABLE);
@@ -292,8 +287,8 @@
 ewl_filedialog_show_dot_files_get(Ewl_Filedialog *fd)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR_RET(fd, 0);
-       DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, 0);
+       DCHECK_PARAM_PTR_RET(fd, FALSE);
+       DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, FALSE);
 
        DRETURN_INT(ewl_filepicker_show_dot_files_get(EWL_FILEPICKER(fd->fp)),
                                                                DLEVEL_STABLE);
@@ -326,8 +321,8 @@
 ewl_filedialog_show_favorites_get(Ewl_Filedialog *fd)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR_RET(fd, 0);
-       DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, 0);
+       DCHECK_PARAM_PTR_RET(fd, FALSE);
+       DCHECK_TYPE_RET(fd, EWL_FILEDIALOG_TYPE, FALSE);
 
        DRETURN_INT(ewl_filepicker_show_favorites_get(EWL_FILEPICKER(fd->fp)),
                                                                DLEVEL_STABLE);
@@ -496,7 +491,7 @@
        DCHECK_TYPE(data, EWL_FILEDIALOG_TYPE);
 
        fd = data;
-       ewl_filedialog_list_view_set(fd, ewl_filelist_column_view_get());
+       ewl_filedialog_list_view_set(fd, EWL_FILELIST_VIEW_COLUMN);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -512,7 +507,7 @@
        DCHECK_TYPE(data, EWL_FILEDIALOG_TYPE);
 
        fd = data;
-       ewl_filedialog_list_view_set(fd, ewl_filelist_icon_view_get());
+       ewl_filedialog_list_view_set(fd, EWL_FILELIST_VIEW_ICON);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -528,7 +523,7 @@
        DCHECK_TYPE(data, EWL_FILEDIALOG_TYPE);
 
        fd = data;
-       ewl_filedialog_list_view_set(fd, ewl_filelist_list_view_get());
+       ewl_filedialog_list_view_set(fd, EWL_FILELIST_VIEW_LIST);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -544,7 +539,7 @@
        DCHECK_TYPE(data, EWL_FILEDIALOG_TYPE);
 
        fd = data;
-       ewl_filedialog_list_view_set(fd, ewl_filelist_tree_view_get());
+       ewl_filedialog_list_view_set(fd, EWL_FILELIST_VIEW_TREE);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filedialog.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- ewl_filedialog.h    11 Nov 2007 06:07:46 -0000      1.22
+++ ewl_filedialog.h    14 Nov 2007 20:07:58 -0000      1.23
@@ -60,8 +60,8 @@
 int             ewl_filedialog_init(Ewl_Filedialog *fd);
 
 void            ewl_filedialog_list_view_set(Ewl_Filedialog *fd,
-                                               Ewl_View *view);
-Ewl_View       *ewl_filedialog_list_view_get(Ewl_Filedialog *fd);
+                                               Ewl_Filelist_View view);
+Ewl_Filelist_View *ewl_filedialog_list_view_get(Ewl_Filedialog *fd);
 
 void            ewl_filedialog_directory_set(Ewl_Filedialog *fd,
                                                const char *dir);
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filelist.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- ewl_filelist.c      12 Nov 2007 22:42:22 -0000      1.37
+++ ewl_filelist.c      14 Nov 2007 20:07:58 -0000      1.38
@@ -1,16 +1,47 @@
 /* vim: set sw=8 ts=8 sts=8 noexpandtab: */
 #include "ewl_base.h"
 #include "ewl_filelist.h"
+#include "ewl_filelist_model.h"
+#include "ewl_filelist_view.h"
+#include "ewl_tree2.h"
+#include "ewl_tree2_view_freebox.h"
+#include "ewl_tree2_view_scrolled.h"
+#include "ewl_mvc.h"
 #include "ewl_icon_theme.h"
 #include "ewl_io_manager.h"
 #include "ewl_macros.h"
 #include "ewl_private.h"
 #include "ewl_debug.h"
 
-static void ewl_filelist_signal_between(Ewl_Filelist *fl, Ewl_Container *c,
-                                               int add, const char *signal,
-                                               int a_idx, Ewl_Widget *a,
-                                               int b_idx, Ewl_Widget *b);
+static void ewl_filelist_setup(Ewl_Filelist *fl);
+static void ewl_filelist_view_setup(Ewl_Filelist *fl);
+static void ewl_filelist_cb_clicked(Ewl_Widget *w, void *ev,
+                                               void *data __UNUSED__);
+
+/**
+ * @return Returns a new Ewl_Filelist widget or NULL on failure
+ * @brief Creates a new Ewl_Filelist widget
+ */
+Ewl_Widget *
+ewl_filelist_new(void)
+{
+       Ewl_Widget *w;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       w = NEW(Ewl_Filelist, 1);
+       if (!w)
+               DRETURN_PTR(NULL, DLEVEL_STABLE);
+
+       if (!ewl_filelist_init(EWL_FILELIST(w)))
+       {
+               ewl_widget_destroy(w);
+               w = NULL;
+       }
+
+       DRETURN_PTR(w, DLEVEL_STABLE);
+}
+
 /**
  * @param fl: The filelist to initialize
  * @return Returns TRUE on success or FALSE on failure
@@ -31,16 +62,191 @@
        fl->scroll_flags.h = EWL_SCROLLPANE_FLAG_AUTO_VISIBLE;
        fl->scroll_flags.v = EWL_SCROLLPANE_FLAG_AUTO_VISIBLE;
 
-       fl->selected = ecore_list_new();
        ewl_callback_prepend(EWL_WIDGET(fl), EWL_CALLBACK_DESTROY,
                                ewl_filelist_cb_destroy, NULL);
 
+       fl->view_flag = EWL_FILELIST_VIEW_ICON;
+       fl->multiselect = FALSE;
+       fl->skip_hidden = TRUE;
+
        ewl_filelist_filter_set(fl, NULL);
+       ewl_filelist_directory_set(fl, NULL);
+       ewl_filelist_setup(fl);
 
        DRETURN_INT(TRUE, DLEVEL_STABLE);
 }
 
 /**
+ * @param fl: The filelist to setup
+ * @return Returns no value
+ * @brief Sets up the filelist view and data
+ */
+static void
+ewl_filelist_setup(Ewl_Filelist *fl)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR(fl);
+       DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
+
+       fl->view = ewl_view_new();
+       ewl_view_widget_fetch_set(fl->view,
+                               ewl_filelist_view_widget_fetch);
+       ewl_view_header_fetch_set(fl->view,
+                               ewl_filelist_view_header_fetch);
+
+       fl->model = ewl_model_new();
+       ewl_model_data_count_set(fl->model,
+                       ewl_filelist_model_data_count);
+       ewl_model_data_fetch_set(fl->model,
+                       ewl_filelist_model_data_fetch);
+       ewl_model_data_sort_set(fl->model,
+                       ewl_filelist_model_data_sort);
+       ewl_model_column_sortable_set(fl->model,
+                       ewl_filelist_model_column_sortable);
+       ewl_model_data_unref_set(fl->model,
+                       ewl_filelist_model_data_unref);
+
+       /* For now just create a tree and set different views */
+       fl->controller = ewl_tree2_new();
+       ewl_mvc_view_set(EWL_MVC(fl->controller), fl->view);
+       ewl_mvc_model_set(EWL_MVC(fl->controller), fl->model);
+       ewl_container_child_append(EWL_CONTAINER(fl), fl->controller);
+       ewl_callback_append(EWL_WIDGET(fl->controller),
+                       EWL_CALLBACK_CLICKED, ewl_filelist_cb_clicked,
+                       fl);
+       ewl_widget_show(fl->controller);
+
+       if (fl->multiselect)
+               ewl_mvc_selection_mode_set(EWL_MVC(fl->controller),
+                               EWL_SELECTION_MODE_MULTI);
+       else
+               ewl_mvc_selection_mode_set(EWL_MVC(fl->controller),
+                               EWL_SELECTION_MODE_SINGLE);
+
+       ewl_filelist_view_setup(fl);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @internal
+ */
+static void
+ewl_filelist_view_setup(Ewl_Filelist *fl)
+{
+       Ewl_View *view;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR(fl);
+       DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
+
+       /* Set expansions callbacks to NULL right off the bat */
+       ewl_model_expansion_data_fetch_set(fl->model, NULL);
+       ewl_model_data_expandable_set(fl->model, NULL);
+
+       if (fl->view_flag == EWL_FILELIST_VIEW_TREE)
+       {
+               ewl_tree2_column_count_set(EWL_TREE2(fl->controller), 2);
+               ewl_tree2_headers_visible_set(EWL_TREE2(fl->controller),
+                                                               TRUE);
+               ewl_tree2_alternate_row_colors_set
+                               (EWL_TREE2(fl->controller), TRUE);
+               ewl_tree2_selection_type_set(EWL_TREE2(fl->controller),
+                                       EWL_TREE_SELECTION_TYPE_CELL);
+               ewl_model_expansion_data_fetch_set(fl->model,
+                       ewl_filelist_model_data_expansion_data_fetch);
+               ewl_model_data_expandable_set(fl->model,
+                       ewl_filelist_model_data_expandable_get);
+               view = ewl_tree2_view_scrolled_get();
+       }
+
+       else if (fl->view_flag == EWL_FILELIST_VIEW_LIST)
+       {
+               ewl_tree2_column_count_set(EWL_TREE2(fl->controller), 6);
+               ewl_tree2_headers_visible_set(EWL_TREE2(fl->controller),
+                                                               TRUE);
+               ewl_tree2_alternate_row_colors_set
+                               (EWL_TREE2(fl->controller), TRUE);
+               ewl_tree2_selection_type_set(EWL_TREE2(fl->controller),
+                                       EWL_TREE_SELECTION_TYPE_ROW);
+               view = ewl_tree2_view_scrolled_get();
+       }
+
+       /* Until column view is written just default and throw a warning */
+       else if (fl->view_flag == EWL_FILELIST_VIEW_COLUMN)
+       {
+               ewl_tree2_column_count_set(EWL_TREE2(fl->controller), 1);
+               ewl_tree2_headers_visible_set(EWL_TREE2(fl->controller),
+                                                               FALSE);
+               ewl_tree2_alternate_row_colors_set
+                               (EWL_TREE2(fl->controller), FALSE);
+               ewl_tree2_selection_type_set(EWL_TREE2(fl->controller),
+                                       EWL_TREE_SELECTION_TYPE_ROW);
+               view = ewl_tree2_view_freebox_get();
+               DWARNING("Column view not implemented");
+       }
+
+       /* Make icon view default */
+       else
+       {
+               ewl_tree2_column_count_set(EWL_TREE2(fl->controller), 1);
+               ewl_tree2_headers_visible_set(EWL_TREE2(fl->controller),
+                                                               FALSE);
+               ewl_tree2_alternate_row_colors_set
+                               (EWL_TREE2(fl->controller), FALSE);
+               ewl_tree2_selection_type_set(EWL_TREE2(fl->controller),
+                                       EWL_TREE_SELECTION_TYPE_ROW);
+               view = ewl_tree2_view_freebox_get();
+               fl->view_flag = EWL_FILELIST_VIEW_ICON;
+       }
+       
+       /* Set the view and redraw the tree */
+       ewl_tree2_content_view_set(EWL_TREE2(fl->controller), view);
+       ewl_mvc_dirty_set(EWL_MVC(fl->controller), TRUE);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param fl: The filelist to change the view for
+ * @param view: The view to set
+ * @return: Returns no value
+ * @brief Sets the filelist view
+ */
+void
+ewl_filelist_view_set(Ewl_Filelist *fl, Ewl_Filelist_View view)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR(fl);
+       DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
+
+       if (fl->view_flag == view)
+               DRETURN(DLEVEL_STABLE);
+
+       fl->view_flag = view;
+
+       ewl_filelist_view_setup(fl);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param fl: The filelist to get the view from
+ * @returns Returns the Ewl_Filelist_View used
+ * @brief Gets the filelist view
+ */
+Ewl_Filelist_View *
+ewl_filelist_view_get(Ewl_Filelist *fl)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR_RET(fl, NULL);
+       DRETURN_PTR(fl->view_flag, DLEVEL_STABLE);
+}
+
+
+
+
+/**
  * @param fl: The filelist to set the directory into
  * @param dir: The directory to set
  * @return Returns no value
@@ -50,20 +256,33 @@
 void
 ewl_filelist_directory_set(Ewl_Filelist *fl, const char *dir)
 {
+       Ewl_Filelist_Directory *data;
        Ewl_Event_Action_Response ev_data;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(fl);
        DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
 
-       IF_FREE(fl->directory);
-       fl->directory = strdup(dir);
-       if (fl->dir_change) fl->dir_change(fl);
+       if (dir == NULL) fl->directory = NULL;
 
-       ev_data.response = EWL_FILELIST_EVENT_DIR_CHANGE;
+       else if ((!fl->directory) || (strcmp(dir, fl->directory)))
+       {
+               fl->directory = strdup(dir);
 
-       ewl_callback_call_with_event_data(EWL_WIDGET(fl),
-                       EWL_CALLBACK_VALUE_CHANGED, &ev_data);
+               data = ewl_mvc_data_get(EWL_MVC(fl->controller));
+               if (data)
+                       ewl_filelist_model_data_unref(data);
+               
+               data = ewl_filelist_model_directory_new
+                                       (fl->directory,
+                                        fl->skip_hidden, TRUE);
+               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);
+       }
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -99,7 +318,9 @@
        IF_FREE(fl->filter);
 
        fl->filter = (filter ? strdup(filter) : NULL);
-       if (fl->filter_change) fl->filter_change(fl);
+       
+       /* Model does not do filtering yet */
+       DWARNING("Filtering not yet implemented");
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -128,13 +349,35 @@
 void
 ewl_filelist_multiselect_set(Ewl_Filelist *fl, unsigned int ms)
 {
+       Ewl_Event_Action_Response ev_data;
+
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(fl);
        DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
 
+       if (fl->multiselect == ms)
+               DRETURN(DLEVEL_STABLE);
+
        fl->multiselect = !!ms;
-       if (fl->multiselect_change) fl->multiselect_change(fl);
+               
+       if (ms == TRUE)
+       {
+               ewl_mvc_selection_mode_set
+                       (EWL_MVC(fl->controller),
+                        EWL_SELECTION_MODE_MULTI);
+               ev_data.response = EWL_FILELIST_EVENT_MULTI_TRUE;
+       }
+       else
+       {
+               ewl_mvc_selection_mode_set
+                       (EWL_MVC(fl->controller),
+                        EWL_SELECTION_MODE_SINGLE);
+               ev_data.response = EWL_FILELIST_EVENT_MULTI_FALSE;
+       }
 
+       ewl_callback_call_with_event_data(EWL_WIDGET(fl),
+                       EWL_CALLBACK_VALUE_CHANGED, &ev_data);
+       
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -147,8 +390,8 @@
 ewl_filelist_multiselect_get(Ewl_Filelist *fl)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR_RET(fl, 0);
-       DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, 0);
+       DCHECK_PARAM_PTR_RET(fl, FALSE);
+       DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, FALSE);
 
        DRETURN_INT((unsigned int)fl->multiselect, DLEVEL_STABLE);
 }
@@ -162,13 +405,25 @@
 void
 ewl_filelist_show_dot_files_set(Ewl_Filelist *fl, unsigned int dot)
 {
+       Ewl_Filelist_Directory *data;
+       
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(fl);
        DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
 
-       fl->show_dot_files = !!dot;
-       if (fl->show_dot_change) fl->show_dot_change(fl);
+       if (fl->skip_hidden == dot)
+               DRETURN(DLEVEL_STABLE);
 
+       fl->skip_hidden = !!dot;
+       data = ewl_mvc_data_get(EWL_MVC(fl->controller));
+       if (data)
+               ewl_filelist_model_data_unref(data);
+                                               
+       data = ewl_filelist_model_directory_new(fl->directory,
+                                        fl->skip_hidden, TRUE);
+       ewl_mvc_data_set(EWL_MVC(fl->controller), data);
+       ewl_mvc_dirty_set(EWL_MVC(fl->controller), TRUE);
+       
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -181,10 +436,10 @@
 ewl_filelist_show_dot_files_get(Ewl_Filelist *fl)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR_RET(fl, 0);
-       DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, 0);
+       DCHECK_PARAM_PTR_RET(fl, FALSE);
+       DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, FALSE);
 
-       DRETURN_INT((unsigned int)fl->show_dot_files, DLEVEL_STABLE);
+       DRETURN_INT((unsigned int)fl->skip_hidden, DLEVEL_STABLE);
 }
 
 /**
@@ -196,17 +451,55 @@
 void
 ewl_filelist_selected_file_set(Ewl_Filelist *fl, const char *file)
 {
+       char *filename;
+       Ewl_Filelist_Directory *data;
+       Ewl_Filelist_File *file_temp;
+       int dir = 0, index = -1;
+       Ecore_List *temp;
+
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(fl);
        DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
 
-       /* clean out the old set of selected files */
-       if (fl->selected_unselect) fl->selected_unselect(fl);
-       ecore_list_clear(fl->selected);
-       if (fl->selected_file_add && file) fl->selected_file_add(fl, file);
+       if (!file)
+       {
+               ewl_mvc_selected_clear(EWL_MVC(fl->controller));
+               DRETURN(DLEVEL_STABLE);
+       }
 
-       ewl_filelist_selected_files_change_notify(fl);
+       filename = ewl_filelist_expand_path(fl, file);
+       data = ewl_mvc_data_get(EWL_MVC(fl->controller));
 
+       if (ecore_file_is_dir(filename))
+       {
+               temp = data->dirs;
+               dir = 1;
+       }
+       else
+               temp = data->files;
+
+       ecore_list_first_goto(temp);
+
+       while ((file_temp = ecore_list_next(temp)))
+       {
+               if (!strcoll(file_temp->name, file))
+               {
+                       index = ecore_list_index(temp);
+                       break;
+               }
+       }
+
+       if ((index >= 0) && (dir == 0))
+               ewl_mvc_selected_set(EWL_MVC(fl->controller), NULL,
+                                       NULL, (index+data->num_dirs-1),
+                                       0);
+       
+       else if ((index >= 0) && (dir == 1))
+               ewl_mvc_selected_set(EWL_MVC(fl->controller), NULL,
+                                       NULL, (index-1), 0);
+
+       FREE(filename);
+       ewl_filelist_selected_files_change_notify(fl);
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -218,18 +511,42 @@
 char *
 ewl_filelist_selected_file_get(Ewl_Filelist *fl)
 {
-       void *widget;
-       const char *file = NULL;
+       Ewl_Filelist_Directory *data;
+       Ewl_Filelist_File *file;
+       Ewl_Selection_Idx *idx;
+       char path[PATH_MAX];
+       int i;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(fl, NULL);
        DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, 0);
 
-       ecore_list_first_goto(fl->selected);
-       widget = ecore_list_current(fl->selected);
-       if (widget && fl->file_name_get) file = fl->file_name_get(fl, widget);
+       if (!ewl_mvc_selected_count_get(EWL_MVC(fl->controller)))
+               DRETURN_PTR(NULL, DLEVEL_STABLE);
 
-       DRETURN_PTR((file ? strdup(file) : NULL), DLEVEL_STABLE);
+       data = ewl_mvc_data_get(EWL_MVC(fl->controller));
+       idx = ewl_mvc_selected_get(EWL_MVC(fl->controller));
+       if (idx->row < data->num_dirs)
+               file = ecore_list_index_goto(data->dirs, idx->row);
+       else
+       {
+               i = (idx->row - data->num_dirs);
+               file = ecore_list_index_goto(data->files, i);
+       }
+
+       FREE(idx);
+
+       if (!strcmp(file->name, ".."))
+               snprintf(path, PATH_MAX, "%s", data->name);
+
+       else if (!strcmp(data->name, "/"))
+               snprintf(path, PATH_MAX, "%s%s", data->name, file->name);
+
+       else
+               snprintf(path, PATH_MAX, "%s/%s", data->name,
+                                                       file->name);
+
+       DRETURN_PTR(strdup(path), DLEVEL_STABLE);
 }
 
 /**
@@ -366,7 +683,7 @@
                time = strdup(time);
                time[strlen(time) - 1] = '\0';
        }
-       else time = strdup("unknown");
+       else time = strdup("Unknown");
 
        DRETURN_PTR(time, DLEVEL_STABLE);
 }
@@ -474,29 +791,72 @@
 
 /**
  * @param fl: The filelist to set the selected files into
- * @param files: The Ecore_List of files to set
+ * @param files: The Ecore_List of the files
  * @return Returns no value.
  * @brief Sets the given files as selected in the filelist
  */
 void
 ewl_filelist_selected_files_set(Ewl_Filelist *fl, Ecore_List *files)
 {
-       char *file;
+       Ewl_Filelist_Directory *data;
+       Ewl_Filelist_File *file;
+       Ecore_List *selected, *temp;
+       Ewl_Selection *sel;
+       int i, index;
+       char *path;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(fl);
        DCHECK_PARAM_PTR(files);
        DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
 
-       /* clean out the old set of selected files */
-       if (fl->selected_unselect) fl->selected_unselect(fl);
-       ecore_list_clear(fl->selected);
+       /* Get the mvc data and get ready for looping */
+       data = ewl_mvc_data_get(EWL_MVC(fl->controller));
+       selected = ecore_list_new();
 
+       ecore_list_first_goto(data->dirs);
+       ecore_list_first_goto(data->files);
        ecore_list_first_goto(files);
-       while ((file = ecore_list_next(files)))
-               if (fl->selected_file_add) fl->selected_file_add(fl, file);
 
+       /* For every file, search for a match */
+       for (i = 0; i < ecore_list_count(files); i++)
+       {
+               path = ecore_list_next(files);
+
+               /* Set temp to whichever list the file could be in */
+               if (ecore_file_is_dir(path))
+               {
+                       temp = data->dirs;
+                       index = 0;
+               }
+               else
+               {
+                       temp = data->files;
+                       index = data->num_dirs;
+               }
+
+               /* Search the list and return the index if found */
+               while ((file = ecore_list_next(temp)))
+               {
+                       if (!strcmp(file->name, ecore_file_file_get
+                                                       (path)))
+                       {
+                               index = (index + 
+                                       ecore_list_index(temp) - 1);
+                               sel = ewl_mvc_selection_index_new
+                                       (fl->model, NULL, index, 0);
+                               ecore_list_append(selected, sel);
+                               break;
+                       }
+               }
+
+               ecore_list_first_goto(temp);
+       }               
+
+       ewl_mvc_selected_list_set(EWL_MVC(fl->controller), selected);
        ewl_filelist_selected_files_change_notify(fl);
+       ecore_list_destroy(files);
+       ecore_list_destroy(selected);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -509,25 +869,71 @@
 Ecore_List *
 ewl_filelist_selected_files_get(Ewl_Filelist *fl)
 {
-       Ecore_List *selected;
-       void *item;
+       Ecore_List *selected, *ret;
+       Ewl_Selection *sel;
+       Ewl_Filelist_Directory *data;
+       Ewl_Filelist_File *file;
+       char path[PATH_MAX];
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(fl, NULL);
        DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, NULL);
 
-       selected = ecore_list_new();
-       ecore_list_free_cb_set(selected, free);
+       ret = ecore_list_new();
 
-       ecore_list_first_goto(fl->selected);
-       while ((item = ecore_list_next(fl->selected)))
+       data = ewl_mvc_data_get(EWL_MVC(fl->controller));
+       selected = ewl_mvc_selected_list_get(EWL_MVC(fl->controller));
+       ecore_list_first_goto(selected);
+
+       while ((sel = ecore_list_next(selected)))
        {
-               const char *file;
-               file = fl->file_name_get(fl, item);
-               ecore_list_append(selected, strdup(file));
-       }
+               /* If using Index instead of range */
+               if (sel->type == EWL_SELECTION_TYPE_INDEX)
+               {
+                       Ewl_Selection_Idx *idx;
+                       
+                       idx = EWL_SELECTION_IDX(sel);
+                       /* Get the file data */
+                       if (idx->row < data->num_dirs)
+                               file = ecore_list_index_goto
+                                       (data->dirs, idx->row);
+                       else
+                               file = ecore_list_index_goto
+                                       (data->files,
+                                        (idx->row - data->num_dirs));
+
+                       snprintf(path, PATH_MAX, "%s/%s", data->name,
+                                                       file->name);
+                       ecore_list_append(ret, strdup(path));
+               }
+
+               /* If using range instead of index */
+               else if (sel->type == EWL_SELECTION_TYPE_RANGE)
+               {
+                       Ewl_Selection_Range *r;
+                       int i;
 
-       DRETURN_PTR(selected, DLEVEL_STABLE);
+                       r = EWL_SELECTION_RANGE(sel);
+                       for (i = r->start.row; i <= r->end.row; i++)
+                       {
+                               /* Get the file data */
+                               if (i < data->num_dirs)
+                                       file = ecore_list_index_goto
+                                               (data->dirs, i);
+                               else
+                                       file = ecore_list_index_goto
+                                               (data->files,
+                                                (i - data->num_dirs));
+
+                               snprintf(path, PATH_MAX, "%s/%s",
+                                                       data->name,
+                                                       file->name);
+                               ecore_list_append(ret, strdup(path));
+                       }
+               }
+       }       
+
+       DRETURN_PTR(ret, DLEVEL_STABLE);
 }
 
 /**
@@ -554,29 +960,6 @@
 
 /**
  * @param fl: The filelist to work with
- * @param signal: The signal to send
- * @return Returns no value
- * @brief Signals all of the selected widgets with the given signal
- */
-void
-ewl_filelist_selected_signal_all(Ewl_Filelist *fl, const char *signal)
-{
-       Ewl_Widget *item;
-
-       DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR(fl);
-       DCHECK_PARAM_PTR(signal);
-       DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
-
-       ecore_list_first_goto(fl->selected);
-       while ((item = ecore_list_next(fl->selected)))
-               ewl_widget_state_set(item, signal, EWL_STATE_PERSISTENT);
-
-       DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-/**
- * @param fl: The filelist to work with
  * @param v: The value to set for the vertical scrollbar
  * @return Returns no value
  * @brief Sets the value to use for flags on the vertical scrollbar
@@ -644,21 +1027,18 @@
 }
 
 /**
- * @param fl: The filelist to work with
  * @param path: The path to get the icon for
  * @return Returns the stock icon for the given file
  * @brief Retrieves the stock icon for the given file
  */
 const char *
-ewl_filelist_stock_icon_get(Ewl_Filelist *fl, const char *path)
+ewl_filelist_stock_icon_get(const char *path)
 {
        const char *ret = NULL;
        char *ptr = NULL;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR_RET(fl, NULL);
        DCHECK_PARAM_PTR_RET(path, NULL);
-       DCHECK_TYPE_RET(fl, EWL_FILELIST_TYPE, NULL);
 
        if (ecore_file_is_dir(path))
                DRETURN_PTR(EWL_ICON_FOLDER, DLEVEL_STABLE);
@@ -734,367 +1114,73 @@
 
 /**
  * @internal
- * @param fl: The filelist to work with
- * @param dir: The directory to read
- * @param skip_dot_dot: Should the .. entry be skipped
- * @param func: The function to call to actually add the item
- * @param data: The data to pass to the callback function
- * @return Returns no value.
- * @brief This will read the directory set in the file list, filter each
- * item through the set filter and call @a func if the file is to be
- * displayed.
+ * @param w: The widget to work with
+ * @param ev: UNUSED
+ * @param data: UNUSED
+ * @return Returns no value
+ * @brief The destroy callback
  */
 void
-ewl_filelist_directory_read(Ewl_Filelist *fl, const char *dir,
-               unsigned int skip_dot_dot,
-               void (*func)(Ewl_Filelist *fl, const char *dir,
-                               char *file, void *data), void *data)
+ewl_filelist_cb_destroy(Ewl_Widget *w, void *ev __UNUSED__,
+                                       void *data __UNUSED__)
 {
-       Ecore_List *all_files, *files, *dirs;
-       char path[PATH_MAX];
-       char *file;
+       Ewl_Filelist *fl;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR(fl);
-       DCHECK_PARAM_PTR(func);
-       DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
-
-       all_files = ecore_file_ls(dir);
-       if (!all_files) DRETURN(DLEVEL_STABLE);
-
-       files = ecore_list_new();
-       dirs = ecore_list_new();
-
-       /* if this isn't the root dir add a .. entry */
-       if (strcmp(dir, "/") && !skip_dot_dot)
-               ecore_list_append(dirs, strdup(".."));
-
-       while ((file = ecore_list_first_remove(all_files)))
-       {
-               int is_dir;
-
-               snprintf(path, PATH_MAX, "%s/%s", dir, file);
-               is_dir = ecore_file_is_dir(path);
-
-               /* check the filter if this isn't a directory */
-               if (fl->filter && (!is_dir) && fnmatch(fl->filter, file, 0))
-                       continue;
-
-               if ((!ewl_filelist_show_dot_files_get(fl))
-                               && (file[0] == '.'))
-                       continue;
-
-               if (is_dir) ecore_list_append(dirs, file);
-               else ecore_list_append(files, file);
-       }
-
-       /* XXX will need to do sorting here ... */
-       while ((file = ecore_list_first_remove(dirs)))
-       {
-               func(fl, dir, file, data);
-               FREE(file);
-       }
-
-       while ((file = ecore_list_first_remove(files)))
-       {
-               func(fl, dir, file, data);
-               FREE(file);
-       }
+       DCHECK_PARAM_PTR(w);
+       DCHECK_TYPE(w, EWL_FILELIST_TYPE);
 
-       IF_FREE_LIST(all_files);
-       IF_FREE_LIST(files);
-       IF_FREE_LIST(dirs);
+       fl = EWL_FILELIST(w);
+       IF_FREE(fl->directory);
+       IF_FREE(fl->filter);
+       IF_FREE(fl->view);
+       IF_FREE(fl->model);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
-/**
- * @internal
- * @param fl: The filelist to work with
- * @param w: The widget that was clicked
- * @param ev: The Ewl_Event_Mouse_Up structure
- * @param select_state: Signal to send to goto select state
- * @param unselect_state: Signal to send to goto unselect state
- * @return Returns no value.
- * @brief Adds or removes the given widget from the select list as needed
- */
-void
-ewl_filelist_handle_click(Ewl_Filelist *fl, Ewl_Widget *w,
-                               Ewl_Event_Mouse_Up *ev,
-                               const char *select_state,
-                               const char *unselect_state)
+static void
+ewl_filelist_cb_clicked(Ewl_Widget *w, void *ev,
+                               void *data __UNUSED__)
 {
-       int multi = FALSE;
+       Ewl_Event_Mouse_Down *event;
+       char *file, *t;
+       Ewl_Filelist *fl;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR(fl);
        DCHECK_PARAM_PTR(w);
        DCHECK_PARAM_PTR(ev);
-       DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
-       DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
-       /* only trigger on lmb */
-       if (ev->button != 1)
-               DRETURN(DLEVEL_STABLE);
-
-       /* are the multiselect keys pressed? */
-       if ((ev->base.modifiers & EWL_KEY_MODIFIER_SHIFT)
-                       || (ev->base.modifiers & EWL_KEY_MODIFIER_CTRL))
-               multi = TRUE;
-
-       /* we are not in multiselect mode, or the multiselect keys aren't
-        * pressed */
-       if (!ewl_filelist_multiselect_get(fl) || (!multi))
-       {
-               if (fl->selected_unselect) fl->selected_unselect(fl);
-               ecore_list_clear(fl->selected);
 
-               if (select_state)
-                       ewl_widget_state_set(w, select_state,
-                                               EWL_STATE_PERSISTENT);
-
-               ecore_list_append(fl->selected, w);
-               ewl_filelist_selected_files_change_notify(fl);
-
-               fl->select.base = w;
-               fl->select.last = NULL;
+       event = ev;
+       fl = data;
 
+       if (!ewl_mvc_selected_count_get(EWL_MVC(fl->controller)))
                DRETURN(DLEVEL_STABLE);
-       }
-
-       /* ok, we're in multiselect mode and either shift or ctrl are
-        * pressed */
-
-       if (ev->base.modifiers & EWL_KEY_MODIFIER_SHIFT)
-       {
-               /* we have no base selected so this is the first click with
-                * the shift. set base and set the clicked as selected */
-               if (!fl->select.base)
-               {
-                       fl->select.base = w;
-                       fl->select.last = NULL;
-
-                       if (fl->selected_unselect) fl->selected_unselect(fl);
-                       ecore_list_clear(fl->selected);
-               }
-               else
-               {
-                       if (fl->shift_handle) fl->shift_handle(fl, w);
-                       fl->select.last = w;
-               }
-
-               if (select_state)
-                       ewl_widget_state_set(w, select_state,
-                                               EWL_STATE_PERSISTENT);
-               ecore_list_append(fl->selected, w);
 
+       /* Single clicks only */
+       if (event->clicks != 2)
                ewl_filelist_selected_files_change_notify(fl);
-       }
-       else
-       {
-               void *item;
-
-               fl->select.base = w;
-               fl->select.last = NULL;
-
-               item = ecore_list_goto(fl->selected, w);
-               if (item)
-               {
-                       if (unselect_state)
-                               ewl_widget_state_set(w, unselect_state,
-                                                       EWL_STATE_PERSISTENT);
-                       ecore_list_remove(fl->selected);
-               }
-               else
-               {
-                       if (select_state)
-                               ewl_widget_state_set(w, select_state,
-                                                       EWL_STATE_PERSISTENT);
-                       ecore_list_append(fl->selected, w);
-               }
-       }
-
-       DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
 
-/**
- * @internal
- * @param fl: The filelist to work with
- * @param c: The container to select/unselect from
- * @param clicked: The clicked widget
- * @param select_signal: The signal to send on select
- * @param unselect_signal: The signal to send on unselect
- * @return Returns no value
- * @brief Handles the select/deselect of widgets in the given container @a c
- */
-void
-ewl_filelist_container_shift_handle(Ewl_Filelist *fl,
-                       Ewl_Container *c, Ewl_Widget *clicked,
-                       const char *select_signal,
-                       const char *unselect_signal)
-{
-       int base_idx, last_idx = -1, cur_idx;
-
-       DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR(fl);
-       DCHECK_PARAM_PTR(c);
-       DCHECK_PARAM_PTR(clicked);
-       DCHECK_PARAM_PTR(select_signal);
-       DCHECK_PARAM_PTR(unselect_signal);
-       DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
-       DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
-       DCHECK_TYPE(clicked, EWL_WIDGET_TYPE);
-
-       ecore_list_goto(c->children, fl->select.base);
-       base_idx = ecore_list_index(c->children);
-
-       ecore_list_goto(c->children, clicked);
-       cur_idx = ecore_list_index(c->children);
-
-       if (fl->select.last)
+       /* Handle double clicks */
+       if (event->clicks == 2)
        {
-               ecore_list_goto(c->children, fl->select.last);
-               last_idx = ecore_list_index(c->children);
-       }
+               file = ewl_filelist_selected_file_get(fl);
 
-       if (last_idx < 0)
-       {
-               ewl_filelist_signal_between(fl, c, TRUE, select_signal, 
base_idx,
-                                       fl->select.base, cur_idx, clicked);
-       }
-       else
-       {
-               /* user selected more, just tag on whats between the last
-                * click and the current click */
-               if (((cur_idx < last_idx) && (last_idx < base_idx))
-                               || ((base_idx < last_idx)
-                                       && (last_idx < cur_idx)))
+               /* If .. */
+               if (!strcmp(file, fl->directory))
                {
-                       ewl_filelist_signal_between(fl, c, TRUE, select_signal,
-                                               last_idx, fl->select.last,
-                                               cur_idx, clicked);
+                       t = ecore_file_dir_get(fl->directory);
+                       ewl_filelist_directory_set(fl, t);
+                       FREE(t);
                }
+               /* Change dir if dir, else call above */
+               else if (ecore_file_is_dir(file))
+                       ewl_filelist_directory_set(fl, file);
+               
+               /* Send signal of file selected */
                else
-               {
-                       /* unselect stuff between last and our current index */
-                       ewl_filelist_signal_between(fl, c, FALSE,
-                                       unselect_signal, last_idx,
-                                       fl->select.last, cur_idx, clicked);
-
-                       /* make sure the last selected is removed */
-                       ewl_widget_state_set(fl->select.last, unselect_signal,
-                                               EWL_STATE_PERSISTENT);
-                       ecore_list_goto(fl->selected, fl->select.last);
-                       ecore_list_remove(fl->selected);
-
-                       /* if we moved over the base point we need to
-                        * reseelct some stuff */
-                       if (!((last_idx < base_idx) && (cur_idx < base_idx))
-                                       && !((last_idx > base_idx)
-                                               && (cur_idx > base_idx)))
-                       {
-                               ewl_filelist_signal_between(fl, c, TRUE,
-                                               select_signal, base_idx,
-                                               fl->select.base, cur_idx,
-                                               clicked);
-                       }
-               }
-       }
-
-       DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-static void
-ewl_filelist_signal_between(Ewl_Filelist *fl, Ewl_Container *c, int add,
-                                               const char *signal,
-                                               int a_idx, Ewl_Widget *a,
-                                               int b_idx, Ewl_Widget *b)
-{
-       Ewl_Widget *start, *end, *cur;
-
-       DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR(fl);
-       DCHECK_PARAM_PTR(c);
-       DCHECK_PARAM_PTR(signal);
-       DCHECK_PARAM_PTR(a);
-       DCHECK_PARAM_PTR(b);
-       DCHECK_TYPE(fl, EWL_FILELIST_TYPE);
-       DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
-       DCHECK_TYPE(a, EWL_WIDGET_TYPE);
-       DCHECK_TYPE(b, EWL_WIDGET_TYPE);
-
-       if (a_idx < b_idx)
-       {
-               start = a;
-               end = b;
+                       ewl_filelist_selected_files_change_notify(fl);
        }
-       else
-       {
-               start = b;
-               end = a;
-       }
-
-       /* select all the widgets between the base and clicked
-        * point, excluding the start/end points */
-       ecore_list_goto(c->children, start);
-       ecore_list_next(c->children);
-       while ((cur = ecore_list_next(c->children)))
-       {
-               if (cur == end) break;
-
-               if (add)
-               {
-                       ewl_widget_state_set(cur, signal, EWL_STATE_PERSISTENT);
-                       ecore_list_append(fl->selected, cur);
-               }
-               else
-               {
-                       /* don't remove the base selected widget */
-                       if (cur != fl->select.base)
-                       {
-                               ecore_list_goto(fl->selected, cur);
-                               ecore_list_remove(fl->selected);
-                               ewl_widget_state_set(cur, signal,
-                                                       EWL_STATE_PERSISTENT);
-                       }
-               }
-       }
-
-       DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-/**
- * @internal
- * @param w: The widget to work with
- * @param ev: UNUSED
- * @param data: UNUSED
- * @return Returns no value
- * @brief The destroy callback
- */
-void
-ewl_filelist_cb_destroy(Ewl_Widget *w, void *ev __UNUSED__,
-                                       void *data __UNUSED__)
-{
-       Ewl_Filelist *fl;
-
-       DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR(w);
-       DCHECK_TYPE(w, EWL_FILELIST_TYPE);
-
-       fl = EWL_FILELIST(w);
-
-       IF_FREE_LIST(fl->selected);
-       IF_FREE(fl->directory);
-       IF_FREE(fl->filter);
-
-       fl->dir_change = NULL;
-       fl->filter_change = NULL;
-       fl->multiselect_change = NULL;
-       fl->show_dot_change = NULL;
-       fl->selected_file_add = NULL;
-       fl->file_name_get = NULL;
-       fl->selected_unselect = NULL;
-       fl->shift_handle = NULL;
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filelist.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- ewl_filelist.h      11 Nov 2007 06:07:46 -0000      1.20
+++ ewl_filelist.h      14 Nov 2007 20:07:58 -0000      1.21
@@ -6,6 +6,8 @@
 #include "ewl_image.h"
 #include "ewl_icon.h"
 #include "ewl_text.h"
+#include "ewl_model.h"
+#include "ewl_view.h"
 
 /**
  * @addtogroup Ewl_Filelist Ewl_Filelist: The base widget for the filelists
@@ -48,50 +50,28 @@
 struct Ewl_Filelist
 {
        Ewl_Box box;            /**< Inherits from Ewl_Box */
+       Ewl_Widget *controller; /**< Must inherit from mvc **/
+
+       Ewl_View *view;          /**< The view for mvc */
+       Ewl_Model *model;       /**< The model for the mvc */
 
-       Ecore_List *selected;   /**< The selected files */
        char *directory;        /**< The directory to display */
        char *filter;           /**< The file filter to employ */
 
        unsigned char multiselect:1;    /**< Allow multiple file selctions */
-       unsigned char show_dot_files:1; /**< Show . files */
+       unsigned char skip_hidden:1;    /**< Show . files */
 
-       struct
-       {
-               Ewl_Widget *base; /**< First select in SHIFT select */
-               Ewl_Widget *last; /**< Last selected in SHIFT select */
-       } select;                /**< Data used in SHIFT select */
+       Ewl_Filelist_View view_flag;    /**< The view to use for controller */
 
        struct
        {       Ewl_Scrollpane_Flags h; /**< Horizontal scroll flag */
                Ewl_Scrollpane_Flags v; /**< Vertical scroll flag */
        } scroll_flags;         /**< Flags to modify a containing scrollpane */
-
-       void (*dir_change)(Ewl_Filelist *fl);   /**< Callback to notify of
-                                                       directory change */
-       void (*filter_change)(Ewl_Filelist *fl);        /**< Callback to notify
-                                                       of filter change */
-       void (*multiselect_change)(Ewl_Filelist *fl); /**< Callback to notify
-                                                       of multilselect state
-                                                       change */
-       void (*show_dot_change)(Ewl_Filelist *fl);      /**< Callback to notify
-                                                       of show dot file
-                                                       setting change */
-       void (*selected_unselect)(Ewl_Filelist *fl); /**< Callback to
-                                                       unselect all files */
-       void (*selected_file_add)(Ewl_Filelist *fl, const char *file); /**<
-                                                       Callback to
-                                                       notify of a change
-                                                       to the selected
-                                                       files */
-       const char *(*file_name_get)(Ewl_Filelist *fl, void *file); /**<
-                                                       Callback to get the
-                                                       selected filename */
-       void (*shift_handle)(Ewl_Filelist *fl, Ewl_Widget *clicked); /**<
-                                                       Callback to handle
-                                                       SHIFT clicks */
 };
 
+
+Ewl_Widget     *ewl_filelist_new(void);
+
 int             ewl_filelist_init(Ewl_Filelist *fl);
 
 void            ewl_filelist_directory_set(Ewl_Filelist *fl,
@@ -102,6 +82,11 @@
                                                        const char *filter);
 const char     *ewl_filelist_filter_get(Ewl_Filelist *fl);
 
+void            ewl_filelist_view_set(Ewl_Filelist *fl,
+                                               Ewl_Filelist_View view);
+Ewl_Filelist_View *ewl_filelist_view_get(Ewl_Filelist *fl);
+
+
 void            ewl_filelist_multiselect_set(Ewl_Filelist *fl,
                                                        unsigned int ms);
 unsigned int    ewl_filelist_multiselect_get(Ewl_Filelist *fl);
@@ -138,7 +123,7 @@
                                                Ewl_Scrollpane_Flags h);
 Ewl_Scrollpane_Flags ewl_filelist_hscroll_flag_get(Ewl_Filelist *fl);
 
-const char     *ewl_filelist_stock_icon_get(Ewl_Filelist *fl, const char 
*path);
+const char     *ewl_filelist_stock_icon_get(const char *path);
 
 char           *ewl_filelist_expand_path(Ewl_Filelist *fl, const char *dir);
 void            ewl_filelist_directory_read(Ewl_Filelist *fl,
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filelist_model.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ewl_filelist_model.c        12 Nov 2007 22:42:22 -0000      1.4
+++ ewl_filelist_model.c        14 Nov 2007 20:07:59 -0000      1.5
@@ -6,7 +6,6 @@
 #include "ewl_model.h"
 #include "ewl_filelist.h"
 #include <dirent.h>
-#include <locale.h>
 
 static int ewl_filelist_model_data_name_sort(Ewl_Filelist_File *file1,
                                Ewl_Filelist_File *file2);
@@ -44,7 +43,7 @@
        all_files = ecore_file_ls(path);
 
        /* Add in the ".." entry for now */
-       if (show_dot_dot)
+       if ((show_dot_dot) && (strcmp(path, "/")))
                ecore_list_prepend(all_files, strdup(path));
 
        while ((file_temp = ecore_list_first_remove(all_files)))
@@ -149,6 +148,7 @@
        Ewl_Filelist_File *file;
        int i;
        void *ret;
+       char path[PATH_MAX];
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(data, NULL);
@@ -164,7 +164,11 @@
                file = ecore_list_index_goto(fld->files, i);
        }
 
-       if (column == 0) ret = strdup(file->name);
+       if ((column == 0) && (strcmp(file->name, "..")))
+       {
+               snprintf(path, PATH_MAX, "%s/%s", fld->name, file->name);
+               ret = strdup(path);
+       }
        else if (column == 1) ret = ewl_filelist_size_get(file->size);
        else if (column == 2) ret = ewl_filelist_perms_get(file->mode);
        else if (column == 3) ret = ewl_filelist_username_get
@@ -173,7 +177,7 @@
                                                (file->groupname);
        else if (column == 5) ret = ewl_filelist_modtime_get
                                                (file->modtime);
-       else ret = NULL;
+       else ret = strdup(file->name);
 
        /* ret needs to be freed by the view or with model_data_free_set */
        DRETURN_PTR(ret, DLEVEL_STABLE);
@@ -353,7 +357,6 @@
        DCHECK_PARAM_PTR_RET(data, FALSE);
        
        dir = data;
-
        ecore_string_release(dir->name);
        ecore_list_destroy(dir->files);
        ecore_list_destroy(dir->dirs);
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filepicker.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -3 -r1.36 -r1.37
--- ewl_filepicker.c    12 Nov 2007 22:42:22 -0000      1.36
+++ ewl_filepicker.c    14 Nov 2007 20:07:59 -0000      1.37
@@ -1,10 +1,10 @@
 /* vim: set sw=8 ts=8 sts=8 noexpandtab: */
 #include "ewl_base.h"
 #include "ewl_filepicker.h"
+#include "ewl_filelist.h"
 #include "ewl_button.h"
 #include "ewl_combo.h"
 #include "ewl_entry.h"
-#include "ewl_filelist_icon.h"
 #include "ewl_label.h"
 #include "ewl_model.h"
 #include "ewl_scrollpane.h"
@@ -104,6 +104,7 @@
        view = ewl_label_view_get();
 
        fp->path = ecore_list_new();
+       ecore_list_free_cb_set(fp->path, ECORE_FREE_CB(free));
 
        fp->path_combo = ewl_combo_new();
        ewl_container_child_append(EWL_CONTAINER(fp), fp->path_combo);
@@ -194,7 +195,14 @@
        ewl_widget_show(o);
 
        /* do this last so all the other widgets are set correctly */
-       ewl_filepicker_list_view_set(fp, ewl_filelist_icon_view_get());
+       fp->file_list = ewl_filelist_new();
+       ewl_container_child_append(EWL_CONTAINER(fp->file_list_box),
+                                                       fp->file_list);
+       ewl_callback_append(EWL_WIDGET(fp->file_list),
+                               EWL_CALLBACK_VALUE_CHANGED,
+                               ewl_filepicker_cb_list_value_changed,
+                               fp);
+       ewl_widget_show(fp->file_list);
        ewl_filepicker_directory_set(fp, NULL);
 
        DRETURN_INT(TRUE, DLEVEL_STABLE);
@@ -247,55 +255,19 @@
  * @brief Sets the given view to be used to display the file list
  */
 void
-ewl_filepicker_list_view_set(Ewl_Filepicker *fp, Ewl_View *view)
+ewl_filepicker_list_view_set(Ewl_Filepicker *fp, Ewl_Filelist_View view)
 {
-       Ewl_Filelist *old_fl;
+       Ewl_Filelist *temp;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(fp);
-       DCHECK_PARAM_PTR(view);
        DCHECK_TYPE(fp, EWL_FILEPICKER_TYPE);
-
-       if (view == fp->view)
+       
+       temp = EWL_FILELIST(fp->file_list);
+       
+       if (temp->view_flag == view)
                DRETURN(DLEVEL_STABLE);
-
-       fp->view = view;
-       old_fl = EWL_FILELIST(fp->file_list);
-
-       /* set the new view */
-       fp->file_list = view->fetch(NULL, 0, 0);
-       ewl_container_child_append(EWL_CONTAINER(fp->file_list_box),
-                                                       fp->file_list);
-       ewl_callback_append(EWL_WIDGET(fp->file_list),
-                               EWL_CALLBACK_VALUE_CHANGED,
-                               ewl_filepicker_cb_list_value_changed, fp);
-
-       /* get any scrollpane flags from the file list in case they need to
-        * turn off certain bars */
-       ewl_scrollpane_vscrollbar_flag_set(EWL_SCROLLPANE(fp->file_list_box),
-                               ewl_filelist_vscroll_flag_get(
-                                               EWL_FILELIST(fp->file_list)));
-       ewl_scrollpane_hscrollbar_flag_set(EWL_SCROLLPANE(fp->file_list_box),
-                               ewl_filelist_hscroll_flag_get(
-                                               EWL_FILELIST(fp->file_list)));
-
-       /* load new view from old view values */
-       if (old_fl)
-       {
-               ewl_filepicker_directory_set(fp,
-                                       ewl_filelist_directory_get(old_fl));
-               ewl_filepicker_filter_set(fp,
-                                       ewl_filelist_filter_get(old_fl));
-               ewl_filepicker_multiselect_set(fp,
-                                       ewl_filelist_multiselect_get(old_fl));
-               ewl_filepicker_show_dot_files_set(fp,
-                                       
ewl_filelist_show_dot_files_get(old_fl));
-               ewl_filepicker_selected_files_set(fp,
-                                       
ewl_filelist_selected_files_get(old_fl));
-               ewl_widget_destroy(EWL_WIDGET(old_fl));
-       }
-       ewl_widget_show(fp->file_list);
-
+       ewl_filelist_view_set(EWL_FILELIST(fp->file_list), view);
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -304,14 +276,15 @@
  * @return Returns the current view set on the filepicker
  * @brief Retrieves the current view used for the file list
  */
-Ewl_View *
+Ewl_Filelist_View *
 ewl_filepicker_list_view_get(Ewl_Filepicker *fp)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(fp, NULL);
        DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, NULL);
 
-       DRETURN_PTR(fp->view, DLEVEL_STABLE);
+       DRETURN_PTR(ewl_filelist_view_get(EWL_FILELIST(fp->file_list)),
+                                                       DLEVEL_STABLE);
 }
 
 /**
@@ -432,8 +405,8 @@
 ewl_filepicker_multiselect_get(Ewl_Filepicker *fp)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR_RET(fp, 0);
-       DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, 0);
+       DCHECK_PARAM_PTR_RET(fp, FALSE);
+       DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, FALSE);
 
        DRETURN_INT(ewl_filelist_multiselect_get(EWL_FILELIST(fp->file_list)),
                                                                DLEVEL_STABLE);
@@ -467,8 +440,8 @@
 ewl_filepicker_show_dot_files_get(Ewl_Filepicker *fp)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR_RET(fp, 0);
-       DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, 0);
+       DCHECK_PARAM_PTR_RET(fp, FALSE);
+       DCHECK_TYPE_RET(fp, EWL_FILEPICKER_TYPE, FALSE);
 
        
DRETURN_INT(ewl_filelist_show_dot_files_get(EWL_FILELIST(fp->file_list)),
                                                                DLEVEL_STABLE);
@@ -600,13 +573,26 @@
                dir = strdup(ewl_filelist_directory_get(fl));
                ewl_filepicker_path_populate(fp, dir);
                ewl_text_clear(EWL_TEXT(fp->file_entry));
-
                FREE(dir);
        }
-       else if (e->response == EWL_FILELIST_EVENT_SELECTION_CHANGE)
+       else if ((e->response == EWL_FILELIST_EVENT_SELECTION_CHANGE) &&
+                                       (!fl->multiselect))
                ewl_text_text_set(EWL_TEXT(fp->file_entry),
                                ewl_filelist_selected_file_get(fl));
 
+       else if (e->response == EWL_FILELIST_EVENT_MULTI_TRUE)
+       {
+               ewl_text_clear(EWL_TEXT(fp->file_entry));
+               ewl_widget_disable(EWL_WIDGET(fp->file_entry));
+       }
+
+       else if (e->response == EWL_FILELIST_EVENT_MULTI_FALSE)
+       {
+               ewl_widget_enable(EWL_WIDGET(fp->file_entry));
+               ewl_text_text_set(EWL_TEXT(fp->file_entry),
+                               ewl_filelist_selected_file_get(fl));
+       }
+
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -674,7 +660,7 @@
        Ewl_Filepicker *fp;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR_RET(data, 0);
+       DCHECK_PARAM_PTR_RET(data, FALSE);
 
        fp = data;
 
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filepicker.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- ewl_filepicker.h    11 Nov 2007 06:07:46 -0000      1.11
+++ ewl_filepicker.h    14 Nov 2007 20:07:59 -0000      1.12
@@ -3,7 +3,6 @@
 #define EWL_FILEPICKER_H
 
 #include "ewl_box.h"
-#include "ewl_view.h"
 
 /**
  * @addtogroup Ewl_Filepicker Ewl_Filepicker: Allows selecting files from a 
list
@@ -59,7 +58,6 @@
        Ecore_List *filters;            /**< The type filters */
 
        unsigned char show_favorites:1; /**< Show the favorite box */
-       Ewl_View *view;                 /**< The filelist view to use */
 };
 
 Ewl_Widget     *ewl_filepicker_new(void);
@@ -94,8 +92,8 @@
 unsigned int    ewl_filepicker_show_favorites_get(Ewl_Filepicker *fp);
 
 void            ewl_filepicker_list_view_set(Ewl_Filepicker *fp,
-                                                       Ewl_View *view);
-Ewl_View       *ewl_filepicker_list_view_get(Ewl_Filepicker *fp);
+                                                       Ewl_Filelist_View view);
+Ewl_Filelist_View *ewl_filepicker_list_view_get(Ewl_Filepicker *fp);
 
 void            ewl_filepicker_filter_add(Ewl_Filepicker *fp,
                                                const char *name,
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_tree2_view_freebox.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ewl_tree2_view_freebox.c    12 Nov 2007 22:42:22 -0000      1.2
+++ ewl_tree2_view_freebox.c    14 Nov 2007 20:07:59 -0000      1.3
@@ -93,7 +93,7 @@
        ewl_widget_inherit(EWL_WIDGET(tv), EWL_TREE2_VIEW_FREEBOX_TYPE);
        ewl_widget_show(tv->scroll);
 
-       tv->fbox = ewl_hfreebox_new();
+       tv->fbox = ewl_vfreebox_new();
        ewl_freebox_layout_type_set(EWL_FREEBOX(tv->fbox),
                                EWL_FREEBOX_LAYOUT_AUTO);
        ewl_container_child_append(EWL_CONTAINER(tv->scroll), tv->fbox);



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to