summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2008-06-21 18:09:17 +0000
committerGuy Harris <guy@alum.mit.edu>2008-06-21 18:09:17 +0000
commit8f244766f380b2f69364b51a0f44461d49e9563f (patch)
tree32d8ca495a020be5d28e61b9ec0d464b27cf667f /gtk
parent4e3df102d787638cf17738d8654b2af4c9baf02b (diff)
downloadwireshark-8f244766f380b2f69364b51a0f44461d49e9563f.tar.gz
If we have xdg-open, always run that to launch a Web browser, and ignore
the Web browser setting; that should honor the user's *real* preferred Web browser setting (i.e., the one they've selected in their desktop environment). Don't bother defining HTML_VIEWER as "xdg-open" if we have xdg-open - we don't need it. svn path=/trunk/; revision=25514
Diffstat (limited to 'gtk')
-rw-r--r--gtk/webbrowser.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/gtk/webbrowser.c b/gtk/webbrowser.c
index 88914f731f..50b6a2dfd2 100644
--- a/gtk/webbrowser.c
+++ b/gtk/webbrowser.c
@@ -61,6 +61,8 @@
/* Mac OS X - use Launch Services to start a browser */
#include <CoreFoundation/CoreFoundation.h>
#include <ApplicationServices/ApplicationServices.h>
+#elif defined(HAVE_XDG_OPEN)
+/* UNIX+X11 desktop with Portland Group stuff - use xdg-open to start a browser */
#else
/* Everything else - launch the browser ourselves */
#define MUST_LAUNCH_BROWSER_OURSELVES
@@ -125,6 +127,38 @@ browser_open_url (const gchar *url)
CFRelease(url_CFURL);
return (status == 0);
+#elif defined(HAVE_XDG_OPEN)
+
+ GError *error = NULL;
+ gchar *argv[3];
+ gboolean retval;
+
+ g_return_val_if_fail (url != NULL, FALSE);
+
+ argv[0] = "xdg-open";
+ argv[1] = (char *)url; /* Grr - g_spawn_async() shouldn't modify this */
+ argv[2] = NULL;
+
+ /*
+ * XXX - use g_spawn_on_screen() so the browser window shows up on
+ * the same screen?
+ */
+ retval = g_spawn_async (NULL, argv, NULL,
+ G_SPAWN_SEARCH_PATH,
+ NULL, NULL,
+ NULL, &error);
+
+ if (! retval)
+ {
+ simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
+ "%sCould not execute xdg-open: %s\n\n\"%s\"",
+ simple_dialog_primary_start(), simple_dialog_primary_end(),
+ error->message);
+ g_error_free (error);
+ }
+
+ return retval;
+
#elif defined(MUST_LAUNCH_BROWSER_OURSELVES)
GError *error = NULL;
@@ -307,7 +341,7 @@ filemanager_open_directory (const gchar *path)
argv[2] = NULL;
/*
- * XXX - use g_spawn_on_screen() so the browser window shows up on
+ * XXX - use g_spawn_on_screen() so the file managaer window shows up on
* the same screen?
*/
retval = g_spawn_async (NULL, argv, NULL,