[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[E-devel] Etk filechooser widget patch



Hi all,
from the #etk discussion this is a patch for e17/proto/etk/src/lib/etk_filechooser_widget.c

This patch resolve the bug that cause etk_filechooser_widget_selected_file_get() to return trash in the case no file is selected. With the patch applied the function
will return NULL if no file is selected.

ps: this is my first patch for the e17 cvs, I have done it with the command:
diff -u old_file new_file
Is this the right method?
I see that other patch in the list have different syntax, so don't know if this is good enought.

Thanks Dave
--- src/lib/etk_filechooser_widget_orig.c	2006-10-20 19:51:44.000000000 +0200
+++ src/lib/etk_filechooser_widget.c	2006-12-19 16:01:10.000000000 +0100
@@ -238,14 +238,14 @@
  */
 const char *etk_filechooser_widget_selected_file_get(Etk_Filechooser_Widget *filechooser_widget)
 {
-   const char *filename;
+   const char *filename = NULL;
    Etk_Tree_Row *row;
 
    if (!filechooser_widget && !(filechooser_widget->files_tree))
       return NULL;
 
-   row = etk_tree_selected_row_get(ETK_TREE(filechooser_widget->files_tree));
-   etk_tree_row_fields_get(row, filechooser_widget->files_name_col, NULL, NULL, &filename, NULL);
+   if (row = etk_tree_selected_row_get(ETK_TREE(filechooser_widget->files_tree)))
+	etk_tree_row_fields_get(row, filechooser_widget->files_name_col, NULL, NULL, &filename, NULL);
 
    return filename;
 }