]> Pileus Git - aweather/commitdiff
Use xdg-open for win32
authorAndy Spencer <andy753421@gmail.com>
Wed, 5 May 2010 07:08:48 +0000 (07:08 +0000)
committerAndy Spencer <andy753421@gmail.com>
Wed, 5 May 2010 07:25:50 +0000 (07:25 +0000)
xdg-open doesn't actually exist, so bundle a fake xdg-open script

src/Makefile.am
src/aweather-gui.c

index 64939a31a32ffdedc815002f3948c54025c90b0c..7bba88f8b6bc0714e886754d2ece864f2c9e2e8a 100644 (file)
@@ -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
index 9cf4c8ae833a0e64dc4022bf13160055a3e82205..7c6e140395feb053aee2a69917f8cfa02f12ae94 100644 (file)
@@ -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)