aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-05-09 20:50:32 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-05-09 20:50:32 +0200
commitbb5445ab939bbe7006800fa63e9218221d5688f9 (patch)
treeffdfd27d20fbfe44c7493a52c03063a777968fdc
parentc75f9ef6ab690931a48d01b9f07c0418e3e2c5d2 (diff)
downloadgtk-vlc-player-bb5445ab939bbe7006800fa63e9218221d5688f9.tar.gz
fixed opening manual under Windows
it turned out that gtk_show_uri() doesn't work even if the URI is correct, so we're using Window's ShellExecute() now
-rw-r--r--configure.ac14
-rw-r--r--src/main.c18
2 files changed, 29 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index f4771f3..a5cb1e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -83,6 +83,16 @@ case $host in
AC_MSG_ERROR([Missing X11/Xlib.h!])
])
;;
+*-*-mingw*)
+ AC_CHECK_HEADERS([windows.h], , [
+ AC_MSG_ERROR([Missing Windows headers!])
+ ])
+ AC_CHECK_HEADERS([shellapi.h], , [
+ AC_MSG_ERROR([Missing Windows headers!])
+ ], [
+ #include <windows.h>
+ ])
+ ;;
esac
# Checks for typedefs, structures, and compiler characteristics.
@@ -141,7 +151,7 @@ AC_ARG_ENABLE(console,
[console=$enableval], [console=no])
if [[ $console = no ]]; then
case $host in
- *-*-mingw32*) GTKAPP_LDFLAGS="$GTKAPP_LDFLAGS -mwindows" ;;
+ *-*-mingw*) GTKAPP_LDFLAGS="$GTKAPP_LDFLAGS -mwindows" ;;
esac
fi
@@ -149,7 +159,7 @@ fi
# necessary for auto-registering GTK+ signal handlers by GTK+ builder
case $host in
*-*-linux*) GTKAPP_LDFLAGS="$GTKAPP_LDFLAGS -Wl,--export-dynamic" ;;
-*-*-mingw32*) GTKAPP_LDFLAGS="$GTKAPP_LDFLAGS -Wl,--export-all-symbols" ;;
+*-*-mingw*) GTKAPP_LDFLAGS="$GTKAPP_LDFLAGS -Wl,--export-all-symbols" ;;
esac
AC_SUBST(GTKAPP_CFLAGS)
diff --git a/src/main.c b/src/main.c
index e616491..6ad7e7d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -8,6 +8,11 @@
#include <X11/Xlib.h>
#endif
+#ifdef HAVE_WINDOWS_H
+#include <windows.h>
+#include <shellapi.h>
+#endif
+
#include <glib.h>
#include <gtk/gtk.h>
@@ -90,8 +95,19 @@ help_menu_manual_item_activate_cb(GtkWidget *widget __attribute__((unused)),
gpointer data __attribute__((unused)))
{
GError *err = NULL;
+ gboolean res;
+
+#ifdef HAVE_WINDOWS_H
+ res = (int)ShellExecute(NULL, "open", HELP_URI,
+ NULL, NULL, SW_SHOWNORMAL) <= 32;
+ if (res)
+ err = g_error_new(g_quark_from_static_string("Cannot open!"), 0,
+ "Cannot open '%s'!", HELP_URI);
+#else
+ res = !gtk_show_uri(NULL, HELP_URI, GDK_CURRENT_TIME, &err);
+#endif
- if (!gtk_show_uri(NULL, HELP_URI, GDK_CURRENT_TIME, &err)) {
+ if (res) {
show_message_dialog_gerror(err);
g_error_free(err);
}