[gnome-documents] edit: derive toolbar from PreviewToolbar
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] edit: derive toolbar from PreviewToolbar
- Date: Sun, 13 Nov 2016 04:30:21 +0000 (UTC)
commit 83fa753d77003e9738bac46fdc927603227b8037
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sat Nov 12 19:13:39 2016 -0800
edit: derive toolbar from PreviewToolbar
To share more code.
src/edit.js | 29 +++++++----------------------
1 files changed, 7 insertions(+), 22 deletions(-)
---
diff --git a/src/edit.js b/src/edit.js
index 5143f49..c379b94 100644
--- a/src/edit.js
+++ b/src/edit.js
@@ -76,7 +76,7 @@ const EditView = new Lang.Class({
},
createToolbar: function() {
- return new EditToolbar();
+ return new EditToolbar(this);
},
onLoadStarted: function() {
@@ -129,22 +129,17 @@ const EditView = new Lang.Class({
const EditToolbar = new Lang.Class({
Name: 'EditToolbar',
- Extends: MainToolbar.MainToolbar,
+ Extends: Preview.PreviewToolbar,
- _init: function() {
- this.parent();
- this.toolbar.set_show_close_button(true);
-
- // back button, on the left of the toolbar
- this.addBackButton();
+ _init: function(preview) {
+ this.parent(preview);
+ // view button, on the right of the toolbar
let viewButton = new Gtk.Button({ label: _("View"),
- action_name: 'view.view-current' });
+ action_name: 'view.view-current',
+ visible: true });
viewButton.get_style_context().add_class('suggested-action');
this.toolbar.pack_end(viewButton);
-
- this._setToolbarTitle();
- this.show_all();
},
createSearchbar: function() {
@@ -153,15 +148,5 @@ const EditToolbar = new Lang.Class({
handleEvent: function(event) {
return false;
- },
-
- _setToolbarTitle: function() {
- let primary = null;
- let doc = Application.documentManager.getActiveItem();
-
- if (doc)
- primary = doc.name;
-
- this.toolbar.set_title(primary);
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]