summaryrefslogtreecommitdiffstats
path: root/windows.c
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2013-01-15 01:20:29 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-15 08:51:32 -0800
commit678fffdcf497832a366b8230c30fc83794391ece (patch)
tree1a4b85235f6ef7ed5a763840359ffdbc83454e0a /windows.c
parent2330f9b379befe4847d77bfd031c273f8883e441 (diff)
downloadsubsurface-678fffdcf497832a366b8230c30fc83794391ece.tar.gz
Added the OS dependent function subsurface_launch_for_uri()
Opening URI addresses from Subsurface does not work on Windows using the latest GTK bundle from the Gnome website. The reason lies in GIO and GLib and how it obtains assigned applications for protocols and MIME types. While gtk_show_uri() should be viable for both linux.c and macos.c, in windows.c ShellExecute() is used, which provides proper support for the URI calls. subsurface_launch_for_uri() returns TRUE on success. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'windows.c')
-rw-r--r--windows.c8
1 files changed, 8 insertions, 0 deletions
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)
{