[glib] W32: Special treatment for inode/directory mime/type



commit 5f0665cbbc1d8b2fafeeb1fba7569612832b7541
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date:   Thu Apr 30 23:09:30 2015 +0000

    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.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=748727

 gio/gcontenttype-win32.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gio/gcontenttype-win32.c b/gio/gcontenttype-win32.c
index cc8bd82..2db8bd7 100644
--- a/gio/gcontenttype-win32.c
+++ b/gio/gcontenttype-win32.c
@@ -299,6 +299,10 @@ g_content_type_from_mime_type (const gchar *mime_type)
 
   g_return_val_if_fail (mime_type != NULL, NULL);
 
+  /* This is a hack to allow directories to have icons in filechooser */
+  if (strcmp ("inode/directory", mime_type) == 0)
+    return g_strdup (mime_type);
+
   key = g_strconcat ("MIME\\DataBase\\Content Type\\", mime_type, NULL);
   content_type = get_registry_classes_key (key, L"Extension");
   g_free (key);


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