GTK File Chooser filter not working in 1.4.0 (and my fix)
Posted: 08.01.2006, 22:06
I recently installed the latest (1.4.0) version on Celestia and found, to my dismay, that no files appeared in the file chooser when attempting to open a script from the "Open Script" dialog. Same with the "Capture Image" dialog... even if there were png's in the "save in" directory, nothing showed in the list. However, after doing Ctrl-L (or right click, open location) and typing the beginning of a known filename, then selecting one from the dropdown, the *.cel files magically appeared in the directory listing.
To illustrate, bfore I modified src/celestia/gtk/actions.cpp, the file chooser looked like this when I browsed my celestia scripts directory:
After my modification, the scripts I know are there appear:
Celestia is locally compiled against gtk+-2.8.9, which is also home-built. The configure optiuons I use are:
I even tried reverting to gtk+-2.6.10 and recompiling Celestia. No joy... file chooser remained empty.
I had meant to file a bug report, but put it off until I got frustrated enough to try and find a fix, myself. I am *not* a programmer. I have no idea if this is "The Right Thing" but the patch I include below works for me.
In actions.cpp, at line 119, instead of (filter, "*.cel *.celx"), I simply added each desired filetype on a line of its own, (and the same thing for image types) and now the file chooser shows *.cel *.clx and *.celx. (The error dialog that compains when an "incorrect" filetype is chosen, asks for ".cel .clx or .celx" so I added .clx, too.) I'm sure there's a regex to make it a neat one liner. I tried a few, but didn't hit the magic combination.
Anyhow... here's the diff I used...
Outside of this one annoyance, I find that the gtk UI is greatly improved over celestia 1.3.2. Thanks for all the hard work, folks.
ciao,
Jonathan
CPU: AMD AthlonXP-M 2600+ (Barton)
RAM: 1024 MB DDR400
Mobo: Abit NF7-S Rev. 2.0/w Nvidia Nforce2 Ultra-400 Chipset
Video: Celestica Radeon 9800-Pro 128MB
ATI Video Driver fglrx_6_8_0-8.18.6-i386-1
Linux 2.4.31 (Slackware 10.2)
Glibc 2.3.5
gcc 3.3.6
X11R6.8.2 (X.org source; home built; optimized for Athlon-XP)
windowmaker-0.92.0
To illustrate, bfore I modified src/celestia/gtk/actions.cpp, the file chooser looked like this when I browsed my celestia scripts directory:
After my modification, the scripts I know are there appear:
Celestia is locally compiled against gtk+-2.8.9, which is also home-built. The configure optiuons I use are:
Code: Select all
--prefix=/opt/celestia-1.4.0 \
--disable-nls \
--with-lua \
--with-gtk
I even tried reverting to gtk+-2.6.10 and recompiling Celestia. No joy... file chooser remained empty.
I had meant to file a bug report, but put it off until I got frustrated enough to try and find a fix, myself. I am *not* a programmer. I have no idea if this is "The Right Thing" but the patch I include below works for me.
In actions.cpp, at line 119, instead of (filter, "*.cel *.celx"), I simply added each desired filetype on a line of its own, (and the same thing for image types) and now the file chooser shows *.cel *.clx and *.celx. (The error dialog that compains when an "incorrect" filetype is chosen, asks for ".cel .clx or .celx" so I added .clx, too.) I'm sure there's a regex to make it a neat one liner. I tried a few, but didn't hit the magic combination.
Anyhow... here's the diff I used...
Code: Select all
--- src/celestia/gtk/actions.cpp.orig 2005-12-15 19:57:05.000000000 -0500
+++ src/celestia/gtk/actions.cpp 2006-01-08 15:24:09.000000000 -0500
@@ -116,7 +116,9 @@
gtk_file_filter_set_name(filter, "Celestia Scripts");
#ifdef CELX
- gtk_file_filter_add_pattern(filter, "*.cel *.celx");
+ gtk_file_filter_add_pattern(filter, "*.cel");
+ gtk_file_filter_add_pattern(filter, "*.clx");
+ gtk_file_filter_add_pattern(filter, "*.celx");
#else
gtk_file_filter_add_pattern(filter, "*.cel");
#endif /* CELX */
@@ -146,7 +148,9 @@
GtkFileFilter* filter = gtk_file_filter_new();
gtk_file_filter_set_name(filter, "PNG and JPEG Images");
- gtk_file_filter_add_pattern(filter, "*.jpeg *.jpg *.png");
+ gtk_file_filter_add_pattern(filter, "*.jpeg");
+ gtk_file_filter_add_pattern(filter, "*.jpg");
+ gtk_file_filter_add_pattern(filter, "*.png");
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(fs), filter);
#if GTK_CHECK_VERSION(2, 7, 0)
Outside of this one annoyance, I find that the gtk UI is greatly improved over celestia 1.3.2. Thanks for all the hard work, folks.
ciao,
Jonathan
CPU: AMD AthlonXP-M 2600+ (Barton)
RAM: 1024 MB DDR400
Mobo: Abit NF7-S Rev. 2.0/w Nvidia Nforce2 Ultra-400 Chipset
Video: Celestica Radeon 9800-Pro 128MB
ATI Video Driver fglrx_6_8_0-8.18.6-i386-1
Linux 2.4.31 (Slackware 10.2)
Glibc 2.3.5
gcc 3.3.6
X11R6.8.2 (X.org source; home built; optimized for Athlon-XP)
windowmaker-0.92.0