Index: gio/ChangeLog
===================================================================
--- gio/ChangeLog	(revision 6849)
+++ gio/ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2008-04-12  Milan Crha  <mcrha@redhat.com>
+
+	* gcontenttype.h:
+	* gcontenttype.c: (g_content_type_from_mime_type):
+	New function to create a content type from a mime type. (#527175)
+
 2008-04-09  Padraig O'Briain  <padraig.obriain@sun.com>
 
 	* gdesktopappinfo.c: In g_app_info_create_from_commandline set comment
Index: gio/gcontenttype.c
===================================================================
--- gio/gcontenttype.c	(revision 6849)
+++ gio/gcontenttype.c	(working copy)
@@ -222,6 +222,20 @@ looks_like_text (const guchar *data, 
 }
 
 char *
+g_content_type_from_mime_type (const char *mime_type)
+{
+  char *key, *content_type;
+
+  g_return_val_if_fail (mime_type != NULL, NULL);
+
+  key = g_strdup_printf ("MIME\\DataBase\\Content Type\\%s", mime_type);
+  content_type = get_registry_classes_key (key, L"Extension");
+  g_free (key);
+
+  return content_type;
+}
+
+char *
 g_content_type_guess (const char   *filename,
 		      const guchar *data,
 		      gsize         data_size,
@@ -719,6 +733,23 @@ looks_like_text (const guchar *data, gsi
 }
 
 /**
+ * g_content_type_from_mime_type:
+ * @mime_type: a mime type string.
+ *
+ * Tries to find a content type based on the mime type name.
+ *
+ * Returns: Newly allocated string with content type or NULL when does not know.
+ **/
+char *
+g_content_type_from_mime_type (const char *mime_type)
+{
+  g_return_val_if_fail (mime_type != NULL, NULL);
+
+  /* mime type and content type are same on unixes */
+  return g_strdup (mime_type);
+}
+
+/**
  * g_content_type_guess:
  * @filename: a string.
  * @data: a stream of data.
Index: gio/gcontenttype.h
===================================================================
--- gio/gcontenttype.h	(revision 6849)
+++ gio/gcontenttype.h	(working copy)
@@ -42,6 +42,8 @@ char *   g_content_type_get_mime_type   
 GIcon *  g_content_type_get_icon          (const char   *type);
 gboolean g_content_type_can_be_executable (const char   *type);
 
+char *   g_content_type_from_mime_type    (const char   *mime_type);
+
 char *   g_content_type_guess             (const char   *filename,
 					   const guchar *data,
 					   gsize         data_size,
