[gnome-calculator/currency-display-format: 3/3] Financial mode labels partially working




commit 23c1a2e8cc59d50cb7f3aac1293c2e1d5ef1b3fd
Author: A.M. Rowsell <amrowsell frozenelectronics ca>
Date:   Tue Nov 3 20:20:27 2020 -0500

    Financial mode labels partially working
    
    Only the from part of the currency conversion combo boxes are
    displaying the currency names according to the new setting. This
    is because the changes are in update_from_model, but there doesn't
    appear to be an update_to_model and I need to figure out where
    the to model is being created/updated.

 src/math-converter.vala   | 14 +++++++-------
 src/math-preferences.vala |  8 ++++----
 2 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/src/math-converter.vala b/src/math-converter.vala
index b52c13d2..02abe2eb 100644
--- a/src/math-converter.vala
+++ b/src/math-converter.vala
@@ -149,7 +149,7 @@ public class MathConverter : Gtk.Grid
                         }
                         else if (CurrencyFormat == 2) /* Both */
                         {
-                            string DisplayName = unit.display_name + unit.name;
+                            string DisplayName = unit.display_name + " " + unit.name;
                             from_model.set (iter, 0, DisplayName, 1, category, 2, unit, -1);
                         }
                     }
@@ -167,26 +167,26 @@ public class MathConverter : Gtk.Grid
             {
                 Gtk.TreeIter iter;
                 from_model.append (out iter, null);
-                if (category == "currency")
+                if (c.name == "currency")
                 {
                     var CurrencyFormat = settings.get_int ("currency-display-format");
                     if (CurrencyFormat == 0) /* Currency names */
                     {
-                        from_model.set (iter, 0, unit.display_name, 1, category, 2, unit, -1);
+                        from_model.set (iter, 0, unit.display_name, 1, c, 2, unit, -1);
                     }
                     else if (CurrencyFormat == 1) /* Currency code */
                     {
-                        from_model.set (iter, 0, unit.name, 1, category, 2, unit, -1);
+                        from_model.set (iter, 0, unit.name, 1, c, 2, unit, -1);
                     }
                     else if (CurrencyFormat == 2) /* Both */
                     {
-                        string DisplayName = unit.display_name + unit.name;
-                        from_model.set (iter, 0, DisplayName, 1, category, 2, unit, -1);
+                        string DisplayName = unit.display_name + " " + unit.name;
+                        from_model.set (iter, 0, DisplayName, 1, c, 2, unit, -1);
                     }
                 }
                 else
                 {
-                    from_model.set (iter, 0, unit.display_name, 1, category, 2, unit, -1);
+                    from_model.set (iter, 0, unit.display_name, 1, c, 2, unit, -1);
                 }
             }
         }
diff --git a/src/math-preferences.vala b/src/math-preferences.vala
index 87b34f92..c801599e 100644
--- a/src/math-preferences.vala
+++ b/src/math-preferences.vala
@@ -16,8 +16,8 @@ public class MathPreferencesDialog : Gtk.Dialog
     private Gtk.ComboBoxText combo_angle_units;
     [GtkChild]
     private Gtk.ComboBoxText combo_refresh_interval;
-       [GtkChild]
-       private Gtk.ComboBoxText combo_currency_display_format;
+    [GtkChild]
+    private Gtk.ComboBoxText combo_currency_display_format;
     [GtkChild]
     private Gtk.ComboBoxText combo_word_size;
     [GtkChild]
@@ -44,7 +44,7 @@ public class MathPreferencesDialog : Gtk.Dialog
         combo_angle_units.changed.connect (combo_angle_units_changed_cb);
         combo_word_size.changed.connect (combo_word_size_changed_cb);
         combo_refresh_interval.changed.connect (combo_refresh_interval_changed_cb);
-               combo_currency_display_format.changed.connect (combo_currency_display_format_changed_cb);
+        combo_currency_display_format.changed.connect (combo_currency_display_format_changed_cb);
 
         spinbutton_decimals.set_value (equation.accuracy);
         equation.notify["accuracy"].connect ((pspec) => { spinbutton_decimals.set_value (equation.accuracy); 
});
@@ -88,7 +88,7 @@ public class MathPreferencesDialog : Gtk.Dialog
         CurrencyManager.get_default ().refresh_interval = value;
     }
 
-       private void combo_currency_display_format_changed_cb (Gtk.ComboBox combo)
+    private void combo_currency_display_format_changed_cb (Gtk.ComboBox combo)
     {
         string active_id = combo.get_active_id ();
         int value = int.parse (active_id);


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