28 #include <glib/gi18n.h>
29 #include <glib/gstdio.h>
31 #include <sys/types.h>
34 #include "gnc-account-merge.h"
35 #include "dialog-new-user.h"
36 #include "dialog-options.h"
37 #include "dialog-utils.h"
39 #include "assistant-hierarchy.h"
40 #include "assistant-utils.h"
41 #include "gnc-amount-edit.h"
43 #include "gnc-exp-parser.h"
44 #include "gnc-general-select.h"
47 #include "gnc-hooks.h"
48 #include "gnc-component-manager.h"
50 #include "gnc-gui-query.h"
53 #include "io-example-account.h"
54 #include "top-level.h"
61 #define GNC_PREFS_GROUP "dialogs.new-hierarchy"
62 #define GNC_PREF_SHOW_ON_NEW_FILE "show-on-new-file"
68 COL_SHORT_DESCRIPTION,
81 GtkWidget *currency_selector;
83 GtkTreeView *categories_tree;
84 GtkTreeRowReference *initial_category;
85 GtkTextView *category_description;
86 GtkWidget *category_accounts_container;
87 GtkLabel *category_accounts_label;
88 GtkTreeView *category_accounts_tree;
89 gboolean category_set_changed;
92 GtkWidget *final_account_tree_container;
100 gboolean account_list_added;
101 gboolean use_defaults;
107 GncHierarchyAssistantFinishedCallback when_completed;
111 void on_prepare (GtkAssistant *assistant, GtkWidget *page,
114 void select_all_clicked (GtkButton *button,
116 void clear_all_clicked (GtkButton *button,
119 void on_cancel (GtkAssistant *gtkassistant,
hierarchy_data *data);
120 void on_finish (GtkAssistant *gtkassistant,
hierarchy_data *data);
127 gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(data->dialog));
128 gtk_widget_destroy (data->dialog);
132 destroy_hash_helper (gpointer key, gpointer value, gpointer user_data)
146 g_hash_table_foreach (hash, destroy_hash_helper, NULL);
147 g_hash_table_destroy (hash);
153 get_final_balance (GHashTable *hash,
Account *account)
157 if (!hash || !account)
158 return gnc_numeric_zero ();
160 balance = g_hash_table_lookup(hash, account);
163 return gnc_numeric_zero ();
171 if (!hash || !account)
174 balance = g_hash_table_lookup (hash, account);
177 *balance = in_balance;
182 *balance = in_balance;
183 g_hash_table_insert (hash, account, balance);
187 gnc_get_ea_locale_dir(
const char *top_dir)
189 static gchar *default_locale =
"C";
195 #ifdef HAVE_LC_MESSAGES
196 locale = g_strdup(setlocale(LC_MESSAGES, NULL));
201 locale = g_win32_getlocale();
204 PWARN (
"Couldn't retrieve locale. Falling back to default one.");
205 locale = g_strdup (
"C");
212 locale = g_strdup(setlocale(LC_ALL, NULL) ?
213 setlocale(LC_ALL, NULL) :
"C");
218 ret = g_build_filename(top_dir, locale, (
char *)NULL);
220 while (g_stat(ret, &buf) != 0)
226 ret = g_build_filename(top_dir, default_locale, (
char *)NULL);
231 ret = g_build_filename(top_dir, locale, (
char *)NULL);
261 account_set_checked_helper (GtkListStore *store,
268 g_return_val_if_fail(GTK_IS_LIST_STORE(store), FALSE);
270 gtk_tree_model_get (GTK_TREE_MODEL(store), iter, COL_CHECKED, &checked, -1);
290 GtkWidget *currentpage;
291 GtkAssistant *assistant = GTK_ASSISTANT(data->dialog);
293 data->next_ok = FALSE;
294 gtk_tree_model_foreach (gtk_tree_view_get_model (data->categories_tree),
295 (GtkTreeModelForeachFunc)account_set_checked_helper,
298 currentpagenum = gtk_assistant_get_current_page(assistant);
299 currentpage = gtk_assistant_get_nth_page(assistant, currentpagenum);
301 gtk_assistant_set_page_complete(assistant, currentpage, data->next_ok);
306 categories_selection_changed (GtkTreeModel *treemodel,
311 data->category_set_changed = TRUE;
312 categories_page_enable_next(data);
324 gboolean use_defaults;
326 g_return_if_fail(acc != NULL);
327 g_return_if_fail(data != NULL);
329 view = data->categories_tree;
330 store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
331 use_defaults = data->use_defaults && acc->start_selected;
333 gtk_list_store_append(store, &iter);
334 gtk_list_store_set(store, &iter,
335 COL_CHECKED, use_defaults,
336 COL_TITLE, acc->title,
337 COL_SHORT_DESCRIPTION, acc->short_description,
338 COL_LONG_DESCRIPTION, acc->long_description,
344 data->category_set_changed = TRUE;
345 path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
346 data->initial_category = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path);
347 gtk_tree_path_free(path);
352 category_checkbox_toggled (GtkCellRendererToggle *toggle,
359 if (!gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(store),
364 active = gtk_cell_renderer_toggle_get_active(toggle);
365 gtk_list_store_set(store, &iter, COL_CHECKED, !active, -1);
372 gchar *gnc_accounts_dir;
374 GtkTreeView *tree_view;
376 GtkTreeViewColumn *column;
377 GtkCellRenderer *renderer;
378 GtkTreeSelection *selection;
381 gnc_accounts_dir = gnc_path_get_accountsdir ();
382 locale_dir = gnc_get_ea_locale_dir (gnc_accounts_dir);
383 list = gnc_load_example_account_list (locale_dir);
384 g_free (gnc_accounts_dir);
388 tree_view = data->categories_tree;
389 model = gtk_list_store_new(NUM_COLUMNS, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING,
390 G_TYPE_STRING, G_TYPE_POINTER);
391 gtk_tree_view_set_model (tree_view, GTK_TREE_MODEL(model));
392 g_object_unref (model);
394 g_slist_foreach(list, (GFunc)add_one_category, data);
396 g_signal_connect (G_OBJECT (model),
"row_changed",
397 G_CALLBACK (categories_selection_changed),
400 renderer = gtk_cell_renderer_toggle_new ();
401 g_object_set (G_OBJECT (renderer),
"activatable", TRUE, NULL);
402 column = gtk_tree_view_column_new_with_attributes (_(
"Selected"),
404 "active", COL_CHECKED,
406 gtk_tree_view_append_column (tree_view, column);
407 gtk_tree_view_column_set_sort_column_id (column, COL_CHECKED);
408 g_signal_connect (G_OBJECT (renderer),
"toggled",
409 G_CALLBACK (category_checkbox_toggled),
413 renderer = gtk_cell_renderer_text_new ();
414 column = gtk_tree_view_column_new_with_attributes (_(
"Account Types"),
418 gtk_tree_view_append_column (tree_view, column);
419 gtk_tree_view_column_set_sort_column_id (column, COL_TITLE);
429 gtk_tree_view_set_headers_clickable(tree_view, TRUE);
430 gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE(model),
434 if (data->initial_category)
436 path = gtk_tree_row_reference_get_path(data->initial_category);
437 selection = gtk_tree_view_get_selection(tree_view);
438 gtk_tree_view_scroll_to_cell(tree_view, path, NULL, TRUE, 0.5, 0.5);
439 gtk_tree_selection_select_path(selection, path);
440 gtk_tree_path_free(path);
444 void on_prepare (GtkAssistant *assistant, GtkWidget *page,
447 const int selection_page = data->new_book ? 3 : 2;
448 const int final_page = data->new_book ? 4 : 3;
449 const int current_page = gtk_assistant_get_current_page (assistant);
451 if (current_page == selection_page)
452 on_choose_account_categories_prepare(data);
454 if (current_page == final_page)
455 on_final_account_prepare (data);
461 GtkTextBuffer* buffer;
463 if (!data->account_list_added)
466 if (data->category_accounts_tree)
467 gtk_widget_destroy(GTK_WIDGET(data->category_accounts_tree));
468 data->category_accounts_tree = NULL;
469 buffer = gtk_text_view_get_buffer(data->category_description);
470 gtk_text_buffer_set_text(buffer,
"", -1);
472 data->account_list_added = TRUE;
475 gnc_suspend_gui_refresh ();
476 account_categories_tree_view_prepare (data);
477 gnc_resume_gui_refresh ();
479 categories_page_enable_next(data);
483 categories_tree_selection_changed (GtkTreeSelection *selection,
486 GtkTreeView *tree_view;
488 GtkTreeViewColumn *column;
491 GtkTextBuffer* buffer;
495 if (data->category_accounts_tree)
496 gtk_widget_destroy(GTK_WIDGET(data->category_accounts_tree));
497 data->category_accounts_tree = NULL;
500 if (gtk_tree_selection_get_selected (selection, &model, &iter))
503 gtk_tree_model_get (model, &iter, COL_ACCOUNT, &gea, -1);
505 text2 = g_strdup_printf(_(
"Accounts in '%s'"), gea->title);
506 text = g_strdup_printf(
"<b>%s</b>", text2);
507 gtk_label_set_markup(data->category_accounts_label, text);
510 buffer = gtk_text_view_get_buffer(data->category_description);
511 gtk_text_buffer_set_text(buffer, gea->long_description ?
512 gea->long_description :
513 _(
"No description provided."), -1);
517 column = gtk_tree_view_get_column(GTK_TREE_VIEW(tree_view), 0);
518 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
520 data->category_accounts_tree = tree_view;
521 gtk_tree_view_expand_all (tree_view);
522 gtk_container_add(GTK_CONTAINER(data->category_accounts_container), GTK_WIDGET(tree_view));
523 gtk_widget_show(GTK_WIDGET(tree_view));
528 text = g_strdup_printf (
"<b>%s</b>", _(
"Accounts in Category"));
529 gtk_label_set_markup(data->category_accounts_label, text);
531 buffer = gtk_text_view_get_buffer(data->category_description);
532 gtk_text_buffer_set_text(buffer,
"", -1);
537 select_helper (GtkListStore *store,
544 g_return_val_if_fail(GTK_IS_LIST_STORE(store), FALSE);
546 gtk_tree_model_get (GTK_TREE_MODEL(store), iter, COL_ACCOUNT, &gea, -1);
547 if ((gea != NULL) && !gea->exclude_from_select_all)
549 gtk_list_store_set(store, iter,
550 COL_CHECKED, GPOINTER_TO_INT(data),
558 select_all_clicked (GtkButton *button,
561 gtk_tree_model_foreach (gtk_tree_view_get_model (data->categories_tree),
562 (GtkTreeModelForeachFunc)select_helper,
563 GINT_TO_POINTER(TRUE));
567 clear_all_clicked (GtkButton *button,
570 gtk_tree_model_foreach (gtk_tree_view_get_model (data->categories_tree),
571 (GtkTreeModelForeachFunc)select_helper,
572 GINT_TO_POINTER(FALSE));
582 if (data->our_account_tree != NULL)
586 data->our_account_tree = NULL;
610 add_groups_for_each (
Account *toadd, gpointer data)
619 foundact = clone_account (toadd, dadata->com);
623 else if (dadata->parent)
627 g_warning (
"add_groups_for_each: no valid parent");
636 downdata.to = foundact;
637 downdata.parent = foundact;
638 downdata.com = dadata->com;
658 hierarchy_merge_accounts (GSList *dalist,
gnc_commodity *com)
663 for (mark = dalist; mark; mark = mark->next)
667 add_new_accounts_with_random_guids (ret, xea->root, com);
674 accumulate_accounts (GtkListStore *store,
682 g_return_val_if_fail(GTK_IS_LIST_STORE(store), FALSE);
684 gtk_tree_model_get (GTK_TREE_MODEL(store), iter,
685 COL_CHECKED, &active,
689 *list = g_slist_prepend(*list, gea);
696 get_selected_account_list (GtkTreeView *tree_view)
698 GSList *actlist = NULL;
701 model = gtk_tree_view_get_model (tree_view);
702 gtk_tree_model_foreach (model,
703 (GtkTreeModelForeachFunc)accumulate_accounts,
709 balance_cell_data_func (GtkTreeViewColumn *tree_column,
710 GtkCellRenderer *cell,
720 gboolean allow_value;
722 g_return_if_fail (GTK_TREE_MODEL (model));
725 balance = get_final_balance (data->
balance_hash, account);
732 print_info = gnc_account_print_info (account, FALSE);
733 string = xaccPrintAmount (balance, print_info);
744 GncAccountMergeDisposition disp;
745 disp = determine_merge_disposition(gnc_book_get_root_account(gnc_get_current_book()), account);
746 if (disp == GNC_ACCOUNT_MERGE_DISPOSITION_CREATE_NEW)
753 string = _(
"existing account");
756 g_object_set (G_OBJECT (cell),
758 "editable", allow_value,
759 "sensitive", allow_value,
764 balance_cell_edited (GtkCellRendererText *cell,
774 g_return_if_fail(data != NULL);
779 g_critical(
"account is null");
784 if (!gnc_exp_parser_parse (new_text, &amount, &error_loc))
786 amount = gnc_numeric_zero();
787 g_object_set (G_OBJECT(cell),
"text",
"", NULL);
798 set_final_balance (data->
balance_hash, account, amount);
799 qof_event_gen (QOF_INSTANCE(account), QOF_EVENT_MODIFY, NULL);
803 placeholder_cell_data_func (GtkTreeViewColumn *tree_column,
804 GtkCellRenderer *cell,
810 gboolean willbe_placeholder = FALSE;
811 GncAccountMergeDisposition disp;
813 g_return_if_fail (GTK_TREE_MODEL (model));
815 root = gnc_book_get_root_account(gnc_get_current_book());
816 disp = determine_merge_disposition(root, account);
819 case GNC_ACCOUNT_MERGE_DISPOSITION_USE_EXISTING:
830 case GNC_ACCOUNT_MERGE_DISPOSITION_CREATE_NEW:
835 gtk_cell_renderer_toggle_set_active(GTK_CELL_RENDERER_TOGGLE(cell), willbe_placeholder);
840 use_existing_account_data_func(GtkTreeViewColumn *tree_column,
841 GtkCellRenderer *cell,
842 GtkTreeModel *tree_model,
848 GncAccountMergeDisposition disposition;
849 char *to_user =
"(error; unknown condition)";
851 g_return_if_fail (GTK_TREE_MODEL (tree_model));
853 if (new_acct == NULL)
855 g_object_set (G_OBJECT(cell),
"text",
"(null account)", NULL);
859 real_root = gnc_book_get_root_account(gnc_get_current_book());
860 disposition = determine_merge_disposition(real_root, new_acct);
863 case GNC_ACCOUNT_MERGE_DISPOSITION_USE_EXISTING:
866 case GNC_ACCOUNT_MERGE_DISPOSITION_CREATE_NEW:
871 g_object_set(G_OBJECT(cell),
"text", to_user, NULL);
878 GtkTreeView *tree_view;
879 GtkTreeSelection *selection;
880 GtkCellRenderer *renderer;
881 GtkTreeViewColumn *column;
885 if (!data->category_set_changed)
887 data->category_set_changed = FALSE;
889 gnc_suspend_gui_refresh ();
892 if (data->final_account_tree)
894 gtk_widget_destroy(GTK_WIDGET(data->final_account_tree));
895 data->final_account_tree = NULL;
897 delete_our_account_tree (data);
901 actlist = get_selected_account_list (data->categories_tree);
903 data->our_account_tree = hierarchy_merge_accounts (actlist, com);
907 data->final_account_tree
909 tree_view = GTK_TREE_VIEW(data->final_account_tree);
910 gnc_tree_view_account_set_name_edited(data->final_account_tree,
911 gnc_tree_view_account_name_edited_cb);
912 gnc_tree_view_account_set_code_edited(data->final_account_tree,
913 gnc_tree_view_account_code_edited_cb);
914 gnc_tree_view_account_set_description_edited(data->final_account_tree,
915 gnc_tree_view_account_description_edited_cb);
916 gnc_tree_view_account_set_notes_edited(data->final_account_tree,
917 gnc_tree_view_account_notes_edited_cb);
919 gtk_tree_view_set_headers_visible (tree_view, TRUE);
921 GNC_TREE_VIEW(data->final_account_tree),
"type");
922 g_object_set_data(G_OBJECT(column), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
927 selection = gtk_tree_view_get_selection (tree_view);
928 gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
934 renderer = gtk_cell_renderer_toggle_new();
935 g_object_set(G_OBJECT (renderer),
936 "activatable", FALSE,
939 column = gtk_tree_view_column_new_with_attributes(_(
"Placeholder"),
941 gtk_tree_view_column_set_cell_data_func (column, renderer,
942 placeholder_cell_data_func,
943 (gpointer)data, NULL);
949 renderer = gtk_cell_renderer_text_new ();
950 g_object_set (G_OBJECT (renderer),
953 g_signal_connect (G_OBJECT (renderer),
"edited",
954 G_CALLBACK (balance_cell_edited),
956 column = gtk_tree_view_column_new_with_attributes (_(
"Opening Balance"),
959 gtk_tree_view_column_set_cell_data_func (column, renderer,
960 balance_cell_data_func,
961 (gpointer)data, NULL);
974 GNC_TREE_VIEW_COLUMN_DATA_NONE,
975 GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
977 renderers = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column));
978 g_object_set(G_OBJECT(renderer),
"xalign", 1.0, (
char*)NULL);
979 gtk_tree_view_column_set_cell_data_func(column, GTK_CELL_RENDERER(renderers->data),
980 use_existing_account_data_func, (gpointer)data, NULL);
981 g_list_free(renderers);
984 gtk_container_add(GTK_CONTAINER(data->final_account_tree_container),
985 GTK_WIDGET(data->final_account_tree));
988 gtk_tree_view_expand_all (tree_view);
989 gtk_widget_show(GTK_WIDGET(data->final_account_tree));
990 gnc_resume_gui_refresh ();
994 on_cancel (GtkAssistant *gtkassistant,
997 gnc_suspend_gui_refresh ();
999 gtk_dialog_response(GTK_DIALOG(gnc_options_dialog_widget (data->optionwin)), GTK_RESPONSE_CANCEL);
1000 delete_hierarchy_dialog (data);
1001 delete_our_account_tree (data);
1003 gnc_resume_gui_refresh ();
1011 QofBook *book = gnc_get_current_book ();
1012 gboolean use_split_action_for_num_before =
1014 gboolean use_split_action_for_num_after;
1016 if (!options)
return;
1018 gnc_option_db_commit (options);
1019 qof_book_save_options (book, gnc_option_db_save_to_kvp, options, TRUE);
1020 use_split_action_for_num_after =
1022 if (use_split_action_for_num_before != use_split_action_for_num_after)
1031 balance = get_final_balance (data->
balance_hash, account);
1032 if (gnc_reverse_balance(account))
1035 gnc_account_create_opening_balance (account, balance,
gnc_time (NULL),
1036 gnc_get_current_book ());
1040 on_finish (GtkAssistant *gtkassistant,
1043 GncHierarchyAssistantFinishedCallback when_completed;
1049 if (data->our_account_tree)
1052 (AccountCb)starting_balance_helper,
1060 finish_book_options_helper(data->optionwin, data->options);
1064 if (data->initial_category)
1065 gtk_tree_row_reference_free(data->initial_category);
1066 delete_hierarchy_dialog (data);
1068 gnc_suspend_gui_refresh ();
1070 gtk_dialog_response(GTK_DIALOG(gnc_options_dialog_widget (data->optionwin)), GTK_RESPONSE_CANCEL);
1072 account_trees_merge(gnc_get_current_root_account(), data->our_account_tree);
1074 delete_our_account_tree (data);
1076 when_completed = data->when_completed;
1079 root = gnc_get_current_root_account();
1082 gnc_resume_gui_refresh ();
1086 (*when_completed)();
1114 gnc_options_dialog_destroy(optionwin);
1115 gnc_option_db_destroy(options);
1121 GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
1123 data->options = gnc_option_db_new_for_type (QOF_ID_BOOK);
1124 qof_book_load_options (gnc_get_current_book (),
1125 gnc_option_db_load_from_kvp, data->options);
1126 gnc_option_db_clean (data->options);
1128 data->optionwin = gnc_options_dialog_new_modal (TRUE, _(
"New Book Options"));
1129 gnc_options_dialog_build_contents_full (data->optionwin, data->options, FALSE);
1131 gnc_options_dialog_set_close_cb (data->optionwin,
1132 book_options_dialog_close_cb,
1133 (gpointer)data->options);
1136 gtk_widget_reparent (gnc_options_dialog_notebook (data->optionwin), vbox);
1137 gtk_widget_show_all (vbox);
1138 gtk_assistant_insert_page (GTK_ASSISTANT(data->dialog), vbox, 2);
1139 gtk_assistant_set_page_title (GTK_ASSISTANT(data->dialog), vbox, _(
"New Book Options"));
1140 gtk_assistant_set_page_complete (GTK_ASSISTANT(data->dialog), vbox, TRUE);
1145 gnc_create_hierarchy_assistant (gboolean use_defaults, GncHierarchyAssistantFinishedCallback when_completed)
1149 GtkTreeView *tree_view;
1151 GtkBuilder *builder;
1160 data->new_book = gnc_is_new_book();
1162 builder = gtk_builder_new();
1163 gnc_builder_add_from_file (builder,
"assistant-hierarchy.glade",
"Hierarchy Assistant");
1165 dialog = GTK_WIDGET(gtk_builder_get_object (builder,
"Hierarchy Assistant"));
1166 data->dialog = dialog;
1169 if (when_completed != NULL)
1170 gtk_window_set_keep_above (GTK_WINDOW(data->dialog), TRUE);
1172 gnc_assistant_set_colors (GTK_ASSISTANT (data->dialog));
1175 gtk_assistant_set_page_complete (GTK_ASSISTANT (dialog),
1176 GTK_WIDGET(gtk_builder_get_object(builder,
"intro_page_label")),
1178 gtk_assistant_set_page_complete (GTK_ASSISTANT (dialog),
1179 GTK_WIDGET(gtk_builder_get_object(builder,
"currency_book_option_page_vbox")),
1181 gtk_assistant_set_page_complete (GTK_ASSISTANT (dialog),
1182 GTK_WIDGET(gtk_builder_get_object(builder,
"final_account_vbox")),
1184 gtk_assistant_set_page_complete (GTK_ASSISTANT (dialog),
1185 GTK_WIDGET(gtk_builder_get_object(builder,
"finish_page_label")),
1191 gtk_widget_show (data->currency_selector);
1192 box = GTK_WIDGET(gtk_builder_get_object (builder,
"currency_chooser_hbox"));
1193 gtk_box_pack_start(GTK_BOX(box), data->currency_selector, TRUE, TRUE, 0);
1196 tree_view = GTK_TREE_VIEW(gtk_builder_get_object (builder,
"account_categories_tree_view"));
1197 g_signal_connect (G_OBJECT (gtk_tree_view_get_selection (tree_view)),
"changed",
1198 G_CALLBACK (categories_tree_selection_changed), data);
1199 gtk_tree_selection_set_mode (gtk_tree_view_get_selection (tree_view), GTK_SELECTION_SINGLE);
1200 data->categories_tree = tree_view;
1202 data->category_accounts_label = GTK_LABEL(gtk_builder_get_object (builder,
"accounts_in_category_label"));
1203 data->category_accounts_container = GTK_WIDGET(gtk_builder_get_object (builder,
"accounts_in_category"));
1204 data->category_description = GTK_TEXT_VIEW(gtk_builder_get_object (builder,
"account_types_description"));
1205 data->account_list_added = FALSE;
1209 assistant_instert_book_options_page (data);
1212 data->final_account_tree_container = GTK_WIDGET(gtk_builder_get_object (builder,
"final_account_tree_box"));
1213 data->final_account_tree = NULL;
1217 gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(data->dialog));
1219 g_signal_connect (G_OBJECT(dialog),
"destroy",
1220 G_CALLBACK (gnc_hierarchy_destroy_cb), data);
1222 gtk_builder_connect_signals(builder, data);
1223 g_object_unref(G_OBJECT(builder));
1225 data->when_completed = when_completed;
1226 data->use_defaults = use_defaults;
1231 gnc_ui_hierarchy_assistant(gboolean use_defaults)
1233 return gnc_create_hierarchy_assistant(use_defaults, NULL);
1237 gnc_ui_hierarchy_assistant_with_callback(gboolean use_defaults,
1238 GncHierarchyAssistantFinishedCallback when_finished)
1240 return gnc_create_hierarchy_assistant(use_defaults, when_finished);
1244 after_assistant(
void)
1247 gnc_ui_file_access_for_save_as();
1251 gnc_ui_hierarchy_assistant_hook (
void)
1255 gnc_ui_hierarchy_assistant_with_callback(TRUE, after_assistant);
1260 gnc_ui_hierarchy_assistant_initialize (
void)
1262 gnc_hook_add_dangler(HOOK_NEW_BOOK,
1263 (GFunc)gnc_ui_hierarchy_assistant_hook, NULL);
void gnc_account_append_child(Account *new_parent, Account *child)
gint gnc_account_n_descendants(const Account *account)
void gnc_currency_edit_set_currency(GNCCurrencyEdit *gce, const gnc_commodity *currency)
GtkTreeViewColumn * gnc_tree_view_add_text_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *stock_icon_name, const gchar *sizing_text, gint model_data_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn)
void gnc_account_foreach_descendant(const Account *acc, AccountCb thunk, gpointer user_data)
utility functions for the GnuCash UI
GNCAccountType xaccAccountGetType(const Account *acc)
int xaccAccountGetCommoditySCU(const Account *acc)
gnc_numeric gnc_numeric_neg(gnc_numeric a)
gboolean qof_book_use_split_action_for_num_field(const QofBook *book)
GHashTable * balance_hash
void gnc_book_option_num_field_source_change_cb(gboolean num_action)
gboolean gnc_numeric_zero_p(gnc_numeric a)
void gnc_tree_view_set_show_column_menu(GncTreeView *view, gboolean visible)
GtkTreeViewColumn * gnc_tree_view_find_column_by_name(GncTreeView *view, const gchar *wanted)
#define ENTER(format, args...)
Functions for adding content to a window.
gnc_commodity * gnc_default_currency(void)
void xaccAccountDestroy(Account *acc)
Account * gnc_account_lookup_by_name(const Account *parent, const char *name)
#define PWARN(format, args...)
gint gnc_tree_view_append_column(GncTreeView *view, GtkTreeViewColumn *column)
Currency selection widget.
gchar * gnc_account_get_full_name(const Account *account)
gnc_numeric gnc_numeric_convert(gnc_numeric n, gint64 denom, gint how)
GtkTreeView implementation for gnucash account tree.
void gnc_account_foreach_child(const Account *acc, AccountCb thunk, gpointer user_data)
GtkTreeView * gnc_tree_view_account_new_with_root(Account *root, gboolean show_root)
void gnc_tree_view_configure_columns(GncTreeView *view)
gnc_commodity * gnc_currency_edit_get_currency(GNCCurrencyEdit *gce)
Account * gnc_tree_view_account_get_account_from_iter(GtkTreeModel *s_model, GtkTreeIter *s_iter)
Account * gnc_account_lookup_by_full_name(const Account *any_acc, const gchar *name)
Gnome specific utility functions.
Account * xaccCloneAccount(const Account *from, QofBook *book)
gint gnc_account_n_children(const Account *account)
All type declarations for the whole Gnucash engine.
void qof_book_mark_session_dirty(QofBook *book)
Generic api to store and retrieve preferences.
Functions providing a chart of account page.
GtkWidget * gnc_currency_edit_new(void)
void xaccAccountBeginEdit(Account *acc)
void gnc_options_dialog_set_new_book_option_values(GNCOptionDB *odb)
gboolean xaccAccountGetPlaceholder(const Account *acc)
gboolean gnc_prefs_get_bool(const gchar *group, const gchar *pref_name)
Account * gnc_tree_view_account_get_selected_account(GncTreeViewAccount *view)
#define LEAVE(format, args...)
Account * xaccMallocAccount(QofBook *book)
time64 gnc_time(time64 *tbuf)
get the current local time
const char * xaccAccountGetName(const Account *acc)
void qof_event_gen(QofInstance *entity, QofEventId event_type, gpointer event_data)
Invoke all registered event handlers using the given arguments.
const gchar * QofLogModule
void xaccAccountSetCommodity(Account *acc, gnc_commodity *com)