+/**
+ * Maps a hash table from country names to counts of belltowers to a
+ * newly-created hash table mapping country names to display
+ * names, containing only those countries which have many
+ * (or few) belltowers.
+ *
+ * \param source the source table
+ * \param want_many true if you want countries with many belltowers;
+ * false if you want countries with few.
+ */
+static GHashTable*
+get_countries_with_many (GHashTable *source,
+ gboolean want_many)
+{
+ GHashTable *result = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ NULL);
+ GList *countries = g_hash_table_get_keys (source);
+ GList *cursor = countries;
+
+ while (cursor)
+ {
+ gboolean has_many =
+ GPOINTER_TO_INT (g_hash_table_lookup (source,
+ cursor->data)) >= MANY_BELLTOWERS;
+
+ if (has_many == want_many)
+ {
+ g_hash_table_insert (result,
+ g_strdup (cursor->data),
+ g_strdup (cursor->data));
+ }
+
+ cursor = cursor->next;
+ }
+
+ g_list_free (countries);
+ return result;
+}
+
+#define COUNTRIES_WITH_MANY "Countries with many belltowers"
+#define COUNTRIES_WITH_FEW "Countries with few belltowers"
+
+/**
+ * Displays a list of areas of the world with many (or few)
+ * belltowers. If you ask for the areas with many, it include
+ * a link to the areas with few.
+ *
+ * \param countries_with_many True to list countries with many;
+ * false to list countries with few.
+ */