[libgweather] GWeatherLocationEntry: remove airports from the entry completion
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather] GWeatherLocationEntry: remove airports from the entry completion
- Date: Fri, 1 Aug 2014 10:20:32 +0000 (UTC)
commit 3e162ede2b11f0b8f0fc04206ec1047cd2d853c9
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Fri Aug 1 12:19:37 2014 +0200
GWeatherLocationEntry: remove airports from the entry completion
If we have multiple locations (airports or weather stations) for
one city, just use the one closest to the city center.
https://bugzilla.gnome.org/show_bug.cgi?id=732315
libgweather/location-entry.c | 43 ++++++-----------------------------------
1 files changed, 7 insertions(+), 36 deletions(-)
---
diff --git a/libgweather/location-entry.c b/libgweather/location-entry.c
index 2076f70..32c1210 100644
--- a/libgweather/location-entry.c
+++ b/libgweather/location-entry.c
@@ -564,43 +564,14 @@ fill_location_entry_model (GtkTreeStore *store, GWeatherLocation *loc,
break;
case GWEATHER_LOCATION_CITY:
- if (children[0] && children[1]) {
- /* If there are multiple (<location>) children, add a line
- * for each of them.
- */
- for (i = 0; children[i]; i++) {
- display_name = g_strdup_printf ("%s (%s), %s",
- loc->local_name, children[i]->local_name,
- parent_display_name);
- local_compare_name = g_strdup_printf ("%s (%s), %s",
- loc->local_sort_name, children[i]->local_sort_name,
- parent_compare_local_name);
- english_compare_name = g_strdup_printf ("%s (%s), %s",
- loc->english_sort_name,
children[i]->english_sort_name,
- parent_compare_english_name);
-
- gtk_tree_store_append (store, &iter, NULL);
- gtk_tree_store_set (store, &iter,
- LOC_GWEATHER_LOCATION_ENTRY_COL_LOCATION, children[i],
- LOC_GWEATHER_LOCATION_ENTRY_COL_DISPLAY_NAME, display_name,
- LOC_GWEATHER_LOCATION_ENTRY_COL_LOCAL_COMPARE_NAME, local_compare_name,
- LOC_GWEATHER_LOCATION_ENTRY_COL_ENGLISH_COMPARE_NAME,
english_compare_name,
- -1);
-
- g_free (display_name);
- g_free (local_compare_name);
- g_free (english_compare_name);
- }
-
- break;
- }
-
- /* fall through */
-
- case GWEATHER_LOCATION_WEATHER_STATION:
- /* <location> with no parent <city>, or <city> with a single
- * child <location>.
+ /* If there are multiple (<location>) children, we use the one
+ * closest to the city center.
+ *
+ * Locations are already sorted by increasing distance from
+ * the city.
*/
+ case GWEATHER_LOCATION_WEATHER_STATION:
+ /* <location> with no parent <city> */
display_name = g_strdup_printf ("%s, %s",
loc->local_name, parent_display_name);
local_compare_name = g_strdup_printf ("%s, %s",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]