[gnome-weather/mcatanzaro/deduplicate: 3/3] Deduplicate cities
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-weather/mcatanzaro/deduplicate: 3/3] Deduplicate cities
- Date: Fri, 3 Apr 2020 17:54:54 +0000 (UTC)
commit 9bb4b91c4ffd692af10614603faa10856e860530
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 07feade..2c13756 100644
--- a/src/shared/world.js
+++ b/src/shared/world.js
@@ -224,6 +224,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]