Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        Ewl.h Makefile.am ewl_enums.h ewl_events.h ewl_filedialog.c 
        ewl_filedialog.h ewl_private.h 
Added Files:
        ewl_filelist.c ewl_filelist.h ewl_filelist_icon.c 
        ewl_filelist_icon.h ewl_filelist_list.c ewl_filelist_list.h 
        ewl_filepicker.c ewl_filepicker.h 
Removed Files:
        ewl_fileselector.c ewl_fileselector.h 


Log Message:
- update the filedialog
- This has API Breakage.
- Ewl_Fileselector is now dead. It has been replaced by Ewl_Filepicker.
- The Ewl_Filepicker has an Ewl_Filelist to display the list of
  files/directories. The Ewl_Filelist is a superclass (it can't be
  instantiated) to Ewl_Filelist_List and Ewl_Filelist_Icon. You can also now
  write your own view if you want something slightly different for your
  filepicker.

- The favorites list isn't setup yet. It is disabled by default.
- multiselect isn't in place yet.

- There are a few issues with this code still.
- There is a strange segv in there we need to track down when clicking on
  directories.
- The combo needs to be turned into a window so it will display outside the
  filedialog window.
- The right mouse menu to change views dosen't always seem to appear.
- As you move around directories it seems as thought it starts taking more
  and more mouse clicks to activate things.


===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/Ewl.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- Ewl.h       29 Mar 2006 19:48:04 -0000      1.1
+++ Ewl.h       10 Apr 2006 04:43:17 -0000      1.2
@@ -298,7 +298,10 @@
 #include <ewl_embed.h>
 #include <ewl_window.h>
 #include <ewl_dialog.h>
-#include <ewl_fileselector.h>
+#include <ewl_filelist.h>
+#include <ewl_filelist_list.h>
+#include <ewl_filelist_icon.h>
+#include <ewl_filepicker.h>
 #include <ewl_filedialog.h>
 
 #include <ewl_text.h>
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/Makefile.am,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- Makefile.am 31 Mar 2006 06:50:29 -0000      1.25
+++ Makefile.am 10 Apr 2006 04:43:17 -0000      1.26
@@ -34,8 +34,11 @@
        ewl_entry.h \
        ewl_enums.h \
        ewl_events.h \
-       ewl_fileselector.h \
        ewl_floater.h \
+       ewl_filelist.h \
+       ewl_filelist_list.h\
+       ewl_filelist_icon.h \
+       ewl_filepicker.h \
        ewl_filedialog.h \
        ewl_freebox.h \
        ewl_grid.h \
@@ -98,8 +101,11 @@
        ewl_embed.c \
        ewl_entry.c \
        ewl_events.c \
-       ewl_fileselector.c \
        ewl_floater.c \
+       ewl_filelist.c \
+       ewl_filelist_list.c \
+       ewl_filelist_icon.c \
+       ewl_filepicker.c \
        ewl_filedialog.c \
        ewl_freebox.c \
        ewl_grid.c \
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_enums.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -3 -r1.39 -r1.40
--- ewl_enums.h 15 Mar 2006 04:03:48 -0000      1.39
+++ ewl_enums.h 10 Apr 2006 04:43:17 -0000      1.40
@@ -277,17 +277,6 @@
 
 typedef enum Ewl_ScrollPane_Flags Ewl_ScrollPane_Flags;
 
-/**
- * @enum Ewl_Filedialog_Type
- */
-enum Ewl_Filedialog_Type
-{
-       EWL_FILEDIALOG_TYPE_OPEN,       /**< Open dialog */
-       EWL_FILEDIALOG_TYPE_SAVE        /**< Save dialog */
-};
-
-typedef enum Ewl_Filedialog_Type Ewl_Filedialog_Type;
-
 enum Ewl_Engine
 {
        EWL_ENGINE_SOFTWARE_X11 = 1,    /**< The Software X11 engine */
@@ -462,6 +451,14 @@
        EWL_FREEBOX_LAYOUT_AUTO
 };
 typedef enum Ewl_Freebox_Layout_Type Ewl_Freebox_Layout_Type;
+
+enum Ewl_Filelist_Event_Type
+{
+       EWL_FILELIST_EVENT_TYPE_DIR_CHANGE,
+       EWL_FILELIST_EVENT_TYPE_SELECTION_CHANGE,
+       EWL_FILELIST_EVENT_TYPE_FILE_SELECTED
+};
+typedef enum Ewl_Filelist_Event_Type Ewl_Filelist_Event_Type;
 
 #define EWL_MOUSE_CURSOR_X 0
 #define EWL_MOUSE_CURSOR_ARROW 2
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_events.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- ewl_events.h        15 Mar 2006 04:03:48 -0000      1.12
+++ ewl_events.h        10 Apr 2006 04:43:17 -0000      1.13
@@ -178,6 +178,20 @@
        unsigned int response; /**< The response ID from the dialog */
 };
 
+typedef struct Ewl_Filepicker_Event Ewl_Filepicker_Event;
+
+struct Ewl_Filepicker_Event
+{
+       unsigned int response;
+};
+
+typedef struct Ewl_Filelist_Event Ewl_Filelist_Event;
+
+struct Ewl_Filelist_Event
+{
+       Ewl_Filelist_Event_Type type;
+};
+
 int            ewl_ev_init(void);
 unsigned int   ewl_ev_modifiers_get(void);
 void           ewl_ev_modifiers_set(unsigned int modifiers);
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filedialog.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- ewl_filedialog.c    17 Feb 2006 06:43:33 -0000      1.15
+++ ewl_filedialog.c    10 Apr 2006 04:43:17 -0000      1.16
@@ -4,6 +4,11 @@
 #include "ewl_private.h"
 
 static void ewl_filedialog_respond(Ewl_Filedialog *fd, unsigned int response);
+static void ewl_filedialog_cb_value_changed(Ewl_Widget *w, void *ev, 
+                                                       void *data);
+static void ewl_filedialog_cb_mouse_down(Ewl_Widget *w, void *ev, void *data);
+static void ewl_filedialog_cb_icon_view(Ewl_Widget *w, void *ev, void *data);
+static void ewl_filedialog_cb_list_view(Ewl_Widget *w, void *ev, void *data);
 
 /**
  * @return Returns a new open filedialog if successful, NULL on failure.
@@ -17,9 +22,9 @@
        DENTER_FUNCTION(DLEVEL_STABLE);
 
        fd = ewl_filedialog_new();
-       if (!fd) {
+       if (!fd) 
                DRETURN_PTR(NULL, DLEVEL_STABLE);
-       }
+               
        ewl_filedialog_multiselect_set(EWL_FILEDIALOG(fd), TRUE);
 
        DRETURN_PTR(EWL_WIDGET(fd), DLEVEL_STABLE);
@@ -37,11 +42,11 @@
        DENTER_FUNCTION(DLEVEL_STABLE);
 
        fd = NEW(Ewl_Filedialog, 1);
-       if (!fd) {
+       if (!fd) 
                DRETURN_PTR(NULL, DLEVEL_STABLE);
-       }
 
-       if (!ewl_filedialog_init(fd)) {
+       if (!ewl_filedialog_init(fd)) 
+       {
                ewl_widget_destroy(EWL_WIDGET(fd));
                fd = NULL;
        }
@@ -57,7 +62,7 @@
 int
 ewl_filedialog_init(Ewl_Filedialog *fd)
 {
-       Ewl_Widget *w, *o;
+       Ewl_Widget *w, *menu, *o;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET("fd", fd, FALSE);
@@ -72,76 +77,104 @@
        ewl_window_name_set(EWL_WINDOW(fd), "Ewl Filedialog");
        ewl_window_class_set(EWL_WINDOW(fd), "Ewl Filedialog");
 
-       ewl_dialog_action_position_set(EWL_DIALOG(fd), EWL_POSITION_BOTTOM);
-
        ewl_callback_append(EWL_WIDGET(fd), EWL_CALLBACK_DELETE_WINDOW,
-                               ewl_filedialog_delete_window_cb, NULL);
+                               ewl_filedialog_cb_delete_window, NULL);
+       ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN,
+                               ewl_filedialog_cb_mouse_down, NULL);
 
        ewl_dialog_active_area_set(EWL_DIALOG(fd), EWL_POSITION_TOP);
 
-       /* the file selector */
-       fd->fs = ewl_fileselector_new();
-       ewl_widget_internal_set(fd->fs, TRUE);
-       ewl_container_child_append(EWL_CONTAINER(fd), fd->fs);
-       ewl_widget_show(fd->fs);
-
-       ewl_dialog_active_area_set(EWL_DIALOG(fd), EWL_POSITION_BOTTOM);
-
-       /* Buttons */
-       o = ewl_button_new();
-       ewl_container_child_append(EWL_CONTAINER(fd), o);
-       ewl_button_stock_type_set(EWL_BUTTON(o), EWL_STOCK_OPEN);
-       ewl_callback_append(o, EWL_CALLBACK_CLICKED, 
-                                       ewl_filedialog_click_cb, fd);
+       /* the file picker */
+       fd->fp = ewl_filepicker_new();
+       ewl_widget_internal_set(fd->fp, TRUE);
+       ewl_container_child_append(EWL_CONTAINER(fd), fd->fp);
+       ewl_callback_append(fd->fp, EWL_CALLBACK_VALUE_CHANGED,
+                               ewl_filedialog_cb_value_changed, fd);
+       ewl_widget_show(fd->fp);
+
+       /* we don't want an action area with this as the filepicker provides
+        * it's own ok/cancel buttons */
+       ewl_dialog_has_separator_set(EWL_DIALOG(fd), FALSE);
+       ewl_widget_hide(EWL_DIALOG(fd)->action_area);
+
+       fd->menu_float = ewl_floater_new();
+       ewl_container_child_append(EWL_CONTAINER(fd), fd->menu_float);
+       ewl_object_fill_policy_set(EWL_OBJECT(fd->menu_float),
+                                               EWL_FLAG_FILL_FILL);
+       ewl_widget_internal_set(EWL_WIDGET(fd->menu_float), TRUE);
+
+       menu = ewl_menu_new();
+       ewl_button_label_set(EWL_BUTTON(menu), " ");
+       ewl_container_child_append(EWL_CONTAINER(fd->menu_float), menu);
+       ewl_widget_show(menu);
+
+       o = ewl_menu_item_new();
+       ewl_button_label_set(EWL_BUTTON(o), "Icon view");
+       ewl_container_child_append(EWL_CONTAINER(menu), o);
+       ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+                               ewl_filedialog_cb_icon_view, fd);
        ewl_widget_show(o);
-       fd->type_btn = o;
 
-       o = ewl_button_new();
-       ewl_container_child_append(EWL_CONTAINER(fd), o);
-       ewl_button_stock_type_set(EWL_BUTTON(o), EWL_STOCK_CANCEL);
-       ewl_callback_append(o, EWL_CALLBACK_CLICKED, 
-                                       ewl_filedialog_click_cb, fd);
+       o = ewl_menu_item_new();
+       ewl_button_label_set(EWL_BUTTON(o), "List view");
+       ewl_container_child_append(EWL_CONTAINER(menu), o);
+       ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+                               ewl_filedialog_cb_list_view, fd);
        ewl_widget_show(o);
 
-       /* set the top active so the tooltips go to the right spot */
-       ewl_dialog_active_area_set(EWL_DIALOG(fd), EWL_POSITION_TOP);
-
        DRETURN_INT(TRUE, DLEVEL_STABLE);
 }
 
 /**
- * @param fd: the filedialog to get the current type
- * @return Returns the current file dialog type.
- * @brief Retrieve the current filedialog type.
+ * @param fd: The filedialog to set the view on
+ * @param view: The Ewl_View to set into the dialog
+ * @return Returns no value.
+ * @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)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("fd", fd);
+       DCHECK_PARAM_PTR("view", view);
+       DCHECK_TYPE("fd", fd, EWL_FILEDIALOG_TYPE);
+
+       ewl_filepicker_list_view_set(EWL_FILEPICKER(fd->fp), view);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param fd: The filedialog to get the view from
+ * @return Returns the Ewl_View set on this file dialog
+ * @brief Retrieve the file list view used in this file dialog
  */
-Ewl_Filedialog_Type
-ewl_filedialog_type_get(Ewl_Filedialog *fd)
+Ewl_View *
+ewl_filedialog_list_view_get(Ewl_Filedialog *fd)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR_RET("fd", fd, EWL_FILEDIALOG_TYPE_OPEN);
-       DCHECK_TYPE_RET("fd", fd, EWL_FILEDIALOG_TYPE, 
EWL_FILEDIALOG_TYPE_OPEN);
+       DCHECK_PARAM_PTR_RET("fd", fd, NULL);
+       DCHECK_TYPE_RET("fd", fd, EWL_FILEDIALOG_TYPE, NULL);
 
-       DRETURN_INT(fd->type, DLEVEL_STABLE);
+       DRETURN_PTR(ewl_filepicker_list_view_get(EWL_FILEPICKER(fd->fp)), 
+                                                       DLEVEL_STABLE);
 }
 
 /**
- * @param fd: the filedialog to change types
- * @param t: The type to set the filedialog too
+ * @param fd: the filedialog to change paths
+ * @param path: the new path used for the filedialog
  * @return Returns no value.
- * @brief Change the current filedialog type.
+ * @brief Changes the current path of a filedialog.
  */
 void
-ewl_filedialog_type_set(Ewl_Filedialog *fd, Ewl_Filedialog_Type t)
+ewl_filedialog_path_set(Ewl_Filedialog *fd, char *path)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("fd", fd);
+       DCHECK_PARAM_PTR("path", path);
        DCHECK_TYPE("fd", fd, EWL_FILEDIALOG_TYPE);
 
-       if (t == EWL_FILEDIALOG_TYPE_OPEN) 
-               ewl_button_stock_type_set(EWL_BUTTON(fd->type_btn), 
EWL_STOCK_OPEN);
-
-       else if (t == EWL_FILEDIALOG_TYPE_SAVE) 
-               ewl_button_stock_type_set(EWL_BUTTON(fd->type_btn), 
EWL_STOCK_SAVE);
+       ewl_filepicker_directory_set(EWL_FILEPICKER(fd->fp), path);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -151,93 +184,169 @@
  * @return Returns the current path of filedialog
  * @brief Retrieve the current filedialog path
  */
-char *
-ewl_filedialog_path_get(Ewl_Filedialog *fd)
+const char *
+ewl_filedialog_directory_get(Ewl_Filedialog *fd)
 {
-       char *s;
-
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET("fd", fd, NULL);
        DCHECK_TYPE("fd", fd, EWL_FILEDIALOG_TYPE);
 
-       s = ewl_fileselector_path_get(EWL_FILESELECTOR(fd->fs)); 
-
-       DRETURN_PTR(s, DLEVEL_STABLE);
+       DRETURN_PTR(ewl_filepicker_directory_get(EWL_FILEPICKER(fd->fp)),
+                                                       DLEVEL_STABLE);
 }
 
 /**
  * @param fd: the filedialog
- * @return Returns the selected filename including its path
- * @brief Retrieve the selected filename
+ * @param val: 1 to set multiselect, 0 otherwise
+ * @return Returns no value.
+ * @brief Sets the dialog to multiselect or single select
  */
-char *
-ewl_filedialog_file_get(Ewl_Filedialog *fd)
+void
+ewl_filedialog_multiselect_set(Ewl_Filedialog *fd, unsigned int val)
 {
-       char *s;
-
        DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR_RET("fd", fd, NULL);
-       DCHECK_TYPE_RET("fd", fd, EWL_FILEDIALOG_TYPE, NULL);
-       
-       s = ewl_fileselector_file_get(EWL_FILESELECTOR(fd->fs));
+       DCHECK_PARAM_PTR("fd", fd);
+       DCHECK_TYPE("fd", fd, EWL_FILEDIALOG_TYPE);
 
-       DRETURN_PTR(s, DLEVEL_STABLE);
+       ewl_filepicker_multiselect_set(EWL_FILEPICKER(fd->fp), val);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
 /**
- * @param fd: the filedialog to change paths
- * @param path: the new path used for the filedialog
+ * @param fd: the filedialog
+ * @return Returns the multi select setting (0|1)
+ * @brief gets the multiselect setting of the filedialog
+ */
+unsigned int
+ewl_filedialog_multiselect_get(Ewl_Filedialog *fd)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR_RET("fd", fd, 0);
+       DCHECK_TYPE_RET("fd", fd, EWL_FILEDIALOG_TYPE, 0);
+
+       DRETURN_INT(ewl_filepicker_multiselect_get(EWL_FILEPICKER(fd->fp)), 
+                                                       DLEVEL_STABLE); 
+}
+
+/** 
+ * @param fd: The filedialog to change
+ * @param dot: The value to set for show dot files
  * @return Returns no value.
- * @brief Changes the current path of a filedialog.
+ * @brief Set if the file dialog should show dot files by default 
  */
 void
-ewl_filedialog_path_set(Ewl_Filedialog *fd, char *path)
+ewl_filedialog_show_dot_files_set(Ewl_Filedialog *fd, unsigned int dot)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("fd", fd);
-       DCHECK_PARAM_PTR("path", path);
        DCHECK_TYPE("fd", fd, EWL_FILEDIALOG_TYPE);
 
-       ewl_fileselector_path_set(EWL_FILESELECTOR(fd->fs), path);
+       ewl_filepicker_show_dot_files_set(EWL_FILEPICKER(fd->fp), dot);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
 /**
- * @param fd: the filedialog
- * @param val: 1 to set multiselect, 0 otherwise
+ * @param fd: The filedialog to get the value from
+ * @return Returns the show dot file setting of the dialog
+ * @brief Returns the current dot file setting of the dialog
+ */
+unsigned int
+ewl_filedialog_show_dot_files_get(Ewl_Filedialog *fd)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR_RET("fd", fd, 0);
+       DCHECK_TYPE_RET("fd", fd, EWL_FILEDIALOG_TYPE, 0);
+
+       DRETURN_INT(ewl_filepicker_show_dot_files_get(EWL_FILEPICKER(fd->fp)),
+                                                               DLEVEL_STABLE);
+}
+
+/** 
+ * @param fd: The filedialog to set the value into
+ * @param show: The setting for show favorites to set
  * @return Returns no value.
- * @brief Sets the dialog to multiselect or single select
+ * @brief Specify if the favorites column should be shown or not
  */
 void
-ewl_filedialog_multiselect_set(Ewl_Filedialog *fd, unsigned int val)
+ewl_filedialog_show_favorites_set(Ewl_Filedialog *fd, unsigned int show)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("fd", fd);
        DCHECK_TYPE("fd", fd, EWL_FILEDIALOG_TYPE);
 
-       ewl_fileselector_multiselect_set(EWL_FILESELECTOR(fd->fs), val);
+       ewl_filepicker_show_favorites_set(EWL_FILEPICKER(fd->fp), show);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
 /**
- * @param fd: the filedialog
- * @return Returns the multi select setting (0|1)
- * @brief gets the multiselect setting of the filedialog
+ * @param: The filedialog to work with
+ * @return Returns the current show favorites setting for the dialog
+ * @brief Get the current show favorites setting for the filedialog
  */
 unsigned int
-ewl_filedialog_multiselect_get(Ewl_Filedialog *fd)
+ewl_filedialog_show_favorites_get(Ewl_Filedialog *fd)
 {
-       unsigned int val;
-
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET("fd", fd, 0);
        DCHECK_TYPE_RET("fd", fd, EWL_FILEDIALOG_TYPE, 0);
 
-       val = ewl_fileselector_multiselect_get(EWL_FILESELECTOR(fd->fs));
+       DRETURN_INT(ewl_filepicker_show_favorites_get(EWL_FILEPICKER(fd->fp)),
+                                                               DLEVEL_STABLE);
+}
 
-       DRETURN_INT(val, DLEVEL_STABLE);        
+/**
+ * @param fd: The filedialog to work with
+ * @param file: The selected file to set
+ * @return Returns no value
+ * @brief Set the currently selected file into the file dialog
+ */
+void
+ewl_filedialog_selected_file_set(Ewl_Filedialog *fd, const char *file)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("fd", fd);
+       DCHECK_TYPE("fd", fd, EWL_FILEDIALOG_TYPE);
+
+       ewl_filepicker_selected_file_set(EWL_FILEPICKER(fd->fp), file);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param fd: the filedialog
+ * @return Returns the selected filename including its path
+ * @brief Retrieve the selected filename
+ */
+char *
+ewl_filedialog_selected_file_get(Ewl_Filedialog *fd)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR_RET("fd", fd, NULL);
+       DCHECK_TYPE_RET("fd", fd, EWL_FILEDIALOG_TYPE, NULL);
+       
+       DRETURN_PTR(ewl_filepicker_selected_file_get(EWL_FILEPICKER(fd->fp)), 
+                                                       DLEVEL_STABLE);
+}
+
+/**
+ * @param fd: The filedialog to work with
+ * @param files: The list of filenames to set selected in the dialog
+ * @return Returns no value
+ * @brief Sets the given files as selected in the filedialog
+ */
+void
+ewl_filedialog_selected_files_set(Ewl_Filedialog *fd, Ecore_List *files)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("fd", fd);
+       DCHECK_TYPE("fd", fd, EWL_FILEDIALOG_TYPE);
+
+       ewl_filepicker_selected_files_set(EWL_FILEPICKER(fd->fp), files);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
 /**
@@ -246,66 +355,148 @@
  * @brief returns all the elements selected by the user
  */
 Ecore_List *
-ewl_filedialog_select_list_get(Ewl_Filedialog *fd)
+ewl_filedialog_selected_files_get(Ewl_Filedialog *fd)
 {
-       Ecore_List *list;
-
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET("fd", fd, NULL);
        DCHECK_TYPE_RET("fd", fd, EWL_FILEDIALOG_TYPE, NULL);
 
-       list = ewl_fileselector_select_list_get(EWL_FILESELECTOR(fd->fs));
+       DRETURN_PTR(ewl_filepicker_selected_files_get(EWL_FILEPICKER(fd->fp)), 
+                                                               DLEVEL_STABLE);
+}
 
-       DRETURN_PTR(list, DLEVEL_STABLE);
+/**
+ * @param fd: The filedialog to work with
+ * @param name: The name to display for the filter
+ * @param filter: The actual regular expression for the filter
+ * @return Returns no value
+ * @brief Add the filter named @a name to the combo box in the filedialog.
+ */
+void
+ewl_filedialog_filter_add(Ewl_Filedialog *fd, const char *name,
+                                               const char *filter)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("fd", fd);
+       DCHECK_PARAM_PTR("name", name);
+       DCHECK_PARAM_PTR("filter", filter);
+       DCHECK_TYPE("fd", fd, EWL_FILEDIALOG_TYPE);
+
+       ewl_filepicker_filter_add(EWL_FILEPICKER(fd->fp), name, filter);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
 /*
  * Internally used callback, override at your own risk.
  */
 void
-ewl_filedialog_click_cb(Ewl_Widget *w, void *ev_data __UNUSED__, void *data)
+ewl_filedialog_cb_delete_window(Ewl_Widget *w, void *ev_data __UNUSED__, 
+                                                       void *data __UNUSED__)
 {
        Ewl_Filedialog *fd;
-       unsigned int resp;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);
        DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
 
-       fd = EWL_FILEDIALOG(data);
-       resp = ewl_button_stock_type_get(EWL_BUTTON(w));
-       ewl_filedialog_respond(fd, resp);
+       fd = EWL_FILEDIALOG(w);
+       ewl_filedialog_respond(fd, EWL_STOCK_CANCEL);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
-void
-ewl_filedialog_delete_window_cb(Ewl_Widget *w, void *ev_data __UNUSED__, 
-                                                       void *data __UNUSED__)
+static void
+ewl_filedialog_respond(Ewl_Filedialog *fd, unsigned int response)
+{
+        Ewl_Dialog_Event ev;
+
+        DENTER_FUNCTION(DLEVEL_STABLE);
+
+        ev.response = response;
+        ewl_callback_call_with_event_data(EWL_WIDGET(fd),
+                                          EWL_CALLBACK_VALUE_CHANGED, &ev);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+static void
+ewl_filedialog_cb_value_changed(Ewl_Widget *w __UNUSED__, void *ev, 
+                                                       void *data)
 {
        Ewl_Filedialog *fd;
+       Ewl_Filepicker_Event *e;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);
+       DCHECK_PARAM_PTR("data", data);
        DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
 
+       fd = data;
+       e = ev;
+
+       ewl_filedialog_respond(fd, e->response);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+static void
+ewl_filedialog_cb_mouse_down(Ewl_Widget *w, void *ev, void *data __UNUSED__)
+{
+       Ewl_Event_Mouse_Down *event;
+       Ewl_Filedialog *fd;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       event = ev;
        fd = EWL_FILEDIALOG(w);
-       ewl_filedialog_respond(fd, EWL_STOCK_CANCEL);
+
+       if (event->button == 3)
+       {
+               int x, y;
+
+               x = ewl_object_current_x_get(EWL_OBJECT(fd));
+               y = ewl_object_current_y_get(EWL_OBJECT(fd));
+
+               ewl_floater_position_set(EWL_FLOATER(fd->menu_float),
+                                               event->x - x, 
+                                               event->y - y);
+               ewl_widget_show(fd->menu_float);
+       }
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
 static void
-ewl_filedialog_respond(Ewl_Filedialog *fd, unsigned int response)
+ewl_filedialog_cb_icon_view(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, 
+                                                               void *data)
 {
-       Ewl_Dialog_Event ev;
+       Ewl_Filedialog *fd;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("data", data);
 
-       ev.response = response;
-       ewl_callback_call_with_event_data(EWL_WIDGET(fd),
-                                         EWL_CALLBACK_VALUE_CHANGED, &ev);
+       fd = data;
+       ewl_filedialog_list_view_set(fd, ewl_filelist_icon_view_get());
+       ewl_widget_hide(fd->menu_float);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
+
+static void
+ewl_filedialog_cb_list_view(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, 
+                                                               void *data)
+{
+       Ewl_Filedialog *fd;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("data", data);
+
+       fd = data;
+       ewl_filedialog_list_view_set(fd, ewl_filelist_list_view_get());
+       ewl_widget_hide(fd->menu_float);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
 
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filedialog.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- ewl_filedialog.h    15 Mar 2006 04:03:48 -0000      1.11
+++ ewl_filedialog.h    10 Apr 2006 04:43:17 -0000      1.12
@@ -35,35 +35,51 @@
  */
 struct Ewl_Filedialog
 {
-       Ewl_Dialog dialog;        /**< The dialog base class */
-
-       Ewl_Filedialog_Type type; /**< Current type of filedialog */
-       Ewl_Widget *fs;           /**< Ewl_Fileselector */
-       Ewl_Widget *type_btn;     /**< Either the open or save button */
+       Ewl_Dialog dialog;      /**< The dialog base class */
+       Ewl_Widget *fp;         /**< Ewl_Filedialog */
+       Ewl_Widget *menu_float; /**< Floater to hold the menu */
 };
 
-Ewl_Widget             *ewl_filedialog_multiselect_new(void);
-Ewl_Widget             *ewl_filedialog_new(void);
-
-Ewl_Filedialog_Type     ewl_filedialog_type_get(Ewl_Filedialog *fd);
-void                    ewl_filedialog_type_set(Ewl_Filedialog *fd, 
-                                               Ewl_Filedialog_Type type);
-int                     ewl_filedialog_init(Ewl_Filedialog *fd);
-char                   *ewl_filedialog_path_get(Ewl_Filedialog *fd);
-char                   *ewl_filedialog_file_get(Ewl_Filedialog *fd);
-void                    ewl_filedialog_path_set(Ewl_Filedialog *fd, char 
*path);
-
-void                    ewl_filedialog_multiselect_set(Ewl_Filedialog *fd, 
-                                                       unsigned int val);
-unsigned int            ewl_filedialog_multiselect_get(Ewl_Filedialog *fd);
-
-Ecore_List             *ewl_filedialog_select_list_get(Ewl_Filedialog *fd);
+Ewl_Widget     *ewl_filedialog_multiselect_new(void);
+Ewl_Widget     *ewl_filedialog_new(void);
+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);
+
+void            ewl_filedialog_directory_set(Ewl_Filedialog *fd,
+                                               const char *dir);
+const char     *ewl_filedialog_directory_get(Ewl_Filedialog *fd);
+
+void            ewl_filedialog_multiselect_set(Ewl_Filedialog *fd,
+                                               unsigned int ms);
+unsigned int    ewl_filedialog_multiselect_get(Ewl_Filedialog *fd);
+
+void            ewl_filedialog_show_dot_files_set(Ewl_Filedialog *fd,
+                                               unsigned int dot);
+unsigned int    ewl_filedialog_show_dot_files_get(Ewl_Filedialog *fd);
+
+void            ewl_filedialog_show_favorites_set(Ewl_Filedialog *fd,
+                                               unsigned int show);
+unsigned int    ewl_filedialog_show_favorites_get(Ewl_Filedialog *fd);
+
+void            ewl_filedialog_selected_file_set(Ewl_Filedialog *fd,
+                                               const char *file);
+char           *ewl_filedialog_selected_file_get(Ewl_Filedialog *fd);
+
+void            ewl_filedialog_selected_files_set(Ewl_Filedialog *fd,
+                                               Ecore_List *files);
+Ecore_List     *ewl_filedialog_selected_files_get(Ewl_Filedialog *fd);
+
+void            ewl_filedialog_filter_add(Ewl_Filedialog *fd,
+                                               const char *name,
+                                               const char *filter);
 
 /*
  * Internally used callbacks, override at your own risk.
  */
-void ewl_filedialog_click_cb (Ewl_Widget *w, void *ev_data, void *data);
-void ewl_filedialog_delete_window_cb(Ewl_Widget *w, void *ev_data, void *data);
+void ewl_filedialog_cb_delete_window(Ewl_Widget *w, void *ev_data, void *data);
 
 /**
  * @}
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_private.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ewl_private.h       20 Oct 2005 05:38:08 -0000      1.3
+++ ewl_private.h       10 Apr 2006 04:43:17 -0000      1.4
@@ -16,7 +16,10 @@
 #include <math.h>
 #include <assert.h>
 #include <time.h>
-#include <regex.h>
+#include <fnmatch.h>
+#include <pwd.h>
+#include <grp.h>
+#include <langinfo.h>
 
 #ifdef HAVE_CONFIG_H
 #include "ewl-config.h"




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to