From cdbd9b689357636953f8c9f0e6f56bffcfe94950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Mon, 14 Jul 2025 13:35:14 -0700 Subject: [PATCH 1/2] SearchResultItem: provide better description labels --- src/SearchResultItem.vala | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/SearchResultItem.vala b/src/SearchResultItem.vala index 536c2a4..b591a04 100644 --- a/src/SearchResultItem.vala +++ b/src/SearchResultItem.vala @@ -15,13 +15,22 @@ public class Maps.SearchResultItem : Granite.Bin { set { _place = value; - var street = place.street ?? unknown_text; - var postal_code = place.postal_code ?? unknown_text; - var town = place.town ?? unknown_text; - image.gicon = place.icon; name_label.label = place.name; - info_label.label = "%s, %s, %s".printf (street, postal_code, town); + + if (place.place_type == TOWN && place.state != null && place.country != null) { + ///TRANSLATORS: a state or probince, followed by a country + info_label.label = _("%s, %s").printf (place.state, place.country); + } else if (place.street_address != null && place.town != null) { + ///TRANSLATORS: a street address, followed by a town or city + info_label.label = _("%s, %s").printf (place.street_address, place.town); + } else { + var street = place.street ?? unknown_text; + var postal_code = place.postal_code ?? unknown_text; + var town = place.town ?? unknown_text; + + info_label.label = "%s, %s, %s, %s".printf (street, postal_code, town, place.state); + } } } From 636913df0327acd8b9591291144b5cb087d649b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Mon, 14 Jul 2025 13:44:03 -0700 Subject: [PATCH 2/2] Try to make more legible --- src/SearchResultItem.vala | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/SearchResultItem.vala b/src/SearchResultItem.vala index b591a04..0a56ef7 100644 --- a/src/SearchResultItem.vala +++ b/src/SearchResultItem.vala @@ -18,19 +18,25 @@ public class Maps.SearchResultItem : Granite.Bin { image.gicon = place.icon; name_label.label = place.name; + if (place.street_address != null && place.town != null) { + ///TRANSLATORS: a street address, followed by a town or city + info_label.label = _("%s, %s").printf (place.street_address, place.town); + + return; + } + if (place.place_type == TOWN && place.state != null && place.country != null) { ///TRANSLATORS: a state or probince, followed by a country info_label.label = _("%s, %s").printf (place.state, place.country); - } else if (place.street_address != null && place.town != null) { - ///TRANSLATORS: a street address, followed by a town or city - info_label.label = _("%s, %s").printf (place.street_address, place.town); - } else { - var street = place.street ?? unknown_text; - var postal_code = place.postal_code ?? unknown_text; - var town = place.town ?? unknown_text; - info_label.label = "%s, %s, %s, %s".printf (street, postal_code, town, place.state); + return; } + + var street = place.street ?? unknown_text; + var postal_code = place.postal_code ?? unknown_text; + var town = place.town ?? unknown_text; + + info_label.label = "%s, %s, %s, %s".printf (street, postal_code, town, place.state); } }