[grisbi-devel] Hello list
Ricardo Martinez
oscar2357 at gmail.com
Wed Dec 15 02:26:22 CET 2010
Hi,
First of all congratulations and thanks for this amazing project, I've
used Grisbi for one day and I'm finding it very attractive.
When I tried to import my QIF file I noticed that the file filter
looks for lower case extensions but some banks may provide this file
name uppercase, at least my bank does.
Probably we could make this filter cases insensitive, please find
attached my patch that seems to be working fine for me.
Thanks,
Ricardo
diff --git a/src/import.c b/src/import.c
index 6ceb993..3cea7aa 100644
--- a/src/import.c
+++ b/src/import.c
@@ -748,8 +748,9 @@ GSList *gsb_import_create_file_chooser ( const
char *enc, GtkWidget *parent )
GSList * tmp;
struct import_format * format;
GSList *filenames = NULL;
- gchar* old_str;
- gchar* tmpstr;
+ gchar* old_str;
+ gchar* tmpstr;
+ gchar* tmpchar;
dialog = gtk_file_chooser_dialog_new ( _("Choose files to import."),
GTK_WINDOW ( parent ),
@@ -794,16 +795,24 @@ GSList *gsb_import_create_file_chooser ( const
char *enc, GtkWidget *parent )
format -> extension );
gtk_file_filter_set_name ( format_filter, tmpstr );
g_free ( tmpstr );
- tmpstr = g_strconcat ( "*.", format -> extension, NULL );
- gtk_file_filter_add_pattern ( format_filter,
- tmpstr );
- g_free ( tmpstr );
- gtk_file_chooser_add_filter ( GTK_FILE_CHOOSER ( dialog ), format_filter );
-
- /* Global filter */
- tmpstr = g_strconcat ( "*.", format -> extension, NULL );
+ /* Make it case insensitive */
+ tmpstr = g_strdup ( "*." );
+ tmpchar = format -> extension;
+ while(*tmpchar != '\0' )
+ {
+ old_str=tmpstr;
+ tmpstr = g_strdup_printf ( _("%s[%c%c]"),
+ tmpstr,
+ (int)g_ascii_toupper(*tmpchar),
+ (int)*tmpchar );
+ tmpchar++;
+ g_free ( old_str );
+ }
+ gtk_file_filter_add_pattern ( format_filter, tmpstr );
+ /* Add this pattern to the global filter as well*/
gtk_file_filter_add_pattern ( default_filter, tmpstr );
g_free ( tmpstr );
+ gtk_file_chooser_add_filter ( GTK_FILE_CHOOSER ( dialog ), format_filter );
tmp = tmp -> next;
}
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Making-the-file-chooser-case-insensitive.patch
Type: application/octet-stream
Size: 2158 bytes
Desc: not available
URL: <http://listes.grisbi.org/pipermail/devel/attachments/20101214/daa447de/attachment.obj>
More information about the devel
mailing list