Skip to content

Commit

Permalink
Merge pull request #98 from marianomontano/master
Browse files Browse the repository at this point in the history
Added ARS currency support + replace hardcoded array length for variable
  • Loading branch information
SubhadeepJasu authored Feb 23, 2022
2 parents fcc6a92 + 73b9315 commit 0ddc5cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Core/CurrencyConverter.vala
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@ namespace Pebbles {
"JPY",
"RUB",
"ZAR",
"ARS",
};

private int currencyCount = 12;
public double[] muliplier_info;

public signal void currency_updated (double[] currency_multipliers);
public signal void update_failed ();

public CurrencyConverter () {
muliplier_info = new double [11];
muliplier_info = new double [currencyCount];
}

public bool request_update () {
Expand All @@ -70,15 +73,15 @@ namespace Pebbles {
}
int update_currency_thread () {
int cnt = 0;
for (int i = 0; i < 11; i++) {
for (int i = 0; i < currencyCount; i++) {
for (int j = 0; j < 2; j++) {
if (request_multiplier ("USD", currency [i], i)) {
cnt++;
break;
}
}
}
if (cnt < 11) {
if (cnt < currencyCount) {
warning (_("Failed to connect to currency exchange service"));
update_failed ();
}
Expand Down
2 changes: 2 additions & 0 deletions src/Views/ConvCurrView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ namespace Pebbles {
(_("Japanese Yen") + ": ¥"),
(_("Russian Ruble") + ": руб"),
(_("South African Rand") + ": R"),
(_("Argentine Peso") + ": $"),
};

private const int[] precision_override_structure = {
Expand All @@ -81,6 +82,7 @@ namespace Pebbles {
2,
3,
2,
2,
2
};

Expand Down

0 comments on commit 0ddc5cb

Please sign in to comment.