[gnome-weather/mcatanzaro/deduplicate] Deduplicate cities
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-weather/mcatanzaro/deduplicate] Deduplicate cities
- Date: Mon, 23 Mar 2020 00:44:01 +0000 (UTC)
commit eea7b40a51768adc3f7b2cf468d18484e26258ee
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Sun Mar 22 19:42:55 2020 -0500
Deduplicate cities
We should not show the same city four times in a row in the locations
popover, nor should we save it multiple times in gsettings.
src/shared/world.js | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/src/shared/world.js b/src/shared/world.js
index 1c7d8c6..17c3cad 100644
--- a/src/shared/world.js
+++ b/src/shared/world.js
@@ -230,6 +230,12 @@ var WorldModel = GObject.registerClass({
}
_addLocationInternal(newLocation, isCurrentLocation) {
+ for (let i = 0; i < this._infoList.length; i++) {
+ let info = this._infoList[i];
+ if (info.get_location().equal(newLocation))
+ return info;
+ }
+
let info = new GWeather.Info({ location: newLocation,
enabled_providers: this._providers });
this._addInfoInternal(info, isCurrentLocation);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]