]> git.street.me.uk Git - andy/viking.git/blame - src/util.c
Fix bug: "config.status: error: cannot find input file: Makefile.in"
[andy/viking.git] / src / util.c
CommitLineData
7d02a0b0
GB
1/*
2 * Viking - GPS data editor
3 * Copyright (C) 2007 Guilhem Bonnefille <guilhem.bonnefille@gmail.com>
4 * Based on:
5 * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@linuxmag.com.br>
6 *
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.
10 *
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.
15 *
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
19 */
20
21#include "dialog.h"
22
23void open_url(GtkWindow *parent, const gchar * url)
24{
25#ifdef WINDOWS
26 ShellExecute(NULL, NULL, (char *) webpage, NULL, ".\\", 0);
27#else /* WINDOWS */
28 const gchar *browsers[] = {
29 "xdg-open", "gnome-open", "kfmclient openURL",
30 "sensible-browser", "firefox", "epiphany",
31 "iceweasel", "seamonkey", "galeon", "mozilla",
32 "opera", "konqueror", "netscape", "links -g",
33 NULL
34 };
35 gint i=0;
36 gchar *cmdline = NULL;
37
38 gchar *browser = g_getenv("BROWSER");
39 if (browser == NULL || browser[0] == '\0') {
40 /* $BROWSER not set -> use first entry */
41 browser = browsers[i++];
42 }
43 do {
44 cmdline = g_strdup_printf("%s '%s'", browser, url);
45 g_debug("Running: %s", cmdline);
46
47 if (g_spawn_command_line_async(cmdline, NULL)) {
48 g_free(cmdline);
49 return;
50 }
51
52 g_free(cmdline);
53 browser = browsers[i++];
54 } while(browser);
55
56 a_dialog_error_msg ( parent, "Could not launch web browser." );
57#endif /* WINDOWS */
58}