[gcalctool/gnome-3-0] Fix bit editor



commit 7b33f4fb5f984be70aa4471777ce0e976ecb450f
Author: Robert Ancell <robert ancell canonical com>
Date:   Wed Apr 20 12:05:19 2011 +1000

    Fix bit editor

 NEWS                |    1 +
 src/math-equation.c |   15 ++++++++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/NEWS b/NEWS
index 5a6e4b4..b24b91d 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Overview of changes in gcalctool 6.0.1
     * Only write to GSettings when settings change, don't sync on exit
       (Bug #647327)
     * Fix crash when not all currencies downloaded
+    * Fix bit editor (Bug #646142)
 
 Overview of changes in gcalctool 6.0.0
 
diff --git a/src/math-equation.c b/src/math-equation.c
index f0c0975..5cbdfeb 100644
--- a/src/math-equation.c
+++ b/src/math-equation.c
@@ -871,11 +871,16 @@ math_equation_get_number(MathEquation *equation, MPNumber *z)
     g_return_val_if_fail(equation != NULL, FALSE);
     g_return_val_if_fail(z != NULL, FALSE);
 
-    text = math_equation_get_equation(equation);
-    result = !mp_serializer_from_string(equation->priv->serializer, text, z);
-    g_free(text);
-
-    return result;
+    if (math_equation_is_result(equation)) {
+        mp_set_from_mp(math_equation_get_answer(equation), z);
+        return TRUE;
+    }
+    else {
+        text = math_equation_get_equation(equation);
+        result = !mp_serializer_from_string(equation->priv->serializer, text, z);
+        g_free(text);
+        return result;
+    }
 }
 
 



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