patch to set default for importing a .CSV file




I propose the following patch to appropriately set the defaults when
using file|import to read a .CSV file.

After putting this together, I discovered that file|open would read in
a CSV file without requiring any dialogs.  However, I didn't know
about that until just now, and I don't suppose every other user will
either.  

         - Jim Van Zandt


--- ./src/dialogs/dialog-stf.c-orig     Sat Jan 19 23:09:55 2002
+++ ./src/dialogs/dialog-stf.c  Sun Jan 20 11:11:46 2002
@@ -555,6 +555,14 @@
 
        stf_dialog_attach_page_signals (gui, &pagedata);
 
+       {
+         /* recognize a Comma Separated Value file by its extension */
+         int len = strlen (filename);
+         if (len > 4 && (strcmp (filename+len-4, ".csv") == 0 ||
+                         strcmp (filename+len-4, ".CSV") == 0))
+           gtk_toggle_button_set_state (pagedata.csv_info->csv_comma, TRUE);
+       }
+
        stf_dialog_editables_enter (&pagedata);
 
        stf_dialog_set_initial_keyboard_focus (&pagedata);



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