From 503eb705a136071e46d8764a322cdd21aa5d45bd Mon Sep 17 00:00:00 2001 From: Alexander Kojevnikov Date: Wed, 23 Feb 2011 16:11:52 +0800 Subject: [PATCH] osx: Fix link activation (issue 31) --- src/spek-platform.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/spek-platform.c b/src/spek-platform.c index c037706..477a0b6 100644 --- a/src/spek-platform.c +++ b/src/spek-platform.c @@ -26,6 +26,7 @@ #ifdef G_OS_DARWIN #include +#include #endif #include "spek-platform.h" @@ -61,12 +62,24 @@ void spek_platform_show_uri (const gchar *uri) { #ifdef G_OS_WIN32 /* 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) {