[gnome-documents] embed: remove special case of saving the search state



commit e55bbce0a847745f0dfbc83ac998ccfd47a798f6
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sun Oct 23 19:49:22 2016 -0700

    embed: remove special case of saving the search state
    
    This is not needed now that the action state is decoupled for preview
    modes.

 src/embed.js |   47 +----------------------------------------------
 1 files changed, 1 insertions(+), 46 deletions(-)
---
diff --git a/src/embed.js b/src/embed.js
index c180f48..3451aa5 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -158,8 +158,6 @@ const Embed = new Lang.Class({
     Extends: Gtk.Box,
 
     _init: function(mainWindow) {
-        this._searchState = null;
-
         this.parent({ orientation: Gtk.Orientation.VERTICAL,
                       visible: true });
 
@@ -176,9 +174,6 @@ const Embed = new Lang.Class({
         Application.modeController.connect('window-mode-changed',
                                            Lang.bind(this, this._onWindowModeChanged));
 
-        Application.documentManager.connect('active-changed',
-                                            Lang.bind(this, this._onActiveItemChanged));
-
         Application.searchTypeManager.connect('active-changed',
                                               Lang.bind(this, this._onSearchChanged));
         Application.sourceManager.connect('active-changed',
@@ -198,15 +193,11 @@ const Embed = new Lang.Class({
         //
         // However there are some exceptions, which are taken care of
         // elsewhere:
-        //  - when moving from search to preview or collection view
-        //  - when in preview or coming out of it
-
+        //  - when moving from search to collection view
         let doc = Application.documentManager.getActiveItem();
         let windowMode = Application.modeController.getWindowMode();
         if (windowMode == WindowMode.WindowMode.SEARCH && doc)
             return;
-        if (windowMode == WindowMode.WindowMode.PREVIEW_EV)
-            return;
 
         let searchType = Application.searchTypeManager.getActiveItem();
         let source = Application.sourceManager.getActiveItem();
@@ -227,42 +218,6 @@ const Embed = new Lang.Class({
         this._view.windowMode = newMode;
     },
 
-    _restoreSearch: function() {
-        if (!this._searchState)
-            return;
-
-        Application.searchMatchManager.setActiveItem(this._searchState.searchMatch);
-        Application.searchTypeManager.setActiveItem(this._searchState.searchType);
-        Application.sourceManager.setActiveItem(this._searchState.source);
-        Application.searchController.setString(this._searchState.str);
-        this._searchState = null;
-    },
-
-    _saveSearch: function() {
-        if (this._searchState)
-            return;
-
-        this._searchState = new Search.SearchState(Application.searchMatchManager.getActiveItem(),
-                                                   Application.searchTypeManager.getActiveItem(),
-                                                   Application.sourceManager.getActiveItem(),
-                                                   Application.searchController.getString());
-    },
-
-    _onActiveItemChanged: function(manager, doc) {
-        let windowMode = Application.modeController.getWindowMode();
-        let showSearch = (windowMode == WindowMode.WindowMode.PREVIEW_EV && !doc
-                          || windowMode == WindowMode.WindowMode.SEARCH && !doc);
-
-        if (showSearch)
-            this._restoreSearch();
-        else
-            this._saveSearch();
-
-        let searchAction = this._view.view.getAction('search');
-        if (searchAction)
-            searchAction.change_state(GLib.Variant.new('b', showSearch));
-    },
-
     getMainToolbar: function() {
         let windowMode = Application.modeController.getWindowMode();
 


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