mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
fadf2f4432
commit
a635c30564
1 changed files with 4 additions and 6 deletions
10
macos.c
10
macos.c
|
@ -4,6 +4,7 @@
|
||||||
#include "dive.h"
|
#include "dive.h"
|
||||||
#include "display-gtk.h"
|
#include "display-gtk.h"
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
#include <LaunchServices/LSOpen.h>
|
||||||
#include <mach-o/dyld.h>
|
#include <mach-o/dyld.h>
|
||||||
#include "gtkosxapplication.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)
|
gboolean subsurface_launch_for_uri(const char* uri)
|
||||||
{
|
{
|
||||||
GError *err = NULL;
|
CFURLRef urlref = CFURLCreateWithBytes(NULL, uri, strlen(uri), kCFStringEncodingMacRoman, NULL);
|
||||||
gtk_show_uri(NULL, uri, gtk_get_current_event_time(), &err);
|
OSStatus status = LSOpenCFURLRef(urlref, NULL);
|
||||||
if (err) {
|
if (status)
|
||||||
g_message("%s: %s", err->message, uri);
|
|
||||||
g_error_free(err);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue