From 0d4cbd60a15a7d2bc8b45cb43633705584fdde98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Tue, 10 Jun 2008 13:51:45 +0000 Subject: [PATCH] Allow and use arguments to the browser command (closes #1989575). Add 'xdg-open' as first browser fallback. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2675 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 7 +++++++ src/utils.c | 43 +++++++++++++++++++++++++++---------------- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index b7deede4..d716dc24 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-06-10 Enrico Tröger + + * src/utils.c: + Allow and use arguments to the browser command (closes #1989575). + Add 'xdg-open' as first browser fallback. + + 2008-06-10 Nick Treleaven * tagmanager/python.c: diff --git a/src/utils.c b/src/utils.c index 67021421..f99e2872 100644 --- a/src/utils.c +++ b/src/utils.c @@ -62,33 +62,44 @@ void utils_start_browser(const gchar *uri) #ifdef G_OS_WIN32 win32_open_browser(uri); #else - const gchar *argv[3]; + gchar *cmdline = g_strconcat(tool_prefs.browser_cmd, " ", uri, NULL); - argv[0] = tool_prefs.browser_cmd; - argv[1] = uri; - argv[2] = NULL; - - if (! g_spawn_async(NULL, (gchar**)argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL)) + if (! g_spawn_command_line_async(cmdline, NULL)) { - argv[0] = "firefox"; - if (! g_spawn_async(NULL, (gchar**)argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL)) + const gchar *argv[3]; + + argv[0] = "xdg-open"; + argv[1] = uri; + argv[2] = NULL; + if (! g_spawn_async(NULL, (gchar**)argv, NULL, G_SPAWN_SEARCH_PATH, + NULL, NULL, NULL, NULL)) { - argv[0] = "mozilla"; - if (! g_spawn_async(NULL, (gchar**)argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL)) + argv[0] = "firefox"; + if (! g_spawn_async(NULL, (gchar**)argv, NULL, G_SPAWN_SEARCH_PATH, + NULL, NULL, NULL, NULL)) { - argv[0] = "opera"; - if (! g_spawn_async(NULL, (gchar**)argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL)) + argv[0] = "mozilla"; + if (! g_spawn_async(NULL, (gchar**)argv, NULL, G_SPAWN_SEARCH_PATH, NULL, + NULL, NULL, NULL)) { - argv[0] = "konqueror"; - if (! g_spawn_async(NULL, (gchar**)argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL)) + argv[0] = "opera"; + if (! g_spawn_async(NULL, (gchar**)argv, NULL, G_SPAWN_SEARCH_PATH, + NULL, NULL, NULL, NULL)) { - argv[0] = "netscape"; - g_spawn_async(NULL, (gchar**)argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL); + argv[0] = "konqueror"; + if (! g_spawn_async(NULL, (gchar**)argv, NULL, G_SPAWN_SEARCH_PATH, + NULL, NULL, NULL, NULL)) + { + argv[0] = "netscape"; + g_spawn_async(NULL, (gchar**)argv, NULL, G_SPAWN_SEARCH_PATH, + NULL, NULL, NULL, NULL); + } } } } } } + g_free(cmdline); #endif }