summaryrefslogtreecommitdiff
path: root/gio/gwin32appinfo.c
diff options
context:
space:
mode:
authorMichael Henning <drawoc@darkrefraction.com>2014-11-05 01:18:25 -0500
committerMichael Henning <drawoc@darkrefraction.com>2014-11-22 17:24:51 -0500
commit90f0eb101f108ee4096b5b3ef2d570ce588abb64 (patch)
treec84805115397e11f85e61a812d1a9d7940cf1c7e /gio/gwin32appinfo.c
parent7f5c862e166a6f288d8d0ec2622685316f64b87c (diff)
downloadglib-90f0eb101f108ee4096b5b3ef2d570ce588abb64.tar.gz
gio: Implement g_app_info_get_default_for_uri_scheme for windows.
Diffstat (limited to 'gio/gwin32appinfo.c')
-rw-r--r--gio/gwin32appinfo.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/gio/gwin32appinfo.c b/gio/gwin32appinfo.c
index 7762a2b26..a03a0e049 100644
--- a/gio/gwin32appinfo.c
+++ b/gio/gwin32appinfo.c
@@ -616,15 +616,19 @@ g_app_info_get_fallback_for_type (const char *content_type)
return g_app_info_get_all_for_type (content_type);
}
-GAppInfo *
-g_app_info_get_default_for_type (const char *content_type,
- gboolean must_support_uris)
+/*
+ * The windows api (AssocQueryString) doesn't distinguish between uri schemes
+ * and file type extensions here, so we use the same implementation for both
+ * g_app_info_get_default_for_type and g_app_info_get_default_for_uri_scheme
+ */
+static GAppInfo *
+get_default_for_association (const char *association)
{
wchar_t *wtype;
wchar_t buffer[1024];
DWORD buffer_size;
- wtype = g_utf8_to_utf16 (content_type, -1, NULL, NULL, NULL);
+ wtype = g_utf8_to_utf16 (association, -1, NULL, NULL, NULL);
/* Verify that we have some sort of app registered for this type */
#ifdef AssocQueryString
@@ -644,10 +648,16 @@ g_app_info_get_default_for_type (const char *content_type,
}
GAppInfo *
+g_app_info_get_default_for_type (const char *content_type,
+ gboolean must_support_uris)
+{
+ return get_default_for_association (content_type);
+}
+
+GAppInfo *
g_app_info_get_default_for_uri_scheme (const char *uri_scheme)
{
- /* TODO: Implement */
- return NULL;
+ return get_default_for_association (uri_scheme);
}
GList *