summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-25 13:22:33 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-25 13:22:33 -0800
commita635c30564ecaccbbaf3420025419d9c6080d4bd (patch)
tree233f3f418c7f858ced833b77c42b4d7f284ac41a
parentfadf2f4432853d5281696876b49936f3ba723cd3 (diff)
downloadsubsurface-a635c30564ecaccbbaf3420025419d9c6080d4bd.tar.gz
Work around yet another Gtk bug: gtk_show_uri doesn't work on Mac
Instead use the native function to open the URL. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--macos.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/macos.c b/macos.c
index 2e549f926..dedca7ec7 100644
--- a/macos.c
+++ b/macos.c
@@ -4,6 +4,7 @@
#include "dive.h"
#include "display-gtk.h"
#include <CoreFoundation/CoreFoundation.h>
+#include <LaunchServices/LSOpen.h>
#include <mach-o/dyld.h>
#include "gtkosxapplication.h"
@@ -228,12 +229,9 @@ gboolean subsurface_os_feature_available(os_feature_t f)
gboolean subsurface_launch_for_uri(const char* uri)
{
- GError *err = NULL;
- gtk_show_uri(NULL, uri, gtk_get_current_event_time(), &err);
- if (err) {
- g_message("%s: %s", err->message, uri);
- g_error_free(err);
+ CFURLRef urlref = CFURLCreateWithBytes(NULL, uri, strlen(uri), kCFStringEncodingMacRoman, NULL);
+ OSStatus status = LSOpenCFURLRef(urlref, NULL);
+ if (status)
return FALSE;
- }
return TRUE;
}