[gnome-calculator] math-equation: "No history" message should disappear when appropriate
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calculator] math-equation: "No history" message should disappear when appropriate
- Date: Fri, 8 Jan 2016 00:28:07 +0000 (UTC)
commit f54ad0e9f933950304d29815e510162a1e14f8fc
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Mon Dec 28 21:09:38 2015 -0600
math-equation: "No history" message should disappear when appropriate
Due to the weird implementation of MathEquation.status, the value of the
property was changing without g_object_notify ever being emitted. Avoid
this.
https://bugzilla.gnome.org/show_bug.cgi?id=759943
lib/math-equation.vala | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/lib/math-equation.vala b/lib/math-equation.vala
index fa04177..7541f85 100644
--- a/lib/math-equation.vala
+++ b/lib/math-equation.vala
@@ -417,6 +417,8 @@ public class MathEquation : Gtk.SourceBuffer
redo_stack = new List<MathEquationState> ();
state = get_current_state ();
+ notify_property ("status");
+
undo_stack.prepend (state);
}
@@ -506,7 +508,8 @@ public class MathEquation : Gtk.SourceBuffer
}
state = undo_stack.nth_data (0);
- status = ("");
+ notify_property ("status");
+
undo_stack.remove (state);
redo_stack.prepend (get_current_state ());
@@ -526,6 +529,8 @@ public class MathEquation : Gtk.SourceBuffer
}
state = redo_stack.nth_data (0);
+ notify_property ("status");
+
redo_stack.remove (state);
undo_stack.prepend (get_current_state ());
@@ -616,14 +621,20 @@ public class MathEquation : Gtk.SourceBuffer
}
}
+ /* Warning: this implementation is quite the footgun. You must be sure to do
+ * an explicit notify when changing state. Previously, failure to do this
+ * caused MathDisplay to miss status message changes.
+ *
+ * FIXME: Rethink this implementation. Does status really need to be a
+ * member of MathEquationState?
+ */
public string status
{
owned get { return state.status; }
set
{
- if (state.status == value)
- return;
-
+ // No early return -- we need to always emit notify so long as the
+ // value of this property can change unexpectedly.
state.status = value;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]