gosxappinfo: Special case x-scheme-handler

This is the only way they are exposed on Unix so we need to handle it

https://bugzilla.gnome.org/show_bug.cgi?id=734946
This commit is contained in:
Patrick Griffis 2017-03-30 19:49:21 -04:00
parent fac83e09d6
commit 0c4dd4a802

View File

@ -600,24 +600,25 @@ g_osx_app_info_get_all_for_scheme (const char *cscheme)
GList *
g_app_info_get_all_for_type (const char *content_type)
{
gchar *type_cstr;
gchar *mime_type;
CFArrayRef bundle_list;
CFStringRef type;
NSBundle *bundle;
GList *info_list = NULL;
gint i;
if (g_str_has_prefix (content_type, "x-scheme-handler/"))
mime_type = g_content_type_get_mime_type (content_type);
if (g_str_has_prefix (mime_type, "x-scheme-handler/"))
{
gchar *scheme = strchr (content_type, '/') + 1;
gchar *scheme = strchr (mime_type, '/') + 1;
GList *ret = g_osx_app_info_get_all_for_scheme (scheme);
return g_osx_app_info_get_all_for_scheme (scheme);
g_free (mime_type);
return ret;
}
g_free (mime_type);
type_cstr = g_content_type_from_mime_type (content_type);
type = create_cfstring_from_cstr (type_cstr);
g_free (type_cstr);
type = create_cfstring_from_cstr (content_type);
bundle_list = LSCopyAllRoleHandlersForContentType (type, kLSRolesAll);
CFRelease (type);
@ -657,6 +658,7 @@ GAppInfo *
g_app_info_get_default_for_type (const char *content_type,
gboolean must_support_uris)
{
gchar *mime_type;
CFStringRef type;
NSBundle *bundle;
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER
@ -665,6 +667,17 @@ g_app_info_get_default_for_type (const char *content_type,
CFStringRef bundle_id;
#endif
mime_type = g_content_type_get_mime_type (content_type);
if (g_str_has_prefix (mime_type, "x-scheme-handler/"))
{
gchar *scheme = strchr (mime_type, '/') + 1;
GAppInfo *ret = g_app_info_get_default_for_uri_scheme (scheme);
g_free (mime_type);
return ret;
}
g_free (mime_type);
type = create_cfstring_from_cstr (content_type);
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER