[gnome-documents] preview: add Rotate Left/Rotate Right options to the preview menu
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] preview: add Rotate Left/Rotate Right options to the preview menu
- Date: Thu, 19 Jul 2012 21:30:33 +0000 (UTC)
commit 16c14e5639250c019739153686bda54f5c91113e
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu Jul 19 17:06:04 2012 -0400
preview: add Rotate Left/Rotate Right options to the preview menu
src/application.js | 4 ++++
src/preview.js | 23 +++++++++++++++++++++++
2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 618dead..8740a3a 100644
--- a/src/application.js
+++ b/src/application.js
@@ -152,6 +152,10 @@ const Application = new Lang.Class({
{ name: 'zoom-in', accel: '<Primary>plus',
window_mode: WindowMode.WindowMode.PREVIEW },
{ name: 'zoom-out', accel: '<Primary>minus',
+ window_mode: WindowMode.WindowMode.PREVIEW },
+ { name: 'rotate-left', accel: '<Primary>Left',
+ window_mode: WindowMode.WindowMode.PREVIEW },
+ { name: 'rotate-right', accel: '<Primary>Right',
window_mode: WindowMode.WindowMode.PREVIEW }
];
diff --git a/src/preview.js b/src/preview.js
index 70b199c..11c276a 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -75,6 +75,18 @@ const PreviewView = new Lang.Class({
this._findNext = Global.application.lookup_action('find-next');
this._findNext.connect('activate', Lang.bind(this,
function() {
+ this.view.find_next();
+ }));
+
+ let rotLeft = Global.application.lookup_action('rotate-left');
+ rotLeft.connect('activate', Lang.bind(this,
+ function() {
+ this._changeRotation(-90);
+ }));
+ let rotRight = Global.application.lookup_action('rotate-right');
+ rotRight.connect('activate', Lang.bind(this,
+ function() {
+ this._changeRotation(90);
}));
},
@@ -131,6 +143,11 @@ const PreviewView = new Lang.Class({
return false;
},
+ _changeRotation: function(offset) {
+ let rotation = this._model.get_rotation();
+ this._model.set_rotation(rotation + offset);
+ },
+
startSearch: function(str) {
if (!this._model)
return;
@@ -355,6 +372,12 @@ const PreviewToolbar = new Lang.Class({
section.append_item(Gio.MenuItem.new(_("Zoom In"), 'app.zoom-in'));
section.append_item(Gio.MenuItem.new(_("Zoom Out"), 'app.zoom-out'));
+ section = new Gio.Menu();
+ menuModel.append_section(null, section);
+
+ section.append_item(Gio.MenuItem.new(_("Rotate Left"), 'app.rotate-left'));
+ section.append_item(Gio.MenuItem.new(_("Rotate Right"), 'app.rotate-right'));
+
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]