[gnome-documents/wip/cosimoc/view-rework: 41/42] search: remove SearchCategoryManager



commit a5395a56f3c203f0ff23e2563028329eacec0d6e
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Aug 8 21:21:42 2016 -0700

    search: remove SearchCategoryManager
    
    It's been unused for the longest time. Just remove it as we're cleaning
    up search actions.

 src/application.js         |    1 -
 src/documents.js           |   11 +------
 src/query.js               |    4 +--
 src/search.js              |   76 --------------------------------------------
 src/shellSearchProvider.js |    1 -
 src/trackerController.js   |    1 -
 6 files changed, 2 insertions(+), 92 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 5f210a2..a758299 100644
--- a/src/application.js
+++ b/src/application.js
@@ -65,7 +65,6 @@ let offsetCollectionsController = null;
 let offsetDocumentsController = null;
 let offsetSearchController = null;
 let queryBuilder = null;
-let searchCategoryManager = null;
 let searchController = null;
 let searchMatchManager = null;
 let searchTypeManager = null;
diff --git a/src/documents.js b/src/documents.js
index eb3cc56..c030553 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -256,9 +256,6 @@ const DocCommon = new Lang.Class({
         this._refreshIconId =
             Application.settings.connect('changed::view-as',
                                          Lang.bind(this, this.refreshIcon));
-        this._filterId =
-            Application.searchCategoryManager.connect('active-changed',
-                                                      Lang.bind(this, this.refreshIcon));
     },
 
     refresh: function() {
@@ -534,13 +531,8 @@ const DocCommon = new Lang.Class({
 
         let emblemIcons = [];
         let emblemedPixbuf = this.origPixbuf;
-        let activeItem;
 
-        activeItem = Application.searchCategoryManager.getActiveItem();
-
-        if (this.shared &&
-            (!activeItem ||
-             (activeItem.id != Search.SearchCategoryStock.SHARED)))
+        if (this.shared)
             emblemIcons.push(this._createSymbolicEmblem('emblem-shared'));
 
         if (emblemIcons.length > 0) {
@@ -591,7 +583,6 @@ const DocCommon = new Lang.Class({
         }
 
         Application.settings.disconnect(this._refreshIconId);
-        Application.searchCategoryManager.disconnect(this._filterId);
     },
 
     loadLocal: function(passwd, cancellable, callback) {
diff --git a/src/query.js b/src/query.js
index 91fea21..9d45b9f 100644
--- a/src/query.js
+++ b/src/query.js
@@ -70,7 +70,6 @@ const QueryBuilder = new Lang.Class({
         if (!isFtsEnabled)
             filters.push(this._context.searchMatchManager.getFilter(flags));
         filters.push(this._context.sourceManager.getFilter(flags));
-        filters.push(this._context.searchCategoryManager.getFilter(flags));
 
         if (currentType) {
             filters.push(currentType.getFilter());
@@ -97,8 +96,7 @@ const QueryBuilder = new Lang.Class({
 
                 if ((flags & QueryFlags.UNFILTERED) == 0) {
                     if (global)
-                        part += this._context.searchCategoryManager.getWhere() +
-                                this._context.documentManager.getWhere();
+                        part += this._context.documentManager.getWhere();
 
                     part += this._buildFilterString(currentType, flags, ftsQuery.length > 0);
                 }
diff --git a/src/search.js b/src/search.js
index 31044df..6810020 100644
--- a/src/search.js
+++ b/src/search.js
@@ -36,7 +36,6 @@ const C_ = imports.gettext.pgettext;
 function initSearch(context) {
     context.documentManager = new Documents.DocumentManager();
     context.sourceManager = new SourceManager(context);
-    context.searchCategoryManager = new SearchCategoryManager(context);
     context.searchMatchManager = new SearchMatchManager(context);
     context.searchTypeManager = new SearchTypeManager(context);
     context.searchController = new SearchController(context);
@@ -81,81 +80,6 @@ const SearchController = new Lang.Class({
 });
 Signals.addSignalMethods(SearchController.prototype);
 
-const SearchCategoryStock = {
-    ALL: 'all',
-    FAVORITES: 'favorites',
-    SHARED: 'shared',
-    PRIVATE: 'private'
-};
-
-const SearchCategory = new Lang.Class({
-    Name: 'SearchCategory',
-
-    _init: function(params) {
-        this.id = params.id;
-        this.name = params.name;
-        this.icon = params.icon;
-    },
-
-    getWhere: function() {
-        if (this.id == SearchCategoryStock.FAVORITES)
-            return '{ ?urn nao:hasTag nao:predefined-tag-favorite }';
-
-        // require to have a contributor, and creator, and they should be different
-        if (this.id == SearchCategoryStock.SHARED)
-            return '{ ?urn nco:contributor ?contributor . ?urn nco:creator ?creator FILTER (?contributor != 
?creator ) }';
-
-        return '';
-    },
-
-    getFilter: function() {
-        // require to be not local
-        if (this.id == SearchCategoryStock.SHARED)
-            return this._manager.context.sourceManager.getFilterNotLocal();
-
-        return '(true)';
-    }
-});
-
-const SearchCategoryManager = new Lang.Class({
-    Name: 'SearchCategoryManager',
-    Extends: Manager.BaseManager,
-
-    _init: function(context) {
-        this.parent(_("Category"), 'search-category', context);
-
-        let category, recent;
-        recent = new SearchCategory({ id: SearchCategoryStock.ALL,
-        // Translators: this refers to new and recent documents
-                                      name: _("All"),
-                                      icon: '' });
-        this.addItem(recent);
-
-        category = new SearchCategory({ id: SearchCategoryStock.FAVORITES,
-        // Translators: this refers to favorite documents
-                                        name: _("Favorites"),
-                                        icon: 'emblem-favorite-symbolic' });
-        this.addItem(category);
-        category = new SearchCategory({ id: SearchCategoryStock.SHARED,
-        // Translators: this refers to shared documents
-                                        name: _("Shared with you"),
-                                        icon: 'emblem-shared-symbolic' });
-        this.addItem(category);
-
-        // Private category: currently unimplemented
-        // category = new SearchCategory(SearchCategoryStock.PRIVATE, _("Private"), 
'channel-secure-symbolic');
-        // this._categories[category.id] = category;
-
-        this.setActiveItem(recent);
-    },
-
-    getFilter: function(flags) {
-        // Since we don't expose the SearchCategoryManager in the UI,
-        // this is a placeholder for the moment.
-        return '(true)';
-    }
-});
-
 const SearchType = new Lang.Class({
     Name: 'SearchType',
 
diff --git a/src/shellSearchProvider.js b/src/shellSearchProvider.js
index 42cb8be..0dd54f1 100644
--- a/src/shellSearchProvider.js
+++ b/src/shellSearchProvider.js
@@ -35,7 +35,6 @@ const Utils = imports.utils;
 
 let documentManager = null;
 let queryBuilder = null;
-let searchCategoryManager = null;
 let searchMatchManager = null;
 let searchTypeManager = null;
 let searchController = null;
diff --git a/src/trackerController.js b/src/trackerController.js
index 919d027..836f7c4 100644
--- a/src/trackerController.js
+++ b/src/trackerController.js
@@ -364,7 +364,6 @@ const TrackerSearchController = new Lang.Class({
 
         Application.sourceManager.connect('active-changed', Lang.bind(this, this.refreshForObject));
         Application.searchController.connect('search-string-changed', Lang.bind(this, 
this.refreshForObject));
-        Application.searchCategoryManager.connect('active-changed', Lang.bind(this, this.refreshForObject));
         Application.searchTypeManager.connect('active-changed', Lang.bind(this, this.refreshForObject));
 
         Application.searchMatchManager.connect('active-changed', Lang.bind(this, 
this._onSearchMatchChanged));


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