]> Pileus Git - aweather/commitdiff
Fix default browser
authorAndy Spencer <andy753421@gmail.com>
Wed, 5 May 2010 05:02:30 +0000 (05:02 +0000)
committerAndy Spencer <andy753421@gmail.com>
Wed, 5 May 2010 05:02:30 +0000 (05:02 +0000)
src/Makefile.am
src/aweather-gui.c

index 7bba88f8b6bc0714e886754d2ece864f2c9e2e8a..64939a31a32ffdedc815002f3948c54025c90b0c 100644 (file)
@@ -8,6 +8,7 @@ aweather_SOURCES  = main.c \
        aweather-gui.c      aweather-gui.h \
        aweather-location.c aweather-location.h
 aweather_CPPFLAGS = \
        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)\""
        -DHTMLDIR="\"$(dots)$(htmldir)\"" \
        -DPKGDATADIR="\"$(dots)$(pkgdatadir)\"" \
        -DPLUGINSDIR="\"$(dots)$(pkglibdir)\""
@@ -20,6 +21,9 @@ if WIN32
 AM_LDFLAGS       += -mwindows 
 aweather_SOURCES += resource.rc
 dots              = ..
 AM_LDFLAGS       += -mwindows 
 aweather_SOURCES += resource.rc
 dots              = ..
+browser           = "open"
+else
+browser           = "xdg-open"
 endif
 
 .rc.o: ../data/aweather.ico
 endif
 
 .rc.o: ../data/aweather.ico
index 42f65af660fd5dbb16bfb585b4eca50f1c4819ee..9cf4c8ae833a0e64dc4022bf13160055a3e82205 100644 (file)
@@ -52,11 +52,13 @@ 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;
 G_MODULE_EXPORT void on_help_contents(GtkMenuItem *menu, AWeatherGui *self)
 {
        GError *err = NULL;
-       const gchar *uri = "file://" HTMLDIR "/aweather.html";
-       gtk_show_uri(NULL, uri, GDK_CURRENT_TIME, &err);
-       if (err)
-               g_warning("Unable to open help page: %s - %s", uri, err->message);
-       g_error_free(err);
+       gchar *argv[] = {BROWSER, HTMLDIR "/aweather.html", 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_MODULE_EXPORT void on_quit(GtkMenuItem *menu, AWeatherGui *self)
 }
 
 G_MODULE_EXPORT void on_quit(GtkMenuItem *menu, AWeatherGui *self)