[gnome-documents] preview: add Zoom In and Zoom Out actions to the preview menu
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] preview: add Zoom In and Zoom Out actions to the preview menu
- Date: Thu, 19 Jul 2012 21:30:23 +0000 (UTC)
commit 210e64625267cbddaf11ffa1f234d1f00734c696
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu Jul 19 15:44:38 2012 -0400
preview: add Zoom In and Zoom Out actions to the preview menu
src/application.js | 10 +++++++---
src/preview.js | 28 ++++++++++++++++++++++++++--
2 files changed, 33 insertions(+), 5 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 18d86c3..f384441 100644
--- a/src/application.js
+++ b/src/application.js
@@ -145,7 +145,9 @@ const Application = new Lang.Class({
{ name: 'search',
callback: this._onActionSearch,
state: GLib.Variant.new('b', false),
- accel: '<Primary>f' }
+ accel: '<Primary>f' },
+ { name: 'zoom-in', accel: '<Primary>plus' },
+ { name: 'zoom-out', accel: '<Primary>minus' }
];
actionEntries.forEach(Lang.bind(this,
@@ -164,11 +166,13 @@ const Application = new Lang.Class({
if (actionEntry.create_hook)
actionEntry.create_hook.apply(this, [action]);
- action.connect('activate', Lang.bind(this, actionEntry.callback));
- this.add_action(action);
+ if (actionEntry.callback)
+ action.connect('activate', Lang.bind(this, actionEntry.callback));
if (actionEntry.accel)
this.add_accelerator(actionEntry.accel, 'app.' + actionEntry.name, null);
+
+ this.add_action(action);
}));
},
diff --git a/src/preview.js b/src/preview.js
index b3ab4a1..9470afd 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -52,6 +52,20 @@ const PreviewView = new Lang.Class({
this._createView();
this.widget.show_all();
+
+ this._zoomIn = Global.application.lookup_action('zoom-in');
+ this._zoomIn.connect('activate', Lang.bind(this,
+ function() {
+ this._model.set_sizing_mode(EvView.SizingMode.FREE);
+ this.view.zoom_in();
+ }));
+
+ this._zoomOut = Global.application.lookup_action('zoom-out');
+ this._zoomOut.connect('activate', Lang.bind(this,
+ function() {
+ this._model.set_sizing_mode(EvView.SizingMode.FREE);
+ this.view.zoom_out();
+ }));
},
_createView: function() {
@@ -299,8 +313,18 @@ const PreviewToolbar = new Lang.Class({
// menu button, on the right of the toolbar
let menuModel = new Gio.Menu();
- menuModel.append_item(Gio.MenuItem.new(this._getOpenItemLabel(), 'app.open-current'));
- menuModel.append_item(Gio.MenuItem.new(_("Print"), 'app.print-current'));
+
+ let section = new Gio.Menu();
+ menuModel.append_section(null, section);
+
+ section.append_item(Gio.MenuItem.new(this._getOpenItemLabel(), 'app.open-current'));
+ section.append_item(Gio.MenuItem.new(_("Print"), 'app.print-current'));
+
+ section = new Gio.Menu();
+ menuModel.append_section(null, section);
+
+ section.append_item(Gio.MenuItem.new(_("Zoom In"), 'app.zoom-in'));
+ section.append_item(Gio.MenuItem.new(_("Zoom Out"), 'app.zoom-out'));
let menuButton = this.widget.add_menu('emblem-system-symbolic', null, false);
menuButton.set_menu_model(menuModel);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]