[Xfce4-commits] <midori:master> Strip scheme and www. in completion to reduce noise
Christian Dywan
noreply at xfce.org
Mon Apr 25 22:18:03 CEST 2011
Updating branch refs/heads/master
to 8adc200bbabaaedf725f838305065130967b1aa3 (commit)
from bab4db6ca26d1c8bee132f5a18e4d7457dcae0d1 (commit)
commit 8adc200bbabaaedf725f838305065130967b1aa3
Author: Christian Dywan <christian at twotoasts.de>
Date: Mon Apr 25 21:24:17 2011 +0200
Strip scheme and www. in completion to reduce noise
Related to: https://bugs.launchpad.net/midori/+bug/752915
midori/midori-locationaction.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c
index c0a55ab..f517606 100644
--- a/midori/midori-locationaction.c
+++ b/midori/midori-locationaction.c
@@ -1063,8 +1063,19 @@ midori_location_entry_render_text_cb (GtkCellLayout* layout,
if (G_LIKELY (uri))
{
- temp_iter = temp = g_utf8_strdown (uri, -1);
- desc_iter = uri;
+ /* Strip URI scheme and www. for display to reduce visual noise */
+ gchar* stripped_uri = uri;
+ if (g_str_has_prefix (uri, "http://"))
+ stripped_uri = &uri[7];
+ else if (g_str_has_prefix (uri, "https://"))
+ stripped_uri = &uri[8];
+ else if (g_str_has_prefix (uri, "file://"))
+ stripped_uri = &uri[7];
+ if (g_str_has_prefix (stripped_uri, "www."))
+ stripped_uri = &stripped_uri[4];
+
+ temp_iter = temp = g_utf8_strdown (stripped_uri, -1);
+ desc_iter = stripped_uri;
key_idx = 0;
key = keys[key_idx];
offset = 0;
@@ -1114,7 +1125,7 @@ midori_location_entry_render_text_cb (GtkCellLayout* layout,
katze_assign (desc_uri, temp_concat);
}
else
- desc_uri = g_markup_escape_text (uri, -1);
+ desc_uri = g_markup_escape_text (stripped_uri, -1);
g_free (temp);
}
More information about the Xfce4-commits
mailing list