aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2004-02-11 16:19:28 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2004-02-11 16:19:28 +0800
commit2767a4325bcdc1731f7abfe58a79831a83badd35 (patch)
tree807373067b6b5182a812a0f23342b8fb77b2c692 /src
parentedb02d56a6b998002e83528bb1de8bd0b8a02b43 (diff)
downloadgsoc2013-epiphany-2767a4325bcdc1731f7abfe58a79831a83badd35.tar
gsoc2013-epiphany-2767a4325bcdc1731f7abfe58a79831a83badd35.tar.gz
gsoc2013-epiphany-2767a4325bcdc1731f7abfe58a79831a83badd35.tar.bz2
gsoc2013-epiphany-2767a4325bcdc1731f7abfe58a79831a83badd35.tar.lz
gsoc2013-epiphany-2767a4325bcdc1731f7abfe58a79831a83badd35.tar.xz
gsoc2013-epiphany-2767a4325bcdc1731f7abfe58a79831a83badd35.tar.zst
gsoc2013-epiphany-2767a4325bcdc1731f7abfe58a79831a83badd35.zip
Better autocompletion sorting logic.
2004-02-11 Marco Pesenti Gritti <marco@gnome.org> * src/ephy-completion-model.c: (is_base_address), (init_relevance_col): Better autocompletion sorting logic. * src/window-commands.c: (window_cmd_help_about): s/translator_credits/translator-credits
Diffstat (limited to 'src')
-rw-r--r--src/ephy-completion-model.c57
-rw-r--r--src/window-commands.c4
2 files changed, 48 insertions, 13 deletions
diff --git a/src/ephy-completion-model.c b/src/ephy-completion-model.c
index 3f840d43d..fd5437934 100644
--- a/src/ephy-completion-model.c
+++ b/src/ephy-completion-model.c
@@ -346,23 +346,58 @@ init_keywords_col (GValue *value, EphyNode *node, int group)
g_value_set_string (value, text);
}
+static gboolean
+is_base_address (const char *address)
+{
+ int slashes = 0;
+
+ if (address == NULL) return FALSE;
+
+ while (*address != '\0')
+ {
+ if (*address == '/') slashes++;
+
+ /* Base uris has 3 slashes like http://www.gnome.org/ */
+ if (slashes == 4) return FALSE;
+
+ address++;
+ }
+
+ return TRUE;
+}
+
static void
init_relevance_col (GValue *value, EphyNode *node, int group)
{
- int relevance, visits;
+ int relevance = 0;
- switch (group)
+ /* We have three ordered groups: history's base
+ addresses, bookmarks, deep history addresses */
+
+ if (group == BOOKMARKS_GROUP)
{
- case HISTORY_GROUP:
- visits = ephy_node_get_property_int
- (node, EPHY_NODE_PAGE_PROP_VISITS);
+ relevance = 1 << 5;
+ }
+ else if (group == HISTORY_GROUP)
+ {
+ const char *address;
+ int visits;
+
+ visits = ephy_node_get_property_int
+ (node, EPHY_NODE_PAGE_PROP_VISITS);
+ address = ephy_node_get_property_string
+ (node, EPHY_NODE_PAGE_PROP_LOCATION);
+
+ visits = MAX (visits, (1 << 5) - 1);
+
+ if (is_base_address (address))
+ {
+ relevance = visits << 10;
+ }
+ else
+ {
relevance = visits;
- break;
- case BOOKMARKS_GROUP:
- relevance = 2000;
- break;
- default:
- relevance = 0;
+ }
}
g_value_set_int (value, relevance);
diff --git a/src/window-commands.c b/src/window-commands.c
index 42ce69a24..825b0d894 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -950,7 +950,7 @@ window_cmd_help_about (GtkAction *action,
};
/* Translator credits */
- char *translator_credits = _("translator_credits");
+ char *translator_credits = _("translator-credits");
if (about != NULL)
{
@@ -983,7 +983,7 @@ window_cmd_help_about (GtkAction *action,
_("A GNOME browser based on Mozilla"),
(const char **)authors,
(const char **)documenters,
- strcmp (translator_credits, "translator_credits") != 0 ? translator_credits : NULL,
+ strcmp (translator_credits, "translator-credits") != 0 ? translator_credits : NULL,
logo);
if (logo != NULL)