GnuCash 2.4.99
split-register-load.c
00001 /********************************************************************\
00002  * split-register-load.c -- split register loading code             *
00003  * Copyright (C) 1998-2000 Linas Vepstas <linas@linas.org>          *
00004  * Copyright (C) 2000 Dave Peticolas                                *
00005  *                                                                  *
00006  * This program is free software; you can redistribute it and/or    *
00007  * modify it under the terms of the GNU General Public License as   *
00008  * published by the Free Software Foundation; either version 2 of   *
00009  * the License, or (at your option) any later version.              *
00010  *                                                                  *
00011  * This program is distributed in the hope that it will be useful,  *
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
00014  * GNU General Public License for more details.                     *
00015  *                                                                  *
00016  * You should have received a copy of the GNU General Public License*
00017  * along with this program; if not, contact:                        *
00018  *                                                                  *
00019  * Free Software Foundation           Voice:  +1-617-542-5942       *
00020  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
00021  * Boston, MA  02110-1301,  USA       gnu@gnu.org                   *
00022  *                                                                  *
00023 \********************************************************************/
00024 
00025 #include "config.h"
00026 
00027 #include <glib/gi18n.h>
00028 
00029 #include "account-quickfill.h"
00030 #include "combocell.h"
00031 #include "gnc-component-manager.h"
00032 #include "qof.h"
00033 #include "gnc-ui-util.h"
00034 #include "gnc-gui-query.h"
00035 #include "numcell.h"
00036 #include "quickfillcell.h"
00037 #include "recncell.h"
00038 #include "split-register.h"
00039 #include "split-register-p.h"
00040 
00041 
00042 /* This static indicates the debugging module that this .o belongs to. */
00043 static QofLogModule log_module = GNC_MOD_LEDGER;
00044 
00045 
00046 static void gnc_split_register_load_xfer_cells (SplitRegister *reg,
00047         Account *base_account);
00048 
00049 static void
00050 gnc_split_register_load_recn_cells (SplitRegister *reg)
00051 {
00052     RecnCell *cell;
00053     const char * s;
00054 
00055     if (!reg) return;
00056 
00057     cell = (RecnCell *)
00058            gnc_table_layout_get_cell (reg->table->layout, RECN_CELL);
00059 
00060     if (!cell) return;
00061 
00062     s = gnc_get_reconcile_valid_flags ();
00063     gnc_recn_cell_set_valid_flags (cell, s, *s);
00064     gnc_recn_cell_set_flag_order (cell, gnc_get_reconcile_flag_order ());
00065     gnc_recn_cell_set_string_getter (cell, gnc_get_reconcile_str);
00066 }
00067 
00068 static void
00069 gnc_split_register_load_type_cells (SplitRegister *reg)
00070 {
00071     RecnCell *cell;
00072 
00073     if (!reg) return;
00074 
00075     cell = (RecnCell *)
00076            gnc_table_layout_get_cell (reg->table->layout, TYPE_CELL);
00077 
00078     if (!cell) return;
00079 
00080     /* FIXME: These should get moved to an i18n function */
00081     gnc_recn_cell_set_valid_flags (cell, "IP?", 'I');
00082     gnc_recn_cell_set_flag_order (cell, "IP");
00083 }
00084 
00147 static void
00148 gnc_split_register_add_transaction (SplitRegister *reg,
00149                                     Transaction *trans,
00150                                     Split *split,
00151                                     CellBlock *lead_cursor,
00152                                     CellBlock *split_cursor,
00153                                     gboolean visible_splits,
00154                                     gboolean start_primary_color,
00155                                     gboolean add_empty,
00156                                     Transaction *find_trans,
00157                                     Split *find_split,
00158                                     CursorClass find_class,
00159                                     int *new_split_row,
00160                                     VirtualCellLocation *vcell_loc)
00161 {
00162     GList *node;
00163 
00164     g_return_if_fail(reg);
00165     g_return_if_fail(vcell_loc);
00166 
00167     if (split == find_split)
00168         *new_split_row = vcell_loc->virt_row;
00169 
00170     /* Set the "leading" virtual cell. */
00171     gnc_table_set_vcell (reg->table, lead_cursor, xaccSplitGetGUID (split),
00172                          TRUE, start_primary_color, *vcell_loc);
00173     vcell_loc->virt_row++;
00174 
00175     /* Continue setting up virtual cells in a column, using a row for each
00176      * split in the transaction. */
00177     for (node = xaccTransGetSplitList (trans); node; node = node->next)
00178     {
00179         Split *secondary = node->data;
00180 
00181         if (!xaccTransStillHasSplit(trans, secondary)) continue;
00182         if (secondary == find_split && find_class == CURSOR_CLASS_SPLIT)
00183             *new_split_row = vcell_loc->virt_row;
00184 
00185         gnc_table_set_vcell (reg->table, split_cursor,
00186                              xaccSplitGetGUID (secondary),
00187                              visible_splits, TRUE, *vcell_loc);
00188         vcell_loc->virt_row++;
00189     }
00190 
00191     /* If requested, add an empty split row at the end. */
00192     if (add_empty)
00193     {
00194         if (find_trans == trans && find_split == NULL &&
00195                 find_class == CURSOR_CLASS_SPLIT)
00196             *new_split_row = vcell_loc->virt_row;
00197 
00198         gnc_table_set_vcell(reg->table, split_cursor, xaccSplitGetGUID(NULL),
00199                             FALSE, TRUE, *vcell_loc);
00200         vcell_loc->virt_row++;
00201     }
00202 }
00203 
00204 static gint
00205 _find_split_with_parent_txn(gconstpointer a, gconstpointer b)
00206 {
00207     Split *split = (Split*)a;
00208     Transaction *txn = (Transaction*)b;
00209 
00210     return xaccSplitGetParent(split) == txn ? 0 : 1;
00211 }
00212 
00213 static void add_quickfill_completions(TableLayout *layout, Transaction *trans,
00214                                       gboolean has_last_num)
00215 {
00216     Split *s;
00217     int i = 0;
00218 
00219     gnc_quickfill_cell_add_completion(
00220         (QuickFillCell *) gnc_table_layout_get_cell(layout, DESC_CELL),
00221         xaccTransGetDescription(trans));
00222 
00223     gnc_quickfill_cell_add_completion(
00224         (QuickFillCell *) gnc_table_layout_get_cell(layout, NOTES_CELL),
00225         xaccTransGetNotes(trans));
00226 
00227     if (!has_last_num)
00228         gnc_num_cell_set_last_num(
00229             (NumCell *) gnc_table_layout_get_cell(layout, NUM_CELL),
00230             xaccTransGetNum(trans));
00231 
00232     while ((s = xaccTransGetSplit(trans, i)) != NULL)
00233     {
00234         gnc_quickfill_cell_add_completion(
00235             (QuickFillCell *) gnc_table_layout_get_cell(layout, MEMO_CELL),
00236             xaccSplitGetMemo(s));
00237         i++;
00238     }
00239 }
00240 
00241 void
00242 gnc_split_register_load (SplitRegister *reg, GList * slist,
00243                          Account *default_account)
00244 {
00245     SRInfo *info;
00246     Transaction *pending_trans;
00247     CursorBuffer *cursor_buffer;
00248     GHashTable *trans_table = NULL;
00249     CellBlock *cursor_header;
00250     CellBlock *lead_cursor;
00251     CellBlock *split_cursor;
00252     Transaction *blank_trans;
00253     Transaction *find_trans;
00254     Transaction *trans;
00255     CursorClass find_class;
00256     Split *find_trans_split;
00257     Split *blank_split;
00258     Split *find_split;
00259     Split *split;
00260     Table *table;
00261     GList *node;
00262 
00263     gboolean start_primary_color = TRUE;
00264     gboolean found_pending = FALSE;
00265     gboolean need_divider_upper = FALSE;
00266     gboolean found_divider_upper = FALSE;
00267     gboolean found_divider = FALSE;
00268     gboolean has_last_num = FALSE;
00269     gboolean multi_line;
00270     gboolean dynamic;
00271     gboolean we_own_slist = FALSE;
00272     gboolean use_autoreadonly = qof_book_uses_autoreadonly(gnc_get_current_book());
00273 
00274     VirtualCellLocation vcell_loc;
00275     VirtualLocation save_loc;
00276 
00277     int new_trans_split_row = -1;
00278     int new_trans_row = -1;
00279     int new_split_row = -1;
00280     time_t present, autoreadonly_time = 0;
00281 
00282     g_return_if_fail(reg);
00283     table = reg->table;
00284     g_return_if_fail(table);
00285     info = gnc_split_register_get_info (reg);
00286     g_return_if_fail(info);
00287 
00288     ENTER("reg=%p, slist=%p, default_account=%p", reg, slist, default_account);
00289 
00290     blank_split = xaccSplitLookup (&info->blank_split_guid,
00291                                    gnc_get_current_book ());
00292 
00293     pending_trans = xaccTransLookup (&info->pending_trans_guid,
00294                                      gnc_get_current_book ());
00295 
00296     /* make sure we have a blank split */
00297     if (blank_split == NULL)
00298     {
00299         Transaction *new_trans;
00300         gnc_commodity * currency = NULL;
00301 
00302         /* Determine the proper currency to use for this transaction.
00303          * if default_account != NULL and default_account->commodity is
00304          * a currency, then use that.  Otherwise use the default currency.
00305          */
00306         if (default_account != NULL)
00307         {
00308             gnc_commodity * commodity = xaccAccountGetCommodity (default_account);
00309             if (gnc_commodity_is_currency(commodity))
00310                 currency = commodity;
00311             else
00312             {
00313                 Account *parent_account = default_account;
00314                 /* Account commodity is not a currency, walk up the tree until
00315                  * we find a parent account that is a currency account and use
00316                  * it's currency.
00317                  */
00318                 do
00319                 {
00320                     parent_account = gnc_account_get_parent (parent_account);
00321                     if (parent_account)
00322                     {
00323                         commodity = xaccAccountGetCommodity (parent_account);
00324                         if (gnc_commodity_is_currency(commodity))
00325                         {
00326                             currency = commodity;
00327                             break;
00328                         }
00329                     }
00330                 }
00331                 while (parent_account && !currency);
00332             }
00333 
00334             /* If we don't have a currency then pop up a warning dialog */
00335             if (!currency)
00336             {
00337                 gnc_info_dialog(NULL, "%s",
00338                                 _("Could not determine the account currency.  "
00339                                   "Using the default currency provided by your system."));
00340             }
00341         }
00342 
00343         gnc_suspend_gui_refresh ();
00344 
00345         new_trans = xaccMallocTransaction (gnc_get_current_book ());
00346 
00347         xaccTransBeginEdit (new_trans);
00348         xaccTransSetCurrency (new_trans,
00349                               currency ? currency : gnc_default_currency());
00350         xaccTransSetDatePostedSecs (new_trans, info->last_date_entered);
00351         blank_split = xaccMallocSplit (gnc_get_current_book ());
00352         xaccSplitSetParent(blank_split, new_trans);
00353         /* We don't want to commit this transaction yet, because the split
00354            doesn't even belong to an account yet.  But, we don't want to
00355            set this transaction as the pending transaction either, because
00356            we want to pretend that it hasn't been changed.  We depend on
00357            some other code (somewhere) to commit this transaction if we
00358            really edit it, even though it's not marked as the pending
00359            transaction. */
00360 
00361         /* Wouldn't it be a bug to open this transaction if there was already a
00362            pending transaction? */
00363         g_assert(pending_trans == NULL);
00364 
00365         info->blank_split_guid = *xaccSplitGetGUID (blank_split);
00366         info->blank_split_edited = FALSE;
00367         DEBUG("created new blank_split=%p", blank_split);
00368 
00369         gnc_resume_gui_refresh ();
00370     }
00371 
00372     blank_trans = xaccSplitGetParent (blank_split);
00373 
00374     DEBUG("blank_split=%p, blank_trans=%p, pending_trans=%p",
00375           blank_split, blank_trans, pending_trans);
00376 
00377     info->default_account = *xaccAccountGetGUID (default_account);
00378 
00379     // gnc_table_leave_update (table, table->current_cursor_loc);
00380 
00381     multi_line = (reg->style == REG_STYLE_JOURNAL);
00382     dynamic    = (reg->style == REG_STYLE_AUTO_LEDGER);
00383 
00384     lead_cursor = gnc_split_register_get_passive_cursor (reg);
00385     split_cursor = gnc_table_layout_get_cursor (table->layout, CURSOR_SPLIT);
00386 
00387     /* figure out where we are going to. */
00388     if (info->traverse_to_new)
00389     {
00390         find_trans = blank_trans;
00391         find_split = NULL;
00392         find_trans_split = blank_split;
00393         find_class = CURSOR_CLASS_SPLIT;
00394     }
00395     else
00396     {
00397         find_trans = info->cursor_hint_trans;
00398         find_split = info->cursor_hint_split;
00399         find_trans_split = info->cursor_hint_trans_split;
00400         find_class = info->cursor_hint_cursor_class;
00401     }
00402 
00403     save_loc = table->current_cursor_loc;
00404 
00405     /* If the current cursor has changed we save the values for later
00406      * possible restoration. */
00407     if (gnc_table_current_cursor_changed (table, TRUE) &&
00408             (find_split == gnc_split_register_get_current_split (reg)))
00409     {
00410         cursor_buffer = gnc_cursor_buffer_new ();
00411         gnc_table_save_current_cursor (table, cursor_buffer);
00412     }
00413     else
00414         cursor_buffer = NULL;
00415 
00416     /* disable move callback -- we don't want the cascade of
00417      * callbacks while we are fiddling with loading the register */
00418     gnc_table_control_allow_move (table->control, FALSE);
00419 
00420     /* invalidate the cursor */
00421     {
00422         VirtualLocation virt_loc;
00423 
00424         gnc_virtual_location_init(&virt_loc);
00425         gnc_table_move_cursor_gui (table, virt_loc);
00426     }
00427 
00428     /* make sure that the header is loaded */
00429     vcell_loc.virt_row = 0;
00430     vcell_loc.virt_col = 0;
00431     cursor_header = gnc_table_layout_get_cursor (table->layout, CURSOR_HEADER);
00432     gnc_table_set_vcell (table, cursor_header, NULL, TRUE, TRUE, vcell_loc);
00433     vcell_loc.virt_row++;
00434 
00435     /* get the current time and reset the dividing row */
00436     present = gnc_timet_get_today_end ();
00437     if (use_autoreadonly)
00438     {
00439         GDate *d = qof_book_get_autoreadonly_gdate(gnc_get_current_book());
00440         // "d" is NULL if use_autoreadonly is FALSE
00441         autoreadonly_time = d ? timespecToTime_t(gdate_to_timespec(*d)) : 0;
00442         g_date_free(d);
00443     }
00444 
00445     if (info->first_pass)
00446     {
00447         if (default_account)
00448         {
00449             const char *last_num = xaccAccountGetLastNum (default_account);
00450 
00451             if (last_num)
00452             {
00453                 NumCell *cell;
00454 
00455                 cell = (NumCell *) gnc_table_layout_get_cell(table->layout, NUM_CELL);
00456                 gnc_num_cell_set_last_num (cell, last_num);
00457                 has_last_num = TRUE;
00458             }
00459         }
00460 
00461         /* load up account names into the transfer combobox menus */
00462         gnc_split_register_load_xfer_cells (reg, default_account);
00463         gnc_split_register_load_recn_cells (reg);
00464         gnc_split_register_load_type_cells (reg);
00465     }
00466 
00467     if (info->separator_changed)
00468     {
00469         info->separator_changed = FALSE;
00470 
00471         /* set the completion character for the xfer cells */
00472         gnc_combo_cell_set_complete_char(
00473             (ComboCell *) gnc_table_layout_get_cell(table->layout, MXFRM_CELL),
00474             gnc_get_account_separator());
00475 
00476         gnc_combo_cell_set_complete_char(
00477             (ComboCell *) gnc_table_layout_get_cell(table->layout, XFRM_CELL),
00478             gnc_get_account_separator());
00479 
00480         /* set the confirmation callback for the reconcile cell */
00481         gnc_recn_cell_set_confirm_cb(
00482             (RecnCell *) gnc_table_layout_get_cell(table->layout, RECN_CELL),
00483             gnc_split_register_recn_cell_confirm, reg);
00484     }
00485 
00486     table->model->dividing_row_upper = -1;
00487     table->model->dividing_row = -1;
00488 
00489     // Ensure that the transaction and splits being edited are in the split
00490     // list we're about to load.
00491     if (pending_trans != NULL)
00492     {
00493         for (node = xaccTransGetSplitList(pending_trans); node; node = node->next)
00494         {
00495             Split *pending_split = (Split*)node->data;
00496             if (!xaccTransStillHasSplit(pending_trans, pending_split)) continue;
00497             if (g_list_find(slist, pending_split) != NULL)
00498                 continue;
00499 
00500             if (g_list_find_custom(slist, pending_trans,
00501                                    _find_split_with_parent_txn) != NULL)
00502                 continue;
00503 
00504             if (!we_own_slist)
00505             {
00506                 // lazy-copy
00507                 slist = g_list_copy(slist);
00508                 we_own_slist = TRUE;
00509             }
00510             slist = g_list_append(slist, pending_split);
00511         }
00512     }
00513 
00514     if (multi_line)
00515         trans_table = g_hash_table_new (g_direct_hash, g_direct_equal);
00516 
00517     /* populate the table */
00518     for (node = slist; node; node = node->next)
00519     {
00520         split = node->data;
00521         trans = xaccSplitGetParent (split);
00522 
00523         if (!xaccTransStillHasSplit(trans, split))
00524             continue;
00525 
00526         if (pending_trans == trans)
00527             found_pending = TRUE;
00528 
00529         /* Do not load splits from the blank transaction. */
00530         if (trans == blank_trans)
00531             continue;
00532 
00533         if (multi_line)
00534         {
00535             /* Skip this split if its transaction has already been loaded. */
00536             if (g_hash_table_lookup (trans_table, trans))
00537                 continue;
00538 
00539             g_hash_table_insert (trans_table, trans, trans);
00540         }
00541 
00542         if (info->show_present_divider &&
00543                 use_autoreadonly &&
00544                 !found_divider_upper)
00545         {
00546             if (xaccTransGetDate (trans) >= autoreadonly_time)
00547             {
00548                 table->model->dividing_row_upper = vcell_loc.virt_row;
00549                 found_divider_upper = TRUE;
00550             }
00551             else
00552             {
00553                 need_divider_upper = TRUE;
00554             }
00555         }
00556 
00557         if (info->show_present_divider &&
00558                 !found_divider &&
00559                 (xaccTransGetDate (trans) > present))
00560         {
00561             table->model->dividing_row = vcell_loc.virt_row;
00562             found_divider = TRUE;
00563         }
00564 
00565         /* If this is the first load of the register,
00566          * fill up the quickfill cells. */
00567         if (info->first_pass)
00568             add_quickfill_completions(reg->table->layout, trans, has_last_num);
00569 
00570         if (trans == find_trans)
00571             new_trans_row = vcell_loc.virt_row;
00572 
00573         if (split == find_trans_split)
00574             new_trans_split_row = vcell_loc.virt_row;
00575 
00576         gnc_split_register_add_transaction (reg, trans, split,
00577                                             lead_cursor, split_cursor,
00578                                             multi_line, start_primary_color,
00579                                             TRUE,
00580                                             find_trans, find_split, find_class,
00581                                             &new_split_row, &vcell_loc);
00582 
00583         if (!multi_line)
00584             start_primary_color = !start_primary_color;
00585     }
00586 
00587     if (multi_line)
00588         g_hash_table_destroy (trans_table);
00589 
00590     /* add the blank split at the end. */
00591     if (pending_trans == blank_trans)
00592         found_pending = TRUE;
00593 
00594     /* No upper divider yet? Store it now */
00595     if (info->show_present_divider &&
00596             use_autoreadonly &&
00597             !found_divider_upper && need_divider_upper)
00598     {
00599         table->model->dividing_row_upper = vcell_loc.virt_row;
00600         found_divider_upper = TRUE;
00601     }
00602 
00603     if (blank_trans == find_trans)
00604         new_trans_row = vcell_loc.virt_row;
00605 
00606     if (blank_split == find_trans_split)
00607         new_trans_split_row = vcell_loc.virt_row;
00608 
00609     /* If we didn't find the pending transaction, it was removed
00610      * from the account. */
00611     if (!found_pending)
00612     {
00613         info->pending_trans_guid = *guid_null ();
00614         if (xaccTransIsOpen (pending_trans))
00615             xaccTransCommitEdit (pending_trans);
00616         else if (pending_trans)
00617             g_assert_not_reached();
00618 
00619         pending_trans = NULL;
00620     }
00621 
00622     /* go to blank on first pass */
00623     if (info->first_pass)
00624     {
00625         new_split_row = -1;
00626         new_trans_split_row = -1;
00627         new_trans_row = -1;
00628 
00629         save_loc.vcell_loc = vcell_loc;
00630         save_loc.phys_row_offset = 0;
00631         save_loc.phys_col_offset = 0;
00632     }
00633 
00634     gnc_split_register_add_transaction (reg, blank_trans, blank_split,
00635                                         lead_cursor, split_cursor,
00636                                         multi_line, start_primary_color,
00637                                         info->blank_split_edited, find_trans,
00638                                         find_split, find_class, &new_split_row,
00639                                         &vcell_loc);
00640 
00641     /* resize the table to the sizes we just counted above */
00642     /* num_virt_cols is always one. */
00643     gnc_table_set_size (table, vcell_loc.virt_row, 1);
00644 
00645     /* restore the cursor to its rightful position */
00646     {
00647         VirtualLocation trans_split_loc;
00648         Split *trans_split;
00649 
00650         if (new_split_row > 0)
00651             save_loc.vcell_loc.virt_row = new_split_row;
00652         else if (new_trans_split_row > 0)
00653             save_loc.vcell_loc.virt_row = new_trans_split_row;
00654         else if (new_trans_row > 0)
00655             save_loc.vcell_loc.virt_row = new_trans_row;
00656 
00657         trans_split_loc = save_loc;
00658 
00659         trans_split =
00660             gnc_split_register_get_trans_split (reg, save_loc.vcell_loc,
00661                                                 &trans_split_loc.vcell_loc);
00662 
00663         if (dynamic || multi_line || info->trans_expanded)
00664         {
00665             gnc_table_set_virt_cell_cursor(
00666                 table, trans_split_loc.vcell_loc,
00667                 gnc_split_register_get_active_cursor (reg));
00668             gnc_split_register_set_trans_visible (reg, trans_split_loc.vcell_loc,
00669                                                   TRUE, multi_line);
00670 
00671             info->trans_expanded = (reg->style == REG_STYLE_LEDGER);
00672         }
00673         else
00674         {
00675             save_loc = trans_split_loc;
00676             info->trans_expanded = FALSE;
00677         }
00678 
00679         if (gnc_table_find_close_valid_cell (table, &save_loc, FALSE))
00680         {
00681             gnc_table_move_cursor_gui (table, save_loc);
00682             new_split_row = save_loc.vcell_loc.virt_row;
00683 
00684             if (find_split == gnc_split_register_get_current_split (reg))
00685                 gnc_table_restore_current_cursor (table, cursor_buffer);
00686         }
00687 
00688         gnc_cursor_buffer_destroy (cursor_buffer);
00689         cursor_buffer = NULL;
00690     }
00691 
00692     /* Set up the hint transaction, split, transaction split, and column. */
00693     info->cursor_hint_trans = gnc_split_register_get_current_trans (reg);
00694     info->cursor_hint_split = gnc_split_register_get_current_split (reg);
00695     info->cursor_hint_trans_split =
00696         gnc_split_register_get_current_trans_split (reg, NULL);
00697     info->cursor_hint_cursor_class =
00698         gnc_split_register_get_current_cursor_class (reg);
00699     info->hint_set_by_traverse = FALSE;
00700     info->traverse_to_new = FALSE;
00701     info->exact_traversal = FALSE;
00702     info->first_pass = FALSE;
00703     info->reg_loaded = TRUE;
00704 
00705     gnc_split_register_set_cell_fractions(
00706         reg, gnc_split_register_get_current_split (reg));
00707 
00708     gnc_table_refresh_gui (table, TRUE);
00709 
00710     gnc_split_register_show_trans (reg, table->current_cursor_loc.vcell_loc);
00711 
00712     /* enable callback for cursor user-driven moves */
00713     gnc_table_control_allow_move (table->control, TRUE);
00714 
00715     if (we_own_slist)
00716         g_list_free(slist);
00717 
00718     LEAVE(" ");
00719 }
00720 
00721 /* ===================================================================== */
00722 
00723 #define QKEY  "split_reg_shared_quickfill"
00724 
00725 static gboolean
00726 skip_cb (Account *account, gpointer x)
00727 {
00728     /* commented out as per Bug#340885 Comments 1 and 2, option (2).
00729     if (xaccAccountIsHidden(account))
00730       return TRUE;
00731     */
00732     return xaccAccountGetPlaceholder (account);
00733 }
00734 
00735 static void
00736 gnc_split_register_load_xfer_cells (SplitRegister *reg, Account *base_account)
00737 {
00738     Account *root = NULL;
00739     QuickFill *qf;
00740     ComboCell *cell;
00741     GtkListStore *store;
00742 
00743     if (base_account)
00744         root = gnc_account_get_root(base_account);
00745     if (root == NULL)
00746         root = gnc_get_current_root_account();
00747     if (root == NULL)
00748         return;
00749 
00750     qf = gnc_get_shared_account_name_quickfill (root, QKEY, skip_cb, NULL);
00751     store = gnc_get_shared_account_name_list_store (root, QKEY, skip_cb, NULL);
00752 
00753     cell = (ComboCell *)
00754            gnc_table_layout_get_cell (reg->table->layout, XFRM_CELL);
00755     gnc_combo_cell_use_quickfill_cache (cell, qf);
00756     gnc_combo_cell_use_list_store_cache (cell, store);
00757 
00758     cell = (ComboCell *)
00759            gnc_table_layout_get_cell (reg->table->layout, MXFRM_CELL);
00760     gnc_combo_cell_use_quickfill_cache (cell, qf);
00761     gnc_combo_cell_use_list_store_cache (cell, store);
00762 }
00763 
00764 /* ====================== END OF FILE ================================== */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines