Compare commits

...

No commits in common. "c8s" and "c10s" have entirely different histories.
c8s ... c10s

13 changed files with 451 additions and 1966 deletions

118
.gitignore vendored
View File

@ -1,2 +1,118 @@
SOURCES/gnome-calculator-3.28.2.tar.xz
/gnome-calculator-3.7.4.tar.xz
/gnome-calculator-3.7.5.tar.xz
/gnome-calculator-3.7.90.tar.xz
/gnome-calculator-3.7.91.tar.xz
/gnome-calculator-3.7.92.tar.xz
/gnome-calculator-3.8.0.tar.xz
/gnome-calculator-3.8.1.tar.xz
/gnome-calculator-3.8.2.tar.xz
/gnome-calculator-3.9.2.tar.xz
/gnome-calculator-3.9.3.tar.xz
/gnome-calculator-3.9.4.tar.xz
/gnome-calculator-3.9.90.tar.xz
/gnome-calculator-3.9.92.tar.xz
/gnome-calculator-3.10.0.tar.xz
/gnome-calculator-3.10.1.tar.xz
/gnome-calculator-3.10.2.tar.xz
/gnome-calculator-3.11.3.tar.xz
/gnome-calculator-3.11.4.tar.xz
/gnome-calculator-3.11.5.tar.xz
/gnome-calculator-3.11.90.tar.xz
/gnome-calculator-3.11.91.tar.xz
/gnome-calculator-3.11.92.tar.xz
/gnome-calculator-3.12.0.tar.xz
/gnome-calculator-3.12.1.tar.xz
/gnome-calculator-3.13.2.tar.xz
/gnome-calculator-3.13.3.tar.xz
/gnome-calculator-3.13.90.tar.xz
/gnome-calculator-3.13.92.tar.xz
/gnome-calculator-3.14.0.tar.xz
/gnome-calculator-3.14.1.tar.xz
/gnome-calculator-3.15.1.tar.xz
/gnome-calculator-3.15.4.tar.xz
/gnome-calculator-3.15.91.tar.xz
/gnome-calculator-3.16.0.tar.xz
/gnome-calculator-3.17.2.tar.xz
/gnome-calculator-3.17.3.tar.xz
/gnome-calculator-3.17.92.tar.xz
/gnome-calculator-3.18.0.tar.xz
/gnome-calculator-3.18.1.tar.xz
/gnome-calculator-3.19.1.tar.xz
/gnome-calculator-3.19.2.tar.xz
/gnome-calculator-3.19.4.tar.xz
/gnome-calculator-3.19.90.tar.xz
/gnome-calculator-3.19.91.tar.xz
/gnome-calculator-3.20.0.tar.xz
/gnome-calculator-3.20.1.tar.xz
/gnome-calculator-3.21.2.tar.xz
/gnome-calculator-3.21.90.tar.xz
/gnome-calculator-3.21.92.tar.xz
/gnome-calculator-3.22.0.tar.xz
/gnome-calculator-3.22.1.tar.xz
/gnome-calculator-3.23.1.tar.xz
/gnome-calculator-3.23.2.tar.xz
/gnome-calculator-3.23.4.tar.xz
/gnome-calculator-3.23.90.tar.xz
/gnome-calculator-3.23.91.tar.xz
/gnome-calculator-3.23.92.tar.xz
/gnome-calculator-3.24.0.tar.xz
/gnome-calculator-3.25.2.tar.xz
/gnome-calculator-3.25.90.tar.xz
/gnome-calculator-3.25.91.tar.xz
/gnome-calculator-3.25.92.tar.xz
/gnome-calculator-3.26.0.tar.xz
/gnome-calculator-3.27.92.tar.xz
/gnome-calculator-3.28.0.tar.xz
/gnome-calculator-3.28.1.tar.xz
/gnome-calculator-3.28.2.tar.xz
/gnome-calculator-3.29.90.tar.xz
/gnome-calculator-3.30.0.tar.xz
/gnome-calculator-3.30.1.tar.xz
/gnome-calculator-3.31.3.tar.xz
/gnome-calculator-3.31.90.tar.xz
/gnome-calculator-3.31.91.tar.xz
/gnome-calculator-3.31.92.tar.xz
/gnome-calculator-3.32.0.tar.xz
/gnome-calculator-3.32.1.tar.xz
/gnome-calculator-3.33.2.tar.xz
/gnome-calculator-3.33.3.tar.xz
/gnome-calculator-3.33.90.tar.xz
/gnome-calculator-3.33.92.tar.xz
/gnome-calculator-3.34.0.tar.xz
/gnome-calculator-3.34.1.tar.xz
/gnome-calculator-3.35.3.tar.xz
/gnome-calculator-3.35.90.tar.xz
/gnome-calculator-3.35.92.tar.xz
/gnome-calculator-3.36.0.tar.xz
/gnome-calculator-3.37.90.tar.xz
/gnome-calculator-3.37.92.tar.xz
/gnome-calculator-3.38.0.tar.xz
/gnome-calculator-3.38.1.tar.xz
/gnome-calculator-3.38.2.tar.xz
/gnome-calculator-40.beta.tar.xz
/gnome-calculator-40.rc.tar.xz
/gnome-calculator-40.0.tar.xz
/gnome-calculator-40.1.tar.xz
/gnome-calculator-41.alpha.tar.xz
/gnome-calculator-41.rc.tar.xz
/gnome-calculator-41.0.tar.xz
/gnome-calculator-41.1.tar.xz
/gnome-calculator-42.alpha.tar.xz
/gnome-calculator-42.beta.tar.xz
/gnome-calculator-42.rc.tar.xz
/gnome-calculator-42.0.tar.xz
/gnome-calculator-42.1.tar.xz
/gnome-calculator-42.2.tar.xz
/gnome-calculator-43.alpha.tar.xz
/gnome-calculator-43.rc.tar.xz
/gnome-calculator-43.0.1.tar.xz
/gnome-calculator-44.beta.tar.xz
/gnome-calculator-44.rc.tar.xz
/gnome-calculator-44.0.tar.xz
/gnome-calculator-45.alpha.tar.xz
/gnome-calculator-45.beta.tar.xz
/gnome-calculator-45.0.tar.xz
/gnome-calculator-45.0.1.tar.xz
/gnome-calculator-45.0.2.tar.xz
/gnome-calculator-46.alpha.tar.xz
/gnome-calculator-46.1.tar.xz

View File

@ -1,552 +0,0 @@
From fc5cb8d7cff03a48cf88e9df1007a497293b56bb Mon Sep 17 00:00:00 2001
From: Robert Roth <robert.roth@bee-tf.ro>
Date: Sun, 3 Feb 2019 16:31:28 +0200
Subject: [PATCH 1/5] Implemented exchange rate refresh interval setting
---
data/org.gnome.calculator.gschema.xml | 5 ++++
lib/currency.vala | 10 +++++--
src/gnome-calculator.vala | 1 +
src/math-preferences.vala | 40 +++++++++++++++++++++++++++
4 files changed, 54 insertions(+), 2 deletions(-)
diff --git a/data/org.gnome.calculator.gschema.xml b/data/org.gnome.calculator.gschema.xml
index 8cb1fc83..a3af435f 100644
--- a/data/org.gnome.calculator.gschema.xml
+++ b/data/org.gnome.calculator.gschema.xml
@@ -30,60 +30,65 @@
<range min="8" max="64"/>
<summary>Word size</summary>
<description>The size of the words used in bitwise operations</description>
</key>
<key type="i" name="base">
<default>10</default>
<range min="2" max="16"/>
<summary>Numeric Base</summary>
<description>The numeric base</description>
</key>
<key type="b" name="show-thousands">
<default>false</default>
<summary>Show Thousands Separators</summary>
<description>Indicates whether thousands separators are shown in large numbers.</description>
</key>
<key type="b" name="show-zeroes">
<default>false</default>
<summary>Show Trailing Zeroes</summary>
<description>Indicates whether any trailing zeroes after the numeric point should be shown in the display value.</description>
</key>
<key name="number-format" enum="org.gnome.calculator.NumberFormat">
<default>'automatic'</default>
<summary>Number format</summary>
<description>The format to display numbers in</description>
</key>
<key name="angle-units" enum="org.gnome.calculator.AngleUnit">
<default>'degrees'</default>
<summary>Angle units</summary>
<description>The angle units to use</description>
</key>
+ <key name="refresh-interval" type="i">
+ <default>604800</default>
+ <summary>Currency update interval</summary>
+ <description>How often the currency exchange rates should be updated</description>
+ </key>
<key name="button-mode" enum="org.gnome.calculator.ButtonMode">
<default>'basic'</default>
<summary>Button mode</summary>
<description>The button mode</description>
</key>
<key type="s" name="source-currency">
<default>''</default>
<summary>Source currency</summary>
<description>Currency of the current calculation</description>
</key>
<key type="s" name="target-currency">
<default>''</default>
<summary>Target currency</summary>
<description>Currency to convert the current calculation into</description>
</key>
<key type="s" name="source-units">
<default>'degree'</default>
<summary>Source units</summary>
<description>Units of the current calculation</description>
</key>
<key type="s" name="target-units">
<default>'radian'</default>
<summary>Target units</summary>
<description>Units to convert the current calculation into</description>
</key>
<key type="i" name="precision">
<default>2000</default>
<summary>Internal precision</summary>
<description>The internal precision used with the MPFR library</description>
</key>
diff --git a/lib/currency.vala b/lib/currency.vala
index f9b913aa..c098cc52 100644
--- a/lib/currency.vala
+++ b/lib/currency.vala
@@ -1,48 +1,51 @@
/*
* Copyright (C) 2008-2012 Robert Ancell.
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
static bool downloading_imf_rates = false;
static bool downloading_ecb_rates = false;
static bool loaded_rates = false;
private static CurrencyManager? default_currency_manager = null;
public class CurrencyManager : Object
{
private List<Currency> currencies;
+
+ public int refresh_interval { get; set; }
+
public signal void updated ();
public static CurrencyManager get_default ()
{
if (default_currency_manager != null)
return default_currency_manager;
default_currency_manager = new CurrencyManager ();
default_currency_manager.currencies.append (new Currency ("AED", _("UAE Dirham"), "إ.د"));
default_currency_manager.currencies.append (new Currency ("AUD", _("Australian Dollar"), "$"));
default_currency_manager.currencies.append (new Currency ("BGN", _("Bulgarian Lev"), "лв"));
default_currency_manager.currencies.append (new Currency ("BHD", _("Bahraini Dinar"), ".ب.د"));
default_currency_manager.currencies.append (new Currency ("BND", _("Brunei Dollar"), "$"));
default_currency_manager.currencies.append (new Currency ("BRL", _("Brazilian Real"), "R$"));
default_currency_manager.currencies.append (new Currency ("BWP", _("Botswana Pula"), "P"));
default_currency_manager.currencies.append (new Currency ("CAD", _("Canadian Dollar"), "$"));
default_currency_manager.currencies.append (new Currency ("CFA", _("CFA Franc"), "Fr"));
default_currency_manager.currencies.append (new Currency ("CHF", _("Swiss Franc"), "Fr"));
default_currency_manager.currencies.append (new Currency ("CLP", _("Chilean Peso"), "$"));
default_currency_manager.currencies.append (new Currency ("CNY", _("Chinese Yuan"), "¥"));
default_currency_manager.currencies.append (new Currency ("COP", _("Colombian Peso"), "$"));
default_currency_manager.currencies.append (new Currency ("CZK", _("Czech Koruna"), "Kč"));
default_currency_manager.currencies.append (new Currency ("DKK", _("Danish Krone"), "kr"));
default_currency_manager.currencies.append (new Currency ("DZD", _("Algerian Dinar"), "ج.د"));
default_currency_manager.currencies.append (new Currency ("EEK", _("Estonian Kroon"), "KR"));
default_currency_manager.currencies.append (new Currency ("EUR", _("Euro"), "€"));
default_currency_manager.currencies.append (new Currency ("GBP", _("British Pound Sterling"), "£"));
default_currency_manager.currencies.append (new Currency ("HKD", _("Hong Kong Dollar"), "$"));
default_currency_manager.currencies.append (new Currency ("HRK", _("Croatian Kuna"), "kn"));
@@ -120,60 +123,63 @@ public class CurrencyManager : Object
return Path.build_filename (Environment.get_user_cache_dir (), "gnome-calculator", "rms_five.xls");
}
private string get_ecb_rate_filepath ()
{
return Path.build_filename (Environment.get_user_cache_dir (), "gnome-calculator", "eurofxref-daily.xml");
}
private Currency add_currency (string short_name, string source)
{
foreach (var c in currencies)
if (c.name == short_name)
{
c.source = source;
return c;
}
warning ("Currency %s is not in the currency table", short_name);
var c = new Currency (short_name, short_name, short_name);
c.source = source;
currencies.append (c);
return c;
}
/* A file needs to be redownloaded if it doesn't exist, or is too old.
* When an error occur, it probably won't hurt to try to download again.
*/
private bool file_needs_update (string filename, double max_age)
{
+ if (max_age == 0)
+ return false;
+
if (!FileUtils.test (filename, FileTest.IS_REGULAR))
return true;
var buf = Posix.Stat ();
if (Posix.stat (filename, out buf) == -1)
return true;
var modify_time = buf.st_mtime;
var now = time_t ();
if (now - modify_time > max_age)
return true;
return false;
}
private void load_imf_rates ()
{
var name_map = new HashTable <string, string> (str_hash, str_equal);
name_map.insert ("Euro", "EUR");
name_map.insert ("Japanese yen", "JPY");
name_map.insert ("U.K. pound", "GBP");
name_map.insert ("U.S. dollar", "USD");
name_map.insert ("Algerian dinar", "DZD");
name_map.insert ("Australian dollar", "AUD");
name_map.insert ("Bahrain dinar", "BHD");
name_map.insert ("Botswana pula", "BWP");
name_map.insert ("Brazilian real", "BRL");
name_map.insert ("Brunei dollar", "BND");
name_map.insert ("Canadian dollar", "CAD");
name_map.insert ("Chilean peso", "CLP");
@@ -350,68 +356,68 @@ public class CurrencyManager : Object
return;
}
xpath_ctx.register_ns ("xref", "http://www.ecb.int/vocabulary/2002-08-01/eurofxref");
var xpath_obj = xpath_ctx.eval_expression ("//xref:Cube[@currency][@rate]");
if (xpath_obj == null)
{
warning ("Couldn't create XPath object");
return;
}
var len = (xpath_obj->nodesetval != null) ? xpath_obj->nodesetval->length () : 0;
for (var i = 0; i < len; i++)
{
var node = xpath_obj->nodesetval->item (i);
if (node->type == Xml.ElementType.ELEMENT_NODE)
set_ecb_rate (node, eur_rate);
/* Avoid accessing removed elements */
if (node->type != Xml.ElementType.NAMESPACE_DECL)
node = null;
}
Xml.Parser.cleanup ();
}
private void download_rates ()
{
/* Update rates if necessary */
var path = get_imf_rate_filepath ();
- if (!downloading_imf_rates && file_needs_update (path, 60 * 60 * 24 * 7))
+ if (!downloading_imf_rates && file_needs_update (path, refresh_interval))
{
downloading_imf_rates = true;
debug ("Downloading rates from the IMF...");
download_file.begin ("https://www.imf.org/external/np/fin/data/rms_five.aspx?tsvflag=Y", path, "IMF");
}
path = get_ecb_rate_filepath ();
- if (!downloading_ecb_rates && file_needs_update (path, 60 * 60 * 24 * 7))
+ if (!downloading_ecb_rates && file_needs_update (path, refresh_interval))
{
downloading_ecb_rates = true;
debug ("Downloading rates from the ECB...");
download_file.begin ("https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml", path, "ECB");
}
}
private bool load_rates ()
{
/* Already loaded */
if (loaded_rates)
return true;
/* In process */
if (downloading_imf_rates || downloading_ecb_rates)
return false;
/* Use the IMF provided values and top up with currencies tracked by the ECB and not the IMF */
load_imf_rates ();
load_ecb_rates ();
/* Check if we couldn't find out a currency */
foreach (var c in currencies)
if (c.get_value () == null || c.get_value ().is_zero ())
warning ("Currency %s is not provided by IMF or ECB", c.name);
debug ("Rates loaded");
loaded_rates = true;
updated ();
diff --git a/src/gnome-calculator.vala b/src/gnome-calculator.vala
index 9f2549e7..5b3f9b8d 100644
--- a/src/gnome-calculator.vala
+++ b/src/gnome-calculator.vala
@@ -100,60 +100,61 @@ public class Calculator : Gtk.Application
}
catch (Error e)
{
error ("Error loading menu UI: %s", e.message);
}
var menu = builder.get_object ("appmenu") as MenuModel;
set_app_menu (menu);
set_accels_for_action ("win.mode::basic", {"<alt>B"});
set_accels_for_action ("win.mode::advanced", {"<alt>A"});
set_accels_for_action ("win.mode::financial", {"<alt>F"});
set_accels_for_action ("win.mode::programming", {"<alt>P"});
set_accels_for_action ("win.mode::keyboard", {"<alt>K"});
set_accels_for_action ("win.copy", {"<control>C"});
set_accels_for_action ("win.paste", {"<control>V"});
set_accels_for_action ("win.undo", {"<control>Z"});
set_accels_for_action ("win.close", {"<control>W"});
set_accels_for_action ("win.redo", {"<control><shift>Z"});
return current_window;
}
protected override void startup ()
{
base.startup ();
settings = new Settings ("org.gnome.calculator");
last_opened_window = create_new_window (settings);
// restore the first window position from the settings
load_window_position (last_opened_window);
+ CurrencyManager.get_default ().refresh_interval = settings.get_int ("refresh-interval");
}
private MathWindow get_active_math_window ()
{
return (MathWindow) get_active_window ();
}
protected override void activate ()
{
base.activate ();
last_opened_window.present ();
if (equation_string != "" && equation_string != null)
{
var equations = (equation_string.compress ()).split ("\n",0);
for (var i = 0; i < equations.length; i++)
{
if ((equations [i].strip ()).length > 0)
last_opened_window.equation.set (equations [i]);
else
last_opened_window.equation.solve ();
}
}
if (mode_string != "" && mode_string != null)
{
var mode = ButtonMode.BASIC;
switch (mode_string)
{
case "basic":
diff --git a/src/math-preferences.vala b/src/math-preferences.vala
index d1ab7657..335b97c6 100644
--- a/src/math-preferences.vala
+++ b/src/math-preferences.vala
@@ -1,58 +1,61 @@
/*
* Copyright (C) 2008-2012 Robert Ancell
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
public class MathPreferencesDialog : Gtk.Dialog
{
public MathEquation equation { private get; construct; }
private Gtk.ComboBox angle_unit_combo;
+ private Gtk.ComboBox refresh_interval_combo;
private Gtk.ComboBox number_format_combo;
private Gtk.ComboBox word_size_combo;
private Gtk.SpinButton decimal_places_spin;
private Gtk.Switch thousands_separator_switch;
private Gtk.Switch trailing_zeroes_switch;
+ private Settings settings;
public MathPreferencesDialog (MathEquation eq)
{
Object(use_header_bar: 1, equation: eq, resizable: false);
}
construct
{
+ settings = new Settings ("org.gnome.calculator");
set_title (/* Title of preferences dialog */
_("Preferences"));
border_width = 8;
((Gtk.HeaderBar) get_header_bar ()).show_close_button = true;
var grid = new Gtk.Grid ();
grid.show ();
grid.border_width = 5;
grid.column_spacing = 6;
grid.row_spacing = 12;
get_content_area ().pack_start (grid, true, true, 0);
var label = new Gtk.Label.with_mnemonic (/* Preferences dialog: Label for number format combo box */
_("Number _Format:"));
label.show ();
label.xalign = 0;
grid.attach (label, 0, 0, 1, 1);
number_format_combo = new Gtk.ComboBox ();
label.mnemonic_widget = number_format_combo;
number_format_combo.show ();
number_format_combo.changed.connect (number_format_combo_changed_cb);
grid.attach (number_format_combo, 1, 0, 1, 1);
var model = new Gtk.ListStore (2, typeof (string), typeof (int));
number_format_combo.model = model;
Gtk.TreeIter iter;
model.append (out iter);
model.set (iter, 0,
@@ -153,106 +156,143 @@ public class MathPreferencesDialog : Gtk.Dialog
renderer = new Gtk.CellRendererText ();
angle_unit_combo.pack_start (renderer, true);
angle_unit_combo.add_attribute (renderer, "text", 0);
label = new Gtk.Label.with_mnemonic (/* Preferences dialog: Label for word size combo box */
_("Word _size:"));
label.show ();
label.xalign = 0;
grid.attach (label, 0, 6, 1, 1);
word_size_combo = new Gtk.ComboBox ();
label.mnemonic_widget = word_size_combo;
word_size_combo.show ();
word_size_combo.changed.connect (word_size_combo_changed_cb);
grid.attach (word_size_combo, 1, 6, 1, 1);
model = new Gtk.ListStore (2, typeof (string), typeof (int));
word_size_combo.model = model;
model.append (out iter);
model.set (iter, 0, /* Word size combo: 8 bits */ _("8 bits"), 1, 8);
model.append (out iter);
model.set (iter, 0, /* Word size combo: 16 bits */ _("16 bits"), 1, 16);
model.append (out iter);
model.set (iter, 0, /* Word size combo: 32 bits */ _("32 bits"), 1, 32);
model.append (out iter);
model.set (iter, 0, /* Word size combo: 64 bits */ _("64 bits"), 1, 64);
renderer = new Gtk.CellRendererText ();
word_size_combo.pack_start (renderer, true);
word_size_combo.add_attribute (renderer, "text", 0);
+ label = new Gtk.Label.with_mnemonic (/* Preferences dialog: Label for word size combo box */
+ _("Exchange rate refresh interval"));
+ label.show ();
+ label.xalign = 0;
+ grid.attach (label, 0, 7, 1, 1);
+
+ refresh_interval_combo = new Gtk.ComboBox ();
+ label.mnemonic_widget = refresh_interval_combo;
+ refresh_interval_combo.show ();
+ refresh_interval_combo.changed.connect (refresh_interval_combo_changed_cb);
+ grid.attach (refresh_interval_combo, 1, 7, 1, 1);
+
+ model = new Gtk.ListStore (2, typeof (string), typeof (int));
+ refresh_interval_combo.model = model;
+ model.append (out iter);
+ model.set (iter, 0, /* Refresh interval combo: never */ _("never"), 1, 0);
+ model.append (out iter);
+ model.set (iter, 0, /* Refresh interval combo: daily */ _("daily"), 1, 60 * 60 * 24);
+ model.append (out iter);
+ model.set (iter, 0, /* Refresh interval combo: weekly */ _("weekly"), 1, 60 * 60 * 24 * 7);
+ renderer = new Gtk.CellRendererText ();
+ refresh_interval_combo.pack_start (renderer, true);
+ refresh_interval_combo.add_attribute (renderer, "text", 0);
+
decimal_places_spin.set_value (equation.accuracy);
equation.notify["accuracy"].connect ((pspec) => { decimal_places_spin.set_value (equation.accuracy); });
thousands_separator_switch.set_active (equation.show_thousands_separators);
equation.notify["show-thousands-separators"].connect (() => { thousands_separator_switch.set_active (equation.show_thousands_separators); });
trailing_zeroes_switch.set_active (equation.show_trailing_zeroes);
equation.notify["show-trailing_zeroes"].connect (() => { trailing_zeroes_switch.set_active (equation.show_trailing_zeroes); });
set_combo_box_from_int (number_format_combo, equation.number_format);
equation.notify["number-format"].connect ((pspec) => { set_combo_box_from_int (number_format_combo, equation.number_format); });
set_combo_box_from_int (word_size_combo, equation.word_size);
equation.notify["word-size"].connect ((pspec) => { set_combo_box_from_int (word_size_combo, equation.word_size); });
set_combo_box_from_int (angle_unit_combo, equation.angle_units);
equation.notify["angle-units"].connect ((pspec) => { set_combo_box_from_int (angle_unit_combo, equation.angle_units); });
+
+ set_combo_box_from_int (refresh_interval_combo, settings.get_int ("refresh-interval"));
}
protected override void response (int id)
{
hide ();
}
protected override bool delete_event (Gdk.EventAny event)
{
hide ();
return true;
}
private void number_format_combo_changed_cb (Gtk.ComboBox combo)
{
Gtk.TreeIter iter;
combo.get_active_iter (out iter);
DisplayFormat value;
combo.model.get (iter, 1, out value, -1);
equation.number_format = value;
}
private void angle_unit_combo_changed_cb (Gtk.ComboBox combo)
{
Gtk.TreeIter iter;
combo.get_active_iter (out iter);
AngleUnit value;
combo.model.get (iter, 1, out value, -1);
equation.angle_units = value;
}
private void word_size_combo_changed_cb (Gtk.ComboBox combo)
{
Gtk.TreeIter iter;
combo.get_active_iter (out iter);
int value;
combo.model.get (iter, 1, out value, -1);
equation.word_size = value;
}
+ private void refresh_interval_combo_changed_cb (Gtk.ComboBox combo)
+ {
+ Gtk.TreeIter iter;
+ combo.get_active_iter (out iter);
+ int value;
+ combo.model.get (iter, 1, out value, -1);
+ settings.set_int ("refresh-interval", value);
+ CurrencyManager.get_default ().refresh_interval = value;
+
+ }
+
private void set_combo_box_from_int (Gtk.ComboBox combo, int value)
{
Gtk.TreeIter iter;
var valid = combo.model.get_iter_first (out iter);
while (valid)
{
int v;
combo.model.get (iter, 1, out v, -1);
if (v == value)
break;
valid = combo.model.iter_next (ref iter);
}
if (!valid)
valid = combo.model.get_iter_first (out iter);
combo.set_active_iter (iter);
}
}
--
2.31.1

View File

@ -1,180 +0,0 @@
From bddcd343ec6a4aad86a7add9cd5abf77338ffb76 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 13 May 2021 10:44:33 -0400
Subject: [PATCH 2/5] currency-provider: Don't ever download rates if refresh
interval is 0
If an admin has set the currency refresh interval to 0 they probably
don't ever want the data refreshed from the network.
This commit treats a refresh interval of 0 specially to mean
"don't go on the network at all"
---
data/org.gnome.calculator.gschema.xml | 2 +-
lib/currency.vala | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/data/org.gnome.calculator.gschema.xml b/data/org.gnome.calculator.gschema.xml
index a3af435f..fbde9b53 100644
--- a/data/org.gnome.calculator.gschema.xml
+++ b/data/org.gnome.calculator.gschema.xml
@@ -33,61 +33,61 @@
</key>
<key type="i" name="base">
<default>10</default>
<range min="2" max="16"/>
<summary>Numeric Base</summary>
<description>The numeric base</description>
</key>
<key type="b" name="show-thousands">
<default>false</default>
<summary>Show Thousands Separators</summary>
<description>Indicates whether thousands separators are shown in large numbers.</description>
</key>
<key type="b" name="show-zeroes">
<default>false</default>
<summary>Show Trailing Zeroes</summary>
<description>Indicates whether any trailing zeroes after the numeric point should be shown in the display value.</description>
</key>
<key name="number-format" enum="org.gnome.calculator.NumberFormat">
<default>'automatic'</default>
<summary>Number format</summary>
<description>The format to display numbers in</description>
</key>
<key name="angle-units" enum="org.gnome.calculator.AngleUnit">
<default>'degrees'</default>
<summary>Angle units</summary>
<description>The angle units to use</description>
</key>
<key name="refresh-interval" type="i">
<default>604800</default>
<summary>Currency update interval</summary>
- <description>How often the currency exchange rates should be updated</description>
+ <description>How often the currency exchange rates should be updated. A value of 0 means the currency exchange rates won't be fetched from the network at all.</description>
</key>
<key name="button-mode" enum="org.gnome.calculator.ButtonMode">
<default>'basic'</default>
<summary>Button mode</summary>
<description>The button mode</description>
</key>
<key type="s" name="source-currency">
<default>''</default>
<summary>Source currency</summary>
<description>Currency of the current calculation</description>
</key>
<key type="s" name="target-currency">
<default>''</default>
<summary>Target currency</summary>
<description>Currency to convert the current calculation into</description>
</key>
<key type="s" name="source-units">
<default>'degree'</default>
<summary>Source units</summary>
<description>Units of the current calculation</description>
</key>
<key type="s" name="target-units">
<default>'radian'</default>
<summary>Target units</summary>
<description>Units to convert the current calculation into</description>
</key>
<key type="i" name="precision">
<default>2000</default>
<summary>Internal precision</summary>
<description>The internal precision used with the MPFR library</description>
diff --git a/lib/currency.vala b/lib/currency.vala
index c098cc52..2adb11e4 100644
--- a/lib/currency.vala
+++ b/lib/currency.vala
@@ -354,83 +354,89 @@ public class CurrencyManager : Object
{
warning ("Couldn't create XPath context");
return;
}
xpath_ctx.register_ns ("xref", "http://www.ecb.int/vocabulary/2002-08-01/eurofxref");
var xpath_obj = xpath_ctx.eval_expression ("//xref:Cube[@currency][@rate]");
if (xpath_obj == null)
{
warning ("Couldn't create XPath object");
return;
}
var len = (xpath_obj->nodesetval != null) ? xpath_obj->nodesetval->length () : 0;
for (var i = 0; i < len; i++)
{
var node = xpath_obj->nodesetval->item (i);
if (node->type == Xml.ElementType.ELEMENT_NODE)
set_ecb_rate (node, eur_rate);
/* Avoid accessing removed elements */
if (node->type != Xml.ElementType.NAMESPACE_DECL)
node = null;
}
Xml.Parser.cleanup ();
}
private void download_rates ()
{
+ if (refresh_interval == 0)
+ return;
+
/* Update rates if necessary */
var path = get_imf_rate_filepath ();
if (!downloading_imf_rates && file_needs_update (path, refresh_interval))
{
downloading_imf_rates = true;
debug ("Downloading rates from the IMF...");
download_file.begin ("https://www.imf.org/external/np/fin/data/rms_five.aspx?tsvflag=Y", path, "IMF");
}
path = get_ecb_rate_filepath ();
if (!downloading_ecb_rates && file_needs_update (path, refresh_interval))
{
downloading_ecb_rates = true;
debug ("Downloading rates from the ECB...");
download_file.begin ("https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml", path, "ECB");
}
}
private bool load_rates ()
{
/* Already loaded */
if (loaded_rates)
return true;
+ if (refresh_interval == 0)
+ return false;
+
/* In process */
if (downloading_imf_rates || downloading_ecb_rates)
return false;
/* Use the IMF provided values and top up with currencies tracked by the ECB and not the IMF */
load_imf_rates ();
load_ecb_rates ();
/* Check if we couldn't find out a currency */
foreach (var c in currencies)
if (c.get_value () == null || c.get_value ().is_zero ())
warning ("Currency %s is not provided by IMF or ECB", c.name);
debug ("Rates loaded");
loaded_rates = true;
updated ();
return true;
}
public Number? get_value (string currency)
{
/* Make sure that the rates we're returning are up to date. (Just in case the application is running from a long long time) */
download_rates ();
if (!load_rates ())
return null;
var c = get_currency (currency);
--
2.31.1

View File

@ -1,85 +0,0 @@
From 21b2235fc53e72eea0aab035de5b19a74fd165c3 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 13 May 2021 14:08:27 -0400
Subject: [PATCH 3/5] gnome-calculator: Update refresh interval when changed in
gsettings
Right now the refresh interval is read at start up.
This commit makes sure it gets reread any time it's changed too.
---
src/gnome-calculator.vala | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/gnome-calculator.vala b/src/gnome-calculator.vala
index 5b3f9b8d..89a83450 100644
--- a/src/gnome-calculator.vala
+++ b/src/gnome-calculator.vala
@@ -101,60 +101,64 @@ public class Calculator : Gtk.Application
catch (Error e)
{
error ("Error loading menu UI: %s", e.message);
}
var menu = builder.get_object ("appmenu") as MenuModel;
set_app_menu (menu);
set_accels_for_action ("win.mode::basic", {"<alt>B"});
set_accels_for_action ("win.mode::advanced", {"<alt>A"});
set_accels_for_action ("win.mode::financial", {"<alt>F"});
set_accels_for_action ("win.mode::programming", {"<alt>P"});
set_accels_for_action ("win.mode::keyboard", {"<alt>K"});
set_accels_for_action ("win.copy", {"<control>C"});
set_accels_for_action ("win.paste", {"<control>V"});
set_accels_for_action ("win.undo", {"<control>Z"});
set_accels_for_action ("win.close", {"<control>W"});
set_accels_for_action ("win.redo", {"<control><shift>Z"});
return current_window;
}
protected override void startup ()
{
base.startup ();
settings = new Settings ("org.gnome.calculator");
last_opened_window = create_new_window (settings);
// restore the first window position from the settings
load_window_position (last_opened_window);
CurrencyManager.get_default ().refresh_interval = settings.get_int ("refresh-interval");
+
+ settings.changed["refresh-interval"].connect(() => {
+ CurrencyManager.get_default ().refresh_interval = settings.get_int ("refresh-interval");
+ });
}
private MathWindow get_active_math_window ()
{
return (MathWindow) get_active_window ();
}
protected override void activate ()
{
base.activate ();
last_opened_window.present ();
if (equation_string != "" && equation_string != null)
{
var equations = (equation_string.compress ()).split ("\n",0);
for (var i = 0; i < equations.length; i++)
{
if ((equations [i].strip ()).length > 0)
last_opened_window.equation.set (equations [i]);
else
last_opened_window.equation.solve ();
}
}
if (mode_string != "" && mode_string != null)
{
var mode = ButtonMode.BASIC;
switch (mode_string)
{
case "basic":
--
2.31.1

View File

@ -1,425 +0,0 @@
From 3edf6664432fd65ad68b7e5b91de65eef7fcdb09 Mon Sep 17 00:00:00 2001
From: Robert Roth <robert.roth.off@gmail.com>
Date: Thu, 4 Oct 2018 23:41:03 +0300
Subject: [PATCH 4/5] Conversion ui improvements (#72)
---
src/math-converter.ui | 9 +++++++--
src/math-converter.vala | 45 +++++++++++++++++++++++++++--------------
src/math-display.vala | 12 ++++-------
3 files changed, 41 insertions(+), 25 deletions(-)
diff --git a/src/math-converter.ui b/src/math-converter.ui
index 8172ede3..9ec03820 100644
--- a/src/math-converter.ui
+++ b/src/math-converter.ui
@@ -1,59 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.19.0 -->
<interface>
<requires lib="gtk+" version="3.16"/>
<template class="MathConverter" parent="GtkGrid">
<property name="visible">False</property>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkButton" id="swap_button">
<property name="label">⇆</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Switch conversion units</property>
<property name="relief">none</property>
<signal name="clicked" handler="swap_button_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="in_label">
+ <object class="GtkButton" id="in_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes"> in </property>
+ <property name="label" translatable="yes"> to </property>
+ <signal name="clicked" handler="convert_button_clicked_cb" swapped="no"/>
+ <style>
+ <class name="flat"/>
+ </style>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="from_combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="changed" handler="from_combobox_changed_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="from_renderer"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="to_combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="opacity">0.88</property>
<signal name="changed" handler="to_combobox_changed_cb" swapped="no"/>
<child>
@@ -103,30 +107,31 @@
<property name="hexpand">False</property>
<property name="vexpand">False</property>
<property name="justify">center</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="label" translatable="yes" context="convertion equals label">=</property>
</object>
</child>
<child>
<object class="GtkLabel" id="to_label">
<property name="visible">True</property>
<property name="sensitive">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="vexpand">False</property>
<property name="justify">center</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
</object>
<packing>
<property name="expand">false</property>
<property name="fill">true</property>
</packing>
</child>
</object>
</child>
</template>
</interface>
+
diff --git a/src/math-converter.vala b/src/math-converter.vala
index 0cf90ac5..a83dea24 100644
--- a/src/math-converter.vala
+++ b/src/math-converter.vala
@@ -75,66 +75,64 @@ public class MathConverter : Gtk.Grid
{
Gtk.TreeIter child_iter;
while (model.iter_children (out child_iter, iter))
iter = child_iter;
from_combo.set_active_iter (iter);
}
return;
}
set_active_unit (from_combo, null, ua);
set_active_unit (to_combo, null, ub);
}
public void get_conversion (out Unit from_unit, out Unit to_unit)
{
Gtk.TreeIter from_iter, to_iter;
from_combo.get_active_iter (out from_iter);
to_combo.get_active_iter (out to_iter);
from_combo.get_model ().get (from_iter, 2, out from_unit, -1);
to_combo.get_model ().get (to_iter, 2, out to_unit, -1);
}
private void update_result_label ()
{
var x = equation.number;
if (x == null)
return;
- var z = convert_equation (x);
+ Unit source_unit, target_unit;
+ var z = convert_equation (x, out source_unit, out target_unit);
if (z != null)
{
- Unit source_unit, target_unit;
- get_conversion (out source_unit, out target_unit);
-
var source_text = source_unit.format (x);
var target_text = target_unit.format (z);
from_label.set_text (source_text);
to_label.set_text (target_text);
}
}
private void update_from_model ()
{
var from_model = new Gtk.TreeStore (3, typeof (string), typeof (UnitCategory), typeof (Unit));
if (category == null)
{
var categories = UnitManager.get_default ().get_categories ();
foreach (var category in categories)
{
Gtk.TreeIter parent;
from_model.append (out parent, null);
from_model.set (parent, 0, category.display_name, 1, category, -1);
foreach (var unit in category.get_units ())
{
Gtk.TreeIter iter;
from_model.append (out iter, parent);
from_model.set (iter, 0, unit.display_name, 1, category, 2, unit, -1);
}
}
}
else
{
@@ -201,62 +199,79 @@ public class MathConverter : Gtk.Grid
/* Set the to combobox to be the list of units can be converted to */
to_model = new Gtk.ListStore (3, typeof (string), typeof (UnitCategory), typeof (Unit));
foreach (var u in category.get_units ())
{
to_model.append (out iter);
to_model.set (iter, 0, u.display_name, 1, category, 2, u, -1);
}
to_combo.model = to_model;
/* Select the first possible unit */
to_combo.set_active (0);
}
}
[GtkCallback]
private void to_combobox_changed_cb ()
{
/* Conversion must have changed */
update_result_label ();
changed ();
}
private void from_cell_data_func (Gtk.CellLayout cell_layout, Gtk.CellRenderer cell, Gtk.TreeModel tree_model, Gtk.TreeIter iter)
{
cell.set ("sensitive", !tree_model.iter_has_child (iter));
}
[GtkCallback]
private void swap_button_clicked_cb ()
{
+ Unit? from_unit, to_unit;
+ get_conversion (out from_unit, out to_unit);
+
+ set_active_unit (from_combo, null, to_unit);
+ set_active_unit (to_combo, null, from_unit);
+
+ do_convert(out from_unit, out to_unit);
+
+ update_result_label ();
+ }
+
+ private void do_convert (out Unit? from_unit, out Unit? to_unit) {
var x = equation.number;
if (x != null)
{
- var z = convert_equation (x);
- if (z != null)
- equation.set_number (z);
+ var z = convert_equation (x, out from_unit, out to_unit);
+ if (z != null && from_unit != null && to_unit != null)
+ {
+ equation.set ("%s %s %s %s".printf(equation.serializer.to_string (x), from_unit.display_name, _("in"), to_unit.display_name));
+ equation.solve ();
+ }
}
+ }
- Unit from_unit, to_unit;
- get_conversion (out from_unit, out to_unit);
- set_active_unit (from_combo, null, to_unit);
- set_active_unit (to_combo, null, from_unit);
+ [GtkCallback]
+ private void convert_button_clicked_cb ()
+ {
+ Unit? from_unit, to_unit;
+ do_convert (out from_unit, out to_unit);
update_result_label ();
}
- private Number? convert_equation (Number x)
+ private Number? convert_equation (Number x,
+ out Unit? source_unit,
+ out Unit? target_unit)
{
Gtk.TreeIter from_iter, to_iter;
if (!from_combo.get_active_iter (out from_iter))
return null;
if (!to_combo.get_active_iter (out to_iter))
return null;
-
UnitCategory category;
- Unit source_unit, target_unit;
from_combo.model.get (from_iter, 1, out category, 2, out source_unit, -1);
to_combo.model.get (to_iter, 2, out target_unit, -1);
return category.convert (x, source_unit, target_unit);
- }
+ }
}
diff --git a/src/math-display.vala b/src/math-display.vala
index 4b1a17c8..01156b0c 100644
--- a/src/math-display.vala
+++ b/src/math-display.vala
@@ -1,60 +1,60 @@
/*
* Copyright (C) 2008-2012 Robert Ancell
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
public class MathDisplay : Gtk.Viewport
{
/* Equation being displayed */
private MathEquation _equation;
public MathEquation equation { get { return _equation; } }
private HistoryView history;
/* Display widget */
Gtk.SourceView source_view;
/* Buffer that shows errors etc */
Gtk.TextBuffer info_buffer;
/* Spinner widget that shows if we're calculating a response */
Gtk.Spinner spinner;
public MathDisplay (MathEquation equation)
{
_equation = equation;
- _equation.history_signal.connect (this.handler);
+ _equation.history_signal.connect (this.update_history);
var main_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
add (main_box);
history = new HistoryView ();
history.answer_clicked.connect ((ans) => { insert_text (ans); });
history.equation_clicked.connect ((eq) => { display_text (eq); });
main_box.add (history);
main_box.show_all ();
var scrolled_window = new Gtk.ScrolledWindow (null, null);
var style_context = scrolled_window.get_style_context ();
style_context.add_class ("display-scrolled");
scrolled_window.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.NEVER);
source_view = new Gtk.SourceView.with_buffer (equation);
source_view.set_accepts_tab (false);
source_view.set_left_margin (14);
source_view.set_pixels_above_lines (8);
source_view.set_pixels_below_lines (2);
source_view.set_justification (Gtk.Justification.LEFT);
source_view.set_name ("displayitem");
source_view.set_size_request (20, 20);
source_view.get_accessible ().set_role (Atk.Role.EDITBAR);
//FIXME:<property name="AtkObject::accessible-description" translatable="yes" comments="Accessible description for the area in which results are displayed">Result Region</property>
source_view.key_press_event.connect (key_press_cb);
create_autocompletion ();
main_box.pack_start (scrolled_window, false, false, 0);
scrolled_window.add (source_view); /* Adds ScrolledWindow to source_view for displaying long equations */
@@ -67,75 +67,71 @@ public class MathDisplay : Gtk.Viewport
info_view.set_wrap_mode (Gtk.WrapMode.WORD);
info_view.set_can_focus (false);
info_view.set_editable (false);
info_view.set_left_margin (12);
info_view.set_right_margin (12);
info_box.pack_start (info_view, true, true, 0);
info_buffer = info_view.get_buffer ();
style_context = info_view.get_style_context ();
style_context.add_class ("info-view");
spinner = new Gtk.Spinner ();
info_box.pack_end (spinner, false, false, 0);
info_box.show ();
info_view.show ();
source_view.show ();
main_box.show ();
equation.notify["status"].connect ((pspec) => { status_changed_cb (); });
status_changed_cb ();
equation.notify["error-token-end"].connect ((pspec) => { error_status_changed_cb (); });
}
public void grabfocus () /* Editbar grabs focus when an instance of gnome-calculator is created */
{
source_view.grab_focus ();
}
- public void handler (string answer, Number number, int number_base, uint representation_base)
+ public void update_history (string answer, Number number, int number_base, uint representation_base)
{
- this.update_history (answer, number, number_base, representation_base); /* Recieves signal emitted by a MathEquation object for updating history-view */
+ /* Recieves signal emitted by a MathEquation object for updating history-view */
+ history.insert_entry (answer, number, number_base, representation_base); /* Sends current equation and answer for updating History-View */
}
public void display_text (string prev_eq)
{
_equation.display_selected (prev_eq);
}
- public void update_history (string answer, Number number, int number_base, uint representation_base)
- {
- history.insert_entry (answer, number, number_base, representation_base); /* Sends current equation and answer for updating History-View */
- }
-
public void clear_history ()
{
history.clear ();
}
public void insert_text (string answer)
{
_equation.insert_selected (answer);
}
private void create_autocompletion ()
{
Gtk.SourceCompletion completion = source_view.get_completion ();
try
{
completion.add_provider (new FunctionCompletionProvider ());
completion.add_provider (new VariableCompletionProvider (equation));
}
catch (Error e)
{
warning ("Could not add CompletionProvider to source-view");
}
}
private bool function_completion_window_visible ()
{
unowned List<Gtk.SourceCompletionProvider> providers_list = source_view.get_completion ().get_providers ();
if (providers_list.length () > 0)
{
MathFunction[] functions = FunctionCompletionProvider.get_matches_for_completion_at_cursor (equation);
--
2.31.1

View File

@ -1,697 +0,0 @@
From 213feffa73f09303914f0032ba9976ecb17629cd Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 13 May 2021 11:29:33 -0400
Subject: [PATCH 5/5] math-converter: Hide currency conversion UI if there
isn't a loaded currency provider
If the admin sets a currency refresh-interval of 0, then the currency
conversion data will be missing or woefully out of date.
This commit changes the code to hide the conversion UI in this case.
---
lib/currency.vala | 15 ++-
src/gnome-calculator.vala | 1 +
src/math-converter.ui | 264 ++++++++++++++++++++++++--------------
src/math-converter.vala | 18 ++-
4 files changed, 197 insertions(+), 101 deletions(-)
diff --git a/lib/currency.vala b/lib/currency.vala
index 2adb11e4..4270b701 100644
--- a/lib/currency.vala
+++ b/lib/currency.vala
@@ -1,53 +1,62 @@
/*
* Copyright (C) 2008-2012 Robert Ancell.
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
static bool downloading_imf_rates = false;
static bool downloading_ecb_rates = false;
-static bool loaded_rates = false;
private static CurrencyManager? default_currency_manager = null;
public class CurrencyManager : Object
{
private List<Currency> currencies;
public int refresh_interval { get; set; }
public signal void updated ();
+ public bool loaded { get; private set; }
+
+ public void refresh_sync () {
+ loaded = false;
+ load_rates ();
+
+ if (!loaded)
+ updated ();
+ }
+
public static CurrencyManager get_default ()
{
if (default_currency_manager != null)
return default_currency_manager;
default_currency_manager = new CurrencyManager ();
default_currency_manager.currencies.append (new Currency ("AED", _("UAE Dirham"), "إ.د"));
default_currency_manager.currencies.append (new Currency ("AUD", _("Australian Dollar"), "$"));
default_currency_manager.currencies.append (new Currency ("BGN", _("Bulgarian Lev"), "лв"));
default_currency_manager.currencies.append (new Currency ("BHD", _("Bahraini Dinar"), ".ب.د"));
default_currency_manager.currencies.append (new Currency ("BND", _("Brunei Dollar"), "$"));
default_currency_manager.currencies.append (new Currency ("BRL", _("Brazilian Real"), "R$"));
default_currency_manager.currencies.append (new Currency ("BWP", _("Botswana Pula"), "P"));
default_currency_manager.currencies.append (new Currency ("CAD", _("Canadian Dollar"), "$"));
default_currency_manager.currencies.append (new Currency ("CFA", _("CFA Franc"), "Fr"));
default_currency_manager.currencies.append (new Currency ("CHF", _("Swiss Franc"), "Fr"));
default_currency_manager.currencies.append (new Currency ("CLP", _("Chilean Peso"), "$"));
default_currency_manager.currencies.append (new Currency ("CNY", _("Chinese Yuan"), "¥"));
default_currency_manager.currencies.append (new Currency ("COP", _("Colombian Peso"), "$"));
default_currency_manager.currencies.append (new Currency ("CZK", _("Czech Koruna"), "Kč"));
default_currency_manager.currencies.append (new Currency ("DKK", _("Danish Krone"), "kr"));
default_currency_manager.currencies.append (new Currency ("DZD", _("Algerian Dinar"), "ج.د"));
default_currency_manager.currencies.append (new Currency ("EEK", _("Estonian Kroon"), "KR"));
default_currency_manager.currencies.append (new Currency ("EUR", _("Euro"), "€"));
default_currency_manager.currencies.append (new Currency ("GBP", _("British Pound Sterling"), "£"));
default_currency_manager.currencies.append (new Currency ("HKD", _("Hong Kong Dollar"), "$"));
default_currency_manager.currencies.append (new Currency ("HRK", _("Croatian Kuna"), "kn"));
default_currency_manager.currencies.append (new Currency ("HUF", _("Hungarian Forint"), "Ft"));
default_currency_manager.currencies.append (new Currency ("IDR", _("Indonesian Rupiah"), "Rp"));
@@ -377,81 +386,81 @@ public class CurrencyManager : Object
}
Xml.Parser.cleanup ();
}
private void download_rates ()
{
if (refresh_interval == 0)
return;
/* Update rates if necessary */
var path = get_imf_rate_filepath ();
if (!downloading_imf_rates && file_needs_update (path, refresh_interval))
{
downloading_imf_rates = true;
debug ("Downloading rates from the IMF...");
download_file.begin ("https://www.imf.org/external/np/fin/data/rms_five.aspx?tsvflag=Y", path, "IMF");
}
path = get_ecb_rate_filepath ();
if (!downloading_ecb_rates && file_needs_update (path, refresh_interval))
{
downloading_ecb_rates = true;
debug ("Downloading rates from the ECB...");
download_file.begin ("https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml", path, "ECB");
}
}
private bool load_rates ()
{
/* Already loaded */
- if (loaded_rates)
+ if (loaded)
return true;
if (refresh_interval == 0)
return false;
/* In process */
if (downloading_imf_rates || downloading_ecb_rates)
return false;
/* Use the IMF provided values and top up with currencies tracked by the ECB and not the IMF */
load_imf_rates ();
load_ecb_rates ();
/* Check if we couldn't find out a currency */
foreach (var c in currencies)
if (c.get_value () == null || c.get_value ().is_zero ())
warning ("Currency %s is not provided by IMF or ECB", c.name);
debug ("Rates loaded");
- loaded_rates = true;
+ loaded = true;
updated ();
return true;
}
public Number? get_value (string currency)
{
/* Make sure that the rates we're returning are up to date. (Just in case the application is running from a long long time) */
download_rates ();
if (!load_rates ())
return null;
var c = get_currency (currency);
if (c != null)
return c.get_value ();
else
return null;
}
private async void download_file (string uri, string filename, string source)
{
var directory = Path.get_dirname (filename);
DirUtils.create_with_parents (directory, 0755);
var dest = File.new_for_path (filename);
var session = new Soup.Session ();
var message = new Soup.Message ("GET", uri);
diff --git a/src/gnome-calculator.vala b/src/gnome-calculator.vala
index 89a83450..0aa0054e 100644
--- a/src/gnome-calculator.vala
+++ b/src/gnome-calculator.vala
@@ -104,60 +104,61 @@ public class Calculator : Gtk.Application
}
var menu = builder.get_object ("appmenu") as MenuModel;
set_app_menu (menu);
set_accels_for_action ("win.mode::basic", {"<alt>B"});
set_accels_for_action ("win.mode::advanced", {"<alt>A"});
set_accels_for_action ("win.mode::financial", {"<alt>F"});
set_accels_for_action ("win.mode::programming", {"<alt>P"});
set_accels_for_action ("win.mode::keyboard", {"<alt>K"});
set_accels_for_action ("win.copy", {"<control>C"});
set_accels_for_action ("win.paste", {"<control>V"});
set_accels_for_action ("win.undo", {"<control>Z"});
set_accels_for_action ("win.close", {"<control>W"});
set_accels_for_action ("win.redo", {"<control><shift>Z"});
return current_window;
}
protected override void startup ()
{
base.startup ();
settings = new Settings ("org.gnome.calculator");
last_opened_window = create_new_window (settings);
// restore the first window position from the settings
load_window_position (last_opened_window);
CurrencyManager.get_default ().refresh_interval = settings.get_int ("refresh-interval");
settings.changed["refresh-interval"].connect(() => {
CurrencyManager.get_default ().refresh_interval = settings.get_int ("refresh-interval");
+ CurrencyManager.get_default ().refresh_sync ();
});
}
private MathWindow get_active_math_window ()
{
return (MathWindow) get_active_window ();
}
protected override void activate ()
{
base.activate ();
last_opened_window.present ();
if (equation_string != "" && equation_string != null)
{
var equations = (equation_string.compress ()).split ("\n",0);
for (var i = 0; i < equations.length; i++)
{
if ((equations [i].strip ()).length > 0)
last_opened_window.equation.set (equations [i]);
else
last_opened_window.equation.solve ();
}
}
if (mode_string != "" && mode_string != null)
{
var mode = ButtonMode.BASIC;
switch (mode_string)
{
diff --git a/src/math-converter.ui b/src/math-converter.ui
index 9ec03820..fb633f10 100644
--- a/src/math-converter.ui
+++ b/src/math-converter.ui
@@ -1,137 +1,207 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.19.0 -->
<interface>
<requires lib="gtk+" version="3.16"/>
<template class="MathConverter" parent="GtkGrid">
- <property name="visible">False</property>
- <property name="can_focus">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
<child>
- <object class="GtkButton" id="swap_button">
- <property name="label">⇆</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Switch conversion units</property>
- <property name="relief">none</property>
- <signal name="clicked" handler="swap_button_clicked_cb" swapped="no"/>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="in_button">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes"> to </property>
- <signal name="clicked" handler="convert_button_clicked_cb" swapped="no"/>
- <style>
- <class name="flat"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="from_combo">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <signal name="changed" handler="from_combobox_changed_cb" swapped="no"/>
- <child>
- <object class="GtkCellRendererText" id="from_renderer"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="to_combo">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="opacity">0.88</property>
- <signal name="changed" handler="to_combobox_changed_cb" swapped="no"/>
- <child>
- <object class="GtkCellRendererText" id="to_renderer"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="result_holder">
- <property name="visible">True</property>
+ <object class="GtkBox" id="outer_box">
+ <property name="visible" bind-source="MathConverter" bind-property="outer-box-visible" bind-flags="sync-create|bidirectional"/>
<property name="orientation">horizontal</property>
<property name="sensitive">True</property>
- <property name="spacing">6</property>
<property name="can_focus">False</property>
- <property name="halign">end</property>
+ <property name="halign">center</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="vexpand">False</property>
<child>
- <object class="GtkLabel" id="from_label">
+ <object class="GtkComboBox" id="from_combo">
<property name="visible">True</property>
- <property name="sensitive">True</property>
<property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="valign">center</property>
<property name="hexpand">True</property>
- <property name="vexpand">False</property>
- <property name="justify">center</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
+ <signal name="changed" handler="from_combobox_changed_cb" swapped="no"/>
+ <child>
+ <object class="GtkCellRendererText" id="from_renderer">
+ <property name="ellipsize">end</property>
+ </object>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="in_button">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"> to </property>
+ <signal name="clicked" handler="convert_button_clicked_cb" swapped="no"/>
+ <style>
+ <class name="flat"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="to_combo">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="opacity">0.88</property>
+ <property name="hexpand">True</property>
+ <signal name="changed" handler="to_combobox_changed_cb" swapped="no"/>
+ <child>
+ <object class="GtkCellRendererText" id="to_renderer">
+ <property name="ellipsize">end</property>
+ </object>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="swap_button">
+ <property name="label">⇆</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Switch conversion units</property>
+ <property name="relief">none</property>
+ <signal name="clicked" handler="swap_button_clicked_cb" swapped="no"/>
</object>
</child>
<child>
- <object class="GtkLabel" id="convert_equals">
+ <object class="GtkBox" id="result_holder">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="sensitive">True</property>
+ <property name="spacing">6</property>
+ <property name="margin-end">2</property>
<property name="can_focus">False</property>
- <property name="halign">center</property>
+ <property name="halign">end</property>
<property name="valign">center</property>
- <property name="hexpand">False</property>
+ <property name="hexpand">True</property>
<property name="vexpand">False</property>
- <property name="justify">center</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes" context="convertion equals label">=</property>
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="from_label">
+ <property name="visible">True</property>
+ <property name="sensitive">True</property>
+ <property name="selectable">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">False</property>
+ <property name="justify">center</property>
+ <property name="ellipsize">end</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="convert_equals">
+ <property name="visible">True</property>
+ <property name="sensitive">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="hexpand">False</property>
+ <property name="vexpand">False</property>
+ <property name="justify">center</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes" context="convertion equals label">=</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="to_label">
+ <property name="visible">True</property>
+ <property name="sensitive">True</property>
+ <property name="selectable">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">fill</property>
+ <property name="valign">center</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">False</property>
+ <property name="justify">center</property>
+ <property name="ellipsize">end</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ </object>
+ <packing>
+ <property name="expand">false</property>
+ </packing>
+ </child>
</object>
</child>
<child>
- <object class="GtkLabel" id="to_label">
- <property name="visible">True</property>
+ <object class="GtkBox">
+ <property name="orientation">horizontal</property>
<property name="sensitive">True</property>
+ <property name="spacing">6</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="vexpand">False</property>
- <property name="justify">center</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
+ <property name="visible" bind-source="result_holder" bind-property="visible" bind-flags="sync-create|invert-boolean"/>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="sensitive">True</property>
+ <property name="selectable">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">False</property>
+ <property name="justify">center</property>
+ <property name="ellipsize">end</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" bind-source="from_label" bind-property="label" bind-flags="sync-create|bidirectional"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="sensitive">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="hexpand">False</property>
+ <property name="vexpand">False</property>
+ <property name="justify">center</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" bind-source="convert_equals" bind-property="label" bind-flags="sync-create|bidirectional"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="sensitive">True</property>
+ <property name="selectable">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">fill</property>
+ <property name="valign">center</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">False</property>
+ <property name="justify">center</property>
+ <property name="ellipsize">end</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" bind-source="to_label" bind-property="label" bind-flags="sync-create|bidirectional"/>
+ </object>
+ </child>
</object>
- <packing>
- <property name="expand">false</property>
- <property name="fill">true</property>
- </packing>
</child>
</object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">1</property>
+ <property name="width">4</property>
+ </packing>
</child>
</template>
</interface>
diff --git a/src/math-converter.vala b/src/math-converter.vala
index a83dea24..c470b91f 100644
--- a/src/math-converter.vala
+++ b/src/math-converter.vala
@@ -1,128 +1,144 @@
/*
* Copyright (C) 2008-2012 Robert Ancell
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
[GtkTemplate (ui = "/org/gnome/calculator/math-converter.ui")]
public class MathConverter : Gtk.Grid
{
private MathEquation equation = null;
private string category;
[GtkChild]
private Gtk.CellRendererText from_renderer;
[GtkChild]
private Gtk.ComboBox from_combo;
[GtkChild]
private Gtk.ComboBox to_combo;
[GtkChild]
private Gtk.Label from_label;
[GtkChild]
private Gtk.Label to_label;
+ public bool outer_box_visible { set; get; default = false; }
public signal void changed ();
construct
{
from_combo.set_cell_data_func (from_renderer, from_cell_data_func);
- CurrencyManager.get_default ().updated.connect (() => { update_result_label (); });
+ CurrencyManager.get_default ().updated.connect (() => {
+ update_visibility ();
+ update_result_label ();
+ });
+ update_visibility ();
update_from_model ();
}
public MathConverter (MathEquation equation)
{
set_equation (equation);
}
public void set_equation (MathEquation equation)
{
this.equation = equation;
equation.notify["display"].connect ((pspec) => { update_result_label (); });
}
public void set_category (string? category)
{
if (this.category == category)
return;
this.category = category;
+ update_visibility ();
update_from_model ();
}
public string get_category ()
{
return category;
}
public void set_conversion (/*string category,*/ string unit_a, string unit_b)
{
var ua = UnitManager.get_default ().get_unit_by_name (unit_a);
var ub = UnitManager.get_default ().get_unit_by_name (unit_b);
if (ua == null || ub == null)
{
/* Select the first unit */
var model = from_combo.get_model ();
Gtk.TreeIter iter;
if (model.get_iter_first (out iter))
{
Gtk.TreeIter child_iter;
while (model.iter_children (out child_iter, iter))
iter = child_iter;
from_combo.set_active_iter (iter);
}
return;
}
set_active_unit (from_combo, null, ua);
set_active_unit (to_combo, null, ub);
}
public void get_conversion (out Unit from_unit, out Unit to_unit)
{
Gtk.TreeIter from_iter, to_iter;
from_combo.get_active_iter (out from_iter);
to_combo.get_active_iter (out to_iter);
from_combo.get_model ().get (from_iter, 2, out from_unit, -1);
to_combo.get_model ().get (to_iter, 2, out to_unit, -1);
}
+ private void update_visibility ()
+ {
+ if (category != "currency") {
+ this.outer_box_visible = true;
+ return;
+ }
+
+ this.outer_box_visible = CurrencyManager.get_default ().loaded;
+ }
+
private void update_result_label ()
{
var x = equation.number;
if (x == null)
return;
Unit source_unit, target_unit;
var z = convert_equation (x, out source_unit, out target_unit);
if (z != null)
{
var source_text = source_unit.format (x);
var target_text = target_unit.format (z);
from_label.set_text (source_text);
to_label.set_text (target_text);
}
}
private void update_from_model ()
{
var from_model = new Gtk.TreeStore (3, typeof (string), typeof (UnitCategory), typeof (Unit));
if (category == null)
{
var categories = UnitManager.get_default ().get_categories ();
foreach (var category in categories)
{
Gtk.TreeIter parent;
from_model.append (out parent, null);
from_model.set (parent, 0, category.display_name, 1, category, -1);
--
2.31.1

View File

@ -1,6 +1,6 @@
--- !Policy
product_versions:
- rhel-8
- rhel-10
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: desktop-qe.desktop-ci.tier1-gating.functional}

View File

@ -1,34 +1,35 @@
%global gtksourceview_version 5.3.0
%global libadwaita_version 1.4~alpha
%global tarball_version %%(echo %{version} | tr '~' '.')
Name: gnome-calculator
Version: 3.28.2
Release: 2%{?dist}
Version: 46.1
Release: 1%{?dist}
Summary: A desktop calculator
License: GPLv3+
License: GPL-3.0-or-later
URL: https://wiki.gnome.org/Apps/Calculator
Source0: https://download.gnome.org/sources/%{name}/3.28/%{name}-%{version}.tar.xz
Source0: https://download.gnome.org/sources/%{name}/46/%{name}-%{tarball_version}.tar.xz
BuildRequires: desktop-file-utils
BuildRequires: gettext
BuildRequires: itstool
BuildRequires: libmpc-devel
BuildRequires: libsoup-devel
BuildRequires: meson
BuildRequires: mpfr-devel
BuildRequires: pkgconfig(gee-0.8)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(gtksourceview-3.0)
BuildRequires: pkgconfig(gtk4)
BuildRequires: pkgconfig(gtksourceview-5) >= %{gtksourceview_version}
BuildRequires: pkgconfig(libadwaita-1) >= %{libadwaita_version}
BuildRequires: pkgconfig(libsoup-3.0)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: vala
BuildRequires: /usr/bin/appstream-util
Provides: gcalctool = 6.6.2-3
Obsoletes: gcalctool < 6.6.2-3
Patch10001: 0001-Implemented-exchange-rate-refresh-interval-setting.patch
Patch10002: 0002-currency-provider-Don-t-ever-download-rates-if-refre.patch
Patch10003: 0003-gnome-calculator-Update-refresh-interval-when-change.patch
Patch10004: 0004-Conversion-ui-improvements-72.patch
Patch10005: 0005-math-converter-Hide-currency-conversion-UI-if-there-.patch
Requires: gtksourceview5%{?_isa} >= %{gtksourceview_version}
Requires: libadwaita%{?_isa} >= %{libadwaita_version}
%description
gnome-calculator is a powerful graphical calculator with financial,
@ -36,8 +37,17 @@ logical and scientific modes. It uses a multiple precision package
to do its arithmetic to give a high degree of accuracy.
%package devel
Summary: Development files for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%prep
%autosetup -p1
%autosetup -p1 -n %{name}-%{tarball_version}
%build
@ -51,31 +61,264 @@ to do its arithmetic to give a high degree of accuracy.
%check
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/org.gnome.Calculator.appdata.xml
appstream-util validate-relax --nonet %{buildroot}/%{_metainfodir}/org.gnome.Calculator.appdata.xml
desktop-file-validate %{buildroot}/%{_datadir}/applications/org.gnome.Calculator.desktop
%files -f %{name}.lang
%doc NEWS
%doc NEWS README.md
%license COPYING
%{_bindir}/gcalccmd
%{_bindir}/gnome-calculator
%dir %{_libdir}/girepository-1.0
%{_libdir}/girepository-1.0/GCalc-2.typelib
%{_libdir}/girepository-1.0/GCi-1.typelib
%{_libdir}/libgcalc-2.so.1*
%{_libdir}/libgci-1.so.0*
%{_libexecdir}/gnome-calculator-search-provider
%{_datadir}/applications/org.gnome.Calculator.desktop
%{_datadir}/dbus-1/services/org.gnome.Calculator.SearchProvider.service
%{_datadir}/glib-2.0/schemas/org.gnome.calculator.gschema.xml
%{_datadir}/gnome-shell/
%{_datadir}/icons/hicolor/*/apps/gnome-calculator.png
%{_datadir}/icons/hicolor/scalable/apps/gnome-calculator-symbolic.svg
%{_datadir}/metainfo/org.gnome.Calculator.appdata.xml
%{_datadir}/icons/hicolor/*/apps/org.gnome.Calculator.*
%{_datadir}/icons/hicolor/symbolic/apps/org.gnome.Calculator-symbolic.svg
%{_metainfodir}/org.gnome.Calculator.appdata.xml
%{_mandir}/man1/gnome-calculator.1*
%{_mandir}/man1/gcalccmd.1*
%files devel
%{_includedir}/gci-2/
%{_includedir}/gcalc-2/
%{_libdir}/libgcalc-2.so
%{_libdir}/libgci-1.so
%{_libdir}/pkgconfig/gcalc-2.pc
%{_libdir}/pkgconfig/gci-1.pc
%dir %{_datadir}/gir-1.0
%{_datadir}/gir-1.0/GCalc-2.gir
%{_datadir}/gir-1.0/GCi-1.gir
%dir %{_datadir}/vala
%dir %{_datadir}/vala/vapi
%{_datadir}/vala/vapi/gcalc-2.deps
%{_datadir}/vala/vapi/gcalc-2.vapi
%{_datadir}/vala/vapi/gci-1.deps
%{_datadir}/vala/vapi/gci-1.vapi
%changelog
* Thu Jul 15 2021 Ray Strode <rstrode@redhat.com> - 3.28.2-2
- Allow disabling downloading by setting refresh interval to 0
Resolves: #1957705
* Thu Nov 21 2024 Tomas Popela <tpopela@redhat.com> - 46.1-1
- Update to 46.1
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 46~alpha-4
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 46~alpha-3
- Bump release for June 2024 mass rebuild
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 46~alpha-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Mon Jan 22 2024 David King <amigadave@amigadave.com> - 46~alpha-1
- Update to 46.alpha
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 45.0.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Tue Sep 19 2023 Kalev Lember <klember@redhat.com> - 45.0.2-1
- Update to 45.0.2
* Tue Sep 05 2023 Kalev Lember <klember@redhat.com> - 45.0.1-1
- Update to 45.0.1
* Thu Aug 17 2023 Kalev Lember <klember@redhat.com> - 45.0-1
- Update to 45.0
* Thu Aug 03 2023 Kalev Lember <klember@redhat.com> - 45~beta-1
- Update to 45.beta
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 45~alpha-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Wed Jun 28 2023 Kalev Lember <klember@redhat.com> - 45~alpha-1
- Update to 45.alpha
* Sat Mar 18 2023 David King <amigadave@amigadave.com> - 44.0-1
- Update to 44.0
* Sun Mar 05 2023 David King <amigadave@amigadave.com> - 44~rc-1
- Update to 44.rc
* Thu Feb 16 2023 David King <amigadave@amigadave.com> - 44~alpha-1
- Update to 44.beta
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 43.0.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Tue Sep 20 2022 Kalev Lember <klember@redhat.com> - 43.0.1-1
- Update to 43.0.1
* Tue Sep 06 2022 Kalev Lember <klember@redhat.com> - 43~rc-1
- Update to 43.rc
- Switch to libsoup3
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 43~alpha-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Fri Jul 15 2022 Kalev Lember <klember@redhat.com> - 43~alpha-1
- Update to 43.alpha
* Wed Jul 06 2022 David King <amigadave@amigadave.com> - 42.2-1
- Update to 42.2
* Sun May 29 2022 David King <amigadave@amigadave.com> - 42.1-1
- Update to 42.1
* Sun Mar 20 2022 David King <amigadave@amigadave.com> - 42.0-1
- Update to 42.0
* Tue Mar 08 2022 David King <amigadave@amigadave.com> - 42~rc-1
- Update to 42.rc
* Mon Feb 14 2022 David King <amigadave@amigadave.com> - 42~beta-1
- Update to 42.beta
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 42~alpha-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Tue Jan 11 2022 David King <amigadave@amigadave.com> - 42~alpha-1
- Update to 42.alpha
* Tue Dec 07 2021 Kalev Lember <klember@redhat.com> - 41.1-1
- Update to 41.1
* Sat Sep 18 2021 Kalev Lember <klember@redhat.com> - 41.0-1
- Update to 41.0
* Wed Sep 08 2021 Kalev Lember <klember@redhat.com> - 41~rc-1
- Update to 41.rc
* Thu Aug 19 2021 Kalev Lember <klember@redhat.com> - 41~alpha-1
- Update to 41.alpha
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 40.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Wed May 05 2021 Kalev Lember <klember@redhat.com> - 40.1-1
- Update to 40.1
* Mon Mar 22 2021 Kalev Lember <klember@redhat.com> - 40.0-1
- Update to 40.0
* Mon Mar 15 2021 Kalev Lember <klember@redhat.com> - 40~rc-1
- Update to 40.rc
* Thu Feb 18 2021 Kalev Lember <klember@redhat.com> - 40~beta-1
- Update to 40.beta
- Drop old gcalctool obsoletes
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.38.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Nov 25 2020 Kalev Lember <klember@redhat.com> - 3.38.2-1
- Update to 3.38.2
* Mon Oct 5 2020 Kalev Lember <klember@redhat.com> - 3.38.1-1
- Update to 3.38.1
* Fri Sep 11 2020 Kalev Lember <klember@redhat.com> - 3.38.0-1
- Update to 3.38.0
* Sun Sep 06 2020 Kalev Lember <klember@redhat.com> - 3.37.92-1
- Update to 3.37.92
* Mon Aug 17 2020 Kalev Lember <klember@redhat.com> - 3.37.90-1
- Update to 3.37.90
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.36.0-3
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.36.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Sun Mar 08 2020 Kalev Lember <klember@redhat.com> - 3.36.0-1
- Update to 3.36.0
* Mon Mar 02 2020 Kalev Lember <klember@redhat.com> - 3.35.92-1
- Update to 3.35.92
* Sun Feb 02 2020 Kalev Lember <klember@redhat.com> - 3.35.90-1
- Update to 3.35.90
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.35.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jan 16 2020 Kalev Lember <klember@redhat.com> - 3.35.3-1
- Update to 3.35.3
* Wed Oct 9 2019 Jerry James <loganjerry@gmail.com> - 3.34.1-2
- Rebuild for mpfr 4
* Mon Oct 07 2019 Kalev Lember <klember@redhat.com> - 3.34.1-1
- Update to 3.34.1
* Mon Sep 09 2019 Kalev Lember <klember@redhat.com> - 3.34.0-1
- Update to 3.34.0
* Tue Sep 03 2019 Kalev Lember <klember@redhat.com> - 3.33.92-1
- Update to 3.33.92
* Mon Aug 12 2019 Kalev Lember <klember@redhat.com> - 3.33.90-1
- Update to 3.33.90
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.33.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Jul 19 2019 Kalev Lember <klember@redhat.com> - 3.33.3-2
- Rebuilt for vala 0.46
* Tue Jun 18 2019 Kalev Lember <klember@redhat.com> - 3.33.3-1
- Update to 3.33.3
* Tue May 21 2019 Kalev Lember <klember@redhat.com> - 3.33.2-1
- Update to 3.33.2
- Add new -devel subpackage
* Tue Apr 16 2019 Adam Williamson <awilliam@redhat.com> - 3.32.1-2
- Rebuild with Meson fix for #1699099
* Tue Apr 09 2019 Kalev Lember <klember@redhat.com> - 3.32.1-1
- Update to 3.32.1
* Mon Mar 11 2019 Kalev Lember <klember@redhat.com> - 3.32.0-1
- Update to 3.32.0
* Tue Mar 05 2019 Kalev Lember <klember@redhat.com> - 3.31.92-1
- Update to 3.31.92
* Mon Feb 18 2019 Kalev Lember <klember@redhat.com> - 3.31.91-1
- Update to 3.31.91
* Mon Feb 04 2019 Phil Wyett <philwyett@kathenas.org> - 3.31.90-1
- Update to 3.31.90
* Mon Feb 04 2019 Kalev Lember <klember@redhat.com> - 3.31.3-1
- Update to 3.31.3
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.30.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Wed Sep 26 2018 Kalev Lember <klember@redhat.com> - 3.30.1-1
- Update to 3.30.1
* Thu Sep 06 2018 Kalev Lember <klember@redhat.com> - 3.30.0-1
- Update to 3.30.0
* Mon Aug 13 2018 Kalev Lember <klember@redhat.com> - 3.29.90-1
- Update to 3.29.90
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.28.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jun 26 2018 Kalev Lember <klember@redhat.com> - 3.28.2-1
- Update to 3.28.2

View File

@ -1 +1 @@
SHA512 (gnome-calculator-3.28.2.tar.xz) = 63b750a24c12feb4db20cdff6bbeb2ce595c7ba165b264c03a507ff9b7c10b70f874230a0f80741ccae775c30a5a39acc9c1fe39270b435eb6d4caef1d92dce5
SHA512 (gnome-calculator-46.1.tar.xz) = b859a35e614ea5415fbb7a03663f1bf184e7f108882c2093511142d8c067e42f6dd11973cc047552bdd9a74d8ee7e39a00ca42009bea739d2b088b2f90affde1

1
tests/.fmf/version Normal file
View File

@ -0,0 +1 @@
1

30
tests/prepare.yml Normal file
View File

@ -0,0 +1,30 @@
- name: Install Workstation packages
dnf:
name: '@Fedora Workstation'
state: present
- name: Install libselinux-python
dnf:
name: libselinux-python
state: present
- name: Set up user test
user:
name: test
groups:
- wheel
- adm
password: $6$lJYbJXPZrkeslR0K$H46Th6V.IdaHEPWt7YUSIwz9r16LWWDFSrIvbmUOyZaGMWfXzS1wb5iWPuMmX9VeSz/wiKj5003sl6gDQ/cUD.
- name: Set passwordless sudo
lineinfile:
path: /etc/sudoers
state: present
regexp: '^%wheel\s'
line: '%wheel ALL=(ALL) NOPASSWD: ALL'
- name: Set gdm to use xorg session
ini_file:
path: /etc/gdm/custom.conf
section: daemon
option: WaylandEnable
value: false
when: wayland is undefined
- name: Turn off lock screen when we are idle
command: gsettings set org.gnome.desktop.session idle-delay 0

11
tests/provision.fmf Normal file
View File

@ -0,0 +1,11 @@
---
# qemu options: https://qemu.weilnetz.de/doc/qemu-doc.html
standard-inventory-qcow2:
qemu:
# RAM size in megabytes. Optionally, a suffix of “M” or “G”.
m: 3G
# vim:ft=yaml: ts=2 sts=2 sw=2 expandtab

23
tests/tests.yml Normal file
View File

@ -0,0 +1,23 @@
# Basic tests for gnome-calculator
- hosts: localhost
pre_tasks:
- name: Prepare the system
include: prepare.yml
roles:
- role: standard-test-basic
tags:
- classic
required_packages:
- gnome-calculator
- dogtail
- python-behave
- python-iniparse
repositories:
- repo: "https://pagure.io/desktop-qa/gnome-calculator.git"
dest: "gnome-calculator"
tests:
- sanity-tests:
dir: "gnome-calculator"
run: run/osci/runtest.sh fedora28