Merge lp:~jmiguelbenitez/pantheon-photos/fix-1360068 into lp:~pantheon-photos/pantheon-photos/trunk

Proposed by José M. Benítez
Status: Rejected
Rejected by: Zisu Andrei
Proposed branch: lp:~jmiguelbenitez/pantheon-photos/fix-1360068
Merge into: lp:~pantheon-photos/pantheon-photos/trunk
Diff against target: 100 lines (+45/-1)
2 files modified
src/Photo.vala (+1/-1)
src/editing_tools/EditingTools.vala (+44/-0)
To merge this branch: bzr merge lp:~jmiguelbenitez/pantheon-photos/fix-1360068
Reviewer Review Type Date Requested Status
Zisu Andrei (community) Needs Information
Review via email: mp+281361@code.launchpad.net

Description of the change

Improved button's sensitivity state in the "Adjust" tool dialog to reflect the item's current state (fix to bug #1360068).

To post a comment you must log in.
Revision history for this message
Zisu Andrei (matzipan) wrote :

Can you please advise on how I can see the effects of this change?

review: Needs Information

Unmerged revisions

2834. By José M. Benítez

Improved buttons' sensitivity state in the Adjustment Tool dialog.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Photo.vala'
2--- src/Photo.vala 2014-08-25 01:41:46 +0000
3+++ src/Photo.vala 2015-12-26 18:04:06 +0000
4@@ -5490,4 +5490,4 @@
5 }
6 }
7 }
8-}
9\ No newline at end of file
10+}
11
12=== modified file 'src/editing_tools/EditingTools.vala'
13--- src/editing_tools/EditingTools.vala 2015-08-09 23:40:46 +0000
14+++ src/editing_tools/EditingTools.vala 2015-12-26 18:04:06 +0000
15@@ -456,6 +456,12 @@
16 protected Cairo.Surface surface;
17 public string name;
18
19+ /**
20+ * Whether the item this instance is associated to is edited when the object
21+ * is created.
22+ */
23+ protected bool item_initially_edited = false;
24+
25 [CCode (has_target = false)]
26 public delegate EditingTool Factory ();
27
28@@ -485,6 +491,8 @@
29
30 this.canvas = canvas;
31
32+ item_initially_edited = canvas.get_photo ().has_transformations () || canvas.get_photo ().has_editable ();
33+
34 tool_window = get_tool_window ();
35 if (tool_window != null)
36 tool_window.key_press_event.connect (on_keypress);
37@@ -2259,6 +2267,33 @@
38
39 add (pane_layouter);
40 }
41+
42+ /**
43+ * Sets this editing tool into the "edited" state.
44+ *
45+ * A tool is said to be in its "edited" state when the item is
46+ * associated to has any modification with respect to its initial state.
47+ *
48+ * Please note that the initial state of the item may be different from
49+ * the original one (because of a previous saved transformation).
50+ *
51+ * @param modified Whether the editing tool is in the "edited" state.
52+ */
53+ public void set_edited_state (bool modified) {
54+ ok_button.sensitive = modified;
55+ }
56+
57+ /**
58+ * Sets this editing tool into the "reset" state.
59+ *
60+ * A tool is said to be in its "reset" state when the item is associated
61+ * to has no modifications at all with respect to its original state.
62+ *
63+ * @param reset Whether the editing tool is in the "reset" state.
64+ */
65+ public void set_reset_state (bool reset) {
66+ reset_button.sensitive = !reset;
67+ }
68 }
69
70 private abstract class AdjustToolCommand : Command {
71@@ -2538,6 +2573,9 @@
72 owner.items_altered.connect (on_photos_altered);
73
74 base.activate (canvas);
75+
76+ adjust_tool_window.set_edited_state (false);
77+ adjust_tool_window.set_reset_state (!item_initially_edited);
78 }
79
80 public override EditingToolWindow? get_tool_window () {
81@@ -2594,6 +2632,10 @@
82 private void on_reset () {
83 AdjustResetCommand command = new AdjustResetCommand (this, transformations);
84 AppWindow.get_command_manager ().execute (command);
85+ adjust_tool_window.set_reset_state (true);
86+ /* it will be edited if the reset state is different from the one which
87+ the dialog was started in (a modified version of the original item) */
88+ adjust_tool_window.set_edited_state (item_initially_edited);
89 }
90
91 private void on_ok () {
92@@ -2628,6 +2670,8 @@
93 SliderAdjustmentCommand command = new SliderAdjustmentCommand (this, old_transformation,
94 new_transformation, name);
95 AppWindow.get_command_manager ().execute (command);
96+ adjust_tool_window.set_edited_state (true);
97+ adjust_tool_window.set_reset_state (false);
98 }
99
100 private void on_temperature_adjustment () {

Subscribers

People subscribed via source and target branches