commit 503eb705a136071e46d8764a322cdd21aa5d45bd
parent b8c28560efdd3e99d053cfa33fb6b0bf7953cd71
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date: Wed, 23 Feb 2011 16:11:52 +0800
osx: Fix link activation (issue 31)
Diffstat:
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/src/spek-platform.c b/src/spek-platform.c
@@ -26,6 +26,7 @@
#ifdef G_OS_DARWIN
#include <CoreFoundation/CoreFoundation.h>
+#include <ApplicationServices/ApplicationServices.h>
#endif
#include "spek-platform.h"
@@ -62,11 +63,23 @@ void spek_platform_show_uri (const gchar *uri) {
/* gtk_show_uri doesn't work on Windows */
ShellExecuteA (NULL, "open", uri, "", NULL, SW_SHOWNORMAL);
#else
+#ifdef G_OS_DARWIN
+ /* it doesn't work on OS X too */
+ CFStringRef str = NULL;
+ CFURLRef url = NULL;
+
+ str = CFStringCreateWithCString (NULL, uri, kCFStringEncodingASCII);
+ url = CFURLCreateWithString (NULL, str, NULL);
+ LSOpenCFURLRef (url, NULL);
+ CFRelease (url);
+ CFRelease (str);
+#else
GError *error = NULL;
if (!gtk_show_uri (NULL, uri, gtk_get_current_event_time (), &error)) {
g_error_free (error);
}
#endif
+#endif
}
gchar *spek_platform_read_line (const gchar *uri) {