GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
split-register-load.c
1 /********************************************************************\
2  * split-register-load.c -- split register loading code *
3  * Copyright (C) 1998-2000 Linas Vepstas <[email protected]> *
4  * Copyright (C) 2000 Dave Peticolas *
5  * *
6  * This program is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU General Public License as *
8  * published by the Free Software Foundation; either version 2 of *
9  * the License, or (at your option) any later version. *
10  * *
11  * This program is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License*
17  * along with this program; if not, contact: *
18  * *
19  * Free Software Foundation Voice: +1-617-542-5942 *
20  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
21  * Boston, MA 02110-1301, USA [email protected] *
22  * *
23 \********************************************************************/
24 
25 #include "config.h"
26 
27 #include <glib/gi18n.h>
28 
29 #include "account-quickfill.h"
30 #include "combocell.h"
31 #include "gnc-component-manager.h"
32 #include "qof.h"
33 #include "gnc-ui-util.h"
34 #include "gnc-gui-query.h"
35 #include "numcell.h"
36 #include "quickfillcell.h"
37 #include "recncell.h"
38 #include "split-register.h"
39 #include "split-register-p.h"
40 #include "engine-helpers.h"
41 #include "gnc-prefs.h"
42 
43 
44 /* This static indicates the debugging module that this .o belongs to. */
45 static QofLogModule log_module = GNC_MOD_LEDGER;
46 
47 
48 static void gnc_split_register_load_xfer_cells (SplitRegister *reg,
49  Account *base_account);
50 
51 static void
52 gnc_split_register_load_recn_cells (SplitRegister *reg)
53 {
54  RecnCell *cell;
55  const char * s;
56 
57  if (!reg) return;
58 
59  cell = (RecnCell *)
60  gnc_table_layout_get_cell (reg->table->layout, RECN_CELL);
61 
62  if (!cell) return;
63 
64  s = gnc_get_reconcile_valid_flags ();
65  gnc_recn_cell_set_valid_flags (cell, s, *s);
66  gnc_recn_cell_set_flag_order (cell, gnc_get_reconcile_flag_order ());
67  gnc_recn_cell_set_string_getter (cell, gnc_get_reconcile_str);
68 }
69 
70 static void
71 gnc_split_register_load_type_cells (SplitRegister *reg)
72 {
73  RecnCell *cell;
74 
75  if (!reg) return;
76 
77  cell = (RecnCell *)
78  gnc_table_layout_get_cell (reg->table->layout, TYPE_CELL);
79 
80  if (!cell) return;
81 
82  /* FIXME: These should get moved to an i18n function */
83  gnc_recn_cell_set_valid_flags (cell, "IP?", 'I');
84  gnc_recn_cell_set_flag_order (cell, "IP");
85 }
86 
149 static void
150 gnc_split_register_add_transaction (SplitRegister *reg,
151  Transaction *trans,
152  Split *split,
153  CellBlock *lead_cursor,
154  CellBlock *split_cursor,
155  gboolean visible_splits,
156  gboolean start_primary_color,
157  gboolean add_empty,
158  Transaction *find_trans,
159  Split *find_split,
160  CursorClass find_class,
161  int *new_split_row,
162  VirtualCellLocation *vcell_loc)
163 {
164  GList *node;
165 
166  g_return_if_fail(reg);
167  g_return_if_fail(vcell_loc);
168 
169  if (split == find_split)
170  *new_split_row = vcell_loc->virt_row;
171 
172  /* Set the "leading" virtual cell. */
173  gnc_table_set_vcell (reg->table, lead_cursor, xaccSplitGetGUID (split),
174  TRUE, start_primary_color, *vcell_loc);
175  vcell_loc->virt_row++;
176 
177  /* Continue setting up virtual cells in a column, using a row for each
178  * split in the transaction. */
179  for (node = xaccTransGetSplitList (trans); node; node = node->next)
180  {
181  Split *secondary = node->data;
182 
183  if (!xaccTransStillHasSplit(trans, secondary)) continue;
184  if (secondary == find_split && find_class == CURSOR_CLASS_SPLIT)
185  *new_split_row = vcell_loc->virt_row;
186 
187  gnc_table_set_vcell (reg->table, split_cursor,
188  xaccSplitGetGUID (secondary),
189  visible_splits, TRUE, *vcell_loc);
190  vcell_loc->virt_row++;
191  }
192 
193  /* If requested, add an empty split row at the end. */
194  if (add_empty)
195  {
196  if (find_trans == trans && find_split == NULL &&
197  find_class == CURSOR_CLASS_SPLIT)
198  *new_split_row = vcell_loc->virt_row;
199 
200  gnc_table_set_vcell(reg->table, split_cursor, xaccSplitGetGUID(NULL),
201  FALSE, TRUE, *vcell_loc);
202  vcell_loc->virt_row++;
203  }
204 }
205 
206 static gint
207 _find_split_with_parent_txn(gconstpointer a, gconstpointer b)
208 {
209  Split *split = (Split*)a;
210  Transaction *txn = (Transaction*)b;
211 
212  return xaccSplitGetParent(split) == txn ? 0 : 1;
213 }
214 
215 static void add_quickfill_completions(TableLayout *layout, Transaction *trans,
216  Split *split, gboolean has_last_num)
217 {
218  Split *s;
219  int i = 0;
220 
221  gnc_quickfill_cell_add_completion(
222  (QuickFillCell *) gnc_table_layout_get_cell(layout, DESC_CELL),
223  xaccTransGetDescription(trans));
224 
225  gnc_quickfill_cell_add_completion(
226  (QuickFillCell *) gnc_table_layout_get_cell(layout, NOTES_CELL),
227  xaccTransGetNotes(trans));
228 
229  if (!has_last_num)
230  gnc_num_cell_set_last_num(
231  (NumCell *) gnc_table_layout_get_cell(layout, NUM_CELL),
232  gnc_get_num_action(trans, split));
233 
234  while ((s = xaccTransGetSplit(trans, i)) != NULL)
235  {
236  gnc_quickfill_cell_add_completion(
237  (QuickFillCell *) gnc_table_layout_get_cell(layout, MEMO_CELL),
238  xaccSplitGetMemo(s));
239  i++;
240  }
241 }
242 
243 static Split*
244 create_blank_split (Account *default_account, SRInfo *info)
245 {
246  Transaction *new_trans;
247  gboolean currency_from_account = TRUE;
248  Split *blank_split = NULL;
249  /* Determine the proper currency to use for this transaction.
250  * if default_account != NULL and default_account->commodity is
251  * a currency, then use that. Otherwise use the default currency.
252  */
253  gnc_commodity * currency = gnc_account_or_default_currency(default_account, &currency_from_account);
254 
255  if (default_account != NULL && !currency_from_account)
256  {
257  /* If we don't have a currency then pop up a warning dialog */
258  gnc_info_dialog(NULL, "%s",
259  _("Could not determine the account currency. "
260  "Using the default currency provided by your system."));
261  }
262 
263  gnc_suspend_gui_refresh ();
264 
265  new_trans = xaccMallocTransaction (gnc_get_current_book ());
266 
267  xaccTransBeginEdit (new_trans);
268  xaccTransSetCurrency (new_trans, currency);
269  xaccTransSetDatePostedSecsNormalized(new_trans, info->last_date_entered);
270  blank_split = xaccMallocSplit (gnc_get_current_book ());
271  xaccSplitSetParent(blank_split, new_trans);
272  /* We don't want to commit this transaction yet, because the split
273  doesn't even belong to an account yet. But, we don't want to
274  set this transaction as the pending transaction either, because
275  we want to pretend that it hasn't been changed. We depend on
276  some other code (somewhere) to commit this transaction if we
277  really edit it, even though it's not marked as the pending
278  transaction. */
279 
280  info->blank_split_guid = *xaccSplitGetGUID (blank_split);
281  info->blank_split_edited = FALSE;
282  info->auto_complete = FALSE;
283  DEBUG("created new blank_split=%p", blank_split);
284 
285  gnc_resume_gui_refresh ();
286  return blank_split;
287 }
288 
289 static void
290 change_account_separator (SRInfo *info, Table *table, SplitRegister *reg)
291 {
292  info->separator_changed = FALSE;
293 
294  /* set the completion character for the xfer cells */
296  (ComboCell *) gnc_table_layout_get_cell(table->layout, MXFRM_CELL),
297  gnc_get_account_separator());
298 
300  (ComboCell *) gnc_table_layout_get_cell(table->layout, XFRM_CELL),
301  gnc_get_account_separator());
302 
303  /* set the confirmation callback for the reconcile cell */
304  gnc_recn_cell_set_confirm_cb(
305  (RecnCell *) gnc_table_layout_get_cell(table->layout, RECN_CELL),
306  gnc_split_register_recn_cell_confirm, reg);
307 }
308 
309 static void
310 update_info (SRInfo *info, SplitRegister *reg)
311 {
312  /* Set up the hint transaction, split, transaction split, and column. */
313  info->cursor_hint_trans = gnc_split_register_get_current_trans (reg);
314  info->cursor_hint_split = gnc_split_register_get_current_split (reg);
315  info->cursor_hint_trans_split =
317  info->cursor_hint_cursor_class =
319  info->hint_set_by_traverse = FALSE;
320  info->traverse_to_new = FALSE;
321  info->exact_traversal = FALSE;
322  info->first_pass = FALSE;
323  info->reg_loaded = TRUE;
324 }
325 
326 void
328  Account *default_account)
329 {
330  SRInfo *info;
331  Transaction *pending_trans;
332  CursorBuffer *cursor_buffer;
333  GHashTable *trans_table = NULL;
334  CellBlock *cursor_header;
335  CellBlock *lead_cursor;
336  CellBlock *split_cursor;
337  Transaction *blank_trans;
338  Transaction *find_trans;
339  Transaction *trans;
340  CursorClass find_class;
341  Split *find_trans_split;
342  Split *blank_split;
343  Split *find_split;
344  Split *split;
345  Table *table;
346  GList *node;
347 
348  gboolean start_primary_color = TRUE;
349  gboolean found_pending = FALSE;
350  gboolean need_divider_upper = FALSE;
351  gboolean found_divider_upper = FALSE;
352  gboolean found_divider = FALSE;
353  gboolean has_last_num = FALSE;
354  gboolean multi_line;
355  gboolean dynamic;
356  gboolean we_own_slist = FALSE;
357  gboolean use_autoreadonly = qof_book_uses_autoreadonly(gnc_get_current_book());
358  gboolean future_after_blank = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER,
359  GNC_PREF_FUTURE_AFTER_BLANK);
360  gboolean added_blank_trans = FALSE;
361 
362  VirtualCellLocation vcell_loc;
363  VirtualLocation save_loc;
364 
365  int new_trans_split_row = -1;
366  int new_trans_row = -1;
367  int new_split_row = -1;
368  time64 present, autoreadonly_time = 0;
369 
370  g_return_if_fail(reg);
371  table = reg->table;
372  g_return_if_fail(table);
373  info = gnc_split_register_get_info (reg);
374  g_return_if_fail(info);
375 
376  ENTER("reg=%p, slist=%p, default_account=%p", reg, slist, default_account);
377 
378  blank_split = xaccSplitLookup (&info->blank_split_guid,
379  gnc_get_current_book ());
380 
381  pending_trans = xaccTransLookup (&info->pending_trans_guid,
382  gnc_get_current_book ());
383 
384  /* make sure we have a blank split */
385  if (blank_split == NULL)
386  {
387  /* Wouldn't it be a bug to open the new transaction if there was
388  * already a pending transaction?
389  */
390  g_assert(pending_trans == NULL);
391  blank_split = create_blank_split (default_account, info);
392  }
393  blank_trans = xaccSplitGetParent (blank_split);
394 
395  DEBUG("blank_split=%p, blank_trans=%p, pending_trans=%p",
396  blank_split, blank_trans, pending_trans);
397 
398  info->default_account = *xaccAccountGetGUID (default_account);
399 
400  // gnc_table_leave_update (table, table->current_cursor_loc);
401 
402  multi_line = (reg->style == REG_STYLE_JOURNAL);
403  dynamic = (reg->style == REG_STYLE_AUTO_LEDGER);
404 
405  lead_cursor = gnc_split_register_get_passive_cursor (reg);
406  split_cursor = gnc_table_layout_get_cursor (table->layout, CURSOR_SPLIT);
407 
408  /* figure out where we are going to. */
409  if (info->traverse_to_new)
410  {
411  find_trans = blank_trans;
412  find_split = NULL;
413  find_trans_split = blank_split;
414  find_class = CURSOR_CLASS_SPLIT;
415  }
416  else
417  {
418  find_trans = info->cursor_hint_trans;
419  find_split = info->cursor_hint_split;
420  find_trans_split = info->cursor_hint_trans_split;
421  find_class = info->cursor_hint_cursor_class;
422  }
423 
424  save_loc = table->current_cursor_loc;
425 
426  /* If the current cursor has changed we save the values for later
427  * possible restoration. */
428  if (gnc_table_current_cursor_changed (table, TRUE) &&
429  (find_split == gnc_split_register_get_current_split (reg)))
430  {
431  cursor_buffer = gnc_cursor_buffer_new ();
432  gnc_table_save_current_cursor (table, cursor_buffer);
433  }
434  else
435  cursor_buffer = NULL;
436 
437  /* disable move callback -- we don't want the cascade of
438  * callbacks while we are fiddling with loading the register */
439  gnc_table_control_allow_move (table->control, FALSE);
440 
441  /* invalidate the cursor */
442  {
443  VirtualLocation virt_loc;
444 
445  gnc_virtual_location_init(&virt_loc);
446  gnc_table_move_cursor_gui (table, virt_loc);
447  }
448 
449  /* make sure that the header is loaded */
450  vcell_loc.virt_row = 0;
451  vcell_loc.virt_col = 0;
452  cursor_header = gnc_table_layout_get_cursor (table->layout, CURSOR_HEADER);
453  gnc_table_set_vcell (table, cursor_header, NULL, TRUE, TRUE, vcell_loc);
454  vcell_loc.virt_row++;
455 
456  /* get the current time and reset the dividing row */
457  present = gnc_time64_get_today_end ();
458  if (use_autoreadonly)
459  {
460  GDate *d = qof_book_get_autoreadonly_gdate(gnc_get_current_book());
461  // "d" is NULL if use_autoreadonly is FALSE
462  autoreadonly_time = d ? timespecToTime64(gdate_to_timespec(*d)) : 0;
463  g_date_free(d);
464  }
465 
466  if (info->first_pass)
467  {
468  if (default_account)
469  {
470  const char *last_num = xaccAccountGetLastNum (default_account);
471 
472  if (last_num)
473  {
474  NumCell *cell;
475 
476  cell = (NumCell *) gnc_table_layout_get_cell(table->layout, NUM_CELL);
477  gnc_num_cell_set_last_num (cell, last_num);
478  has_last_num = TRUE;
479  }
480  }
481 
482  /* load up account names into the transfer combobox menus */
483  gnc_split_register_load_xfer_cells (reg, default_account);
484  gnc_split_register_load_recn_cells (reg);
485  gnc_split_register_load_type_cells (reg);
486  }
487 
488  if (info->separator_changed)
489  change_account_separator (info, table, reg);
490 
491  table->model->dividing_row_upper = -1;
492  table->model->dividing_row = -1;
493  table->model->dividing_row_lower = -1;
494 
495  // Ensure that the transaction and splits being edited are in the split
496  // list we're about to load.
497  if (pending_trans != NULL)
498  {
499  for (node = xaccTransGetSplitList(pending_trans); node; node = node->next)
500  {
501  Split *pending_split = (Split*)node->data;
502  if (!xaccTransStillHasSplit(pending_trans, pending_split)) continue;
503  if (g_list_find(slist, pending_split) != NULL)
504  continue;
505 
506  if (g_list_find_custom(slist, pending_trans,
507  _find_split_with_parent_txn) != NULL)
508  continue;
509 
510  if (!we_own_slist)
511  {
512  // lazy-copy
513  slist = g_list_copy(slist);
514  we_own_slist = TRUE;
515  }
516  slist = g_list_append(slist, pending_split);
517  }
518  }
519 
520  if (multi_line)
521  trans_table = g_hash_table_new (g_direct_hash, g_direct_equal);
522 
523  /* populate the table */
524  for (node = slist; node; node = node->next)
525  {
526  split = node->data;
527  trans = xaccSplitGetParent (split);
528 
529  if (!xaccTransStillHasSplit(trans, split))
530  continue;
531 
532  if (pending_trans == trans)
533  found_pending = TRUE;
534  /* If the transaction has only one split, and it's not our
535  * pending_trans, then it's another register's blank split and
536  * we don't want to see it.
537  */
538  else if (xaccTransCountSplits (trans) == 1 &&
539  xaccSplitGetAccount (split) == NULL)
540  continue;
541 
542 
543  /* Do not load splits from the blank transaction. */
544  if (trans == blank_trans)
545  continue;
546 
547  if (multi_line)
548  {
549  /* Skip this split if its transaction has already been loaded. */
550  if (g_hash_table_lookup (trans_table, trans))
551  continue;
552 
553  g_hash_table_insert (trans_table, trans, trans);
554  }
555 
556  if (info->show_present_divider &&
557  use_autoreadonly &&
558  !found_divider_upper)
559  {
560  if (xaccTransGetDate (trans) >= autoreadonly_time)
561  {
562  table->model->dividing_row_upper = vcell_loc.virt_row;
563  found_divider_upper = TRUE;
564  }
565  else
566  {
567  need_divider_upper = TRUE;
568  }
569  }
570 
571  if (info->show_present_divider &&
572  !found_divider &&
573  (xaccTransGetDate (trans) > present))
574  {
575  table->model->dividing_row = vcell_loc.virt_row;
576  found_divider = TRUE;
577 
578  if (future_after_blank)
579  {
580  if (blank_trans == find_trans)
581  new_trans_row = vcell_loc.virt_row;
582 
583  if (blank_split == find_trans_split)
584  new_trans_split_row = vcell_loc.virt_row;
585 
586  /* go to blank on first pass */
587  if (info->first_pass)
588  {
589  save_loc.vcell_loc = vcell_loc;
590  save_loc.phys_row_offset = 0;
591  save_loc.phys_col_offset = 0;
592  }
593 
594  gnc_split_register_add_transaction (reg,
595  blank_trans, blank_split,
596  lead_cursor, split_cursor,
597  multi_line, start_primary_color,
598  info->blank_split_edited,
599  find_trans, find_split,
600  find_class, &new_split_row,
601  &vcell_loc);
602 
603  table->model->dividing_row_lower = vcell_loc.virt_row;
604 
605  if (!multi_line)
606  start_primary_color = !start_primary_color;
607 
608  added_blank_trans = TRUE;
609  }
610  }
611 
612  /* If this is the first load of the register,
613  * fill up the quickfill cells. */
614  if (info->first_pass)
615  add_quickfill_completions(reg->table->layout, trans, split, has_last_num);
616 
617  if (trans == find_trans)
618  new_trans_row = vcell_loc.virt_row;
619 
620  if (split == find_trans_split)
621  new_trans_split_row = vcell_loc.virt_row;
622 
623  gnc_split_register_add_transaction (reg, trans, split,
624  lead_cursor, split_cursor,
625  multi_line, start_primary_color,
626  TRUE,
627  find_trans, find_split, find_class,
628  &new_split_row, &vcell_loc);
629 
630  if (!multi_line)
631  start_primary_color = !start_primary_color;
632  }
633 
634  if (multi_line)
635  g_hash_table_destroy (trans_table);
636 
637  /* add the blank split at the end. */
638  if (pending_trans == blank_trans)
639  found_pending = TRUE;
640 
641  /* No upper divider yet? Store it now */
642  if (info->show_present_divider &&
643  use_autoreadonly &&
644  !found_divider_upper && need_divider_upper)
645  {
646  table->model->dividing_row_upper = vcell_loc.virt_row;
647  found_divider_upper = TRUE;
648  }
649 
650  /* If we didn't find the pending transaction, it was removed
651  * from the account. */
652  if (!found_pending)
653  {
654  info->pending_trans_guid = *guid_null ();
655  if (xaccTransIsOpen (pending_trans))
656  xaccTransCommitEdit (pending_trans);
657  else if (pending_trans)
658  g_assert_not_reached();
659 
660  pending_trans = NULL;
661  }
662 
663  if (!added_blank_trans) {
664  if (blank_trans == find_trans)
665  new_trans_row = vcell_loc.virt_row;
666 
667  if (blank_split == find_trans_split)
668  new_trans_split_row = vcell_loc.virt_row;
669 
670  /* go to blank on first pass */
671  if (info->first_pass)
672  {
673  save_loc.vcell_loc = vcell_loc;
674  save_loc.phys_row_offset = 0;
675  save_loc.phys_col_offset = 0;
676  }
677 
678  gnc_split_register_add_transaction (reg, blank_trans, blank_split,
679  lead_cursor, split_cursor,
680  multi_line, start_primary_color,
681  info->blank_split_edited,
682  find_trans, find_split,
683  find_class, &new_split_row,
684  &vcell_loc);
685 
686  if (future_after_blank)
687  table->model->dividing_row_lower = vcell_loc.virt_row;
688  }
689 
690  /* go to blank on first pass */
691  if (info->first_pass)
692  {
693  new_split_row = -1;
694  new_trans_split_row = -1;
695  new_trans_row = -1;
696  }
697 
698  /* resize the table to the sizes we just counted above */
699  /* num_virt_cols is always one. */
700  gnc_table_set_size (table, vcell_loc.virt_row, 1);
701 
702  /* restore the cursor to its rightful position */
703  {
704  VirtualLocation trans_split_loc;
705 
706  if (new_split_row > 0)
707  save_loc.vcell_loc.virt_row = new_split_row;
708  else if (new_trans_split_row > 0)
709  save_loc.vcell_loc.virt_row = new_trans_split_row;
710  else if (new_trans_row > 0)
711  save_loc.vcell_loc.virt_row = new_trans_row;
712 
713  trans_split_loc = save_loc;
714 
715  gnc_split_register_get_trans_split (reg, save_loc.vcell_loc,
716  &trans_split_loc.vcell_loc);
717 
718  if (dynamic || multi_line || info->trans_expanded)
719  {
720  gnc_table_set_virt_cell_cursor(
721  table, trans_split_loc.vcell_loc,
722  gnc_split_register_get_active_cursor (reg));
723  gnc_split_register_set_trans_visible (reg, trans_split_loc.vcell_loc,
724  TRUE, multi_line);
725 
726  info->trans_expanded = (reg->style == REG_STYLE_LEDGER);
727  }
728  else
729  {
730  save_loc = trans_split_loc;
731  info->trans_expanded = FALSE;
732  }
733 
734  if (gnc_table_find_close_valid_cell (table, &save_loc, FALSE))
735  {
736  gnc_table_move_cursor_gui (table, save_loc);
737  new_split_row = save_loc.vcell_loc.virt_row;
738 
739  if (find_split == gnc_split_register_get_current_split (reg))
740  gnc_table_restore_current_cursor (table, cursor_buffer);
741  }
742  }
743  gnc_cursor_buffer_destroy (cursor_buffer);
744  cursor_buffer = NULL;
745 
746  update_info (info, reg);
747 
748  gnc_split_register_set_cell_fractions(
750 
751  gnc_table_refresh_gui (table, TRUE);
752 
753  gnc_split_register_show_trans (reg, table->current_cursor_loc.vcell_loc);
754 
755  /* enable callback for cursor user-driven moves */
756  gnc_table_control_allow_move (table->control, TRUE);
757 
758  if (we_own_slist)
759  g_list_free(slist);
760 
761  LEAVE(" ");
762 }
763 
764 /* ===================================================================== */
765 
766 #define QKEY "split_reg_shared_quickfill"
767 
768 static gboolean
769 skip_cb (Account *account, gpointer x)
770 {
771  /* commented out as per Bug#340885 Comments 1 and 2, option (2).
772  if (xaccAccountIsHidden(account))
773  return TRUE;
774  */
775  return xaccAccountGetPlaceholder (account);
776 }
777 
778 static void
779 gnc_split_register_load_xfer_cells (SplitRegister *reg, Account *base_account)
780 {
781  Account *root = NULL;
782  QuickFill *qf;
783  ComboCell *cell;
784  GtkListStore *store;
785 
786  if (base_account)
787  root = gnc_account_get_root(base_account);
788  if (root == NULL)
789  root = gnc_get_current_root_account();
790  if (root == NULL)
791  return;
792 
793  qf = gnc_get_shared_account_name_quickfill (root, QKEY, skip_cb, NULL);
794  store = gnc_get_shared_account_name_list_store (root, QKEY, skip_cb, NULL);
795 
796  cell = (ComboCell *)
797  gnc_table_layout_get_cell (reg->table->layout, XFRM_CELL);
799  gnc_combo_cell_use_list_store_cache (cell, store);
800 
801  cell = (ComboCell *)
802  gnc_table_layout_get_cell (reg->table->layout, MXFRM_CELL);
804  gnc_combo_cell_use_list_store_cache (cell, store);
805 }
806 
807 /* ====================== END OF FILE ================================== */
Transaction * gnc_split_register_get_current_trans(SplitRegister *reg)
Transaction * xaccMallocTransaction(QofBook *book)
Definition: Transaction.c:513
const char * xaccAccountGetLastNum(const Account *acc)
Definition: Account.c:4472
void xaccTransSetDatePostedSecsNormalized(Transaction *trans, time64 time)
Definition: Transaction.c:1920
time64 timespecToTime64(Timespec ts)
Split * xaccTransGetSplit(const Transaction *trans, int i)
Definition: Transaction.c:2144
time64 xaccTransGetDate(const Transaction *trans)
Definition: Transaction.c:2215
time64 gnc_time64_get_today_end(void)
gboolean xaccTransIsOpen(const Transaction *trans)
Definition: Transaction.c:1819
utility functions for the GnuCash UI
The type, style and table for the register.
Split * gnc_split_register_get_current_split(SplitRegister *reg)
#define DEBUG(format, args...)
Definition: qoflog.h:255
Create an account-name quick-fill.
Split * gnc_split_register_get_current_trans_split(SplitRegister *reg, VirtualCellLocation *trans_split_loc)
Transaction * xaccSplitGetParent(const Split *split)
Definition: Split.c:1903
void gnc_combo_cell_use_quickfill_cache(ComboCell *cell, QuickFill *shared_qf)
#define ENTER(format, args...)
Definition: qoflog.h:261
QuickFill * gnc_get_shared_account_name_quickfill(Account *root, const char *key, AccountBoolCB cb, gpointer cb_data)
void xaccTransSetCurrency(Transaction *trans, gnc_commodity *curr)
Definition: Transaction.c:1354
const char * xaccTransGetNotes(const Transaction *trans)
Definition: Transaction.c:2197
Transaction * xaccTransLookup(const GncGUID *guid, QofBook *book)
Definition: Transaction.c:1024
int xaccTransCountSplits(const Transaction *trans)
Definition: Transaction.c:2170
#define xaccAccountGetGUID(X)
Definition: Account.h:239
GDate * qof_book_get_autoreadonly_gdate(const QofBook *book)
Split * xaccSplitLookup(const GncGUID *guid, QofBook *book)
Definition: Split.c:1104
void gnc_combo_cell_set_complete_char(ComboCell *cell, gunichar complete_char)
const char * xaccTransGetDescription(const Transaction *trans)
Definition: Transaction.c:2184
The ComboCell object implements a cell handler with a "combination-box" pull-down menu in it...
void xaccTransCommitEdit(Transaction *trans)
Definition: Transaction.c:1579
#define xaccSplitGetGUID(X)
Definition: Split.h:521
void xaccTransBeginEdit(Transaction *trans)
Definition: Transaction.c:1380
API for checkbook register display area.
Split * xaccMallocSplit(QofBook *book)
Definition: Split.c:582
Generic api to store and retrieve preferences.
gnc_commodity * gnc_account_or_default_currency(const Account *account, gboolean *currency_from_account_found)
Definition: gnc-ui-util.c:944
CursorClass
Definition: SplitP.h:71
void gnc_split_register_load(SplitRegister *reg, GList *slist, Account *default_account)
CursorClass gnc_split_register_get_current_cursor_class(SplitRegister *reg)
Account * xaccSplitGetAccount(const Split *s)
Definition: Split.c:968
const GncGUID * guid_null(void)
gboolean xaccAccountGetPlaceholder(const Account *acc)
Definition: Account.c:3912
gboolean gnc_prefs_get_bool(const gchar *group, const gchar *pref_name)
Definition: gnc-prefs.c:196
#define LEAVE(format, args...)
Definition: qoflog.h:271
const char * xaccSplitGetMemo(const Split *split)
Definition: Split.c:1968
gint64 time64
Definition: gnc-date.h:83
Timespec gdate_to_timespec(GDate d)
gboolean qof_book_uses_autoreadonly(const QofBook *book)
Account * gnc_account_get_root(Account *acc)
Definition: Account.c:2630
SplitList * xaccTransGetSplitList(const Transaction *trans)
Definition: Transaction.c:2164
const gchar * QofLogModule
Definition: qofid.h:89