r21039 - in /desktop/experimental/epiphany-webkit/debian: changelog patches/16_reimplement_search_on_locationbar.patch
kov at users.alioth.debian.org
kov at users.alioth.debian.org
Tue Aug 25 03:25:48 UTC 2009
Author: kov
Date: Tue Aug 25 03:25:47 2009
New Revision: 21039
URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=21039
Log:
Updated 16_reimplement_search_on_locationbar.patch
Modified:
desktop/experimental/epiphany-webkit/debian/changelog
desktop/experimental/epiphany-webkit/debian/patches/16_reimplement_search_on_locationbar.patch
Modified: desktop/experimental/epiphany-webkit/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/experimental/epiphany-webkit/debian/changelog?rev=21039&op=diff
==============================================================================
--- desktop/experimental/epiphany-webkit/debian/changelog [utf-8] (original)
+++ desktop/experimental/epiphany-webkit/debian/changelog [utf-8] Tue Aug 25 03:25:47 2009
@@ -3,6 +3,8 @@
* New upstream release
* debian/control:
- updated build-deps; soup >= 2.27.91, webkit >= 1.1.13
+ * debian/patches/16_reimplement_search_on_locationbar.patch:
+ - updated from upstream's bugzilla
-- Gustavo Noronha Silva <kov at debian.org> Tue, 25 Aug 2009 00:18:12 -0300
Modified: desktop/experimental/epiphany-webkit/debian/patches/16_reimplement_search_on_locationbar.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/experimental/epiphany-webkit/debian/patches/16_reimplement_search_on_locationbar.patch?rev=21039&op=diff
==============================================================================
--- desktop/experimental/epiphany-webkit/debian/patches/16_reimplement_search_on_locationbar.patch [utf-8] (original)
+++ desktop/experimental/epiphany-webkit/debian/patches/16_reimplement_search_on_locationbar.patch [utf-8] Tue Aug 25 03:25:47 2009
@@ -1,32 +1,30 @@
-From 61438f2aa8b784b30d88414816174efa8f63bd0f Mon Sep 17 00:00:00 2001
+From b0bea4d27140f1899e84d4cf50f47655c57f18fc Mon Sep 17 00:00:00 2001
From: Michael Kuhn <suraia at ikkoku.de>
-Date: Thu, 30 Jul 2009 16:59:33 +0200
-Subject: [PATCH] Use the load-error signal to reimplement search on the location bar
+Date: Thu, 20 Aug 2009 18:48:50 -0300
+Subject: [PATCH] Use regex and the load-error signal to reimplement search on the location bar
Changes slightly modified by Gustavo Noronha Silva to apply comments
about also checking if the error is related to DNS (and the other
error soup uses when we try to load multiple words as an URI).
-
-Bug #583795
---
- embed/ephy-embed.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
- embed/ephy-embed.h | 5 +++--
- src/ephy-link.c | 5 +++++
- 3 files changed, 52 insertions(+), 2 deletions(-)
+ embed/ephy-embed.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++
+ embed/ephy-embed.h | 5 ++-
+ embed/ephy-web-view.c | 39 ++++++++++++++++++++++++++++++++++++
+ 3 files changed, 95 insertions(+), 2 deletions(-)
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
-index 18c943f..181a73c 100644
+index f9f9c53..8b4f5f6 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
-@@ -62,6 +62,7 @@ struct EphyEmbedPrivate
+@@ -61,6 +61,7 @@ struct EphyEmbedPrivate
EphyHistory *history;
GtkWidget *inspector_window;
guint is_setting_zoom : 1;
-+ guint handle_load_error : 1;
++ guint search_on_load_error : 1;
};
static void
-@@ -224,6 +225,40 @@ load_status_changed_cb (WebKitWebView *view,
+@@ -228,6 +229,41 @@ load_status_changed_cb (WebKitWebView *view,
}
}
@@ -37,14 +35,14 @@
+ GError *error,
+ EphyEmbed *embed)
+{
-+ if (embed->priv->handle_load_error == TRUE &&
++ if (embed->priv->search_on_load_error == TRUE &&
+ g_str_has_prefix (uri, "http://") == TRUE &&
+ (error->code == SOUP_STATUS_CANT_RESOLVE ||
+ error->code == SOUP_STATUS_SWITCHING_PROTOCOLS)) {
+ char *tmp_uri = g_strdup (uri);
+ char *effective_uri = NULL;
+
-+ embed->priv->handle_load_error = FALSE;
++ embed->priv->search_on_load_error = FALSE;
+
+ /* Remove slash that is added to the URI when DNS fails.
+ * FIXME: who is adding this slash here? */
@@ -64,10 +62,11 @@
+ return FALSE;
+}
+
++
static void
hovering_over_link_cb (WebKitWebView *web_view,
char *title,
-@@ -674,6 +709,7 @@ ephy_embed_constructed (GObject *object)
+@@ -678,6 +714,7 @@ ephy_embed_constructed (GObject *object)
g_object_connect (web_view,
"signal::notify::load-status", G_CALLBACK (load_status_changed_cb), embed,
@@ -75,20 +74,28 @@
"signal::hovering-over-link", G_CALLBACK (hovering_over_link_cb), embed,
"signal::mime-type-policy-decision-requested", G_CALLBACK (mime_type_policy_decision_requested_cb), embed,
"signal::download-requested", G_CALLBACK (download_requested_cb), embed,
-@@ -735,3 +771,11 @@ ephy_embed_get_web_view (EphyEmbed *embed)
+@@ -739,3 +776,19 @@ ephy_embed_get_web_view (EphyEmbed *embed)
return EPHY_WEB_VIEW (embed->priv->web_view);
}
+
++/**
++ * _ephy_embed_search_on_load_error:
++ * @embed: and #EphyEmbed
++ *
++ * Tells the @embed that it should handle the load error by searching
++ * the string in a web search engine. This will happen when a name
++ * fails loading because of a DNS failure.
++ **/
+void
-+ephy_embed_handle_load_error (EphyEmbed *embed)
++_ephy_embed_search_on_load_error (EphyEmbed *embed)
+{
+ g_return_if_fail (EPHY_IS_EMBED (embed));
+
-+ embed->priv->handle_load_error = TRUE;
++ embed->priv->search_on_load_error = TRUE;
+}
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
-index 18fb6ed..40387b4 100644
+index 18fb6ed..04b7ba4 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -51,8 +51,9 @@ struct EphyEmbedClass {
@@ -97,42 +104,95 @@
-GType ephy_embed_get_type (void);
-EphyWebView* ephy_embed_get_web_view (EphyEmbed *embed);
-+GType ephy_embed_get_type (void);
-+EphyWebView* ephy_embed_get_web_view (EphyEmbed *embed);
-+void ephy_embed_handle_load_error (EphyEmbed *embed);
++GType ephy_embed_get_type (void);
++EphyWebView* ephy_embed_get_web_view (EphyEmbed *embed);
++void _ephy_embed_search_on_load_error (EphyEmbed *embed);
G_END_DECLS
-diff --git a/src/ephy-link.c b/src/ephy-link.c
-index 7845dfb..b4090f9 100644
---- a/src/ephy-link.c
-+++ b/src/ephy-link.c
-@@ -90,6 +90,7 @@ ephy_link_open (EphyLink *link,
+diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
+index 2c8d66d..da62a9e 100644
+--- a/embed/ephy-web-view.c
++++ b/embed/ephy-web-view.c
+@@ -81,6 +81,9 @@ struct _EphyWebViewPrivate {
+ guint reload_scheduled_id;
+ guint reload_delay_ticks;
+
++ /* Location bar search regex */
++ GRegex *search_regex;
++
+ GSList *hidden_popups;
+ GSList *shown_popups;
+ };
+@@ -501,6 +504,11 @@ ephy_web_view_finalize (GObject *object)
+ priv->icon = NULL;
+ }
+
++ if (priv->search_regex != NULL) {
++ g_regex_unref (priv->search_regex);
++ priv->search_regex = NULL;
++ }
++
+ ephy_web_view_popups_manager_reset (EPHY_WEB_VIEW (object));
+
+ g_free (priv->address);
+@@ -983,6 +991,7 @@ ephy_web_view_init (EphyWebView *web_view)
{
- EphyEmbed *new_embed = NULL;
- char *effective_url = NULL;
-+ gboolean handle_load_error = FALSE;
+ EphyWebViewPrivate *priv;
+ EphyFaviconCache *cache;
++ GError *error = NULL;
- /*
- * WebKit does not normalize URI's by itself, so we need to
-@@ -98,6 +99,7 @@ ephy_link_open (EphyLink *link,
- if (ephy_embed_utils_address_has_web_scheme (address) == FALSE)
- {
- effective_url = g_strconcat ("http://", address, NULL);
-+ handle_load_error = TRUE;
- }
- else
- {
-@@ -112,6 +114,9 @@ ephy_link_open (EphyLink *link,
+ priv = web_view->priv = EPHY_WEB_VIEW_GET_PRIVATE (web_view);
- g_free (effective_url);
+@@ -994,6 +1003,16 @@ ephy_web_view_init (EphyWebView *web_view)
+ priv->security_level = EPHY_WEB_VIEW_STATE_IS_UNKNOWN;
+ priv->monitor_directory = FALSE;
-+ if (new_embed != NULL && handle_load_error == TRUE)
-+ ephy_embed_handle_load_error(new_embed);
++ priv->search_regex = g_regex_new ("(^localhost$|^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]$|"
++ "^[^[\\.[:space:]]+\\.[^\\.[:space:]]+.*$|"
++ "^https?://[^/\\.[:space:]]+.*$|"
++ "^about:.*$)",
++ G_REGEX_OPTIMIZE, G_REGEX_MATCH_NOTEMPTY, &error);
++ if (error) {
++ g_critical ("Failure creating search regex: %s", error->message);
++ g_error_free (error);
++ }
+
- return new_embed;
- }
+ g_signal_connect_object (web_view, "ge_document_type",
+ G_CALLBACK (ge_document_type_cb),
+ web_view, (GConnectFlags)0);
+@@ -1069,11 +1088,31 @@ void
+ ephy_web_view_load_url (EphyWebView *view,
+ const char *url)
+ {
++ EphyWebViewPrivate *priv;
+ char *effective_url;
+ g_return_if_fail (EPHY_IS_WEB_VIEW (view));
+ g_return_if_fail (url);
+
++ priv = view->priv;
++
++ /* If the string doesn't look like an URL, let's search it */
++ if (priv->search_regex &&
++ !g_regex_match (priv->search_regex, url, 0, NULL)) {
++ effective_url = g_strdup_printf (_("http://www.google.com/search?q=%s&ie=UTF-8&oe=UTF-8"), url);
++ webkit_web_view_open (WEBKIT_WEB_VIEW (view), effective_url);
++ g_free (effective_url);
++ return;
++ }
++
++ if (!ephy_embed_utils_address_has_web_scheme (url)) {
++ EphyEmbed *embed;
++
++ embed = EPHY_EMBED (gtk_widget_get_parent (GTK_WIDGET(view)));
++
++ _ephy_embed_search_on_load_error (embed);
++ }
++
+ effective_url = ephy_embed_utils_normalize_address (url);
+ webkit_web_view_open (WEBKIT_WEB_VIEW (view), effective_url);
+ g_free (effective_url);
--
1.6.3.3
More information about the pkg-gnome-commits
mailing list