Merge lp:~kbailey4444/pantheon-photos/fix-1363541 into lp:~pantheon-photos/pantheon-photos/trunk

Proposed by Keith Bailey on 2015-07-08
Status: Merged
Approved by: Cody Garver on 2015-07-08
Approved revision: 2781
Merged at revision: 2781
Proposed branch: lp:~kbailey4444/pantheon-photos/fix-1363541
Merge into: lp:~pantheon-photos/pantheon-photos/trunk
Diff against target: 44 lines (+16/-0)
2 files modified
src/PhotoPage.vala (+15/-0)
src/Resources.vala (+1/-0)
To merge this branch: bzr merge lp:~kbailey4444/pantheon-photos/fix-1363541
Reviewer Review Type Date Requested Status
Photos Devs 2015-07-08 Pending
Review via email: mp+264095@code.launchpad.net

Commit message

Add button to zoom 1:1 to image viewer

Description of the change

Adds a button next to the zoom slider that when clicked causes the image to be displayed with 1:1 zoom. Uses zoom-original-symbolic icon for the button. Gives the button a padding of 5 pixels so that it shouldn't be accidentally clicked when trying to click the zoom-out button, but is still close enough that it is visually associated with the zoom slider. Uses already existing function "snap_zoom_to_isomorphic" to zoom 1:1. Here is a video of it working. https://www.youtube.com/watch?v=PQ7g7ThhRPQ

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/PhotoPage.vala'
2--- src/PhotoPage.vala 2014-12-14 14:53:26 +0000
3+++ src/PhotoPage.vala 2015-07-08 02:40:48 +0000
4@@ -501,6 +501,16 @@
5
6 Gtk.Box zoom_group = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
7
8+ Gtk.Image zoom_original = new Gtk.Image.from_icon_name (Resources.ICON_ZOOM_ORIGINAL, Gtk.IconSize.MENU);
9+ Gtk.EventBox zoom_original_box = new Gtk.EventBox ();
10+ zoom_original_box.set_above_child (true);
11+ zoom_original_box.set_visible_window (false);
12+ zoom_original_box.add (zoom_original);
13+
14+ zoom_original_box.button_press_event.connect (on_zoom_original_pressed);
15+
16+ zoom_group.pack_start (zoom_original_box, false, false, 5);
17+
18 Gtk.Image zoom_out = new Gtk.Image.from_icon_name (Resources.ICON_ZOOM_OUT, Gtk.IconSize.MENU);
19 Gtk.EventBox zoom_out_box = new Gtk.EventBox ();
20 zoom_out_box.set_above_child (true);
21@@ -611,6 +621,11 @@
22 return false;
23 }
24
25+ private bool on_zoom_original_pressed (Gdk.EventButton event) {
26+ snap_zoom_to_isomorphic ();
27+ return true;
28+ }
29+
30 private bool on_zoom_out_pressed (Gdk.EventButton event) {
31 snap_zoom_to_min ();
32 return true;
33
34=== modified file 'src/Resources.vala'
35--- src/Resources.vala 2014-11-08 14:15:40 +0000
36+++ src/Resources.vala 2015-07-08 02:40:48 +0000
37@@ -103,6 +103,7 @@
38 public const string ICON_FILTER_UNRATED_OR_BETTER = "shotwell-16.svg";
39 public const int ICON_FILTER_UNRATED_OR_BETTER_FIXED_SIZE = 16;
40
41+public const string ICON_ZOOM_ORIGINAL = "zoom-original-symbolic";
42 public const string ICON_ZOOM_IN = "zoom-in-symbolic";
43 public const string ICON_ZOOM_OUT = "zoom-out-symbolic";
44 public const int ICON_ZOOM_SCALE = 16;

Subscribers

People subscribed via source and target branches

to all changes: