[Xfce4-commits] <libxfce4ui:xfce-4.10> Prefer exo-open for opening the manual pages.
Jérôme Guelfucci
noreply at xfce.org
Sat May 4 12:10:12 CEST 2013
Updating branch refs/heads/xfce-4.10
to 6768c125334050f26065585d0bd6f6207ea5d255 (commit)
from f038df3d7c083fde9448dccd1d81b0e48aea83df (commit)
commit 6768c125334050f26065585d0bd6f6207ea5d255
Author: Nick Schermer <nick at xfce.org>
Date: Tue May 1 22:05:35 2012 +0200
Prefer exo-open for opening the manual pages.
gtk_show_uri() could fail if the mimelist is not properly
configured or gvfs is missing. Instead try exo-open first
because it is likely this is installed.
libxfce4ui/xfce-dialogs.c | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/libxfce4ui/xfce-dialogs.c b/libxfce4ui/xfce-dialogs.c
index 8fab5c9..762b610 100644
--- a/libxfce4ui/xfce-dialogs.c
+++ b/libxfce4ui/xfce-dialogs.c
@@ -38,11 +38,10 @@
#include <libxfce4ui/xfce-dialogs.h>
#include <libxfce4ui/xfce-gtk-extensions.h>
#include <libxfce4ui/xfce-gdk-extensions.h>
+#include <libxfce4ui/xfce-spawn.h>
#include <libxfce4ui/libxfce4ui-private.h>
#include <libxfce4ui/libxfce4ui-alias.h>
-#define NOTNULL(str) ((str) != NULL ? (str) : "")
-
static void
@@ -69,12 +68,31 @@ xfce_dialog_show_help_uri (GdkScreen *screen,
GtkWindow *parent,
GString *uri)
{
- GError *error = NULL;
+ GError *error = NULL;
+ gchar *path;
+ gchar *cmd;
+ gboolean result;
g_return_if_fail (GDK_IS_SCREEN (screen));
g_return_if_fail (parent == NULL || GTK_IS_WINDOW (parent));
- if (!gtk_show_uri (screen, uri->str, gtk_get_current_event_time (), &error))
+ path = g_find_program_in_path ("exo-open");
+ if (G_LIKELY (path != NULL))
+ {
+ cmd = g_strdup_printf ("%s --launch WebBrowser '%s'", path, uri->str);
+
+ result = xfce_spawn_command_line_on_screen (screen, cmd, FALSE, TRUE, &error);
+
+ g_free (path);
+ g_free (cmd);
+ }
+ else
+ {
+ /* not very likely to happen, but it is possible exo is not installed */
+ result = gtk_show_uri (screen, uri->str, gtk_get_current_event_time (), &error);
+ }
+
+ if (!result)
{
xfce_dialog_show_error (parent, error,
_("Failed to open web browser for online documentation"));
More information about the Xfce4-commits
mailing list