summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2015-03-02 17:44:43 -0500
committerMatthias Clasen <mclasen@redhat.com>2015-03-02 18:01:37 -0500
commitadb5cce6b8f35a262f7efa08dc78f35db2b9d5e7 (patch)
tree6003511422ba61e42909192793652b03397abe4c
parent396578a785bb5d1fb83fbba5acb9042c58aa53a5 (diff)
downloadyelp-adb5cce6b8f35a262f7efa08dc78f35db2b9d5e7.tar.gz
Avoid activating ourselves recursively
We consider INFO:foobar an 'external uri', and call g_app_info_launch_default_for_uri on it. Which is bad, since GIO promptly determines the default handler for INFO: uris to be...yelp. Avoid this by manually looking up the default handler, and ignoring it if it appears to be yelp. https://bugzilla.gnome.org/show_bug.cgi?id=745407
-rw-r--r--libyelp/yelp-view.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/libyelp/yelp-view.c b/libyelp/yelp-view.c
index 4334be65..67afd0a3 100644
--- a/libyelp/yelp-view.c
+++ b/libyelp/yelp-view.c
@@ -728,7 +728,27 @@ view_external_uri (YelpView *view,
YelpUri *uri)
{
gchar *struri = yelp_uri_get_canonical_uri (uri);
- g_app_info_launch_default_for_uri (struri, NULL, NULL);
+ gchar *uri_scheme;
+ GAppInfo *app_info = NULL;
+
+ uri_scheme = g_uri_parse_scheme (struri);
+ if (uri_scheme && *uri_scheme)
+ app_info = g_app_info_get_default_for_uri_scheme (uri_scheme);
+ g_free (uri_scheme);
+
+ if (app_info)
+ {
+ if (!strstr (g_app_info_get_executable (app_info), "yelp"))
+ {
+ GList l;
+
+ l.data = struri;
+ l.next = l.prev = NULL;
+ g_app_info_launch_uris (app_info, &l, NULL, NULL);
+ }
+
+ g_object_unref (app_info);
+ }
g_free (struri);
return TRUE;
}