[polari/wip/fmuellner/combined-gsoc: 42/137] peformance improvements
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/combined-gsoc: 42/137] peformance improvements
- Date: Thu, 28 Jul 2016 16:18:57 +0000 (UTC)
commit bef97d3efb6e064dc170a58454896fa4ad4161a9
Author: Kunaal Jain <kunaalus gmail com>
Date: Thu Jul 21 16:29:49 2016 +0530
peformance improvements
src/mainWindow.js | 9 +++------
src/resultList.js | 18 +++++++++++++-----
2 files changed, 16 insertions(+), 11 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 3c791fa..50b7da0 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -480,18 +480,15 @@ const MainWindow = new Lang.Class({
_handleSearchChanged: function(entry) {
let text = entry.get_text().replace(/^\s+|\s+$/g, '');
+ let app = this.application;
+ let action = app.lookup_action('search-terms');
+ action.change_state(GLib.Variant.new('s', text));
if(text!='') {
this._mode='search';
} else {
this._mode='chat';
}
this.notify('mode');
- if (text.length < MIN_SEARCH_WIDTH) {
- return;
- }
- let app = this.application;
- let action = app.lookup_action('search-terms');
- action.change_state(GLib.Variant.new('s', text));
return;
this._cancellable.cancel();
this._cancellable.reset();
diff --git a/src/resultList.js b/src/resultList.js
index 8832b48..c6d11b1 100644
--- a/src/resultList.js
+++ b/src/resultList.js
@@ -11,6 +11,8 @@ const AccountsMonitor = imports.accountsMonitor;
const ChatroomManager = imports.chatroomManager;
const Lang = imports.lang;
+const MIN_SEARCH_WIDTH = 4;
+
const ResultRow = new Lang.Class({
Name: 'ResultRow',
Extends: Gtk.ListBoxRow,
@@ -180,17 +182,21 @@ const ResultList = new Lang.Class({
},
_clearList: function() {
- this.foreach(r => { r.destroy(); });
+ this.foreach(r => { r.hide(); });
+ },
+
+ _showList: function() {
+ this.foreach(r => { r.show(); });
},
_handleSearchChanged: function(group, actionName, value) {
this._cancellable.cancel();
- this._cancellable.reset();
-
+ // this._cancellable.reset();
+ this._cancellable = new Gio.Cancellable();
let text = value.deep_unpack();
+ this._clearList();
- if(text == '') {
- this._clearList();
+ if(text.length < MIN_SEARCH_WIDTH) {
return;
}
@@ -242,6 +248,8 @@ const ResultList = new Lang.Class({
let row = this._widgetMap[events[i].id];
this.add(row);
}
+
+ this._showList();
},
_formatTimestamp: function(timestamp) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]