Re: A few problems with GtkFileChooser

On Sun, 2003-11-16 at 14:06, iain wrote:
> I've been trying out the file chooser in my program and have come
> against a few issues

> 4: When you select a filter, say "All PNGs" all the directories
> disappear too.

I'm trying from fairly-up-to-date CVS, and when I select a mime-based
filter _everything_ disappears, files and directories.  I did a bit of
digging, and my mime types seem a bit hosed, all files are coming out as
"application/octet-stream", and all directories as NULL.  (I'm going to
investigate further...)

Do we have to specify "x-directory/normal" in the list of mime types for
the filter in order to see folders?  This only makes sense if we're
intending for the user to select a directory itself.

Perhaps we need to always list folders; attached is a patch to the
default widget's list model filter which does this (plus a bit of
useless debug code as I track down my MIME issues).

David Malcolm
? always-show-folders-in-list.patch
Index: gtkfilechooserdefault.c
RCS file: /cvs/gnome/gtk+/gtk/gtkfilechooserdefault.c,v
retrieving revision 1.37
diff -p -u -r1.37 gtkfilechooserdefault.c
--- gtkfilechooserdefault.c	4 Nov 2003 01:56:56 -0000	1.37
+++ gtkfilechooserdefault.c	16 Nov 2003 15:11:14 -0000
@@ -1457,12 +1457,17 @@ list_model_filter_func (GtkFileSystemMod
   if (!impl->current_filter)
     return TRUE;
+  /* Always display folders: */
+  if (gtk_file_info_get_is_folder (file_info))
+    return TRUE;
   needed = gtk_file_filter_get_needed (impl->current_filter);
   filter_info.display_name = gtk_file_info_get_display_name (file_info);
   filter_info.mime_type = gtk_file_info_get_mime_type (file_info);
+  g_message ("mime type: \"%s\"", filter_info.mime_type);

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