[gcalctool] Add fixed rate of 15.6466 EEK = 1 EUR (Bug #639332)



commit 9058cd3b7faba09187125280cc3e1d1a5a62d927
Author: Robert Ancell <robert ancell canonical com>
Date:   Wed Jan 26 16:34:38 2011 +1000

    Add fixed rate of 15.6466 EEK = 1 EUR (Bug #639332)

 NEWS           |    4 ++++
 src/currency.c |   19 ++++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 66632eb..45f3a02 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+Overview of changes in gcalctool 5.91.6
+
+    * Add fixed rate of 15.6466 EEK = 1 EUR (Bug #639332)
+
 Overview of changes in gcalctool 5.91.5
 
     * Make new variable buttons that combines add/set/get and clear into one
diff --git a/src/currency.c b/src/currency.c
index d49d7e4..5c74ad4 100644
--- a/src/currency.c
+++ b/src/currency.c
@@ -319,6 +319,20 @@ set_ecb_rate(xmlNodePtr node, Currency *eur_rate)
 
 
 static void
+set_ecb_fixed_rate(const gchar *name, const gchar *value, Currency *eur_rate)
+{
+    Currency *c;
+    MPNumber r;
+
+    g_debug ("Using ECB fixed rate of %s for %s", value, name);
+    c = add_currency(name);
+    mp_set_from_string(value, 10, &r);
+    mp_set_from_mp(&eur_rate->value, &c->value);
+    mp_divide(&c->value, &r, &c->value);
+}
+
+
+static void
 load_ecb_rates()
 {
     Currency *eur_rate;
@@ -335,6 +349,9 @@ load_ecb_rates()
         return;
     }
 
+    /* Set some fixed rates */
+    set_ecb_fixed_rate("EEK", "15.6466", eur_rate);
+
     xmlInitParser();
     document = xmlReadFile(filename, NULL, 0);
     g_free (filename);
@@ -374,7 +391,7 @@ load_ecb_rates()
     xmlXPathFreeObject(xpath_obj);
     xmlXPathFreeContext(xpath_ctx);
     xmlFreeDoc(document);
-    xmlCleanupParser();  
+    xmlCleanupParser();
 }
 
 



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