[yelp/wip/amigadave/webkit2-port: 18/53] yelp-document: Use xref: uris for search results



commit 24d9acf1c0f200ecdff276bb85787116e8c6ac00
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Thu Aug 30 12:57:37 2012 +0200

    yelp-document: Use xref: uris for search results

 libyelp/yelp-document.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/libyelp/yelp-document.c b/libyelp/yelp-document.c
index 04f98fb..2ead58d 100644
--- a/libyelp/yelp-document.c
+++ b/libyelp/yelp-document.c
@@ -1039,12 +1039,19 @@ document_read_contents (YelpDocument *document,
         }
         else {
             while (g_variant_iter_loop (iter, "(&s&s&s&s)", &url, &title, &desc, &icon)) {
+                gchar *xref_uri = NULL;
+
+                if (g_str_has_prefix (url, document->priv->doc_uri))
+                    xref_uri = g_strdup_printf ("xref:%s", url + strlen (document->priv->doc_uri) + 1);
+
                 tmp = g_markup_printf_escaped ("<div><a class='linkdiv' href='%s'><div class='linkdiv'>"
                                                "<div class='title'>%s</div>"
                                                "<div class='desc'>%s</div>"
                                                "</div></a></div>",
-                                               url, title, desc);
+                                               xref_uri && xref_uri[0] != '\0' ? xref_uri : url,
+                                               title, desc);
                 g_string_append (ret, tmp);
+                g_free (xref_uri);
                 g_free (tmp);
             }
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]