[gnome-maps] PlaceStore: add storing of favorites
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] PlaceStore: add storing of favorites
- Date: Tue, 14 Jan 2014 23:04:47 +0000 (UTC)
commit f041ab1553eac4cb1f415d470ca530cf773b921a
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date: Tue Jan 14 23:00:37 2014 +0100
PlaceStore: add storing of favorites
https://bugzilla.gnome.org/show_bug.cgi?id=722102
src/placeStore.js | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/src/placeStore.js b/src/placeStore.js
index 638a17d..1377d6b 100644
--- a/src/placeStore.js
+++ b/src/placeStore.js
@@ -36,7 +36,8 @@ const _ICON_SIZE = 20;
const PlaceType = {
ANY: -1,
- RECENT: 0
+ RECENT: 0,
+ FAVORITE: 1
};
const Columns = {
@@ -67,6 +68,19 @@ const PlaceStore = new Lang.Class({
GObject.TYPE_DOUBLE]);
},
+ addFavorite: function(place) {
+ if (this._exists(place, PlaceType.FAVORITE))
+ return;
+
+ if (this._exists(place, PlaceType.RECENT)) {
+ this._removeIf((function(model, iter) {
+ let p = model.get_value(iter, Columns.PLACE);
+ return p.name === place.name;
+ }), true);
+ }
+ this._addPlace(place, PlaceType.FAVORITE, new Date().getTime());
+ },
+
addRecent: function(place) {
if (this._exists(place, PlaceType.RECENT))
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]