[Xfce4-commits] <midori:master> Recognize open search description links
Christian Dywan
noreply at xfce.org
Tue Mar 13 20:06:01 CET 2012
Updating branch refs/heads/master
to ecbc8d077295a77c37004cc487f85f472627abdc (commit)
from 3184b5226e9b08190a1d863d3e6afd08ad6e82fc (commit)
commit ecbc8d077295a77c37004cc487f85f472627abdc
Author: Christian Dywan <christian at twotoasts.de>
Date: Sun Mar 11 22:37:56 2012 +0100
Recognize open search description links
midori/midori-view.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/midori/midori-view.c b/midori/midori-view.c
index 1ad473a..0c9fb5b 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -1476,12 +1476,14 @@ webkit_web_view_load_finished_cb (WebKitWebView* web_view,
{
JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
- /* Icon: URI, News Feed: $URI|title */
+ /* Icon: URI, News Feed: $URI|title, Search: :URI|title */
gchar* value = sokoke_js_script_eval (js_context,
"(function (l) { var f = new Array (); for (var i in l) "
"{ var t = l[i].type; var r = l[i].rel; "
"if (t && (t.indexOf ('rss') != -1 || t.indexOf ('atom') != -1)) "
"f.push ('$' + l[i].href + '|' + l[i].title);"
+ "else if (r == 'search' && t == 'application/opensearchdescription+xml') "
+ "f.push (':' + l[i].href + '|' + l[i].title); "
#if !WEBKIT_CHECK_VERSION (1, 1, 18)
"else if (r && r.indexOf ('icon') != -1) f.push (l[i].href); "
#endif
@@ -1525,6 +1527,22 @@ webkit_web_view_load_finished_cb (WebKitWebView* web_view,
else
g_free (uri);
}
+ else if (uri_and_title[0] == ':')
+ {
+ const gchar* title;
+
+ uri_and_title++;
+ if (uri_and_title == NULL)
+ continue;
+ title = strchr (uri_and_title, '|');
+ if (title == NULL)
+ goto news_feeds_continue;
+ title++;
+ /* TODO: Parse search engine XML
+ midori_view_add_info_bar (view, GTK_MESSAGE_INFO, title,
+ G_CALLBACK (midori_view_open_search_response_cb), view,
+ _("_Save Search engine"), GTK_RESPONSE_ACCEPT, NULL); */
+ }
#if !WEBKIT_CHECK_VERSION (1, 1, 18)
else
katze_assign (view->icon_uri, g_strdup (uri_and_title));
More information about the Xfce4-commits
mailing list