Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src Modified Files: ewl_filedialog.c ewl_filedialog.h Log Message: - make sure ewl_filedialog_init was successful - remove unneeded includes =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_filedialog.c,v retrieving revision 1.44 retrieving revision 1.45 diff -u -3 -r1.44 -r1.45 --- ewl_filedialog.c 21 Dec 2004 01:45:19 -0000 1.44 +++ ewl_filedialog.c 21 Dec 2004 03:56:25 -0000 1.45 @@ -6,10 +6,6 @@ #include <dirent.h> #include <string.h> -#include "ewl_fileselector.h" -#include "ewl_filedialog.h" - - /** * @param type: type of dialog to display * @return Returns a new filedialog in success, NULL on failure. @@ -22,11 +18,14 @@ DENTER_FUNCTION(DLEVEL_STABLE); fd = NEW(Ewl_Filedialog, 1); - if (!fd) + if (!fd) { DRETURN_PTR(NULL, DLEVEL_STABLE); + } - ewl_filedialog_init(fd, type); - + if (!ewl_filedialog_init(fd, type)) { + ewl_widget_destroy(EWL_WIDGET(fd)); + fd = NULL; + } DRETURN_PTR(EWL_WIDGET(fd), DLEVEL_STABLE); } @@ -36,14 +35,14 @@ * @return Returns no value. * @brief Initialize a new filedialog */ -void ewl_filedialog_init(Ewl_Filedialog * fd, Ewl_Filedialog_Type type) +int ewl_filedialog_init(Ewl_Filedialog * fd, Ewl_Filedialog_Type type) { Ewl_Widget *w; Ewl_Widget *button; Ewl_Widget *box; DENTER_FUNCTION(DLEVEL_STABLE); - DCHECK_PARAM_PTR("fd", fd); + DCHECK_PARAM_PTR_RET("fd", fd, FALSE); w = EWL_WIDGET(fd); @@ -54,10 +53,11 @@ /* the file selector */ fd->fs = ewl_fileselector_new(); - if (fd->fs) { - ewl_container_child_append(EWL_CONTAINER(fd), fd->fs); - ewl_widget_show(fd->fs); + if (!fd->fs) { + DRETURN_INT(FALSE, DLEVEL_STABLE); } + ewl_container_child_append(EWL_CONTAINER(fd), fd->fs); + ewl_widget_show(fd->fs); box = ewl_hbox_new(); ewl_object_alignment_set(EWL_OBJECT(box), EWL_FLAG_ALIGN_RIGHT); @@ -84,7 +84,7 @@ ewl_container_child_append(EWL_CONTAINER(box), button); ewl_widget_show(button); - DLEAVE_FUNCTION(DLEVEL_STABLE); + DRETURN_INT(TRUE, DLEVEL_STABLE); } /** =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_filedialog.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- ewl_filedialog.h 31 Aug 2004 18:31:36 -0000 1.16 +++ ewl_filedialog.h 21 Dec 2004 03:56:25 -0000 1.17 @@ -52,7 +52,7 @@ Ewl_Widget *ewl_filedialog_new (Ewl_Filedialog_Type type); -void ewl_filedialog_init (Ewl_Filedialog *fd, +int ewl_filedialog_init (Ewl_Filedialog *fd, Ewl_Filedialog_Type type); char *ewl_filedialog_path_get (Ewl_Filedialog *fd); char *ewl_filedialog_file_get (Ewl_Filedialog *fd); ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ enlightenment-cvs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs