+/**
+ * g_app_info_get_recommended_for_type:
+ * @content_type: the content type to find a #GAppInfo for
+ *
+ * Gets a list of recommended #GAppInfos for a given content type, i.e.
+ * those applications which claim to support the given content type exactly,
+ * and not by MIME type subclassing.
+ * Note that the first application of the list is the last used one, i.e.
+ * the last one for which #g_app_info_set_as_last_used_for_type has been
+ * called.
+ *
+ * Returns: (element-type GAppInfo) (transfer full): #GList of #GAppInfos
+ * for given @content_type or %NULL on error.
+ *
+ * Since: 2.28
+ **/
+GList *
+g_app_info_get_recommended_for_type (const gchar *content_type)
+{
+ GList *desktop_entries, *l;
+ GList *infos;
+ GDesktopAppInfo *info;
+
+ g_return_val_if_fail (content_type != NULL, NULL);
+
+ desktop_entries = get_all_desktop_entries_for_mime_type (content_type, NULL, FALSE, NULL);
+
+ infos = NULL;
+ for (l = desktop_entries; l != NULL; l = l->next)
+ {
+ char *desktop_entry = l->data;
+
+ info = g_desktop_app_info_new (desktop_entry);
+ if (info)
+ {
+ if (app_info_in_list (G_APP_INFO (info), infos))
+ g_object_unref (info);
+ else
+ infos = g_list_prepend (infos, info);
+ }
+ g_free (desktop_entry);
+ }
+
+ g_list_free (desktop_entries);
+
+ return g_list_reverse (infos);
+}
+
+/**
+ * g_app_info_get_fallback_for_type:
+ * @content_type: the content type to find a #GAppInfo for
+ *
+ * Gets a list of fallback #GAppInfos for a given content type, i.e.
+ * those applications which claim to support the given content type
+ * by MIME type subclassing and not directly.
+ *
+ * Returns: (element-type GAppInfo) (transfer full): #GList of #GAppInfos
+ * for given @content_type or %NULL on error.
+ *
+ * Since: 2.28
+ **/
+GList *
+g_app_info_get_fallback_for_type (const gchar *content_type)
+{
+ GList *desktop_entries, *l;
+ GList *infos, *recommended_infos;
+ GDesktopAppInfo *info;
+
+ g_return_val_if_fail (content_type != NULL, NULL);
+
+ desktop_entries = get_all_desktop_entries_for_mime_type (content_type, NULL, TRUE, NULL);
+ recommended_infos = g_app_info_get_recommended_for_type (content_type);
+
+ infos = NULL;
+ for (l = desktop_entries; l != NULL; l = l->next)
+ {
+ char *desktop_entry = l->data;
+
+ info = g_desktop_app_info_new (desktop_entry);
+ if (info)
+ {
+ if (app_info_in_list (G_APP_INFO (info), infos) ||
+ app_info_in_list (G_APP_INFO (info), recommended_infos))
+ g_object_unref (info);
+ else
+ infos = g_list_prepend (infos, info);
+ }
+ g_free (desktop_entry);
+ }
+
+ g_list_free (desktop_entries);
+ g_list_free_full (recommended_infos, g_object_unref);
+
+ return g_list_reverse (infos);
+}