[polari/wip/fmuellner/combined-gsoc: 20/136] Primitive highlighting of keywords
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/combined-gsoc: 20/136] Primitive highlighting of keywords
- Date: Tue, 26 Jul 2016 23:17:40 +0000 (UTC)
commit c1769780e127c7ff8277ef9e399f1523e7fe680b
Author: Kunaal Jain <kunaalus gmail com>
Date: Sun Jun 12 18:37:20 2016 +0530
Primitive highlighting of keywords
src/mainWindow.js | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 5ba6c28..f5aa2af 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -207,6 +207,7 @@ const MainWindow = new Lang.Class({
// this.connect('key-press-event', Lang.bind(this, this._handleKeyPress));
// search start
+ this._keywords = [];
this._cancellable = new Gio.Cancellable();
this._widgetMap = {};
Utils.initActions(this,
@@ -241,7 +242,7 @@ const MainWindow = new Lang.Class({
this._logManager = LogManager.getDefault();
let query = "select ?text as ?mms where { ?msg a nmo:IMMessage; nie:plainTextContent ?text. ?msg
nmo:communicationChannel ?channel. ?channel nie:title '#tracker'. ?msg nmo:from ?contact. ?contact
nco:nickname 'bijan' . ?msg fts:match 'wonderful' }"
let query1 = "select ?msg as ?id ?nick as ?name ?text as ?mms where { ?msg a nmo:IMMessage;
nie:plainTextContent ?text. ?msg nmo:communicationChannel ?channel. ?channel nie:title '#tracker'. ?msg
nmo:from ?contact. ?contact nco:nickname ?nick }"
- this._logManager.query(query1,null,Lang.bind(this, this._Log));
+ //this._logManager.query(query1,null,Lang.bind(this, this._Log));
log("hello");
//test
// search end
@@ -266,6 +267,12 @@ const MainWindow = new Lang.Class({
let uid = events[i].id;
let row = this._widgetMap[uid];
+ for (let j = 0; j < this._keywords.length; j++) {
+ log(this._keywords[j]);
+ print(message.indexOf(this._keywords[j]));
+ message = message.replace(this._keywords[j],"<span
font_weight='bold'>"+this._keywords[j]+"</span>");
+ print(message);
+ }
if (row) {
log("REUSING!!!");
@@ -273,13 +280,14 @@ const MainWindow = new Lang.Class({
this._results.remove(row);
} else {
let row = new Gtk.ListBoxRow({visible: true});
- let label = new Gtk.Label({ label: events[i].mms,
+ let label = new Gtk.Label({ label: message,
halign: Gtk.Align.START,
margin_start: 6,
margin_end: 6,
visible: true,
ellipsize: Pango.EllipsizeMode.END,
- max_width_chars: 18 });
+ max_width_chars: 18,
+ use_markup: true });
row.add(label);
row.uid = events[i].id;
widgetMap[uid] = row;
@@ -312,6 +320,7 @@ const MainWindow = new Lang.Class({
this._cancellable.cancel();
this._cancellable.reset();
let text = entry.get_text().replace(/^\s+|\s+$/g, '');
+ this._keywords = text == '' ? [] : text.split(/\s+/);
log(text);
let query1 = ("select ?text as ?mms ?msg as ?id where { ?msg a nmo:IMMessage . ?msg
nie:plainTextContent ?text . ?msg fts:match '%s*' }").format(text);
log(query1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]