aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dive.h1
-rw-r--r--linux.c12
-rw-r--r--macos.c12
-rw-r--r--windows.c8
4 files changed, 33 insertions, 0 deletions
diff --git a/dive.h b/dive.h
index 365f519fe..28ea79926 100644
--- a/dive.h
+++ b/dive.h
@@ -583,6 +583,7 @@ typedef enum {
extern const char *existing_filename;
extern const char *subsurface_gettext_domainpath(char *);
extern gboolean subsurface_os_feature_available(os_feature_t);
+extern gboolean subsurface_launch_for_uri(const char *);
extern void subsurface_command_line_init(gint *, gchar ***);
extern void subsurface_command_line_exit(gint *, gchar ***);
diff --git a/linux.c b/linux.c
index 9281b434e..f8d3e88b4 100644
--- a/linux.c
+++ b/linux.c
@@ -176,3 +176,15 @@ gboolean subsurface_os_feature_available(os_feature_t f)
{
return TRUE;
}
+
+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);
+ return FALSE;
+ }
+ return TRUE;
+}
diff --git a/macos.c b/macos.c
index b8451cfd0..b67c9d6ea 100644
--- a/macos.c
+++ b/macos.c
@@ -220,3 +220,15 @@ gboolean subsurface_os_feature_available(os_feature_t f)
{
return TRUE;
}
+
+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);
+ return FALSE;
+ }
+ return TRUE;
+}
diff --git a/windows.c b/windows.c
index f9b04ce03..2730d4819 100644
--- a/windows.c
+++ b/windows.c
@@ -298,6 +298,14 @@ void subsurface_command_line_exit(gint *argc, gchar ***argv)
g_free(*argv);
}
+gboolean subsurface_launch_for_uri(const char* uri)
+{
+ if ((INT_PTR)ShellExecute(NULL, "open", uri, NULL, NULL, SW_SHOWNORMAL) > 32)
+ return TRUE;
+ g_message("ShellExecute failed for: %s", uri);
+ return FALSE;
+}
+
/* check if we are running a newer OS version */
gboolean subsurface_os_feature_available(os_feature_t f)
{