[gcalctool] Keep settings (show zeroes, thousands separator etc) when changing modes (Robert Ancell, Bug #580398



commit 9f221b440dfab0bdc518db7f3af9c144f9a3d6d5
Author: Robert Ancell <robert ancell gmail com>
Date:   Mon May 11 14:24:46 2009 +1000

    Keep settings (show zeroes, thousands separator etc) when changing modes (Robert Ancell, Bug #580398)
---
 ChangeLog |    1 +
 src/gtk.c |   15 ++++++++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 45774c4..47a6179 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,7 @@ gcalctool change history.
 
     * Really fix the license text in the about dialog (Robert Ancell, Bug #579174)
     * Support odd roots of negative numbers (Robert Ancell, Bug #576973)
+    * Keep settings (show zeroes, thousands separator etc) when changing modes (Robert Ancell, Bug #580398)
 
 2009-05-07 Robin Sonefors <ozamosi flukkost nu>
 
diff --git a/src/gtk.c b/src/gtk.c
index d3b5104..093f64b 100644
--- a/src/gtk.c
+++ b/src/gtk.c
@@ -986,11 +986,16 @@ ui_set_mode(ModeType mode)
     if (X.mode != mode) {
         X.mode = mode;
 
-        ui_set_base(DEC);
-        ui_set_numeric_mode(FIX);
-        do_button(FN_SET_ACCURACY, DEFAULT_ACCURACY);
-        ui_set_show_thousands_separator(FALSE);
-        ui_set_show_trailing_zeroes(FALSE);
+        // FIXME: These should affect display but not the actual UI settings
+        if (mode != PROGRAMMING)
+            ui_set_base(DEC);
+        if (mode != SCIENTIFIC) {
+            ui_set_numeric_mode(FIX);
+            do_button(FN_SET_ACCURACY, DEFAULT_ACCURACY);
+        }
+        if (mode == BASIC)
+            ui_set_show_trailing_zeroes(FALSE);
+
         ui_make_registers();
     }
     



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