From: Andy Spencer Date: Wed, 5 May 2010 07:08:48 +0000 (+0000) Subject: Use xdg-open for win32 X-Git-Tag: v0.4~9 X-Git-Url: http://pileus.org/git/?p=aweather;a=commitdiff_plain;h=d3555c59280ae44557f97e6372464b775f734f3a Use xdg-open for win32 xdg-open doesn't actually exist, so bundle a fake xdg-open script --- diff --git a/src/Makefile.am b/src/Makefile.am index 64939a3..7bba88f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,7 +8,6 @@ aweather_SOURCES = main.c \ aweather-gui.c aweather-gui.h \ aweather-location.c aweather-location.h aweather_CPPFLAGS = \ - -DBROWSER="\"$(browser)\"" \ -DHTMLDIR="\"$(dots)$(htmldir)\"" \ -DPKGDATADIR="\"$(dots)$(pkgdatadir)\"" \ -DPLUGINSDIR="\"$(dots)$(pkglibdir)\"" @@ -21,9 +20,6 @@ if WIN32 AM_LDFLAGS += -mwindows aweather_SOURCES += resource.rc dots = .. -browser = "open" -else -browser = "xdg-open" endif .rc.o: ../data/aweather.ico diff --git a/src/aweather-gui.c b/src/aweather-gui.c index 9cf4c8a..7c6e140 100644 --- a/src/aweather-gui.c +++ b/src/aweather-gui.c @@ -52,13 +52,16 @@ G_MODULE_EXPORT gboolean on_gui_key_press(GtkWidget *widget, GdkEventKey *event, G_MODULE_EXPORT void on_help_contents(GtkMenuItem *menu, AWeatherGui *self) { GError *err = NULL; - gchar *argv[] = {BROWSER, HTMLDIR "/aweather.html", NULL}; + gchar *path = g_strdup(HTMLDIR "/aweather.html"); + g_strdelimit(path, "/", G_DIR_SEPARATOR); + gchar *argv[] = {"xdg-open", path, NULL}; g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &err); if (err) { g_warning("Unable to open help page: %s - %s", argv[1], err->message); g_error_free(err); } + g_free(path); } G_MODULE_EXPORT void on_quit(GtkMenuItem *menu, AWeatherGui *self)