diff options
author | danw <danw> | 2001-09-24 23:47:36 +0000 |
---|---|---|
committer | danw <danw> | 2001-09-24 23:47:36 +0000 |
commit | d514ab5483d4f2db2a53ae3d55fce117ec4d9497 (patch) | |
tree | dfdc0d4687a64bc0b4b20635f5128a64aab20d8f /x11/gnome-libs/patches | |
parent | c33590dab7d2c5f5e5940880526070a1eaddcb59 (diff) | |
download | pkgsrc-d514ab5483d4f2db2a53ae3d55fce117ec4d9497.tar.gz |
Patch gnome_url_show() to fall back to the default handler if the
one specified by gnome_config doesn't work. In particular, if a help file
can't be viewed with gnome-help-browser (eg, because gnome-core isn't
installed), fall back to the user's web browser rather than silently
losing.
Diffstat (limited to 'x11/gnome-libs/patches')
-rw-r--r-- | x11/gnome-libs/patches/patch-ay | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/x11/gnome-libs/patches/patch-ay b/x11/gnome-libs/patches/patch-ay new file mode 100644 index 00000000000..edd7b93f908 --- /dev/null +++ b/x11/gnome-libs/patches/patch-ay @@ -0,0 +1,71 @@ +$NetBSD: patch-ay,v 1.1 2001/09/24 23:47:37 danw Exp $ + +--- libgnome/gnome-url.c.orig Fri Mar 16 14:44:42 2001 ++++ libgnome/gnome-url.c Mon Sep 24 18:36:21 2001 +@@ -72,6 +72,8 @@ + return default_handler; + } + ++static int gnome_url_show_with_handler (const gchar *url, const gchar *template); ++ + /** + * gnome_url_show + * @url: URL to show +@@ -97,11 +99,9 @@ + void + gnome_url_show(const gchar *url) + { +- gint i; + gchar *pos, *template; + gboolean free_template = FALSE; +- int argc; +- char **argv; ++ int status; + + g_return_if_fail (url != NULL); + pos = strchr (url, ':'); +@@ -127,12 +127,26 @@ + } else /* no : ? -- this shouldn't happen. Use default handler */ + template = gnome_url_default_handler (); + ++ status = gnome_url_show_with_handler (url, template); ++ if (status == -1 && free_template) ++ gnome_url_show_with_handler (url, gnome_url_default_handler ()); ++ ++ if (free_template) ++ g_free (template); ++} ++ ++static int ++gnome_url_show_with_handler (const gchar *url, const gchar *template) ++{ ++ int argc, i, status; ++ char **argv; ++ + /* we use a popt function as it does exactly what we want to do and + gnome already uses popt */ + if(poptParseArgvString(template, &argc, &argv) != 0) { + /* can't parse */ + g_warning("Parse error of '%s'", template); +- return; ++ return -1; + } + + /* we can just replace the entry in the array since the +@@ -146,13 +160,12 @@ + + /* use execute async, and not the shell, shell is evil and a + * security hole */ +- gnome_execute_async (NULL, argc, argv); +- +- if (free_template) +- g_free (template); ++ status = gnome_execute_async (NULL, argc, argv); + + /* the way the poptParseArgvString works is that the entire thing + * is allocated as one buffer, so just free will suffice, also + * it must be free and not g_free */ + free(argv); ++ ++ return status; + } |