[gnome-maps/wip/completion: 1/2] PlaceStore: Add recent icon



commit bf4e4a7c4fb765e22a15eca05f880ffe282f0e54
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Fri Nov 21 22:18:36 2014 +0100

    PlaceStore: Add recent icon

 src/placeStore.js |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/placeStore.js b/src/placeStore.js
index 3ed17dc..11cefe3 100644
--- a/src/placeStore.js
+++ b/src/placeStore.js
@@ -22,6 +22,7 @@ const GLib = imports.gi.GLib;
 const GObject = imports.gi.GObject;
 const GdkPixbuf = imports.gi.GdkPixbuf;
 const Geocode = imports.gi.GeocodeGlib;
+const Gio = imports.gi.Gio;
 const Gtk = imports.gi.Gtk;
 const Lang = imports.lang;
 
@@ -30,6 +31,7 @@ const Place = imports.place;
 const Utils = imports.utils;
 
 const _PLACES_STORE_FILE = 'maps-places.json';
+const _RECENT_ICON = 'document-open-recent-symbolic'
 const _ICON_SIZE = 20;
 
 const PlaceType = {
@@ -78,6 +80,7 @@ const PlaceStore = new Lang.Class({
         this.set_column_types([GdkPixbuf.Pixbuf,
                                GObject.TYPE_OBJECT,
                                GObject.TYPE_STRING,
+                               GdkPixbuf.Pixbuf,
                                GObject.TYPE_INT,
                                GObject.TYPE_DOUBLE]);
 
@@ -190,6 +193,13 @@ const PlaceStore = new Lang.Class({
             }).bind(this));
         }
         this._typeTable[place.osm_id] = type;
+
+        if (type === PlaceType.RECENT) {
+            let icon = Gio.Icon.new_for_string(_RECENT_ICON);
+            Utils.load_icon(icon, 16, (function(pixbuf) {
+                this.set(iter, [Columns.TYPE_ICON], [pixbuf]);
+            }).bind(this));
+        }
     },
 
     get: function(osmId) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]