[Gtkradiant] [Bug 915] file_dialog may put garbage in file type dropdown if filter is NULL

gtkradiant@zerowing.idsoftware.com gtkradiant@zerowing.idsoftware.com
Thu, 27 Nov 2003 16:54:30 -0600


------- Additional Comments From rfm@collectivecomputing.com  2003-11-27 16:54 -------
Well, from the way file_dialog is specified, one would expect a NULL filter is
supposed to work.  It isn't completely clear what it is supposed to do though.

from include/qerplugin.h:
// file and directory selection functions return NULL if the user hits cancel
// or a gchar* string that must be g_free'd by the user
// - 'title' is the dialog title (can be NULL)
// - 'path' is used to set the initial directory (can be NULL)
// - 'pattern': the first pattern is for the win32 mode, then comes the Gtk
pattern list, see Radiant source for samples
// TTimo 04/01/2001 toolkit-independant, cast parent to a GtkWidget*

typedef const gchar* (* PFN_QERAPP_FILEDIALOG) (void *parent, gboolean open,
const char* title,
                                                const char* path = NULL, const
char* pattern = NULL);

There are a couple of other places in the code that do it (the prefs dialog, to
select an INI file for example).

BTW, the comment is wrong too, the returned gchar should not be g_free'd, it is
a static in radiant/gtkmisc.cpp

I'd suggest the right thing to do is to use a default filter of *.* (or just *
for unix ?)  if none is passed in.