Index: gio/ChangeLog
===================================================================
--- gio/ChangeLog	(revision 6891)
+++ gio/ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2008-05-15  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-05-13  Bastien Nocera  <hadess@hadess.net>
 
 	* gfile.c (has_valid_scheme): A URI scheme must start with a
Index: gio/gcontenttype.c
===================================================================
--- gio/gcontenttype.c	(revision 6891)
+++ 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_strconcat ("MIME\\DataBase\\Content Type\\", mime_type, NULL);
+  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,25 @@ 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.
+ *
+ * Since: 2.18
+ **/
+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 6891)
+++ 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,
Index: gio/gio.symbols
===================================================================
--- gio/gio.symbols	(revision 6891)
+++ gio/gio.symbols	(working copy)
@@ -140,6 +140,7 @@ g_content_type_get_description
 g_content_type_get_mime_type
 g_content_type_get_icon
 g_content_type_can_be_executable
+g_content_type_from_mime_type
 g_content_type_guess
 g_content_types_get_registered
 #endif
Index: docs/reference/gio/gio-sections.txt
===================================================================
--- docs/reference/gio/gio-sections.txt	(revision 6891)
+++ docs/reference/gio/gio-sections.txt	(working copy)
@@ -990,6 +990,7 @@ g_content_type_get_description
 g_content_type_get_mime_type
 g_content_type_get_icon
 g_content_type_can_be_executable
+g_content_type_from_mime_type
 g_content_type_guess
 g_content_types_get_registered
 </SECTION>
