[gnome-calculator] Fixed variable popup showing incorrect ans value (bgo#778242)



commit 0c58495d18f2826a49641b95682ccf0286fd1353
Author: Robert Roth <robert roth off gmail com>
Date:   Mon Feb 6 19:55:02 2017 +0200

    Fixed variable popup showing incorrect ans value (bgo#778242)

 src/math-variable-popover.vala |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/math-variable-popover.vala b/src/math-variable-popover.vala
index b5c7c31..c9837e0 100644
--- a/src/math-variable-popover.vala
+++ b/src/math-variable-popover.vala
@@ -25,6 +25,7 @@ public class MathVariablePopover : Gtk.Popover
     public MathVariablePopover (MathEquation equation)
     {
         this.equation = equation;
+        equation.history_signal.connect (this.handler);
 
         // Fill variable list
         var names = equation.variables.get_names ();
@@ -35,7 +36,6 @@ public class MathVariablePopover : Gtk.Popover
         }
 
         variable_list.add (make_variable_row ("rand", null));
-        variable_list.add (make_variable_row ("ans", equation.answer));
 
         // Sort list
         variable_list.set_sort_func (variable_list_sort);
@@ -53,6 +53,12 @@ public class MathVariablePopover : Gtk.Popover
         });
     }
 
+    private void handler (string answer, Number number, int number_base, uint representation_base)
+    {
+        variable_list.remove (find_row_for_variable ("ans"));
+        variable_list.add (make_variable_row ("ans", number));
+    }
+
     private Gtk.ListBoxRow? find_row_for_variable (string name)
     {
         weak Gtk.ListBoxRow? row = null;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]