diff --git a/.gitignore b/.gitignore
index be629f4..8c11d72 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
# build dirs
.flatpak-builder
-build*
+build*/
# vim
*.swp
diff --git a/data/Application.css b/data/Application.css
index 0f2b5df..48e10c9 100644
--- a/data/Application.css
+++ b/data/Application.css
@@ -47,3 +47,64 @@ button.osd:active {
.linked.vertical button.osd:not(:first-child) {
margin-top: 0;
}
+
+search-result-item image {
+ border-radius: 100%;
+ background-color: @STRAWBERRY_500;
+ background-image:
+ linear-gradient(
+ to bottom,
+ transparent,
+ alpha(white, 0.1)
+ );
+ color: white;
+ min-height: 2.5em;
+ min-width: 2.5em;
+ padding: 0;
+ -gtk-icon-shadow: 0 1px 3px @STRAWBERRY_700;
+}
+
+search-result-item.administrative-division image {
+ background-color: @SLATE_300;
+ -gtk-icon-shadow: 0 1px 3px @SLATE_500;
+}
+
+search-result-item.historical image {
+ background-color: @COCOA_100;
+ -gtk-icon-shadow: 0 1px 3px @COCOA_300;
+}
+
+search-result-item.motorway image {
+ background-color: @BANANA_700;
+ -gtk-icon-shadow: 0 1px 3px @BANANA_900;
+}
+
+search-result-item.point-of-interest image {
+ background-color: @BUBBLEGUM_500;
+ -gtk-icon-shadow: 0 1px 3px @BUBBLEGUM_700;
+}
+
+search-result-item.service image {
+ background-color: @ORANGE_500;
+ -gtk-icon-shadow: 0 1px 3px @ORANGE_700;
+}
+
+search-result-item.street image {
+ background-color: @SLATE_300;
+ -gtk-icon-shadow: 0 1px 3px @SLATE_500;
+}
+
+search-result-item.transit image {
+ background-color: @BLUEBERRY_500;
+ -gtk-icon-shadow: 0 1px 3px @BLUEBERRY_700;
+}
+
+search-result-item.water image {
+ background-color: @MINT_500;
+ -gtk-icon-shadow: 0 1px 3px @MINT_700;
+}
+
+search-result-item.land-feature image {
+ background-color: @LIME_500;
+ -gtk-icon-shadow: 0 1px 3px @LIME_700;
+}
diff --git a/data/icons/16/airport.svg b/data/icons/16/airport.svg
new file mode 100644
index 0000000..ec36c2a
--- /dev/null
+++ b/data/icons/16/airport.svg
@@ -0,0 +1,21 @@
+
+
diff --git a/data/icons/16/bar.svg b/data/icons/16/bar.svg
new file mode 100644
index 0000000..6a6f2d9
--- /dev/null
+++ b/data/icons/16/bar.svg
@@ -0,0 +1,30 @@
+
+
diff --git a/data/icons/16/building.svg b/data/icons/16/building.svg
new file mode 100644
index 0000000..2972cbe
--- /dev/null
+++ b/data/icons/16/building.svg
@@ -0,0 +1,2 @@
+
+
diff --git a/data/icons/16/bus.svg b/data/icons/16/bus.svg
new file mode 100644
index 0000000..5047cbe
--- /dev/null
+++ b/data/icons/16/bus.svg
@@ -0,0 +1,12 @@
+
+
diff --git a/data/icons/16/light-rail.svg b/data/icons/16/light-rail.svg
new file mode 100644
index 0000000..e2be509
--- /dev/null
+++ b/data/icons/16/light-rail.svg
@@ -0,0 +1,12 @@
+
+
diff --git a/data/icons/16/marker.svg b/data/icons/16/marker.svg
new file mode 100644
index 0000000..b5d0f0e
--- /dev/null
+++ b/data/icons/16/marker.svg
@@ -0,0 +1,15 @@
+
+
diff --git a/data/icons/16/place-of-worship.svg b/data/icons/16/place-of-worship.svg
new file mode 100644
index 0000000..a124116
--- /dev/null
+++ b/data/icons/16/place-of-worship.svg
@@ -0,0 +1,13 @@
+
+
diff --git a/data/icons/16/restaurant.svg b/data/icons/16/restaurant.svg
new file mode 100644
index 0000000..319621d
--- /dev/null
+++ b/data/icons/16/restaurant.svg
@@ -0,0 +1,34 @@
+
+
diff --git a/data/icons/16/school.svg b/data/icons/16/school.svg
new file mode 100644
index 0000000..91c965b
--- /dev/null
+++ b/data/icons/16/school.svg
@@ -0,0 +1,2 @@
+
+
diff --git a/data/icons/16/street.svg b/data/icons/16/street.svg
new file mode 100644
index 0000000..6456362
--- /dev/null
+++ b/data/icons/16/street.svg
@@ -0,0 +1,2 @@
+
+
diff --git a/data/icons/16/town.svg b/data/icons/16/town.svg
new file mode 100644
index 0000000..98939f1
--- /dev/null
+++ b/data/icons/16/town.svg
@@ -0,0 +1,2 @@
+
+
diff --git a/data/icons/16/train.svg b/data/icons/16/train.svg
new file mode 100644
index 0000000..4cf8350
--- /dev/null
+++ b/data/icons/16/train.svg
@@ -0,0 +1,12 @@
+
+
diff --git a/data/maps.gresource.xml b/data/maps.gresource.xml
index 05f323d..d967c7a 100644
--- a/data/maps.gresource.xml
+++ b/data/maps.gresource.xml
@@ -9,4 +9,19 @@
icons/48/explore.svg
icons/48/transit.svg
+
+
+ icons/16/airport.svg
+ icons/16/bar.svg
+ icons/16/building.svg
+ icons/16/bus.svg
+ icons/16/street.svg
+ icons/16/light-rail.svg
+ icons/16/marker.svg
+ icons/16/place-of-worship.svg
+ icons/16/train.svg
+ icons/16/restaurant.svg
+ icons/16/school.svg
+ icons/16/town.svg
+
diff --git a/src/SearchResultItem.vala b/src/SearchResultItem.vala
index 536c2a4..46ddc5f 100644
--- a/src/SearchResultItem.vala
+++ b/src/SearchResultItem.vala
@@ -19,9 +19,12 @@ public class Maps.SearchResultItem : Granite.Bin {
var postal_code = place.postal_code ?? unknown_text;
var town = place.town ?? unknown_text;
- image.gicon = place.icon;
+ image.icon_name = place.icon.to_string () + "-symbolic";
name_label.label = place.name;
info_label.label = "%s, %s, %s".printf (street, postal_code, town);
+
+ // Not add because this widget gets recycled
+ css_classes = {placetype_to_cssclass (place.place_type)};
}
}
@@ -31,9 +34,13 @@ public class Maps.SearchResultItem : Granite.Bin {
private Gtk.Label name_label;
private Gtk.Label info_label;
+ class construct {
+ set_css_name ("search-result-item");
+ }
+
construct {
image = new Gtk.Image () {
- icon_size = LARGE
+ valign = CENTER
};
name_label = new Gtk.Label (null) {
@@ -56,4 +63,77 @@ public class Maps.SearchResultItem : Granite.Bin {
child = box;
}
+
+ private string placetype_to_cssclass (Geocode.PlaceType place_type) {
+ var css_name = "";
+ switch (place_type) {
+ case AIRPORT:
+ case BUS_STOP:
+ case LIGHT_RAIL_STATION:
+ case RAILWAY_STATION:
+ css_name = "transit";
+ break;
+
+ case BAR:
+ case RESTAURANT:
+ css_name = "service";
+ break;
+
+ case COLLOQUIAL:
+ case CONTINENT:
+ case COUNTRY:
+ case COUNTY:
+ case ESTATE:
+ case LOCAL_ADMINISTRATIVE_AREA:
+ case POSTAL_CODE:
+ case STATE:
+ case SUBURB:
+ case SUPERNAME:
+ case TIME_ZONE:
+ case TOWN:
+ case ZONE:
+ css_name = "administrative-division";
+ break;
+
+ case DRAINAGE:
+ case ISLAND:
+ case OCEAN:
+ case SEA:
+ css_name = "water";
+ break;
+
+ case HISTORICAL_COUNTY:
+ case HISTORICAL_STATE:
+ case HISTORICAL_TOWN:
+ css_name = "historical";
+ break;
+
+ case LAND_FEATURE:
+ css_name = "land-feature";
+ break;
+
+ case MOTORWAY:
+ css_name = "motorway";
+ break;
+
+ case BUILDING:
+ case PLACE_OF_WORSHIP:
+ case POINT_OF_INTEREST:
+ case SCHOOL:
+ css_name = "point-of-interest";
+ break;
+
+ case STREET:
+ css_name = "street";
+ break;
+
+ case MISCELLANEOUS:
+ case UNKNOWN:
+ // Default style
+ break;
+ // No "default" here so that we can detect new value of PlaceType by the build warning
+ }
+
+ return css_name;
+ }
}