gnucash maint: Multiple changes pushed
Christopher Lam
clam at code.gnucash.org
Sun Sep 26 20:56:51 EDT 2021
Updated via https://github.com/Gnucash/gnucash/commit/10c1223d (commit)
via https://github.com/Gnucash/gnucash/commit/cb4d9529 (commit)
via https://github.com/Gnucash/gnucash/commit/8bfcc982 (commit)
via https://github.com/Gnucash/gnucash/commit/d82bb7b8 (commit)
via https://github.com/Gnucash/gnucash/commit/b8c9b1a6 (commit)
from https://github.com/Gnucash/gnucash/commit/2a7566cc (commit)
commit 10c1223df209666538caf0a7050aa726dd9719ac
Merge: 2a7566cc4 cb4d9529d
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Mon Sep 27 08:10:02 2021 +0800
Merge branch 'maint-progress' into maint #1150
commit cb4d9529dcb27bafa18fa5cb98715170974f247b
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sun Sep 26 23:33:33 2021 +0800
[gnc-plugin-page-register] call invoice editor with parent window
diff --git a/gnucash/gnome/gnc-plugin-page-register.c b/gnucash/gnome/gnc-plugin-page-register.c
index ba913dd49..989593cef 100644
--- a/gnucash/gnome/gnc-plugin-page-register.c
+++ b/gnucash/gnome/gnc-plugin-page-register.c
@@ -4733,6 +4733,7 @@ gnc_plugin_page_register_cmd_jump_linked_invoice (GtkAction* action,
SplitRegister* reg;
GncInvoice* invoice;
Transaction *txn;
+ GtkWidget *window;
ENTER ("(action %p, plugin_page %p)", action, plugin_page);
@@ -4741,6 +4742,7 @@ gnc_plugin_page_register_cmd_jump_linked_invoice (GtkAction* action,
reg = gnc_ledger_display_get_split_register (priv->gsr->ledger);
txn = gnc_split_register_get_current_trans (reg);
invoice = invoice_from_split (gnc_split_register_get_current_split (reg));
+ window = GNC_PLUGIN_PAGE(plugin_page)->window;
if (!invoice)
{
@@ -4775,7 +4777,7 @@ gnc_plugin_page_register_cmd_jump_linked_invoice (GtkAction* action,
}
details = g_list_reverse (details);
choice = gnc_choose_radio_option_dialog
- (GNC_PLUGIN_PAGE (plugin_page)->window, _("Select document"),
+ (window, _("Select document"),
_("Several documents are linked with this transaction. \
Please choose one:"), _("Select"), 0, details);
if (choice >= 0)
@@ -4786,7 +4788,10 @@ Please choose one:"), _("Select"), 0, details);
}
if (invoice)
- gnc_ui_invoice_edit (NULL, invoice);
+ {
+ GtkWindow *gtk_window = gnc_window_get_gtk_window (GNC_WINDOW (window));
+ gnc_ui_invoice_edit (gtk_window, invoice);
+ }
LEAVE (" ");
}
commit 8bfcc982ddc7be09fba57238c4b7b7439ec3b703
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Sep 25 19:34:16 2021 +0800
[assistant-stock-split] set parent window properly
without this commit, the assistant-stock-split window will be hidden
if the register is activated.
diff --git a/gnucash/gnome/assistant-stock-split.c b/gnucash/gnome/assistant-stock-split.c
index 7328da94c..5c6b0cd90 100644
--- a/gnucash/gnome/assistant-stock-split.c
+++ b/gnucash/gnome/assistant-stock-split.c
@@ -789,6 +789,7 @@ gnc_stock_split_dialog (GtkWidget *parent, Account * initial)
return;
}
+ gtk_window_set_transient_for (GTK_WINDOW (info->window), GTK_WINDOW(parent));
gtk_widget_show_all (info->window);
gnc_window_adjust_for_screen (GTK_WINDOW(info->window));
diff --git a/gnucash/gnome/gnc-plugin-page-register.c b/gnucash/gnome/gnc-plugin-page-register.c
index 9f0eba207..ba913dd49 100644
--- a/gnucash/gnome/gnc-plugin-page-register.c
+++ b/gnucash/gnome/gnc-plugin-page-register.c
@@ -4563,13 +4563,15 @@ gnc_plugin_page_register_cmd_stock_split (GtkAction* action,
GncPluginPageRegister* page)
{
Account* account;
+ GtkWindow* window;
ENTER ("(action %p, plugin_page %p)", action, page);
g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
account = gnc_plugin_page_register_get_account (page);
- gnc_stock_split_dialog (NULL, account);
+ window = gnc_window_get_gtk_window (GNC_WINDOW (GNC_PLUGIN_PAGE (page)->window));
+ gnc_stock_split_dialog (GTK_WIDGET (window), account);
LEAVE (" ");
}
commit d82bb7b8a221c7cf1649217b26db1396d034cc56
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Sep 25 00:09:47 2021 +0800
[Transaction.c] use is_unset static to denote uncached readonly_reason
tests in 128c8d6f8864790ffe4bba9be2349d991fda4c8c
diff --git a/libgnucash/engine/Transaction.c b/libgnucash/engine/Transaction.c
index 7f12f80a2..489e883b9 100644
--- a/libgnucash/engine/Transaction.c
+++ b/libgnucash/engine/Transaction.c
@@ -274,8 +274,7 @@ gnc_transaction_init(Transaction* trans)
trans->date_posted = 0;
trans->marker = 0;
trans->orig = NULL;
- trans->readonly_reason = NULL;
- trans->reason_cache_valid = FALSE;
+ trans->readonly_reason = (char*) is_unset;
trans->isClosingTxn_cached = -1;
trans->notes = (char*) is_unset;
trans->doclink = (char*) is_unset;
@@ -818,7 +817,8 @@ xaccFreeTransaction (Transaction *trans)
/* free up transaction strings */
CACHE_REMOVE(trans->num);
CACHE_REMOVE(trans->description);
- g_free (trans->readonly_reason);
+ if (trans->readonly_reason != is_unset)
+ g_free (trans->readonly_reason);
if (trans->doclink != is_unset)
g_free (trans->doclink);
if (trans->void_reason != is_unset)
@@ -832,7 +832,6 @@ xaccFreeTransaction (Transaction *trans)
trans->date_entered = 0;
trans->date_posted = 0;
trans->readonly_reason = NULL;
- trans->reason_cache_valid = FALSE;
trans->doclink = NULL;
trans->notes = NULL;
trans->void_reason = NULL;
@@ -2130,9 +2129,9 @@ void xaccTransClearReadOnly (Transaction *trans)
qof_instance_set_dirty(QOF_INSTANCE(trans));
xaccTransCommitEdit(trans);
- g_free (trans->readonly_reason);
+ if (trans->readonly_reason != is_unset)
+ g_free (trans->readonly_reason);
trans->readonly_reason = NULL;
- trans->reason_cache_valid = TRUE;
}
}
@@ -2150,9 +2149,9 @@ xaccTransSetReadOnly (Transaction *trans, const char *reason)
g_value_unset (&v);
xaccTransCommitEdit(trans);
- g_free (trans->readonly_reason);
+ if (trans->readonly_reason != is_unset)
+ g_free (trans->readonly_reason);
trans->readonly_reason = g_strdup (reason);
- trans->reason_cache_valid = TRUE;
}
}
@@ -2570,22 +2569,13 @@ xaccTransGetReadOnly (Transaction *trans)
if (!trans)
return NULL;
- if (!trans->reason_cache_valid)
+ if (trans->readonly_reason == is_unset)
{
GValue v = G_VALUE_INIT;
qof_instance_get_kvp (QOF_INSTANCE(trans), &v, 1, TRANS_READ_ONLY_REASON);
-
- /* Clear possible old cache value first */
- g_free (trans->readonly_reason);
- trans->readonly_reason = NULL;
-
- /* Then set the new one */
- if (G_VALUE_HOLDS_STRING (&v))
- {
- trans->readonly_reason = g_value_dup_string (&v);
- g_value_unset (&v);
- }
- trans->reason_cache_valid = TRUE;
+ trans->readonly_reason = G_VALUE_HOLDS_STRING (&v) ?
+ g_value_dup_string (&v) : NULL;
+ g_value_unset (&v);
}
return trans->readonly_reason;
}
diff --git a/libgnucash/engine/TransactionP.h b/libgnucash/engine/TransactionP.h
index f7c455381..d7b141d0c 100644
--- a/libgnucash/engine/TransactionP.h
+++ b/libgnucash/engine/TransactionP.h
@@ -114,11 +114,9 @@ struct transaction_s
/* The readonly_reason is a string that indicates why a transaction
* is marked as read-only. If NULL, the transaction is read-write.
* This value is stored in kvp, but we cache a copy here for
- * performance reasons. reason_cache_valid indicates whether the
- * cached value is valid.
+ * performance reasons.
*/
char * readonly_reason;
- gboolean reason_cache_valid;
char * doclink;
char * void_reason;
diff --git a/libgnucash/engine/mocks/gmock-Transaction.h b/libgnucash/engine/mocks/gmock-Transaction.h
index 61fc4a4ae..ce82437fa 100644
--- a/libgnucash/engine/mocks/gmock-Transaction.h
+++ b/libgnucash/engine/mocks/gmock-Transaction.h
@@ -33,7 +33,6 @@ public:
marker = 0;
orig = nullptr;
readonly_reason = nullptr;
- reason_cache_valid = FALSE;
isClosingTxn_cached = -1;
}
void* operator new(size_t size)
commit b8c9b1a6ce0e1e4c6740e1de450859b90cbadcec
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Fri Sep 24 21:41:27 2021 +0800
[gnc-plugin-page-register] when reversing reversed txn, offer jump
When reversing a transaction which is already reversed, offer a jump
to the reversal transaction.
diff --git a/gnucash/gnome/gnc-plugin-page-register.c b/gnucash/gnome/gnc-plugin-page-register.c
index 6ed0f4d84..9f0eba207 100644
--- a/gnucash/gnome/gnc-plugin-page-register.c
+++ b/gnucash/gnome/gnc-plugin-page-register.c
@@ -4072,13 +4072,6 @@ gnc_plugin_page_register_cmd_reverse_transaction (GtkAction* action,
if (trans == NULL)
return;
- if (xaccTransGetReversedBy (trans))
- {
- gnc_error_dialog (GTK_WINDOW (window), "%s",
- _ ("A reversing entry has already been created for this transaction."));
- return;
- }
-
split = gnc_split_register_get_current_split (reg);
account = xaccSplitGetAccount (split);
@@ -4088,6 +4081,17 @@ gnc_plugin_page_register_cmd_reverse_transaction (GtkAction* action,
return;
}
+ new_trans = xaccTransGetReversedBy (trans);
+ if (new_trans)
+ {
+ const char *rev = _("A reversing entry has already been created for this transaction.");
+ const char *jump = _("Jump to the transaction?");
+ if (gnc_verify_dialog (GTK_WINDOW (window), TRUE, "%s\n\n%s", rev, jump))
+ goto jump_to_trans;
+ else
+ return;
+ }
+
if (!gnc_dup_time64_dialog (window, _("Reverse Transaction"),
_("New Transaction Information"), &date))
{
@@ -4104,6 +4108,7 @@ gnc_plugin_page_register_cmd_reverse_transaction (GtkAction* action,
gnc_resume_gui_refresh();
+ jump_to_trans:
/* Now jump to new trans */
gsr = gnc_plugin_page_register_get_gsr (GNC_PLUGIN_PAGE (page));
split = xaccTransFindSplitByAccount(new_trans, account);
Summary of changes:
gnucash/gnome/assistant-stock-split.c | 1 +
gnucash/gnome/gnc-plugin-page-register.c | 32 ++++++++++++++++++++---------
libgnucash/engine/Transaction.c | 32 ++++++++++-------------------
libgnucash/engine/TransactionP.h | 4 +---
libgnucash/engine/mocks/gmock-Transaction.h | 1 -
5 files changed, 35 insertions(+), 35 deletions(-)
More information about the gnucash-changes
mailing list