gnucash maint: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Mon Apr 26 15:14:02 EDT 2021
Updated via https://github.com/Gnucash/gnucash/commit/d60d5c30 (commit)
via https://github.com/Gnucash/gnucash/commit/6bb4faac (commit)
from https://github.com/Gnucash/gnucash/commit/2392bc24 (commit)
commit d60d5c30d2824d9550ffe19357102001d687a771
Author: John Ralls <jralls at ceridwen.us>
Date: Mon Apr 26 12:11:40 2021 -0700
Bug 798177 - Price of new stock transactions not saved in price database
Add call to xaccTransRecordPrice after every call to xaccTransCommitEdit
in gnc_split_register_save.
diff --git a/gnucash/register/ledger-core/split-register.c b/gnucash/register/ledger-core/split-register.c
index 427aedc02..101ca8023 100644
--- a/gnucash/register/ledger-core/split-register.c
+++ b/gnucash/register/ledger-core/split-register.c
@@ -1778,6 +1778,7 @@ gnc_split_register_save (SplitRegister* reg, gboolean do_commit)
PINFO ("committing trans (%p)", trans);
unreconcile_splits (reg);
xaccTransCommitEdit (trans);
+ xaccTransRecordPrice (trans, PRICE_SOURCE_SPLIT_REG);
gnc_resume_gui_refresh ();
}
@@ -1830,6 +1831,7 @@ gnc_split_register_save (SplitRegister* reg, gboolean do_commit)
g_warning ("Impossible? committing pending %p", pending_trans);
unreconcile_splits (reg);
xaccTransCommitEdit (pending_trans);
+ xaccTransRecordPrice (trans, PRICE_SOURCE_SPLIT_REG);
}
else if (pending_trans)
{
commit 6bb4faac5845be29e624cfe095f4c78e41923066
Author: John Ralls <jralls at ceridwen.us>
Date: Mon Apr 26 10:38:48 2021 -0700
Bug 795804 - Extremely slow save
Only update the status bar when the percentage changes by at least 1%
because running the mainloop is expensive on macOS and Microsoft
Windows. This speeds up all operations that run the progress bar with
overly-fine resolution.
diff --git a/gnucash/gnome-utils/gnc-splash.c b/gnucash/gnome-utils/gnc-splash.c
index efee10df6..9d4f4a5ac 100644
--- a/gnucash/gnome-utils/gnc-splash.c
+++ b/gnucash/gnome-utils/gnc-splash.c
@@ -24,6 +24,7 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
+#include <math.h>
#include "gnc-gnome-utils.h"
#include "gnc-splash.h"
@@ -168,13 +169,19 @@ gnc_update_splash_screen (const gchar *string, double percentage)
}
}
- if (progress_bar)
+ if (progress_bar )
{
- if (percentage < 0)
+ double curr_fraction =
+ round(gtk_progress_bar_get_fraction(GTK_PROGRESS_BAR(progress_bar)) * 100.0);
+ if (percentage >= 0 && percentage <= 100.0 &&
+ round(percentage) == curr_fraction)
+ return; // No change so don't wast time running the main loop
+
+ if (percentage <= 0)
{
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress_bar), 0.0);
}
- else
+ else
{
if (percentage <= 100)
{
diff --git a/gnucash/gnome-utils/gnc-window.c b/gnucash/gnome-utils/gnc-window.c
index 2c9dd907b..fecacd4f9 100644
--- a/gnucash/gnome-utils/gnc-window.c
+++ b/gnucash/gnome-utils/gnc-window.c
@@ -25,6 +25,7 @@
#include <config.h>
#include <gtk/gtk.h>
+#include <math.h>
#include "gnc-engine.h"
#include "gnc-plugin-page.h"
@@ -167,6 +168,7 @@ gnc_window_show_progress (const char *message, double percentage)
{
GncWindow *window;
GtkWidget *progressbar;
+ double curr_fraction;
window = progress_bar_hack_window;
if (window == NULL)
@@ -179,6 +181,13 @@ gnc_window_show_progress (const char *message, double percentage)
return;
}
+ curr_fraction =
+ round(gtk_progress_bar_get_fraction(GTK_PROGRESS_BAR(progressbar)) * 100.0);
+
+ if (percentage >= 0 && percentage <= 100 &&
+ round(percentage) == curr_fraction)
+ return; // No change, so don't waste time running the main loop.
+
gnc_update_splash_screen(message, percentage);
if (percentage < 0)
@@ -192,13 +201,13 @@ gnc_window_show_progress (const char *message, double percentage)
{
if (message && *message)
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progressbar), message);
- if ((percentage == 0) &&
+ if ((percentage == 0.0) &&
(GNC_WINDOW_GET_IFACE(window)->ui_set_sensitive != NULL))
GNC_WINDOW_GET_IFACE(window)->ui_set_sensitive(window, FALSE);
- if (percentage <= 100)
+ if (percentage <= 100.0)
{
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbar),
- percentage / 100);
+ percentage / 100.0);
}
else
{
Summary of changes:
gnucash/gnome-utils/gnc-splash.c | 13 ++++++++++---
gnucash/gnome-utils/gnc-window.c | 15 ++++++++++++---
gnucash/register/ledger-core/split-register.c | 2 ++
3 files changed, 24 insertions(+), 6 deletions(-)
More information about the gnucash-changes
mailing list