[gnome-documents] categories: don't emit active-category-changed with the same category
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] categories: don't emit active-category-changed with the same category
- Date: Thu, 29 Sep 2011 22:24:29 +0000 (UTC)
commit d00ff364ad342932bba9cbe2ff026947a1b780a7
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu Sep 29 18:22:24 2011 -0400
categories: don't emit active-category-changed with the same category
If we are set the same active category, don't emit a changed signal to
refresh the views.
https://bugzilla.gnome.org/show_bug.cgi?id=660506
src/categories.js | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/categories.js b/src/categories.js
index 7f01662..b30296a 100644
--- a/src/categories.js
+++ b/src/categories.js
@@ -91,11 +91,15 @@ CategoryManager.prototype = {
},
setActiveCategoryId: function(id) {
- if (!this._categories[id])
+ let category = this._categories[id];
+
+ if (!category)
return;
- this.activeCategory = this._categories[id];
- this.emit('active-category-changed');
+ if (category != this.activeCategory) {
+ this.activeCategory = category;
+ this.emit('active-category-changed');
+ }
},
getActiveCategoryId: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]