[gnome-maps/wip/mlundblad/search-as-you-type: 1/2] placeListRow: Add a function to update existing row
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/search-as-you-type: 1/2] placeListRow: Add a function to update existing row
- Date: Thu, 30 May 2019 08:53:55 +0000 (UTC)
commit 08da8ac1d0a91afa0b9f61494a8f1966264f6a15
Author: Marcus Lundblad <ml update uu se>
Date: Thu May 30 10:51:20 2019 +0200
placeListRow: Add a function to update existing row
Adds a function to update an existing row with
a new place.
src/placeListRow.js | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/placeListRow.js b/src/placeListRow.js
index da19041..49f0ecd 100644
--- a/src/placeListRow.js
+++ b/src/placeListRow.js
@@ -42,21 +42,24 @@ var PlaceListRow = GObject.registerClass({
let searchString = params.searchString || '';
delete params.searchString;
- let maxChars = params.maxChars || 40;
+ this._maxChars = params.maxChars || 40;
delete params.maxChars;
- let type = params.type;
+ this.type = params.type;
delete params.type;
params.height_request = ROW_HEIGHT;
super._init(params);
+ this.update(this.place, this.type, searchString);
+ }
- let formatter = new PlaceFormatter.PlaceFormatter(this.place);
+ update(place, type, searchString) {
+ let formatter = new PlaceFormatter.PlaceFormatter(place);
this.title = formatter.title;
let markup = GLib.markup_escape_text(formatter.title, -1);
this._name.label = this._boldMatch(markup, searchString);
- this._details.max_width_chars = maxChars;
+ this._details.max_width_chars = this._maxChars;
this._details.label = GLib.markup_escape_text(formatter.getDetailsString(),-1);
this._icon.gicon = this.place.icon;
@@ -67,7 +70,6 @@ var PlaceListRow = GObject.registerClass({
this._typeIcon.icon_name = 'starred-symbolic';
else if (type === PlaceStore.PlaceType.CONTACT)
this._typeIcon.icon_name = 'avatar-default-symbolic';
-
}
_boldMatch(title, string) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]