[libgweather] location-entry: Fix completion entries that can't be differentiated
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather] location-entry: Fix completion entries that can't be differentiated
- Date: Tue, 12 Dec 2017 01:01:46 +0000 (UTC)
commit d64b60a3f601ba07f8eabf8ca754cc0b506f616f
Author: Bastien Nocera <hadess hadess net>
Date: Mon Dec 11 14:57:10 2017 +0100
location-entry: Fix completion entries that can't be differentiated
In commit 6787563, we started stripping the country from geocode-glib
results. But the last element was not always the country, but other
differentiating information (such as the state, or province) if all the
results were in the same country. And the statement:
"remove the country part, which will be readded by libgweather anyway."
doesn't seem to be correct anymore.
This fixes the unusable completion popup when there's no differentiating
information between the results.
https://bugzilla.gnome.org/show_bug.cgi?id=791403
libgweather/gweather-location-entry.c | 19 ++-----------------
1 files changed, 2 insertions(+), 17 deletions(-)
---
diff --git a/libgweather/gweather-location-entry.c b/libgweather/gweather-location-entry.c
index 26725da..46b25df 100644
--- a/libgweather/gweather-location-entry.c
+++ b/libgweather/gweather-location-entry.c
@@ -742,30 +742,16 @@ new_matcher (GtkEntryCompletion *completion, const char *key,
return TRUE;
}
-static char *
-sanitize_display_name (GeocodeLocation *loc)
-{
- const char *display_name;
- const char *last_comma;
-
- display_name = geocode_location_get_description (loc);
- last_comma = g_utf8_strrchr (display_name, -1, ',');
- if (last_comma == NULL)
- return g_strdup (display_name);
- else
- return g_strndup (display_name, last_comma - display_name);
-}
-
static void
fill_store (gpointer data, gpointer user_data)
{
GeocodePlace *place = GEOCODE_PLACE (data);
GeocodeLocation *loc = geocode_place_get_location (place);
- char *display_name;
+ const char *display_name;
char *normalized;
char *compare_name;
- display_name = sanitize_display_name (loc);
+ display_name = geocode_location_get_description (loc);
normalized = g_utf8_normalize (display_name, -1, G_NORMALIZE_ALL);
compare_name = g_utf8_casefold (normalized, -1);
@@ -775,7 +761,6 @@ fill_store (gpointer data, gpointer user_data)
PLACE_GWEATHER_LOCATION_ENTRY_COL_LOCAL_COMPARE_NAME, compare_name,
-1);
- g_free (display_name);
g_free (normalized);
g_free (compare_name);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]