After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 748727 - Filechooser dialog shows no icons for directories on W32
Filechooser dialog shows no icons for directories on W32
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: win32
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtk-win32 maintainers
: 749489 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2015-04-30 23:14 UTC by LRN
Modified: 2015-07-08 03:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
W32: Special treatment for inode/directory mime/type (1.37 KB, patch)
2015-04-30 23:14 UTC, LRN
committed Details | Review

Description LRN 2015-04-30 23:14:41 UTC
This is because there's no extension (W32 variant of 'content type') that says "directory".
Comment 1 LRN 2015-04-30 23:14:46 UTC
Created attachment 302698 [details] [review]
W32: Special treatment for inode/directory mime/type

This is a hack for GLocalFileInfo to correctly get icons for directories.
Without this change content type for any W32 directory is NULL
(because there's no registry entry for "inode/directory" by default,
and in any way there's no file extension that means "directory" to put there),
and GLocalFileInfo uses content type to grab icons.
Comment 2 Matthias Clasen 2015-05-01 15:48:51 UTC
A place where such 'hacks' are already centralized is glocalfileinfo.c:get_content_type. Maybe that should ensure some fallback content types on win32 as well ? Or does it already ?
Comment 3 LRN 2015-05-01 15:58:43 UTC
(In reply to Matthias Clasen from comment #2)
> A place where such 'hacks' are already centralized is
> glocalfileinfo.c:get_content_type.
One could argue that this is a W32-specific hack, and thus should go into w32-specific source file (gcontenttype-win32.c), rather than into generic glocalfileinfo.c.

Could go either way.

> Maybe that should ensure some fallback
> content types on win32 as well ? Or does it already ?
I dare not touch glocalfileinfo much. I would rather fix gcontenttype on W32 altogether (see bug 735696), which would also fix this bug (i filed this bug separately because it's a small hack for a user-visible immediate problem - lack of directory icons in filechooser, and i would rather have it fixed than wait (possibly in vain) for bug 735696 to be fixed).
Comment 4 Matthias Clasen 2015-05-04 11:27:33 UTC
Review of attachment 302698 [details] [review]:

The only concern I would have is whether there are other places in the code that assume the content type is obtained by get_registry_classes_key.
If that is not the case, sure, go ahead.
Comment 5 LRN 2015-05-17 12:00:46 UTC
LRN: i'm not sure what that last comment in 748727 means.

mclasen: I was wondering if the rest of the win32 content-type code can deal with the string "inode/directory"

LRN: um, probably not. "inode/directory" is not the proper format for "content-type", as far as current W32 glib gcontenttype code is concerned. "inode/directory" hack is there for a very specific case of working with glocalfileinfo.  If places are found where it also makes sense to hardcode such a check, these could be patched up later on. Hopefully, gcontenttype-win32 rewrite will land before that is needed though

mclasen: well, if you have glocalfileinfo hand out inode/directory as a content-type, the content-type machinery needs to be prepared to deal with it

LRN: that's fair.
g_content_type_equals()            - works (strcasecmp).
g_content_type_is_a()              - works (calls g_content_type_equals() first thing).
g_content_type_is_unknown()        - does not (and should not) work.
g_content_type_get_description()   - no directory-specific code (non-fatal though - will say "inode/directory filetype" instead of "Directory").
g_content_type_get_mime_type()     - does not work (and probably should).
g_content_type_get_icon()          - works.
g_content_type_can_be_executable() - works.
g_content_type_guess()             - doesn't (should?).

mclasen: sounds good enough

LRN: so _get_description(), _get_mime_type() and _type_guess() don't work but probably should made to. First is non-fatal, the last is weird (who calls that on *directories*?). Second one is unlikely (i.e. you get CT from mime "inode/directory" and later on do the reverse with the result you've got).
Comment 6 Matthias Clasen 2015-06-05 16:32:39 UTC
Attachment 302698 [details] pushed as 5f0665c - W32: Special treatment for inode/directory mime/type
Comment 7 John Lindgren 2015-07-08 03:07:01 UTC
*** Bug 749489 has been marked as a duplicate of this bug. ***