Index: gtk/gtkrecentmanager.c
===================================================================
--- gtk/gtkrecentmanager.c	(revision 19269)
+++ gtk/gtkrecentmanager.c	(working copy)
@@ -45,6 +45,12 @@
 #include "xdgmime/xdgmime.h"
 #endif
 
+#ifdef G_OS_WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <gdk/win32/gdkwin32.h>
+#include <winreg.h>
+#endif
+
 /* the file where we store the recently used items */
 #define GTK_RECENTLY_USED_FILE	".recently-used.xbel"
 
@@ -851,6 +857,62 @@ gtk_recent_manager_add_item (GtkRecentMa
         recent_data.mime_type = g_strdup (GTK_RECENT_DEFAULT_MIME);
     }
   else
+#elif G_OS_WIN32
+  char* p = strrchr(uri, '.');
+  if(p != NULL)
+  {
+    HKey key;
+    gchar* key_name;
+    key_name = g_strdup_printf("%s\\Content Type", p);
+    BOOL res = RegOpenKeyEx (HKEY_CLASSES_ROOT, key_name, 0, KEY_READ, &key);
+    g_free(key_name);
+    if(!res) recent_data.mime_type = g_strdup(GTK_RECENT_DEFAULT_MIME);
+  }
+#endif
+#ifdef G_OS_WIN32
+  if (has_case_prefix (uri, "file:/"))
+    {
+      gboolean success = FALSE;
+      gchar* filename;
+      filename = g_filename_from_uri(uri, NULL, NULL);
+      if (filename)
+        {
+          gchar* basename;
+          gchar* ext;
+
+          basename = g_path_get_basename(filename);
+          ext = strchr(filename, '.');
+
+          if (ext)
+            {
+              HKEY key;
+              DWORD size;
+              DWORD var_type = REG_SZ;
+
+              RegOpenKeyEx (HKEY_CLASSES_ROOT, ext, 0, KEY_READ, &key);
+              if (RegQueryValueEx (key, "Content Type", NULL, &var_type, NULL, &size) == ERROR_SUCCESS)
+                {
+                  recent_data.mime_type = g_malloc(size);
+                  if (RegQueryValueEx (key, "Content Type", NULL, &var_type, recent_data.mime_type, &size) != ERROR_SUCCESS)
+                    {
+                      g_free(recent_data.mime_type);
+                    }
+                  else
+                    {
+                      success = TRUE;
+                    }
+                }
+              RegCloseKey(key);
+            }
+
+          g_free(basename);
+          g_free(filename);
+        }
+
+        if(!success)
+          recent_data.mime_type = g_strdup (GTK_RECENT_DEFAULT_MIME);
+    }
+  else
 #endif
     recent_data.mime_type = g_strdup (GTK_RECENT_DEFAULT_MIME);
   
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 19269)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2007-12-28  Armin Burgmeier  <armin@openismus.com>
+
+	* gtk/gtkrecentmanager.c: Guess mime type from extension on windows,
+	instead of always falling back to application/octet-stream.
+
 2007-12-28  Johan Dahlin  <johan@gnome.org>
 
 	* gtk/gtkdialog.c (gtk_dialog_buildable_custom_finished)
