mirror of
https://github.com/alexkay/spek.git
synced 2025-04-20 10:27:38 +03:00
osx: Fix link activation (issue 31)
This commit is contained in:
parent
b8c28560ef
commit
503eb705a1
@ -26,6 +26,7 @@
|
||||
|
||||
#ifdef G_OS_DARWIN
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user