[gnome-documents] evinceview: remove searchbar subclass
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] evinceview: remove searchbar subclass
- Date: Sun, 13 Nov 2016 04:30:06 +0000 (UTC)
commit baee066b449cbcd7b72291dca8623087329eccaf
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sat Nov 12 18:53:24 2016 -0800
evinceview: remove searchbar subclass
This is not needed -- all functionality can be moved to the main preview
class.
src/evinceview.js | 50 ++++++++------------------------------------------
1 files changed, 8 insertions(+), 42 deletions(-)
---
diff --git a/src/evinceview.js b/src/evinceview.js
index d7f8b16..271fc20 100644
--- a/src/evinceview.js
+++ b/src/evinceview.js
@@ -122,8 +122,10 @@ const EvinceView = new Lang.Class({
if (action.state.get_boolean()) {
toolbar.searchbar.reveal();
+ this._evView.find_set_highlight_search(true);
} else {
toolbar.searchbar.conceal();
+ this._evView.find_set_highlight_search(false);
}
},
@@ -567,6 +569,8 @@ const EvinceView = new Lang.Class({
},
search: function(str) {
+ this._evView.find_search_changed();
+
if (!this._model)
return;
@@ -595,7 +599,10 @@ const EvinceView = new Lang.Class({
// FIXME: ev_job_find_get_results() returns a GList **
// and thus is not introspectable
GdPrivate.ev_view_find_changed(this._evView, job, page);
- this.emitJS('search-changed', job.has_results());
+
+ let hasResults = job.has_results();
+ this.getAction('find-prev').enabled = hasResults;
+ this.getAction('find-next').enabled = hasResults;
},
_loadMetadata: function() {
@@ -648,15 +655,10 @@ const EvinceView = new Lang.Class({
return this._model ? this._model.document.get_n_pages() : 0;
},
- get evView() {
- return this._evView;
- },
-
get fullscreen() {
return this.getAction('fullscreen').state.get_boolean();
}
});
-Utils.addJSSignalMethods(EvinceView.prototype);
const EvinceViewNavControls = new Lang.Class({
Name: 'EvinceViewNavControls',
@@ -760,10 +762,6 @@ const EvinceViewToolbar = new Lang.Class({
this.preview.getAction('find').enabled = (hasPages && canFind);
},
- createSearchbar: function() {
- return new EvinceViewSearchbar(this.preview);
- },
-
setModel: function() {
this.preview.getAction('gear-menu').enabled = true;
this._enableSearch();
@@ -771,38 +769,6 @@ const EvinceViewToolbar = new Lang.Class({
}
});
-const EvinceViewSearchbar = new Lang.Class({
- Name: 'EvinceViewSearchbar',
- Extends: Preview.PreviewSearchbar,
-
- _init: function(preview) {
- this.parent(preview);
-
- this.preview.connectJS('search-changed', Lang.bind(this, this._onSearchChanged));
- this._onSearchChanged(this.preview, false);
- },
-
- _onSearchChanged: function(view, hasResults) {
- this.preview.getAction('find-prev').enabled = hasResults;
- this.preview.getAction('find-next').enabled = hasResults;
- },
-
- entryChanged: function() {
- this.preview.evView.find_search_changed();
- this.parent();
- },
-
- reveal: function() {
- this.preview.evView.find_set_highlight_search(true);
- this.parent();
- },
-
- conceal: function() {
- this.preview.evView.find_set_highlight_search(false);
- this.parent();
- }
-});
-
const EvinceViewFullscreenToolbar = new Lang.Class({
Name: 'EvinceViewFullscreenToolbar',
Extends: Gtk.Revealer,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]