[Gnucash-changes] r14367 - gnucash/trunk - Use the new mechanism for the account list popups. Fixes #342058.

David Hampton hampton at cvs.gnucash.org
Wed Jun 14 19:34:12 EDT 2006


Author: hampton
Date: 2006-06-14 19:34:10 -0400 (Wed, 14 Jun 2006)
New Revision: 14367
Trac: http://svn.gnucash.org/trac/changeset/14367

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/business/business-ledger/gncEntryLedgerLoad.c
Log:
Use the new mechanism for the account list popups.  Fixes #342058.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-06-14 22:38:38 UTC (rev 14366)
+++ gnucash/trunk/ChangeLog	2006-06-14 23:34:10 UTC (rev 14367)
@@ -1,5 +1,8 @@
 2006-06-14  David Hampton  <hampton at employees.org>
 
+	* src/business/business-ledger/gncEntryLedgerLoad.c: Use the new
+	mechanism for the account list popups.  Fixes #342058.
+
 	* src/import-export/hbci/gnc-hbci-utils.c: HBCI data is already in
 	utf8. Don't recode into the local charset (which may not be utf8).
 

Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedgerLoad.c
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedgerLoad.c	2006-06-14 22:38:38 UTC (rev 14366)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedgerLoad.c	2006-06-14 23:34:10 UTC (rev 14367)
@@ -172,69 +172,16 @@
 /* ===================================================================== */
 /* Splat the account name into the transfer cell combobox menu */
 
-typedef struct {
-  ComboCell *cell;
-  GncEntryLedgerType ledger_type;
-} BCE;
-
-static gpointer
-load_entry_xfer_cell_cb (Account *account, gpointer data)
-{
-  BCE *bce = data;
-  GNCAccountType type;
-  char *name;
-
-  /* Don't add A/R, A/P, Bank, Cash, or Equity accounts */
-  type = xaccAccountGetType (account);
-  if (type == PAYABLE || type == RECEIVABLE ||
-      type == CASH || type == BANK || type == EQUITY)
-  {
-    return NULL;
-  }
-
-  /* If this is an ORDER or INVOICE, then leave out the expenses.
-   * if it's a BILL, then leave out the incomes
-   */
-  switch (bce->ledger_type) 
-  {
-    case GNCENTRY_ORDER_ENTRY:
-    case GNCENTRY_ORDER_VIEWER:
-    case GNCENTRY_INVOICE_ENTRY:
-    case GNCENTRY_INVOICE_VIEWER:
-      if (type == EXPENSE) return NULL;
-      break;
-
-    case GNCENTRY_BILL_ENTRY:
-    case GNCENTRY_BILL_VIEWER:
-    case GNCENTRY_EXPVOUCHER_ENTRY:
-    case GNCENTRY_EXPVOUCHER_VIEWER:
-    case GNCENTRY_NUM_REGISTER_TYPES:
-      if (type == INCOME) return NULL;
-      break;
-  }
-
-  /* Don't add placeholder accounts */
-  if (xaccAccountGetPlaceholder (account)) return NULL;
-
-
-  name = xaccAccountGetFullName (account);
-  if (NULL == name) return NULL;
-  gnc_combo_cell_add_menu_item (bce->cell, name);
-  g_free(name);
-
-  return NULL;
-}
-
 #define EKEY "Expense Business entry quickfill"
 #define IKEY "Income Business entry quickfill"
 
 static void 
 load_xfer_type_cells (GncEntryLedger *ledger)
 {
-  BCE bce;
   AccountGroup *group;
   ComboCell *cell;
   QuickFill *qf=NULL;
+  GtkListStore *store = NULL;
 
   group = gnc_book_get_group (ledger->book);
   if (group == NULL) return;
@@ -251,6 +198,8 @@
     case GNCENTRY_INVOICE_VIEWER:
       qf = gnc_get_shared_account_name_quickfill (group, IKEY, 
                                       skip_expense_acct_cb, NULL);
+      store = gnc_get_shared_account_name_list_store (group, IKEY,
+						      skip_expense_acct_cb, NULL);
       break;
 
     case GNCENTRY_BILL_ENTRY:
@@ -260,26 +209,20 @@
     case GNCENTRY_NUM_REGISTER_TYPES:
       qf = gnc_get_shared_account_name_quickfill (group, EKEY, 
                                       skip_income_acct_cb, NULL);
+      store = gnc_get_shared_account_name_list_store (group, EKEY,
+						      skip_income_acct_cb, NULL);
       break;
   }
 
   cell = (ComboCell *)
     gnc_table_layout_get_cell (ledger->table->layout, ENTRY_IACCT_CELL);
-  gnc_combo_cell_clear_menu (cell);
   gnc_combo_cell_use_quickfill_cache (cell, qf);
+  gnc_combo_cell_use_list_store_cache (cell, store);
 
-  bce.cell = cell;
-  bce.ledger_type = ledger->type;
-  xaccGroupForEachAccount (group, load_entry_xfer_cell_cb, &bce, TRUE);
-
   cell = (ComboCell *)
     gnc_table_layout_get_cell (ledger->table->layout, ENTRY_BACCT_CELL);
-  gnc_combo_cell_clear_menu (cell);
   gnc_combo_cell_use_quickfill_cache (cell, qf);
-
-  bce.cell = cell;
-  bce.ledger_type = ledger->type;
-  xaccGroupForEachAccount (group, load_entry_xfer_cell_cb, &bce, TRUE);
+  gnc_combo_cell_use_list_store_cache (cell, store);
 }
 
 /* ===================================================================== */



More information about the gnucash-changes mailing list