r18540 - gnucash/trunk/src/gnome-utils - Don't show hidden accounts in the transfer dialog. This should be connected to the UI,

Phil Longstaff plongstaff at code.gnucash.org
Wed Dec 30 11:49:30 EST 2009


Author: plongstaff
Date: 2009-12-30 11:49:30 -0500 (Wed, 30 Dec 2009)
New Revision: 18540
Trac: http://svn.gnucash.org/trac/changeset/18540

Modified:
   gnucash/trunk/src/gnome-utils/dialog-transfer.c
Log:
Don't show hidden accounts in the transfer dialog.  This should be connected to the UI,
but my ubuntu has glade 3 which mucks up the .glade files.


Modified: gnucash/trunk/src/gnome-utils/dialog-transfer.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-transfer.c	2009-12-29 21:18:54 UTC (rev 18539)
+++ gnucash/trunk/src/gnome-utils/dialog-transfer.c	2009-12-30 16:49:30 UTC (rev 18540)
@@ -131,6 +131,16 @@
   gpointer transaction_user_data;
 };
 
+/** Structure passed to "filter tree accounts" function to provide it information */
+typedef struct
+{
+	/** Show income/expense accounts in tree */
+    gboolean show_inc_exp;
+
+	/** Show hidden accounts in tree */
+	gboolean show_hidden;
+} AccountTreeFilterInfo;
+
 struct _acct_list_item
 {
   char *acct_full_name;
@@ -439,13 +449,16 @@
 gnc_xfer_dialog_show_inc_exp_visible_cb (Account *account,
 					 gpointer data)
 {
-  GtkCheckButton *show_button;
+  AccountTreeFilterInfo* info;
   GNCAccountType type;
 
-  g_return_val_if_fail (GTK_IS_CHECK_BUTTON (data), FALSE);
+  info = (AccountTreeFilterInfo*)data;
 
-  show_button = GTK_CHECK_BUTTON (data);
-  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (show_button))) {
+  if (!info->show_hidden && xaccAccountIsHidden(account)) {
+      return FALSE;
+  }
+
+  if (info->show_inc_exp) {
     return TRUE;
   }
 
@@ -463,6 +476,7 @@
   GtkWidget *button;
   GtkTreeSelection *selection;
   gboolean  use_accounting_labels;
+  AccountTreeFilterInfo info;
 
   use_accounting_labels = gnc_gconf_get_bool(GCONF_GENERAL,
 					     KEY_ACCOUNTING_LABELS, NULL);
@@ -497,10 +511,13 @@
 
   tree_view = GTK_TREE_VIEW(gnc_tree_view_account_new(FALSE));
   gtk_container_add(GTK_CONTAINER(scroll_win), GTK_WIDGET(tree_view));
+  info.show_inc_exp = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
+  info.show_hidden = FALSE;
   gnc_tree_view_account_set_filter (GNC_TREE_VIEW_ACCOUNT (tree_view),
 				    gnc_xfer_dialog_show_inc_exp_visible_cb,
-				    button, /* user data */
+				    &info,  /* user data */
 				    NULL    /* destroy callback */);
+
  /* Have to force the filter once. Alt is to show income/expense by default. */
   gnc_tree_view_account_refilter (GNC_TREE_VIEW_ACCOUNT (tree_view));
   gtk_widget_show(GTK_WIDGET(tree_view));



More information about the gnucash-changes mailing list