[gnome-calculator] Fixed compile warning, keep track of currencies per provider
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calculator] Fixed compile warning, keep track of currencies per provider
- Date: Fri, 5 Feb 2021 08:33:44 +0000 (UTC)
commit a788a50b93d4db2d89f87d6c416664ded224f8b6
Author: Robert Roth <robert roth off gmail com>
Date: Fri Feb 5 10:32:48 2021 +0200
Fixed compile warning, keep track of currencies per provider
lib/currency-provider.vala | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/lib/currency-provider.vala b/lib/currency-provider.vala
index 8bf27cde..518b12f0 100644
--- a/lib/currency-provider.vala
+++ b/lib/currency-provider.vala
@@ -33,6 +33,12 @@ public abstract class AbstractCurrencyProvider : Object, CurrencyProvider {
public void clear () {
FileUtils.remove (rate_filepath);
}
+
+ public Currency register_currency(string symbol, string source) {
+ Currency currency = currency_manager.add_currency (symbol, source);
+ currencies.append(currency);
+ return currency;
+ }
public void update_rates (bool asyncLoad = true) {
debug ("Updating %s rates ".printf(source_name));
@@ -272,7 +278,7 @@ public class ImfCurrencyProvider : AbstractCurrencyProvider {
if (c == null && value != null)
{
debug ("Using IMF rate of %s for %s", tokens[value_index], symbol);
- c = currency_manager.add_currency (symbol, source_name);
+ c = register_currency (symbol, source_name);
value = value.reciprocal ();
if (c != null)
c.set_value (value);
@@ -375,7 +381,7 @@ public class EcbCurrencyProvider : AbstractCurrencyProvider {
if (name != null && value != null && get_currency (name) == null)
{
debug ("Using ECB rate of %s for %s", value, name);
- var c = currency_manager.add_currency (name, source_name);
+ var c = register_currency (name, source_name);
var r = mp_set_from_string (value);
var v = eur_rate.get_value ();
v = v.multiply (r);
@@ -386,7 +392,7 @@ public class EcbCurrencyProvider : AbstractCurrencyProvider {
private void set_ecb_fixed_rate (string name, string value, Currency eur_rate)
{
debug ("Using ECB fixed rate of %s for %s", value, name);
- var c = currency_manager.add_currency (name, source_name + "#fixed");
+ var c = register_currency (name, source_name + "#fixed");
var r = mp_set_from_string (value);
var v = eur_rate.get_value ();
v = v.divide (r);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]