188{
189 GncBudgetView *budget_view;
191
192 g_return_val_if_fail (GNC_IS_BUDGET(budget), NULL);
194
195 budget_view = g_object_new (GNC_TYPE_BUDGET_VIEW, NULL);
196
197 priv = GNC_BUDGET_VIEW_GET_PRIVATE(budget_view);
198 priv->budget = budget;
199 priv->key = *gnc_budget_get_guid (budget);
200 priv->fd = fd;
201 priv->total_col = NULL;
202 priv->show_account_code = FALSE;
203 priv->show_account_desc = FALSE;
204 gbv_create_widget (budget_view);
205
206 LEAVE(
"new budget view %p", budget_view);
207 return budget_view;
208}
209
210static void
211gnc_budget_view_class_init (GncBudgetViewClass *klass)
212{
213 GObjectClass *object_class = G_OBJECT_CLASS(klass);
214
215 object_class->finalize = gnc_budget_view_finalize;
216
217 g_signal_new ("account-activated", GNC_TYPE_BUDGET_VIEW, G_SIGNAL_RUN_LAST,
218 0, NULL, NULL, NULL, G_TYPE_NONE, 1, GNC_TYPE_ACCOUNT);
219}
220
221static void
222gnc_budget_view_init (GncBudgetView *budget_view)
223{
225
226 ENTER(
"view %p", budget_view);
227
228 gtk_orientable_set_orientation (GTK_ORIENTABLE(budget_view), GTK_ORIENTATION_VERTICAL);
229
230 priv = GNC_BUDGET_VIEW_GET_PRIVATE(budget_view);
231
232
233 priv->rootAcct = gnc_book_get_root_account (gnc_get_current_book());
234
236}
237
238static void
239gbv_treeview_update_grid_lines (gpointer prefs, gchar *pref, gpointer user_data)
240{
241 GtkTreeView *view = user_data;
242 gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(view), gnc_tree_view_get_grid_lines_pref ());
243}
244
245void
246gnc_budget_view_set_show_account_code (GncBudgetView *budget_view, gboolean show_account_code)
247{
249 priv->show_account_code = show_account_code;
251}
252
253gboolean
254gnc_budget_view_get_show_account_code (GncBudgetView *budget_view)
255{
257 return priv->show_account_code;
258}
259
260void
261gnc_budget_view_set_show_account_description (GncBudgetView *budget_view, gboolean show_account_desc)
262{
264 priv->show_account_desc = show_account_desc;
266}
267
268gboolean
269gnc_budget_view_get_show_account_description (GncBudgetView *budget_view)
270{
272 return priv->show_account_desc;
273}
274
275static void
276gbv_update_use_red (gpointer prefs, gchar *pref, gpointer user_data)
277{
278 GncBudgetView *budget_view = user_data;
280
282 GNC_PREF_NEGATIVE_IN_RED);
283}
284
285static void
286gnc_budget_view_finalize (GObject *object)
287{
288 GncBudgetView *budget_view;
290
291 ENTER(
"object %p",
object);
292 budget_view = GNC_BUDGET_VIEW(object);
293 g_return_if_fail (GNC_IS_BUDGET_VIEW(budget_view));
294
295 priv = GNC_BUDGET_VIEW_GET_PRIVATE(budget_view);
296
297 g_list_free (priv->period_col_list);
298 g_list_free (priv->totals_col_list);
299
301 gbv_treeview_update_grid_lines, priv->totals_tree_view);
303 gbv_treeview_update_grid_lines, priv->totals_tree_view);
305 gbv_update_use_red, budget_view);
306
307 G_OBJECT_CLASS(gnc_budget_view_parent_class)->finalize (object);
309}
310
316GtkTreeSelection*
318{
320
321 g_return_val_if_fail (GNC_IS_BUDGET_VIEW(budget_view), NULL);
322
323 priv = GNC_BUDGET_VIEW_GET_PRIVATE(budget_view);
324 return gtk_tree_view_get_selection (GTK_TREE_VIEW(priv->tree_view));
325}
326
328gnc_budget_view_get_account_from_path (GncBudgetView *budget_view, GtkTreePath *path)
329{
331
332 g_return_val_if_fail (GNC_IS_BUDGET_VIEW(budget_view), NULL);
333
334 priv = GNC_BUDGET_VIEW_GET_PRIVATE(budget_view);
336}
337
338GtkWidget*
339gnc_budget_view_get_account_tree_view (GncBudgetView *budget_view)
340{
342
343 g_return_val_if_fail (GNC_IS_BUDGET_VIEW(budget_view), NULL);
344
345 priv = GNC_BUDGET_VIEW_GET_PRIVATE(budget_view);
346 return GTK_WIDGET(priv->fd->tree_view);
347}
348
349GList*
350gnc_budget_view_get_selected_accounts (GncBudgetView *budget_view)
351{
353
354 g_return_val_if_fail (GNC_IS_BUDGET_VIEW(budget_view), NULL);
355
356 priv = GNC_BUDGET_VIEW_GET_PRIVATE(budget_view);
358}
359
360static void
361gbv_totals_scrollbar_value_changed_cb (GtkAdjustment *adj, GncBudgetView *budget_view)
362{
364
365 g_return_if_fail (GNC_IS_BUDGET_VIEW(budget_view));
366
367 priv = GNC_BUDGET_VIEW_GET_PRIVATE(budget_view);
368 gtk_adjustment_set_value (priv->hadj, gtk_adjustment_get_value (adj));
369}
370
371static gboolean
372gbv_totals_tree_view_redraw_idle (GtkTreeView *view)
373{
374 gtk_widget_queue_draw (GTK_WIDGET(view));
375 return FALSE;
376}
377
378static void
379gbv_tree_view_model_row_changed_cb (GtkTreeModel *tree_model, GtkTreePath *path,
380 GtkTreeIter *iter, gpointer user_data)
381{
382 GncBudgetView *budget_view = user_data;
384
385
386
387 g_idle_remove_by_data (priv->totals_tree_view);
388 g_idle_add ((GSourceFunc)gbv_totals_tree_view_redraw_idle, priv->totals_tree_view);
389}
390
391
392
393
401static void
402gbv_create_widget (GncBudgetView *budget_view)
403{
405 GtkTreeSelection *selection;
406 GtkTreeView *tree_view;
407 GtkWidget *scrolled_window;
408 GtkAdjustment *h_adj;
409 GtkWidget *h_scrollbar;
410 GtkBox *vbox;
411 GtkListStore *totals_tree_model;
412 GtkTreeView *totals_tree_view;
413 GtkTreeViewColumn *totals_title_col, *name_col, *code_col, *desc_col;
414 GtkTreeIter iter;
415 GtkWidget *h_separator;
416 gchar *state_section;
418
419 priv = GNC_BUDGET_VIEW_GET_PRIVATE(budget_view);
420 vbox = GTK_BOX(budget_view);
421
422
423 gtk_widget_set_name (GTK_WIDGET(vbox), "gnc-id-budget-page");
424
425
426 scrolled_window = gtk_scrolled_window_new (NULL, NULL);
427 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scrolled_window),
428 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
429
430
432 gtk_tree_view_set_headers_visible (tree_view, TRUE);
433
435 state_section = g_strjoin (" ", STATE_SECTION_PREFIX, guidstr, NULL);
436 g_object_set (G_OBJECT(tree_view), "state-section", state_section, NULL);
437 g_free (state_section);
438
440 priv->tree_view = tree_view;
441 selection = gtk_tree_view_get_selection (tree_view);
442 gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
443
444
447 gtk_tree_view_column_set_reorderable (name_col, FALSE);
448
449
450 priv->fd->tree_view = GNC_TREE_VIEW_ACCOUNT(priv->tree_view);
453 priv->fd, NULL);
454
455
457 priv->show_account_code = gtk_tree_view_column_get_visible (code_col);
458 gtk_tree_view_column_set_reorderable (code_col, FALSE);
459
460
462 priv->show_account_desc = gtk_tree_view_column_get_visible (desc_col);
463 gtk_tree_view_column_set_reorderable (desc_col, FALSE);
464
465
466 gtk_container_add (GTK_CONTAINER(scrolled_window), GTK_WIDGET(tree_view));
467
468 g_object_set (tree_view, "has-tooltip", TRUE, NULL);
469 g_signal_connect (G_OBJECT(tree_view), "query-tooltip",
470 G_CALLBACK(query_tooltip_tree_view_cb), budget_view);
471 g_signal_connect (G_OBJECT(tree_view), "row-activated",
472 G_CALLBACK(gbv_row_activated_cb), budget_view);
473
474
475 priv->hadj = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW(scrolled_window));
476
477 PINFO(
"Number of Created Account columns is %d", gtk_tree_view_get_n_columns (tree_view));
478
479#if 0
480 g_signal_connect (G_OBJECT(selection), "changed",
481 G_CALLBACK(gbv_selection_changed_cb), budget_view);
482 g_signal_connect (G_OBJECT(tree_view), "button-press-event",
483 G_CALLBACK(gbv_button_press_cb), budget_view);
484 gbv_selection_changed_cb (NULL, budget_view);
485#endif
486
487
488 priv->totals_scroll_window = gtk_scrolled_window_new (NULL, NULL);
489 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(priv->totals_scroll_window),
490 GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
491
492 h_adj = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW(priv->totals_scroll_window));
493 g_signal_connect (G_OBJECT(h_adj), "value-changed",
494 G_CALLBACK(gbv_totals_scrollbar_value_changed_cb), budget_view);
495
496
497 totals_tree_model = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING);
498 gtk_list_store_append (totals_tree_model, &iter);
499 gtk_list_store_set (totals_tree_model, &iter, 0,
_(
"Income"),
501 gtk_list_store_append (totals_tree_model, &iter);
502 gtk_list_store_set (totals_tree_model, &iter, 0,
_(
"Expenses"),
504 gtk_list_store_append (totals_tree_model, &iter);
505 gtk_list_store_set (totals_tree_model, &iter, 0,
_(
"Transfer"),
507 gtk_list_store_append (totals_tree_model, &iter);
508 gtk_list_store_set (totals_tree_model, &iter, 0,
_(
"Remaining to Budget"),
510
511 totals_tree_view = GTK_TREE_VIEW(gtk_tree_view_new ());
512 priv->totals_tree_view = totals_tree_view;
513 gtk_tree_selection_set_mode (gtk_tree_view_get_selection (totals_tree_view), GTK_SELECTION_NONE);
514 gtk_tree_view_set_headers_visible (totals_tree_view, FALSE);
515 gtk_tree_view_set_model (totals_tree_view, GTK_TREE_MODEL(totals_tree_model));
516 g_object_unref (totals_tree_model);
517
518
519 totals_title_col = gtk_tree_view_column_new_with_attributes ("", gtk_cell_renderer_text_new (), "text", 0, NULL);
520 gtk_tree_view_column_set_expand (totals_title_col, TRUE);
521 gtk_tree_view_column_set_sizing (totals_title_col, GTK_TREE_VIEW_COLUMN_FIXED);
522 gtk_tree_view_append_column (totals_tree_view, totals_title_col);
523
524
525 code_col = gtk_tree_view_column_new_with_attributes ("", gtk_cell_renderer_text_new(), "text", 2, NULL);
526 gtk_tree_view_column_set_sizing (code_col, GTK_TREE_VIEW_COLUMN_FIXED);
527 gtk_tree_view_append_column (totals_tree_view, code_col);
528 gtk_tree_view_column_set_visible (code_col, priv->show_account_code);
529
530
531 desc_col = gtk_tree_view_column_new_with_attributes ("", gtk_cell_renderer_text_new(), "text", 3, NULL);
532 gtk_tree_view_column_set_sizing (desc_col, GTK_TREE_VIEW_COLUMN_FIXED);
533 gtk_tree_view_append_column (totals_tree_view, desc_col);
534 gtk_tree_view_column_set_visible (desc_col, priv->show_account_desc);
535
536
537 gtk_container_add (GTK_CONTAINER(priv->totals_scroll_window), GTK_WIDGET(totals_tree_view));
538
539
540 gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(totals_tree_view), gnc_tree_view_get_grid_lines_pref ());
542 gbv_treeview_update_grid_lines, totals_tree_view);
544 gbv_treeview_update_grid_lines, totals_tree_view);
545
546
547 priv->use_red_color =
gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED);
549 gbv_update_use_red, budget_view);
550
551 PINFO(
"Number of Created totals columns is %d", gtk_tree_view_get_n_columns (totals_tree_view));
552
553 gtk_box_set_homogeneous (GTK_BOX(vbox), FALSE);
554
555 gtk_box_pack_start (GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0);
556
557 h_separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
558 gtk_box_pack_end (GTK_BOX(vbox), h_separator, FALSE, TRUE, 0);
559
560 gtk_box_pack_start (GTK_BOX(vbox), GTK_WIDGET(priv->totals_scroll_window), FALSE, TRUE, 0);
561
562 gtk_widget_show_all (GTK_WIDGET(vbox));
563
564
565 h_scrollbar = gtk_scrolled_window_get_hscrollbar (GTK_SCROLLED_WINDOW(scrolled_window));
566 gtk_widget_hide (h_scrollbar);
567
568 g_signal_connect (G_OBJECT(tree_view), "size-allocate",
569 G_CALLBACK(gbv_treeview_resized_cb), budget_view);
570
571
572 gnc_tree_view_account_restore_filter (GNC_TREE_VIEW_ACCOUNT(priv->tree_view),
573 priv->fd,
576 GNC_TREE_VIEW(priv->tree_view)));
577
578
579 g_signal_connect (G_OBJECT(gtk_tree_view_get_model (GTK_TREE_VIEW(tree_view))), "row-changed",
580 G_CALLBACK(gbv_tree_view_model_row_changed_cb), budget_view);
581
583}
584
585#define BUDGET_GUID "Budget GncGUID"
586
587
588
589
590
591
592
593
594
595
596
597
598void
599gnc_budget_view_save (GncBudgetView *budget_view, GKeyFile *key_file, const gchar *group_name)
600{
602
603 g_return_if_fail (budget_view != NULL);
604 g_return_if_fail (key_file != NULL);
605 g_return_if_fail (group_name != NULL);
606
607 ENTER(
"view %p, key_file %p, group_name %s", budget_view, key_file, group_name);
608
609 priv = GNC_BUDGET_VIEW_GET_PRIVATE(budget_view);
610
611
612 gnc_tree_view_account_save (GNC_TREE_VIEW_ACCOUNT(priv->tree_view),
613 priv->fd, key_file, group_name);
615}
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631gboolean
632gnc_budget_view_restore (GncBudgetView *budget_view, GKeyFile *key_file, const gchar *group_name)
633{
635 GError *error = NULL;
636 char *guid_str;
638 GncBudget *bgt;
640 gboolean has_guid;
641
642 g_return_val_if_fail (key_file, FALSE);
643 g_return_val_if_fail (group_name, FALSE);
644
645 ENTER(
"key_file %p, group_name %s", key_file, group_name);
646
647 guid_str = g_key_file_get_string (key_file, group_name, BUDGET_GUID,
648 &error);
649 if (error)
650 {
651 g_warning ("error reading group %s key %s: %s",
652 group_name, BUDGET_GUID, error->message);
653 g_error_free (error);
654 error = NULL;
655 return FALSE;
656 }
657 has_guid = string_to_guid (guid_str, &guid);
658 g_free (guid_str);
659
660 if (!has_guid)
661 {
662 return FALSE;
663 }
664
666 bgt = gnc_budget_lookup (&guid, book);
667 if (!bgt)
668 {
669 return FALSE;
670 }
671
672
673 priv = GNC_BUDGET_VIEW_GET_PRIVATE(budget_view);
674
675
676 gnc_tree_view_account_restore (GNC_TREE_VIEW_ACCOUNT(priv->tree_view),
677 priv->fd, key_file, group_name);
679
680 return TRUE;
681}
682
683
684
685
686
687
688
689void
690gnc_budget_view_delete_budget (GncBudgetView *budget_view)
691{
694
695 g_return_if_fail (budget_view != NULL);
696
697 ENTER(
"view %p", budget_view);
698
699 priv = GNC_BUDGET_VIEW_GET_PRIVATE(budget_view);
700
703 g_object_set (G_OBJECT(priv->tree_view), "state-section", NULL, NULL);
704
706}
707
708
709
710
711
712
713void
714gnc_budget_view_save_account_filter (GncBudgetView *budget_view)
715{
717
718 g_return_if_fail (budget_view != NULL);
719
720 ENTER(
"view %p", budget_view);
721
722 priv = GNC_BUDGET_VIEW_GET_PRIVATE(budget_view);
723
724
725 gnc_tree_view_account_save_filter (GNC_TREE_VIEW_ACCOUNT(priv->tree_view),
728 GNC_TREE_VIEW(priv->tree_view)));
730}
731
732#if 0
733
734
735
736
737
738
739
740
741
742static gboolean
743gbv_button_press_cb (GtkWidget *widget, GdkEventButton *event,
744 GncBudgetView *budget_view)
745{
746 gboolean result;
747
748 g_return_val_if_fail (budget_view != NULL, FALSE);
749
750 ENTER(
"widget %p, event %p, page %p", widget, event, page);
753 return result;
754}
755#endif
756
761static gboolean
762gbv_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
763{
764 GtkTreeViewColumn *col;
765 GtkTreePath *path = NULL;
767 GtkTreeView *tv = priv->tree_view;
768 gboolean shifted;
769 gint period_num, num_periods;
770 gpointer data;
771
772 if (event->type != GDK_KEY_PRESS || !priv->temp_cr)
773 return FALSE;
774
775 switch (event->keyval)
776 {
777 case GDK_KEY_KP_Decimal:
778 if (event->keyval == GDK_KEY_KP_Decimal)
779 {
780 struct lconv *lc = gnc_localeconv ();
781 event->keyval = lc->mon_decimal_point[0];
782 event->string[0] = lc->mon_decimal_point[0];
783 }
784 return FALSE;
785 case GDK_KEY_Tab:
786 case GDK_KEY_ISO_Left_Tab:
787 case GDK_KEY_KP_Tab:
788 shifted = event->state & GDK_SHIFT_MASK;
789 gtk_tree_view_get_cursor (tv, &path, &col);
790 if (!path)
791 return TRUE;
792 data = g_object_get_data (G_OBJECT(col), "period_num");
793 period_num = GPOINTER_TO_UINT(data);
794 num_periods = gnc_budget_get_num_periods (priv->budget);
795
796 if (period_num >= num_periods)
797 period_num = num_periods - 1;
798
799 if (shifted)
800 period_num--;
801 else
802 period_num++;
803
804 if (period_num >= num_periods)
805 {
806 period_num = 0;
807 if (gtk_tree_view_row_expanded (tv, path))
808 {
809 gtk_tree_path_down (path);
810 }
811 else
812 {
813 gtk_tree_path_next (path);
814 while (!gnc_tree_view_path_is_valid (GNC_TREE_VIEW(tv), path) &&
815 gtk_tree_path_get_depth (path) > 1)
816 {
817 gtk_tree_path_up (path);
818 gtk_tree_path_next (path);
819 }
820 }
821 }
822 else if (period_num < 0)
823 {
824 period_num = num_periods - 1;
825 if (!gtk_tree_path_prev (path))
826 gtk_tree_path_up (path);
827 else
828 {
829 while (gtk_tree_view_row_expanded (tv, path))
830 {
831 gtk_tree_path_down (path);
832 do
833 {
834 gtk_tree_path_next (path);
835 } while (
836 gnc_tree_view_path_is_valid (GNC_TREE_VIEW(tv), path));
837 gtk_tree_path_prev (path);
838 }
839 }
840 }
841
842 col = g_list_nth_data (priv->period_col_list, period_num);
843
844
845 if (priv->temp_ce)
846 {
847 gtk_cell_editable_editing_done (priv->temp_ce);
848 gtk_cell_editable_remove_widget (priv->temp_ce);
849
850 while (gtk_events_pending())
851 gtk_main_iteration ();
852 }
853
854 if (gnc_tree_view_path_is_valid (GNC_TREE_VIEW(tv), path))
855 gtk_tree_view_set_cursor (tv, path, col, TRUE);
856 gtk_tree_path_free (path);
857 break;
858 default:
859 return FALSE;
860 }
861
862 return TRUE;
863}
864
867static void
868gbv_treeview_resized_cb (GtkWidget *widget, GtkAllocation *allocation,
869 GncBudgetView *budget_view)
870{
872 GList *columns = gtk_tree_view_get_columns (GTK_TREE_VIEW(priv->tree_view));
873 GList *total_columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (priv->totals_tree_view));
874
876
877 for (GList *node = columns, *total_node = total_columns;
878 node; node = g_list_next (node))
879 {
880 GtkTreeViewColumn *tree_view_col = node->data;
881 const gchar *name = g_object_get_data (G_OBJECT(tree_view_col), PREF_NAME);
882
883
884 if ((g_strcmp0 (name, "account-code") == 0) && (!priv->show_account_code))
885 total_node = g_list_next (total_node);
886
887
888
889 if ((g_strcmp0 (name, "description") == 0) && (!priv->show_account_desc))
890 total_node = g_list_next (total_node);
891
892 if (gtk_tree_view_column_get_visible (tree_view_col) && total_node != NULL)
893 {
894 gint col_width = gtk_tree_view_column_get_width (tree_view_col);
895 GtkTreeViewColumn *totals_view_col = total_node->data;
896 if (GTK_IS_TREE_VIEW_COLUMN(totals_view_col))
897 gtk_tree_view_column_set_fixed_width (totals_view_col, col_width);
898 total_node = g_list_next (total_node);
899 }
900 }
901
903 g_list_free (columns);
904 g_list_free (total_columns);
906}
907
910static void
911gbv_row_activated_cb (GtkTreeView *treeview, GtkTreePath *path,
912 GtkTreeViewColumn *col, GncBudgetView *budget_view)
913{
915
916 g_return_if_fail (GNC_IS_BUDGET_VIEW(budget_view));
917
919 GNC_TREE_VIEW_ACCOUNT(treeview), path);
920 if (account == NULL)
921 return;
922
923 g_signal_emit_by_name (budget_view, "account-activated", account);
924}
925
926static gboolean
927query_tooltip_tree_view_cb (GtkWidget *widget, gint x, gint y,
928 gboolean keyboard_tip, GtkTooltip *tooltip,
929 GncBudgetView *view)
930{
931 GtkTreeView *tree_view = GTK_TREE_VIEW(widget);
933 GtkTreePath *path = NULL;
934 GtkTreeViewColumn *column = NULL;
935 const gchar *note;
936 guint period_num;
938
939 gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, x, y, &x, &y);
940
941 if (keyboard_tip || !gtk_tree_view_get_path_at_pos (tree_view, x, y, &path,
942 &column, NULL, NULL))
943 {
944 gtk_tree_path_free (path);
945 return FALSE;
946 }
947
948 if (!column)
949 {
950 gtk_tree_path_free (path);
951 return FALSE;
952 }
953
954 period_num = GPOINTER_TO_UINT(g_object_get_data (G_OBJECT(column), "period_num"));
955 if (!period_num && priv->period_col_list->data != column)
956 {
957 gtk_tree_path_free (path);
958 return FALSE;
959 }
961 GNC_TREE_VIEW_ACCOUNT(widget), path);
962 note = gnc_budget_get_account_period_note (priv->budget, account, period_num);
963 if (!note)
964 {
965 gtk_tree_path_free (path);
966 return FALSE;
967 }
968
969 gtk_tooltip_set_text (tooltip, note);
970 gtk_tree_view_set_tooltip_cell (tree_view, tooltip, path, column, NULL);
971 gtk_tree_path_free (path);
972
973 return TRUE;
974}
975
978#if 0
979static void
980gbv_selection_changed_cb (GtkTreeSelection *selection, GncBudgetView *budget_view)
981{
982 GtkTreeView *tree_view;
983 GList *acct_list;
984 gboolean sensitive;
985
986 if (!selection)
987 sensitive = FALSE;
988 else
989 {
990 g_return_if_fail (GTK_IS_TREE_SELECTION(selection));
991 tree_view = gtk_tree_selection_get_tree_view (selection);
993 GNC_TREE_VIEW_ACCOUNT(tree_view));
994
995
996 sensitive = (g_list_length (acct_list) > 0);
997 g_list_free (acct_list);
998 }
999}
1000#endif
1001
1009typedef struct
1010{
1011 gnc_numeric total;
1012 GncBudget *budget;
1013 guint period_num;
1014 GNCPriceDB *pdb;
1015 gnc_commodity *total_currency;
1017
1022static void
1023budget_accum_helper (
Account *account, gpointer data)
1024{
1027 gnc_commodity *currency;
1028
1030
1031 if (gnc_budget_is_account_period_value_set (info->budget, account, info->period_num))
1032 {
1033 numeric = gnc_budget_get_account_period_value (info->budget, account,
1034 info->period_num);
1036 info->pdb,
numeric, currency, info->total_currency,
1039 GNC_HOW_DENOM_LCD);
1040 }
1042 {
1043 numeric = gbv_get_accumulated_budget_amount (info->budget, account,
1044 info->period_num);
1046 info->pdb,
numeric, currency, info->total_currency,
1048
1050 GNC_HOW_DENOM_LCD);
1051 }
1052}
1053
1058static gnc_numeric
1059gbv_get_accumulated_budget_amount (GncBudget *budget,
Account *account, guint period_num)
1060{
1062
1063 info.total = gnc_numeric_zero ();
1064 info.budget = budget;
1065 info.period_num = period_num;
1068
1069 if (!gnc_budget_is_account_period_value_set (budget, account, period_num))
1071 else
1072 info.total = gnc_budget_get_account_period_value (budget, account, period_num);
1073
1074 return info.total;
1075}
1076
1077
1085static gchar *
1086budget_col_source (
Account *account, GtkTreeViewColumn *col,
1087 GtkCellRenderer *cell)
1088{
1089 GncBudgetView *budget_view;
1091 guint period_num;
1093 gchar amtbuff[100];
1094 const gchar *note;
1095
1096 budget_view = GNC_BUDGET_VIEW(g_object_get_data (G_OBJECT(col), "budget_view"));
1097 period_num = GPOINTER_TO_UINT(g_object_get_data (G_OBJECT(col), "period_num"));
1098
1099 priv = GNC_BUDGET_VIEW_GET_PRIVATE(budget_view);
1100
1101 if (!gnc_budget_is_account_period_value_set (priv->budget, account, period_num))
1102 {
1104 amtbuff[0] = '\0';
1105 else
1106 {
1107 GdkRGBA color;
1108 GtkStyleContext *stylectxt = gtk_widget_get_style_context (GTK_WIDGET(priv->tree_view));
1109 gtk_style_context_get_color (stylectxt, GTK_STATE_FLAG_NORMAL, &color);
1110
1111 numeric = gbv_get_accumulated_budget_amount (priv->budget, account, period_num);
1112
1113 if (gnc_reverse_balance (account))
1115
1118 g_object_set (cell, "foreground",
1120 ? "darkred"
1121 : "darkgray",
1122 NULL);
1123 else
1124 g_object_set (cell, "foreground",
1126 ? "PaleVioletRed"
1127 : "dimgray",
1128 NULL);
1129 }
1130 }
1131 else
1132 {
1133 numeric = gnc_budget_get_account_period_value (priv->budget, account,
1134 period_num);
1135 if (gnc_numeric_check (
numeric))
1136 strcpy (amtbuff, "error");
1137 else
1138 {
1139 if (gnc_reverse_balance (account))
1141
1143 gnc_account_print_info (account, FALSE));
1144
1146 {
1147 gchar *color = gnc_get_negative_color ();
1148 g_object_set (cell, "foreground", color, NULL);
1149 g_free (color);
1150 }
1151 else
1152 g_object_set (cell, "foreground", NULL, NULL);
1153 }
1154 }
1155
1156 note = gnc_budget_get_account_period_note (priv->budget, account, period_num);
1157 g_object_set (cell, "flagged", note != NULL, NULL);
1158
1159 return g_strdup (amtbuff);
1160}
1161
1165static gnc_numeric
1166bgv_get_total_for_account (
Account *account, GncBudget *budget, gnc_commodity *new_currency)
1167{
1168 guint num_periods;
1169 int period_num;
1171 gnc_numeric total = gnc_numeric_zero ();
1172 GNCPriceDB *pdb;
1173 gnc_commodity *currency;
1174
1175 if (new_currency)
1176 {
1179 }
1180
1181 num_periods = gnc_budget_get_num_periods (budget);
1182 for (period_num = 0; period_num < num_periods; ++period_num)
1183 {
1184 if (!gnc_budget_is_account_period_value_set (budget, account, period_num))
1185 {
1187 {
1188 numeric = gbv_get_accumulated_budget_amount (budget, account, period_num);
1189
1190 if (new_currency)
1191 {
1193 pdb,
numeric, currency, new_currency,
1195 }
1197 }
1198 }
1199 else
1200 {
1201 numeric = gnc_budget_get_account_period_value (budget, account, period_num);
1202 if (!gnc_numeric_check (
numeric))
1203 {
1204 if (new_currency)
1205 {
1207 pdb,
numeric, currency, new_currency,
1209 }
1211 }
1212 }
1213 }
1214
1215 return total;
1216}
1217
1220static gchar *
1221budget_total_col_source (
Account *account, GtkTreeViewColumn *col,
1222 GtkCellRenderer *cell)
1223{
1224 GncBudgetView *budget_view;
1226 gnc_numeric total;
1227 gchar amtbuff[100];
1228
1229 budget_view = GNC_BUDGET_VIEW(g_object_get_data (G_OBJECT(col), "budget_view"));
1230 priv = GNC_BUDGET_VIEW_GET_PRIVATE(budget_view);
1231
1232 total = bgv_get_total_for_account (account, priv->budget, NULL);
1233 if (gnc_reverse_balance (account))
1235
1237
1239 {
1240 gchar *color = gnc_get_negative_color ();
1241 g_object_set (cell, "foreground", color, NULL);
1242 g_free (color);
1243 }
1244 else
1245 g_object_set (cell, "foreground", NULL, NULL);
1246
1247 return g_strdup (amtbuff);
1248}
1249
1257static void
1258budget_col_edited (
Account *account, GtkTreeViewColumn *col,
1259 const gchar *new_text)
1260{
1261 GncBudgetView *budget_view;
1263 guint period_num;
1265
1267 return;
1268
1270 !(new_text && *new_text == '\0'))
1271 return;
1272
1273 period_num = GPOINTER_TO_UINT(g_object_get_data (G_OBJECT(col), "period_num"));
1274
1275 budget_view = GNC_BUDGET_VIEW(g_object_get_data (G_OBJECT(col), "budget_view"));
1276 priv = GNC_BUDGET_VIEW_GET_PRIVATE(budget_view);
1277
1278 if (new_text && *new_text == '\0')
1279 gnc_budget_unset_account_period_value (priv->budget, account, period_num);
1280 else
1281 {
1282 if (gnc_reverse_balance (account))
1284 gnc_budget_set_account_period_value (priv->budget, account, period_num,
1286 }
1287}
1288
1301static void
1302totals_col_source (GtkTreeViewColumn *col, GtkCellRenderer *cell,
1303 GtkTreeModel *s_model, GtkTreeIter *s_iter,
1304 gpointer user_data)
1305{
1306 gnc_numeric total = gnc_numeric_zero ();
1307 GncBudgetView *budget_view = GNC_BUDGET_VIEW(user_data);
1309 gint period_num = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(col), "period_num"));
1313 gint row_type;
1314
1315 gtk_tree_model_get (s_model, s_iter, 1, &row_type, -1);
1316
1317
1318
1319 for (GList *node = top_level_accounts; node; node = g_list_next (node))
1320 {
1321 Account *account = node->data;
1323
1328 (acctype == ACCT_TYPE_ASSET || acctype == ACCT_TYPE_LIABILITY ||
1329 acctype == ACCT_TYPE_EQUITY)))
1330 {
1331 gnc_numeric value;
1332
1333 if (period_num < 0)
1334 value = bgv_get_total_for_account (account, priv->budget, total_currency);
1335 else
1336 {
1338 value = gbv_get_accumulated_budget_amount
1339 (priv->budget, account, period_num);
1340
1342 (pdb, value, currency, total_currency,
1344 }
1345
1347 }
1348 }
1349
1351
1352 GNCPrintAmountInfo pinfo = gnc_commodity_print_info (total_currency, period_num < 0);
1354 gnc_get_negative_color () : NULL;
1355
1356 g_object_set (G_OBJECT(cell),
1358 "xalign", 1.0,
1359 "foreground", color,
1360 NULL);
1361
1362 g_free (color);
1363 g_list_free (top_level_accounts);
1364}
1365
1371static void
1372gbv_refresh_col_titles (GncBudgetView *budget_view)
1373{
1376 GDate date, nextdate;
1378
1379 g_return_if_fail (budget_view != NULL);
1380 priv = GNC_BUDGET_VIEW_GET_PRIVATE(budget_view);
1381
1382
1383 r = gnc_budget_get_recurrence (priv->budget);
1384 date = r->start;
1385 for (GList *node = priv->period_col_list; node; node = g_list_next (node))
1386 {
1387 GtkTreeViewColumn *col = GTK_TREE_VIEW_COLUMN (node->data);
1389
1390 if (titlelen > 0)
1391 gtk_tree_view_column_set_title (col, title);
1392
1393 recurrenceNextInstance (r, &date, &nextdate);
1394 date = nextdate;
1395 }
1396}
1397
1398static void
1399gbv_renderer_add_padding (GtkCellRenderer *renderer)
1400{
1401 gint xpad, ypad;
1402
1403 gtk_cell_renderer_get_padding (renderer, &xpad, &ypad);
1404 if (xpad < 5)
1405 gtk_cell_renderer_set_padding (renderer, 5, ypad);
1406}
1407
1410static GtkTreeViewColumn*
1411gbv_create_totals_column (GncBudgetView *budget_view, gint period_num)
1412{
1413 GtkTreeViewColumn *col;
1414 GtkCellRenderer* renderer;
1415
1416 g_return_val_if_fail (budget_view != NULL, NULL);
1417
1418 renderer = gtk_cell_renderer_text_new ();
1419 col = gtk_tree_view_column_new_with_attributes ("", renderer, NULL);
1420
1421
1422 gbv_renderer_add_padding (renderer);
1423
1424 gtk_tree_view_column_set_cell_data_func (col, renderer, totals_col_source, budget_view, NULL);
1425 g_object_set_data (G_OBJECT(col), "budget_view", budget_view);
1426 g_object_set_data (G_OBJECT(col), "period_num", GUINT_TO_POINTER(period_num));
1427 gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_FIXED);
1428
1429 return col;
1430}
1431
1436static void
1437gbv_col_edited_cb (GtkCellRendererText *cell, gchar *path_string,
1438 gchar *new_text, gpointer user_data)
1439{
1440 GncBudgetView *budget_view = GNC_BUDGET_VIEW(user_data);
1442
1443 gtk_widget_queue_draw (GTK_WIDGET(priv->totals_tree_view));
1444}
1445
1446
1447
1448static void
1449gdv_editing_started_cb (GtkCellRenderer *cr, GtkCellEditable *editable,
1450 const gchar *path_string, gpointer user_data)
1451{
1453
1454 priv->temp_cr = cr;
1455 priv->temp_ce = editable;
1456
1457 g_signal_connect (G_OBJECT(editable), "key-press-event",
1458 G_CALLBACK(gbv_key_press_cb), user_data);
1459}
1460
1461static void
1462gdv_editing_canceled_cb (GtkCellRenderer *cr, gpointer user_data)
1463{
1465
1466 priv->temp_cr = NULL;
1467 priv->temp_ce = NULL;
1468}
1469
1475void
1477{
1478
1479 enum {
1480 code_column = 1,
1481 description_column = 2,
1482 startPeriods_column = 3
1483
1484 };
1485
1487 gint num_periods;
1488 gint num_periods_visible;
1489 GtkTreeViewColumn *col, *code_col, *desc_col;
1490 GList *col_list;
1491 GList *totals_col_list;
1492 GdkRGBA *note_color, *note_color_selected;
1493 GtkStyleContext *stylectxt;
1494
1495 ENTER(
"view %p", budget_view);
1496
1497 g_return_if_fail (budget_view != NULL);
1498 priv = GNC_BUDGET_VIEW_GET_PRIVATE(budget_view);
1499
1500 stylectxt = gtk_widget_get_style_context (GTK_WIDGET(priv->tree_view));
1501 gtk_style_context_get (stylectxt, GTK_STATE_FLAG_SELECTED, "background-color", ¬e_color, NULL);
1502 gtk_style_context_get (stylectxt, GTK_STATE_FLAG_NORMAL, "background-color", ¬e_color_selected, NULL);
1503
1504 num_periods = gnc_budget_get_num_periods (priv->budget);
1505
1506 col_list = g_list_reverse (priv->period_col_list);
1507 totals_col_list = g_list_reverse (priv->totals_col_list);
1508 num_periods_visible = g_list_length (col_list);
1509
1510
1511 while (num_periods_visible > num_periods)
1512 {
1513 col = GTK_TREE_VIEW_COLUMN (col_list->data);
1514 gtk_tree_view_remove_column (GTK_TREE_VIEW(priv->tree_view), col);
1515 col_list = g_list_delete_link (col_list, col_list);
1516 num_periods_visible--;
1517
1518 col = GTK_TREE_VIEW_COLUMN(totals_col_list->data);
1519 gtk_tree_view_remove_column (GTK_TREE_VIEW(priv->totals_tree_view), col);
1520 totals_col_list = g_list_delete_link (totals_col_list, totals_col_list);
1521 }
1522
1524
1525
1527 gtk_tree_view_column_set_visible (code_col, priv->show_account_code);
1528 code_col = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->totals_tree_view), code_column);
1529 gtk_tree_view_column_set_visible (code_col, priv->show_account_code);
1530
1531
1533 gtk_tree_view_column_set_visible (desc_col, priv->show_account_desc);
1534 desc_col = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->totals_tree_view), description_column);
1535 gtk_tree_view_column_set_visible (desc_col, priv->show_account_desc);
1536
1537
1538
1539
1540 if (num_periods_visible != 0 && num_periods > num_periods_visible)
1541 {
1542
1543 col = priv->total_col;
1544 gtk_tree_view_remove_column (GTK_TREE_VIEW(priv->tree_view), col);
1545 priv->total_col = NULL;
1546 col = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->totals_tree_view),
1547 startPeriods_column + num_periods_visible);
1548 gtk_tree_view_remove_column (GTK_TREE_VIEW(priv->totals_tree_view), col);
1549 }
1550
1551
1552 while (num_periods_visible < num_periods)
1553 {
1554 GtkCellRenderer *renderer = gnc_cell_renderer_text_flag_new ();
1555 g_object_set (renderer, "flag-color-rgba", note_color, NULL);
1556 g_object_set (renderer, "flag-color-rgba-selected", note_color_selected, NULL);
1557
1558 col = gnc_tree_view_account_add_custom_column_renderer (
1559 GNC_TREE_VIEW_ACCOUNT(priv->tree_view), "",
1560 budget_col_source, budget_col_edited, renderer);
1561 g_object_set_data (G_OBJECT(col), "budget_view", budget_view);
1562 g_object_set_data (G_OBJECT(col), "period_num", GUINT_TO_POINTER(num_periods_visible));
1563 col_list = g_list_prepend (col_list, col);
1564
1565
1566 gbv_renderer_add_padding (renderer);
1567
1568 g_signal_connect (G_OBJECT(renderer), "edited", (GCallback)gbv_col_edited_cb, budget_view);
1569 g_signal_connect (G_OBJECT(renderer), "editing-started",
1570 (GCallback)gdv_editing_started_cb, budget_view);
1571 g_signal_connect (G_OBJECT(renderer), "editing-canceled",
1572 (GCallback)gdv_editing_canceled_cb, budget_view);
1573 col = gbv_create_totals_column (budget_view, num_periods_visible);
1574 if (col != NULL)
1575 {
1576 gtk_tree_view_append_column (priv->totals_tree_view, col);
1577 totals_col_list = g_list_prepend (totals_col_list, col);
1578 }
1579
1580 num_periods_visible++;
1581 }
1582
1583 gdk_rgba_free (note_color);
1584 gdk_rgba_free (note_color_selected);
1585
1586 priv->period_col_list = g_list_reverse (col_list);
1587 priv->totals_col_list = g_list_reverse (totals_col_list);
1588
1589 if (priv->total_col == NULL)
1590 {
1592 guint titlelen;
1593 GDate *date;
1594 GtkCellRenderer* renderer;
1595
1597 GNC_TREE_VIEW_ACCOUNT(priv->tree_view),
_(
"Total"),
1598 budget_total_col_source, NULL);
1599
1600
1601 gtk_tree_view_column_set_alignment (priv->total_col, 1.0);
1602
1603
1604 date = g_date_new_dmy (31, 12, 2018);
1606 if (titlelen > 0)
1607 {
1608 PangoLayout *layout = gtk_widget_create_pango_layout (GTK_WIDGET(budget_view), title);
1609 PangoRectangle logical_rect;
1610 pango_layout_set_width (layout, -1);
1611 pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
1612 g_object_unref (layout);
1613
1614 gtk_tree_view_column_set_min_width (priv->total_col, logical_rect.width);
1615 }
1616 g_date_free (date);
1617 g_object_set_data (G_OBJECT(priv->total_col), "budget_view", budget_view);
1618
1619
1621
1622
1623 gbv_renderer_add_padding (renderer);
1624
1625 col = gbv_create_totals_column (budget_view, -1);
1626 if (col != NULL)
1627 gtk_tree_view_append_column (priv->totals_tree_view, col);
1628 }
1629 gbv_refresh_col_titles (budget_view);
1630
1631 PINFO(
"Number of columns is %d, totals columns is %d",
1632 gtk_tree_view_get_n_columns (priv->tree_view), gtk_tree_view_get_n_columns (priv->totals_tree_view));
1633
1635}
1636
GNCAccountType
The account types are used to determine how the transaction data in the account is displayed.
gnc_commodity * gnc_account_get_currency_or_parent(const Account *account)
Returns a gnc_commodity that is a currency, suitable for being a Transaction's currency.
GNCAccountType xaccAccountGetType(const Account *acc)
Returns the account's account type.
GList * gnc_account_get_children(const Account *account)
This routine returns a GList of all children accounts of the specified account.
void gnc_account_foreach_child(const Account *acc, AccountCb thunk, gpointer user_data)
This method will traverse the immediate children of this accounts, calling 'func' on each account.
gint gnc_account_n_children(const Account *account)
Return the number of children of the specified account.
QofBook * qof_session_get_book(const QofSession *session)
Returns the QofBook of this session.
gboolean qof_book_is_readonly(const QofBook *book)
Return whether the book is read only.
#define MAX_DATE_LENGTH
The maximum length of a string created by the date printers.
size_t qof_print_gdate(char *buf, size_t len, const GDate *gd)
Convenience; calls through to qof_print_date_dmy_buff().
GNCAccountType xaccAccountTypeGetFundamental(GNCAccountType t)
Convenience function to return the fundamental type asset/liability/income/expense/equity given an ac...
#define GUID_ENCODING_LENGTH
Number of characters needed to encode a guid as a string not including the null terminator.
gchar * guid_to_string_buff(const GncGUID *guid, gchar *str)
The guid_to_string_buff() routine puts a null-terminated string encoding of the id into the memory po...
gboolean gnc_main_window_button_press_cb(GtkWidget *whatever, GdkEventButton *event, GncPluginPage *page)
Callback function invoked when the user clicks in the content of any Gnucash window.
gint gnc_state_drop_sections_for(const gchar *partial_name)
Drop all sections from the state file whose name contains partial_name.
GKeyFile * gnc_state_get_current(void)
Returns a pointer to the most recently loaded state.
void gnc_tree_view_configure_columns(GncTreeView *view)
Make all the correct columns visible, respecting their default visibility setting,...
GtkCellRenderer * gnc_tree_view_column_get_renderer(GtkTreeViewColumn *column)
Return the "main" cell renderer from a GtkTreeViewColumn added to a GncTreeView my one of the conveni...
const gchar * gnc_tree_view_get_state_section(GncTreeView *view)
Get the name of the state section this tree view is associated with.
void gnc_tree_view_expand_columns(GncTreeView *view, gchar *first_column_name,...)
This function set the columns that will be allocated the free space in the view.
GtkTreeViewColumn * gnc_tree_view_find_column_by_name(GncTreeView *view, const gchar *wanted)
Find a tree column given the "pref name" used with saved state.
gboolean gnc_is_dark_theme(GdkRGBA *fg_color)
Return whether the current gtk theme is a dark one.
GList * gnc_tree_view_account_get_selected_accounts(GncTreeViewAccount *view)
This function returns a list of the accounts associated with the selected items in the account tree v...
Account * gnc_tree_view_account_get_account_from_path(GncTreeViewAccount *view, GtkTreePath *s_path)
This function returns the account associated with the specified path.
GtkTreeView * gnc_tree_view_account_new(gboolean show_root)
Create a new account tree view.
gboolean gnc_plugin_page_account_tree_filter_accounts(Account *account, gpointer user_data)
This function tells the account tree view whether or not to filter out a particular account.
GtkTreeViewColumn * gnc_tree_view_account_add_custom_column(GncTreeViewAccount *account_view, const gchar *column_title, GncTreeViewAccountColumnSource col_source_cb, GncTreeViewAccountColumnTextEdited col_edited_cb)
Add a new custom column to the set of columns in an account tree view.
void gnc_tree_view_account_set_filter(GncTreeViewAccount *view, gnc_tree_view_account_filter_func func, gpointer data, GSourceFunc destroy)
This function attaches a filter function to the given account tree.
int xaccSPrintAmount(char *bufp, gnc_numeric val, GNCPrintAmountInfo info)
Make a string representation of a gnc_numeric.
const char * xaccPrintAmount(gnc_numeric val, GNCPrintAmountInfo info)
Make a string representation of a gnc_numeric.
gnc_commodity * gnc_default_currency(void)
Return the default currency set by the user.
gboolean xaccParseAmount(const char *in_str, gboolean monetary, gnc_numeric *result, char **endstr)
Parses in_str to obtain a numeric result.
#define PINFO(format, args...)
Print an informational note.
#define LEAVE(format, args...)
Print a function exit debugging message.
#define ENTER(format, args...)
Print a function entry debugging message.
#define GNC_DENOM_AUTO
Values that can be passed as the 'denom' argument.
gnc_numeric gnc_numeric_error(GNCNumericErrorCode error_code)
Create a gnc_numeric object that signals the error condition noted by error_code, rather than a numbe...
gboolean gnc_numeric_negative_p(gnc_numeric a)
Returns 1 if a < 0, otherwise returns 0.
gnc_numeric gnc_numeric_neg(gnc_numeric a)
Returns a newly created gnc_numeric that is the negative of the given gnc_numeric value.
gnc_numeric gnc_numeric_add(gnc_numeric a, gnc_numeric b, gint64 denom, gint how)
Return a+b.
@ GNC_ERROR_ARG
Argument is not a valid number.
void gnc_prefs_remove_cb_by_func(const gchar *group, const gchar *pref_name, gpointer func, gpointer user_data)
Remove a function that was registered for a callback when the given preference changed.
gulong gnc_prefs_register_cb(const char *group, const gchar *pref_name, gpointer func, gpointer user_data)
Register a callback that gets triggered when the given preference changes.
gboolean gnc_prefs_get_bool(const gchar *group, const gchar *pref_name)
Get a boolean value from the preferences backend.
gnc_numeric gnc_pricedb_convert_balance_nearest_price_t64(GNCPriceDB *pdb, gnc_numeric balance, const gnc_commodity *balance_currency, const gnc_commodity *new_currency, time64 t)
Convert a balance from one currency to another using the price nearest to the given time.
GNCPriceDB * gnc_pricedb_get_db(QofBook *book)
Return the pricedb associated with the book.
void gnc_budget_view_refresh(GncBudgetView *budget_view)
refreshes the current budget view
GtkTreeSelection * gnc_budget_view_get_selection(GncBudgetView *budget_view)
returns the current selection in the gnc budget view.
@ TOTALS_TYPE_REMAINDER
This total is Remaining to Budget.
@ TOTALS_TYPE_ASSET_LIAB_EQ
This total is Asset/Liab/Equity type.
@ TOTALS_TYPE_EXPENSES
This total is Expenses type.
@ TOTALS_TYPE_INCOME
This total is Income type.
Action for when a selection in a gnc budget view is changed.
the private budget view structure