[Gnucash-changes] r13785 - gnucash/trunk - Add a per-account
"hidden" flag, and update the accounts page and the
David Hampton
hampton at cvs.gnucash.org
Fri Apr 14 23:52:45 EDT 2006
Author: hampton
Date: 2006-04-14 23:52:44 -0400 (Fri, 14 Apr 2006)
New Revision: 13785
Trac: http://svn.gnucash.org/trac/changeset/13785
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/src/engine/Account.c
gnucash/trunk/src/engine/Account.h
gnucash/trunk/src/gnome-utils/dialog-account.c
gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c
gnucash/trunk/src/gnome-utils/gnc-tree-view-account.h
gnucash/trunk/src/gnome/glade/account.glade
gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c
gnucash/trunk/src/gnome/gnc-plugin-page-budget.c
gnucash/trunk/src/register/ledger-core/split-register-load.c
Log:
Add a per-account "hidden" flag, and update the accounts page and the
account quickfill to respect this flag. Also flip the "hide zero
balance" flag to a "show zero balance" flag for symmetry. Implements
87077.
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2006-04-15 00:14:19 UTC (rev 13784)
+++ gnucash/trunk/ChangeLog 2006-04-15 03:52:44 UTC (rev 13785)
@@ -1,5 +1,16 @@
2006-04-14 David Hampton <hampton at employees.org>
+ * src/register/ledger-core/split-register-load.c:
+ * src/gnome-utils/gnc-tree-view-account.[ch]:
+ * src/gnome-utils/dialog-account.c:
+ * src/gnome/gnc-plugin-page-account-tree.c:
+ * src/gnome/glade/account.glade:
+ * src/gnome/gnc-plugin-page-budget.c:
+ * src/engine/Account.[ch]: Add a per-account "hidden" flag, and
+ update the accounts page and the account quickfill to respect this
+ flag. Also flip the "hide zero balance" flag to a "show zero
+ balance" flag for symmetry. Implements 87077.
+
* src/gnome/gnc-plugin-page-account-tree.c: Allow the account tree
view callback to run in addition the the page callback. Fixes
303995.
Modified: gnucash/trunk/src/engine/Account.c
===================================================================
--- gnucash/trunk/src/engine/Account.c 2006-04-15 00:14:19 UTC (rev 13784)
+++ gnucash/trunk/src/engine/Account.c 2006-04-15 03:52:44 UTC (rev 13785)
@@ -1961,6 +1961,45 @@
\********************************************************************/
gboolean
+xaccAccountGetHidden (const Account *acc)
+{
+ char *str;
+ if (!acc) return FALSE;
+
+ str = kvp_frame_get_string(acc->inst.kvp_data, "hidden");
+ return (str && !strcmp(str, "true"));
+}
+
+void
+xaccAccountSetHidden (Account *acc, gboolean val)
+{
+ if (!acc) return;
+
+ kvp_frame_set_string (acc->inst.kvp_data, "hidden",
+ val ? "true" : NULL);
+ mark_account (acc);
+ xaccAccountCommitEdit (acc);
+}
+
+gboolean
+xaccAccountIsHidden (const Account *acc)
+{
+ if (!acc)
+ return FALSE;
+ if (xaccAccountGetHidden(acc))
+ return TRUE;
+
+ while ((acc = xaccAccountGetParentAccount(acc)) != NULL) {
+ if (xaccAccountGetHidden(acc))
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/********************************************************************\
+\********************************************************************/
+
+gboolean
xaccAccountHasAncestor (const Account *acc, const Account * ancestor)
{
const Account *parent = acc;
Modified: gnucash/trunk/src/engine/Account.h
===================================================================
--- gnucash/trunk/src/engine/Account.h 2006-04-15 00:14:19 UTC (rev 13784)
+++ gnucash/trunk/src/engine/Account.h 2006-04-15 03:52:44 UTC (rev 13785)
@@ -673,9 +673,21 @@
/** @name Account Placeholder flag
@{
*/
-/** DOCUMENT ME! */
+
+/** Get the "placeholder" flag for an account. If this flag is set
+ * then the account may not be modified by the user.
+ *
+ * @param acc The account whose flag should be retrieved.
+ *
+ * @return The current state of the account's "placeholder" flag. */
gboolean xaccAccountGetPlaceholder (const Account *account);
-/** DOCUMENT ME! */
+
+/** Set the "placeholder" flag for an account. If this flag is set
+ * then the account may not be modified by the user.
+ *
+ * @param acc The account whose flag should be retrieved.
+ *
+ * @param val The new state for the account's "placeholder" flag. */
void xaccAccountSetPlaceholder (Account *account, gboolean option);
/** Returns PLACEHOLDER_NONE if account is NULL or neither account nor
@@ -686,7 +698,40 @@
GNCPlaceholderType xaccAccountGetDescendantPlaceholder(const Account *account);
/** @} */
+/** @name Account Hidden flag
+ @{
+*/
+/** Get the "hidden" flag for an account. If this flag is set then
+ * the account (and any children) will be hidden from the user unless
+ * they explicitly ask to see them.
+ *
+ * @param acc The account whose flag should be retrieved.
+ *
+ * @return The current state of the account's "hidden" flag. */
+gboolean xaccAccountGetHidden (const Account *acc);
+
+/** Set the "hidden" flag for an account. If this flag is set then
+ * the account (and any children) will be hidden from the user unless
+ * they explicitly ask to see them.
+ *
+ * @param acc The account whose flag should be retrieved.
+ *
+ * @param val The new state for the account's "hidden" flag. */
+void xaccAccountSetHidden (Account *acc, gboolean val);
+
+/** Should this account be "hidden". If this flag is set for this
+ * account (or any parent account) then the account should be hidden
+ * from the user unless they explicitly ask to see it. This function
+ * is different from the xaccAccountGetHidden() function because it
+ * checks the flag in parent accounts in addition to this account.
+ *
+ * @param acc The account whose flag should be retrieved.
+ *
+ * @return Whether or not this account should be "hidden". */
+gboolean xaccAccountIsHidden (const Account *acc);
+/** @} */
+
/** @name Account Tax related getters/setters
@{
*/
Modified: gnucash/trunk/src/gnome/glade/account.glade
===================================================================
--- gnucash/trunk/src/gnome/glade/account.glade 2006-04-15 00:14:19 UTC (rev 13784)
+++ gnucash/trunk/src/gnome/glade/account.glade 2006-04-15 03:52:44 UTC (rev 13785)
@@ -188,28 +188,6 @@
</child>
<child>
- <widget class="GtkEntry" id="name_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="has_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">*</property>
- <property name="activates_default">True</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
<widget class="GtkLabel" id="label">
<property name="visible">True</property>
<property name="label" translatable="yes">_Account code:</property>
@@ -235,27 +213,6 @@
</child>
<child>
- <widget class="GtkEntry" id="code_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">*</property>
- <property name="activates_default">True</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
<widget class="GtkLabel" id="label">
<property name="visible">True</property>
<property name="label" translatable="yes">_Description:</property>
@@ -281,27 +238,6 @@
</child>
<child>
- <widget class="GtkEntry" id="description_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">*</property>
- <property name="activates_default">True</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
<widget class="GtkLabel" id="commodity_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Co_mmodity:</property>
@@ -371,6 +307,161 @@
</child>
<child>
+ <widget class="GtkLabel" id="label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">No_tes:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">notes_text</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="tax_related_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Ta_x related</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="placeholder_button">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">This account is present solely as a placeholder in the hierarchy. Transactions may not be posted to this account, only to sub-accounts of this account.</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Placeholde_r</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="hidden_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">H_idden</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="name_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char">*</property>
+ <property name="activates_default">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="code_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char">*</property>
+ <property name="activates_default">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="description_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char">*</property>
+ <property name="activates_default">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
<widget class="GtkOptionMenu" id="account_scu">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Smallest fraction of this commodity that can be referenced.</property>
@@ -494,76 +585,6 @@
<property name="y_options">fill</property>
</packing>
</child>
-
- <child>
- <widget class="GtkLabel" id="label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">No_tes:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">notes_text</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="placeholder_button">
- <property name="visible">True</property>
- <property name="tooltip" translatable="yes">This account is present solely as a placeholder in the hierarchy. Transactions may not be posted to this account, only to sub-accounts of this account.</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Placeholde_r</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">2</property>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="tax_related_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Ta_x related</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">2</property>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -3092,18 +3113,17 @@
<property name="spacing">0</property>
<child>
- <widget class="GtkCheckButton" id="hide_zero">
+ <widget class="GtkCheckButton" id="show_hidden">
<property name="visible">True</property>
- <property name="tooltip" translatable="yes">Hide accounts which have a zero total value.</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">Hide _zero totals</property>
+ <property name="label" translatable="yes">Show _hidden accounts</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
- <signal name="toggled" handler="gppat_filter_hide_zero_toggled_cb" last_modification_time="Fri, 30 Dec 2005 01:58:04 GMT"/>
+ <signal name="toggled" handler="gppat_filter_show_hidden_toggled_cb" last_modification_time="Sat, 15 Apr 2006 02:28:03 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
@@ -3113,7 +3133,24 @@
</child>
<child>
- <placeholder/>
+ <widget class="GtkCheckButton" id="show_zero">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Hide accounts which have a zero total value.</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Show _zero total accounts</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="gppat_filter_show_zero_toggled_cb" last_modification_time="Sat, 15 Apr 2006 02:27:08 GMT"/>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
</child>
<child>
@@ -3129,7 +3166,7 @@
<child>
<widget class="GtkLabel" id="Balance">
<property name="visible">True</property>
- <property name="label" translatable="yes">Balances</property>
+ <property name="label" translatable="yes">Other</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
Modified: gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c 2006-04-15 00:14:19 UTC (rev 13784)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c 2006-04-15 03:52:44 UTC (rev 13785)
@@ -323,7 +323,8 @@
/* Visisble types */
priv->fd.visible_types = -1; /* Start with all types */
- priv->fd.hide_zero_total = FALSE;
+ priv->fd.show_hidden = FALSE;
+ priv->fd.show_zero_total = TRUE;
LEAVE("page %p, priv %p, action group %p",
plugin_page, priv, action_group);
Modified: gnucash/trunk/src/gnome/gnc-plugin-page-budget.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-budget.c 2006-04-15 00:14:19 UTC (rev 13784)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-budget.c 2006-04-15 03:52:44 UTC (rev 13785)
@@ -294,7 +294,8 @@
/* Visisble types */
priv->fd.visible_types = -1; /* Start with all types */
- priv->fd.hide_zero_total = FALSE;
+ priv->fd.show_hidden = TRUE;
+ priv->fd.show_zero_total = TRUE;
priv->sigFigs = 1;
recurrenceSet(&priv->r, 1, PERIOD_MONTH, NULL);
Modified: gnucash/trunk/src/gnome-utils/dialog-account.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-account.c 2006-04-15 00:14:19 UTC (rev 13784)
+++ gnucash/trunk/src/gnome-utils/dialog-account.c 2006-04-15 03:52:44 UTC (rev 13785)
@@ -101,6 +101,7 @@
GtkWidget * tax_related_button;
GtkWidget * placeholder_button;
+ GtkWidget * hidden_button;
gint component_id;
} AccountWindow;
@@ -180,7 +181,7 @@
Account *account;
gnc_commodity * commodity;
const char *string;
- gboolean tax_related, placeholder, nonstd_scu;
+ gboolean flag, nonstd_scu;
gint index;
ENTER("%p", aw);
@@ -221,14 +222,18 @@
gtk_text_buffer_set_text (aw->notes_text_buffer, string, strlen(string));
- tax_related = xaccAccountGetTaxRelated (account);
+ flag = xaccAccountGetTaxRelated (account);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (aw->tax_related_button),
- tax_related);
+ flag);
- placeholder = xaccAccountGetPlaceholder (account);
+ flag = xaccAccountGetPlaceholder (account);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (aw->placeholder_button),
- placeholder);
+ flag);
+ flag = xaccAccountGetHidden (account);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (aw->hidden_button),
+ flag);
+
gtk_tree_view_collapse_all (aw->parent_tree);
gnc_tree_view_account_set_selected_account (GNC_TREE_VIEW_ACCOUNT(aw->parent_tree), account);
LEAVE(" ");
@@ -295,7 +300,7 @@
Account *parent_account;
const char *old_string;
const char *string;
- gboolean tax_related, placeholder;
+ gboolean flag;
gnc_numeric balance;
gboolean use_equity, nonstd;
time_t date;
@@ -353,14 +358,18 @@
if (safe_strcmp (string, old_string) != 0)
xaccAccountSetNotes (account, string);
- tax_related =
+ flag =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (aw->tax_related_button));
- xaccAccountSetTaxRelated (account, tax_related);
+ xaccAccountSetTaxRelated (account, flag);
- placeholder =
+ flag =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (aw->placeholder_button));
- xaccAccountSetPlaceholder (account, placeholder);
+ xaccAccountSetPlaceholder (account, flag);
+ flag =
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (aw->hidden_button));
+ xaccAccountSetHidden (account, flag);
+
parent_account = gnc_tree_view_account_get_selected_account (GNC_TREE_VIEW_ACCOUNT (aw->parent_tree));
if (parent_account == aw->top_level_account)
parent_account = NULL;
@@ -1288,6 +1297,7 @@
aw->tax_related_button = glade_xml_get_widget (xml, "tax_related_button");
aw->placeholder_button = glade_xml_get_widget (xml, "placeholder_button");
+ aw->hidden_button = glade_xml_get_widget (xml, "hidden_button");
box = glade_xml_get_widget (xml, "opening_balance_box");
amount = gnc_amount_edit_new ();
Modified: gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c 2006-04-15 00:14:19 UTC (rev 13784)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c 2006-04-15 03:52:44 UTC (rev 13785)
@@ -1613,7 +1613,12 @@
ENTER("account %p:%s", account, xaccAccountGetName(account));
- if (fd->hide_zero_total) {
+ if (!fd->show_hidden && xaccAccountIsHidden (account)) {
+ LEAVE(" hide: hidden");
+ return FALSE;
+ }
+
+ if (!fd->show_zero_total) {
total = xaccAccountGetBalanceInCurrency (account, NULL, TRUE);
if (gnc_numeric_zero_p(total)) {
LEAVE(" hide: zero balance");
@@ -1627,22 +1632,40 @@
return result;
}
-/** The "hide zero totals" button in the Filter dialog changed state.
+/** The "show hidden" button in the Filter dialog changed state.
* Update the page to reflect these changes.
*
* @param button The GtkCheckButton that was toggled.
*
* @param fd A pointer to the account filter dialog struct. */
void
-gppat_filter_hide_zero_toggled_cb (GtkToggleButton *button,
+gppat_filter_show_hidden_toggled_cb (GtkToggleButton *button,
+ AccountFilterDialog *fd)
+{
+ g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
+
+ ENTER("button %p", button);
+ fd->show_hidden = gtk_toggle_button_get_active(button);
+ gnc_tree_view_account_refilter(fd->tree_view);
+ LEAVE("show_hidden %d", fd->show_hidden);
+}
+
+/** The "show zero totals" button in the Filter dialog changed state.
+ * Update the page to reflect these changes.
+ *
+ * @param button The GtkCheckButton that was toggled.
+ *
+ * @param fd A pointer to the account filter dialog struct. */
+void
+gppat_filter_show_zero_toggled_cb (GtkToggleButton *button,
AccountFilterDialog *fd)
{
g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
ENTER("button %p", button);
- fd->hide_zero_total = gtk_toggle_button_get_active(button);
+ fd->show_zero_total = gtk_toggle_button_get_active(button);
gnc_tree_view_account_refilter(fd->tree_view);
- LEAVE("hide_zero %d", fd->hide_zero_total);
+ LEAVE("show_zero %d", fd->show_zero_total);
}
/** The "clear all account types" button in the Filter dialog was
@@ -1779,7 +1802,8 @@
if (response != GTK_RESPONSE_OK) {
fd->visible_types = fd->original_visible_types;
- fd->hide_zero_total = fd->original_hide_zero_total;
+ fd->show_hidden = fd->original_show_hidden;
+ fd->show_zero_total = fd->original_show_zero_total;
gnc_tree_view_account_refilter(fd->tree_view);
}
@@ -1823,12 +1847,16 @@
/* Remember current state */
fd->original_visible_types = fd->visible_types;
- fd->original_hide_zero_total = fd->hide_zero_total;
+ fd->original_show_hidden = fd->show_hidden;
+ fd->original_show_zero_total = fd->show_zero_total;
/* Update the dialog widgets for the current state */
- button = glade_xml_get_widget (xml, "hide_zero");
+ button = glade_xml_get_widget (xml, "show_hidden");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),
- fd->hide_zero_total);
+ fd->show_hidden);
+ button = glade_xml_get_widget (xml, "show_zero");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),
+ fd->show_zero_total);
/* Set up the tree view and model */
view = GTK_TREE_VIEW(glade_xml_get_widget (xml, FILTER_TREE_VIEW));
@@ -1864,7 +1892,8 @@
#define ACCT_COUNT "Number of Open Accounts"
#define ACCT_OPEN "Open Account %d"
#define ACCT_SELECTED "Selected Account"
-#define HIDE_ZERO "Hide Zero Total"
+#define SHOW_HIDDEN "Show Hidden"
+#define SHOW_ZERO "Show Zero Total"
#define ACCT_TYPES "Account Types"
typedef struct foo {
@@ -1955,8 +1984,10 @@
g_key_file_set_integer(key_file, group_name, ACCT_TYPES,
fd->visible_types);
- g_key_file_set_boolean(key_file, group_name, HIDE_ZERO,
- fd->hide_zero_total);
+ g_key_file_set_boolean(key_file, group_name, SHOW_HIDDEN,
+ fd->show_hidden);
+ g_key_file_set_boolean(key_file, group_name, SHOW_ZERO,
+ fd->show_zero_total);
bar.key_file = key_file;
bar.group_name = group_name;
@@ -2021,19 +2052,29 @@
GError *error = NULL;
gchar *key, *value;
gint i, count;
- gboolean hide;
+ gboolean show;
/* Filter information. Ignore missing keys. */
- hide = g_key_file_get_boolean(key_file, group_name, HIDE_ZERO, &error);
+ show = g_key_file_get_boolean(key_file, group_name, SHOW_HIDDEN, &error);
if (error) {
g_warning("error reading group %s key %s: %s",
- group_name, HIDE_ZERO, error->message);
+ group_name, SHOW_HIDDEN, error->message);
g_error_free(error);
error = NULL;
- hide = FALSE;
+ show = TRUE;
}
- fd->hide_zero_total = hide;
+ fd->show_hidden = show;
+ show = g_key_file_get_boolean(key_file, group_name, SHOW_ZERO, &error);
+ if (error) {
+ g_warning("error reading group %s key %s: %s",
+ group_name, SHOW_ZERO, error->message);
+ g_error_free(error);
+ error = NULL;
+ show = TRUE;
+ }
+ fd->show_zero_total = show;
+
i = g_key_file_get_integer(key_file, group_name, ACCT_TYPES, &error);
if (error) {
g_warning("error reading group %s key %s: %s",
Modified: gnucash/trunk/src/gnome-utils/gnc-tree-view-account.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-view-account.h 2006-04-15 00:14:19 UTC (rev 13784)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-view-account.h 2006-04-15 03:52:44 UTC (rev 13785)
@@ -78,8 +78,10 @@
GncTreeViewAccount *tree_view;
guint32 visible_types;
guint32 original_visible_types;
- gboolean hide_zero_total;
- gboolean original_hide_zero_total;
+ gboolean show_hidden;
+ gboolean original_show_hidden;
+ gboolean show_zero_total;
+ gboolean original_show_zero_total;
} AccountFilterDialog;
void account_filter_dialog_create(AccountFilterDialog *fd,
@@ -89,7 +91,9 @@
gpointer user_data);
/* "Filter By" dialog callbacks */
-void gppat_filter_hide_zero_toggled_cb (GtkToggleButton *togglebutton,
+void gppat_filter_show_hidden_toggled_cb (GtkToggleButton *togglebutton,
+ AccountFilterDialog *fd);
+void gppat_filter_show_zero_toggled_cb (GtkToggleButton *togglebutton,
AccountFilterDialog *fd);
void gppat_filter_clear_all_cb (GtkWidget *button, AccountFilterDialog *fd);
void gppat_filter_select_all_cb (GtkWidget *button, AccountFilterDialog *fd);
Modified: gnucash/trunk/src/register/ledger-core/split-register-load.c
===================================================================
--- gnucash/trunk/src/register/ledger-core/split-register-load.c 2006-04-15 00:14:19 UTC (rev 13784)
+++ gnucash/trunk/src/register/ledger-core/split-register-load.c 2006-04-15 03:52:44 UTC (rev 13785)
@@ -556,6 +556,8 @@
static gboolean
skip_cb (Account *account, gpointer x)
{
+ if (xaccAccountIsHidden(account))
+ return TRUE;
return xaccAccountGetPlaceholder (account);
}
More information about the gnucash-changes
mailing list