mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-10-13 18:02:00 -05:00
Enhance the quickfill event handler to detect changes in whether an
account should appear in the quickfill. Fixes 334787. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13661 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
1 parent
2cd27a1b6e
commit
79e7cdff57
2 files changed
+27
-14
No files matched your search
@@ -1,5 +1,9 @@
|
||||
2006-03-17 David Hampton <hampton@employees.org>
|
||||
|
||||
* src/gnome-utils/account-quickfill.c: Enhance the quickfill event
|
||||
handler to detect changes in whether an account should appear in
|
||||
the quickfill. Fixes 334787.
|
||||
|
||||
* src/gnome-utils/gnc-file.c:
|
||||
* src/gnome-utils/gnc-main-window.c:
|
||||
* src/engine/gnc-hooks.[ch]: Add a "book saved" hook. Use this to
|
||||
|
||||
@@ -225,6 +225,7 @@ listen_for_account_events (QofEntity *entity, QofEventId event_type,
|
||||
Account *account;
|
||||
GtkTreeIter iter;
|
||||
find_data data;
|
||||
gboolean skip;
|
||||
|
||||
if (0 == (event_type & (QOF_EVENT_MODIFY | QOF_EVENT_ADD | QOF_EVENT_REMOVE)))
|
||||
return;
|
||||
@@ -236,16 +237,6 @@ listen_for_account_events (QofEntity *entity, QofEventId event_type,
|
||||
ENTER("entity %p, event type %x, user data %p, ecent data %p",
|
||||
entity, event_type, user_data, event_data);
|
||||
|
||||
/* Not every new account is eligable for the menu */
|
||||
if (qfb->dont_add_cb)
|
||||
{
|
||||
gboolean skip = (qfb->dont_add_cb) (account, qfb->dont_add_data);
|
||||
if (skip) {
|
||||
LEAVE("skip function matched");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (xaccAccountGetRoot(account) != qfb->group) {
|
||||
LEAVE("root group mismatch");
|
||||
return;
|
||||
@@ -257,8 +248,30 @@ listen_for_account_events (QofEntity *entity, QofEventId event_type,
|
||||
return;
|
||||
}
|
||||
|
||||
/* Does the account exist in the model? */
|
||||
data.account = account;
|
||||
data.found = NULL;
|
||||
gtk_tree_model_foreach(GTK_TREE_MODEL(qfb->list_store),
|
||||
shared_quickfill_find_account, &data);
|
||||
|
||||
/* Should the account exist in the model? */
|
||||
if (qfb->dont_add_cb) {
|
||||
skip = (qfb->dont_add_cb) (account, qfb->dont_add_data);
|
||||
} else {
|
||||
skip = FALSE;
|
||||
}
|
||||
|
||||
/* Synthesize new events to make the following case statement
|
||||
* simpler. */
|
||||
if (event_type == QOF_EVENT_MODIFY) {
|
||||
if (skip && data.found) {
|
||||
DEBUG("existing account now filtered");
|
||||
event_type = QOF_EVENT_REMOVE;
|
||||
} else if (!skip && !data.found) {
|
||||
DEBUG("existing account no longer filtered");
|
||||
event_type = QOF_EVENT_ADD;
|
||||
}
|
||||
}
|
||||
|
||||
switch (event_type) {
|
||||
case QOF_EVENT_MODIFY:
|
||||
@@ -269,8 +282,6 @@ listen_for_account_events (QofEntity *entity, QofEventId event_type,
|
||||
xaccGroupForEachAccount (qfb->group, load_shared_qf_cb, qfb, TRUE);
|
||||
|
||||
/* Update list store */
|
||||
gtk_tree_model_foreach(GTK_TREE_MODEL(qfb->list_store),
|
||||
shared_quickfill_find_account, &data);
|
||||
if (data.found) {
|
||||
if (gtk_tree_model_get_iter(GTK_TREE_MODEL(qfb->list_store),
|
||||
&iter, data.found)) {
|
||||
@@ -290,8 +301,6 @@ listen_for_account_events (QofEntity *entity, QofEventId event_type,
|
||||
xaccGroupForEachAccount (qfb->group, load_shared_qf_cb, qfb, TRUE);
|
||||
|
||||
/* Remove from list store */
|
||||
gtk_tree_model_foreach(GTK_TREE_MODEL(qfb->list_store),
|
||||
shared_quickfill_find_account, &data);
|
||||
if (data.found) {
|
||||
if (gtk_tree_model_get_iter(GTK_TREE_MODEL(qfb->list_store),
|
||||
&iter, data.found)) {
|
||||
|
||||
Reference in new issue
Block a user