[gnome-documents] sources: style cleanups



commit 31125cffe450b8174c9d6eed413bb3ccf9eeb793
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Nov 14 10:49:31 2011 -0500

    sources: style cleanups

 src/sources.js |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/src/sources.js b/src/sources.js
index e283137..d326f1f 100644
--- a/src/sources.js
+++ b/src/sources.js
@@ -28,6 +28,11 @@ const _ = imports.gettext.gettext;
 const Global = imports.global;
 const Manager = imports.manager;
 
+const SourceStock = {
+    ALL: 'all',
+    LOCAL: 'local'
+}
+
 function Source(params) {
     this._init(params);
 };
@@ -54,10 +59,10 @@ Source.prototype = {
     },
 
     getFilter: function() {
-        if (this.id == 'local')
+        if (this.id == SourceStock.LOCAL)
             return Global.queryBuilder.buildFilterLocal();
 
-        if (this.id == 'all')
+        if (this.id == SourceStock.ALL)
             return '(' + Global.queryBuilder.buildFilterLocal() + ' || '
                     + Global.queryBuilder.buildFilterNotLocal() + ')';
 
@@ -85,13 +90,13 @@ SourceManager.prototype = {
         Manager.BaseManager.prototype._init.call(this, _("Sources"));
 
         // Translators: this refers to documents
-        let source = new Source({ id: 'all',
+        let source = new Source({ id: SourceStock.ALL,
                                   name: _("All"),
                                   builtin: true });
         this.addItem(source);
 
         // Translators: this refers to local documents
-        source = new Source({ id: 'local',
+        source = new Source({ id: SourceStock.LOCAL,
                               name: _("Local"),
                               builtin: true });
         this.addItem(source);
@@ -126,7 +131,7 @@ SourceManager.prototype = {
         // fallback to 'all' if we never saved any source, or if the saved
         // source disappeared in the meantime
         if (!this.setActiveItemById(activeItemId))
-            this.setActiveItemById('all');
+            this.setActiveItemById(SourceStock.ALL);
     },
 
     setActiveItem: function(item) {



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