2 * Viking - GPS data editor
3 * Copyright (C) 2007 Guilhem Bonnefille <guilhem.bonnefille@gmail.com>
5 * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@linuxmag.com.br>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, version 2.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #include <glib/gi18n.h>
28 void open_url(GtkWindow *parent, const gchar * url)
31 ShellExecute(NULL, NULL, (char *) webpage, NULL, ".\\", 0);
33 const gchar *browsers[] = {
34 "xdg-open", "gnome-open", "kfmclient openURL",
35 "sensible-browser", "firefox", "epiphany",
36 "iceweasel", "seamonkey", "galeon", "mozilla",
37 "opera", "konqueror", "netscape", "links -g",
41 gchar *cmdline = NULL;
43 const gchar *browser = g_getenv("BROWSER");
44 if (browser == NULL || browser[0] == '\0') {
45 /* $BROWSER not set -> use first entry */
46 browser = browsers[i++];
49 cmdline = g_strdup_printf("%s '%s'", browser, url);
50 g_debug("Running: %s", cmdline);
52 if (g_spawn_command_line_async(cmdline, NULL)) {
58 browser = browsers[i++];
61 a_dialog_error_msg ( parent, _("Could not launch web browser.") );