aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-04-10 05:08:02 +0800
committerChristian Persch <chpe@src.gnome.org>2004-04-10 05:08:02 +0800
commit0def815524548951faa2fdff0c2ea914b72da6d3 (patch)
tree207e204fb5e55efa312cdb1adb01b4420f01d720
parent19b0d73f92fd47c44c140869dcc8d252869b9c02 (diff)
downloadgsoc2013-epiphany-0def815524548951faa2fdff0c2ea914b72da6d3.tar
gsoc2013-epiphany-0def815524548951faa2fdff0c2ea914b72da6d3.tar.gz
gsoc2013-epiphany-0def815524548951faa2fdff0c2ea914b72da6d3.tar.bz2
gsoc2013-epiphany-0def815524548951faa2fdff0c2ea914b72da6d3.tar.lz
gsoc2013-epiphany-0def815524548951faa2fdff0c2ea914b72da6d3.tar.xz
gsoc2013-epiphany-0def815524548951faa2fdff0c2ea914b72da6d3.tar.zst
gsoc2013-epiphany-0def815524548951faa2fdff0c2ea914b72da6d3.zip
Sort the actions in the location entry autocompletion dropdown. Fixes bug
2004-04-09 Christian Persch <chpe@cvs.gnome.org> * src/ephy-location-action.c: (compare_actions), (init_actions_list): Sort the actions in the location entry autocompletion dropdown. Fixes bug #139575.
-rw-r--r--ChangeLog8
-rw-r--r--src/ephy-location-action.c39
2 files changed, 46 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 366c5934d..8bb09fc53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-04-09 Christian Persch <chpe@cvs.gnome.org>
+
+ * src/ephy-location-action.c: (compare_actions),
+ (init_actions_list):
+
+ Sort the actions in the location entry autocompletion dropdown.
+ Fixes bug #139575.
+
2004-04-09 Adam Hooper <adamh@cvs.gnome.org>
* embed/ephy-encodings.c: (ephy_encodings_init):
diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c
index 2d64cb09b..e34b2c1af 100644
--- a/src/ephy-location-action.c
+++ b/src/ephy-location-action.c
@@ -406,6 +406,40 @@ ephy_location_action_class_init (EphyLocationActionClass *class)
g_type_class_add_private (object_class, sizeof (EphyLocationActionPrivate));
}
+static int
+compare_actions (gconstpointer a,
+ gconstpointer b)
+{
+ EphyNode *node_a = (EphyNode *)a;
+ EphyNode *node_b = (EphyNode *)b;
+ const char *title1, *title2;
+ int retval;
+
+ title1 = ephy_node_get_property_string (node_a, EPHY_NODE_BMK_PROP_TITLE);
+ title2 = ephy_node_get_property_string (node_b, EPHY_NODE_BMK_PROP_TITLE);
+
+ if (title1 == NULL)
+ {
+ retval = -1;
+ }
+ else if (title2 == NULL)
+ {
+ retval = 1;
+ }
+ else
+ {
+ char *str_a, *str_b;
+
+ str_a = g_utf8_casefold (title1, -1);
+ str_b = g_utf8_casefold (title2, -1);
+ retval = g_utf8_collate (str_a, str_b);
+ g_free (str_a);
+ g_free (str_b);
+ }
+
+ return retval;
+}
+
static void
init_actions_list (EphyLocationAction *action)
{
@@ -419,9 +453,12 @@ init_actions_list (EphyLocationAction *action)
kid = g_ptr_array_index (children, i);
- action->priv->actions = g_list_append
+ action->priv->actions = g_list_prepend
(action->priv->actions, kid);
}
+
+ action->priv->actions =
+ g_list_sort (action->priv->actions, (GCompareFunc) compare_actions);
}
static void