/** * initialisation of all the variables of grisbi * if some are not empty, free them before set it to NULL * * \param * * \return * */ void init_variables ( void ) { gint bet_array_col_width_init[BET_ARRAY_COLUMNS] = {15, 40, 15, 15, 15 }; gint transaction_col_align_init[CUSTOM_MODEL_VISIBLE_COLUMNS] = { 1, 1, 0, 1, 2, 2, 2 }; gint i; /* xxx on devrait séparer ça en 2 : les variables liées au fichier de compte, qui doivent être remises à 0, * et les variables liées à grisbi (ex sauvegarde auto...) qui doivent rester */ devel_debug (NULL); /* init the new crypted file */ run.new_crypted_file = FALSE; /* init the format date */ initialise_format_date ( ); /* init the decimal point and the thousands separator. */ initialise_number_separators ( ); /* initialise l'ordre des pages du panneau de gauche */ gsb_gui_navigation_init_pages_list ( ); /* if ever there is still something from the previous list, * erase now */ transaction_model_initialize(); gsb_data_account_init_variables (); gsb_data_transaction_init_variables (); gsb_data_payee_init_variables (); payees_init_variables_list (); gsb_data_category_init_variables (); categories_init_variables_list (); gsb_data_budget_init_variables (); budgetary_lines_init_variables_list (); gsb_data_report_init_variables (); gsb_data_report_amount_comparison_init_variables (); gsb_data_report_text_comparison_init_variables (); gsb_data_scheduled_init_variables (); gsb_scheduler_list_init_variables (); gsb_data_currency_init_variables (); gsb_data_currency_link_init_variables (); gsb_data_fyear_init_variables (); gsb_data_bank_init_variables (); gsb_data_reconcile_init_variables (); gsb_data_payment_init_variables (); gsb_data_archive_init_variables (); gsb_data_archive_store_init_variables (); gsb_data_import_rule_init_variables (); gsb_import_associations_init_variables ( ); gsb_data_partial_balance_init_variables ( ); gsb_currency_init_variables (); gsb_fyear_init_variables (); gsb_report_init_variables (); gsb_regex_init_variables (); gsb_data_print_config_init (); /* no bank in memory for now */ bank_list_model = NULL; run.mise_a_jour_liste_comptes_accueil = FALSE; run.mise_a_jour_liste_echeances_manuelles_accueil = FALSE; run.mise_a_jour_liste_echeances_auto_accueil = FALSE; run.mise_a_jour_soldes_minimaux = FALSE; run.mise_a_jour_fin_comptes_passifs = FALSE; orphan_child_transactions = NULL; /* the main notebook is set to NULL, * important because it's the checked variable in a new file * to know if the widgets are created or not */ gsb_gui_init_general_notebook ( ); if ( nom_fichier_comptes ) g_free ( nom_fichier_comptes ); nom_fichier_comptes = NULL; affichage_echeances = SCHEDULER_PERIODICITY_ONCE_VIEW; affichage_echeances_perso_nb_libre = 0; affichage_echeances_perso_j_m_a = PERIODICITY_DAYS; /* initialization of titles and logo part */ if ( titre_fichier && strlen ( titre_fichier ) ) g_free ( titre_fichier ); titre_fichier = g_strdup( _("My accounts") ); etat.is_pixmaps_dir = TRUE; if ( etat.name_logo && strlen ( etat.name_logo ) ) g_free ( etat.name_logo ); etat.name_logo = NULL; etat.utilise_logo = 1; gsb_select_icon_init_logo_variables (); etat.retient_affichage_par_compte = 0; /* reconcile (etat) */ run.reconcile_account_number = -1; g_free ( run.reconcile_final_balance ); if ( run.reconcile_new_date ) g_date_free ( run.reconcile_new_date ); run.reconcile_final_balance = NULL; run.reconcile_new_date = NULL; adresse_commune = NULL; adresse_secondaire = NULL; current_tree_view_width = 0; scheduler_current_tree_view_width = 0; initialise_tab_affichage_ope(); valeur_echelle_recherche_date_import = 2; etat.get_fyear_by_value_date = FALSE; /* init default combofix values */ etat.combofix_mixed_sort = FALSE; etat.combofix_max_item = 0; etat.combofix_case_sensitive = FALSE; etat.combofix_enter_select_completion = FALSE; etat.combofix_force_payee = FALSE; etat.combofix_force_category = FALSE; /* mis à NULL prévient un plantage aléatoire dans * gsb_currency_update_combobox_currency_list */ detail_devise_compte = NULL; /* defaut value for width and align of columns */ initialise_largeur_colonnes_tab_affichage_ope ( GSB_ACCOUNT_PAGE, transaction_col_width_init ); initialise_largeur_colonnes_tab_affichage_ope ( GSB_SCHEDULER_PAGE, scheduler_col_width_init ); for ( i = 0 ; i < CUSTOM_MODEL_VISIBLE_COLUMNS ; i++ ) transaction_col_align[i] = transaction_col_align_init[i]; if ( etat.transaction_column_width && strlen ( etat.transaction_column_width ) ) { g_free ( etat.transaction_column_width ); etat.transaction_column_width = NULL; } if ( etat.scheduler_column_width && strlen ( etat.scheduler_column_width ) ) { g_free ( etat.scheduler_column_width ); etat.scheduler_column_width = NULL; } gsb_gui_navigation_init_tree_view ( ); /* free the form */ gsb_form_widget_free_list (); gsb_form_scheduler_free_list (); /* set colors to default */ gsb_color_set_colors_to_default ( ); /* divers */ etat.add_archive_in_total_balance = TRUE; /* add the archived transactions by default */ etat.get_fyear_by_value_date = 0; /* By default use transaction-date */ /* remove the timeout if necessary */ if (id_timeout) { g_source_remove (id_timeout); id_timeout = 0; } /* initializes the variables for the estimate balance module */ /* création de la liste des données à utiliser dans le tableau de résultats */ bet_data_init_variables ( ); /* initialisation des boites de dialogue */ bet_future_initialise_dialog ( ); etat.bet_deb_period = 1; /* defaut value for width of columns */ for ( i = 0 ; i < BET_ARRAY_COLUMNS ; i++ ) bet_array_col_width[i] = bet_array_col_width_init[i]; bet_data_finance_data_simulator_init ( ); bet_graph_set_configuration_variables ( NULL ); }
/** * initialisation of all the variables of grisbi * if some are not empty, free them before set it to NULL * * \param * * \return * */ void init_variables ( void ) { gint transaction_col_align_init[CUSTOM_MODEL_VISIBLE_COLUMNS] = { 1, 1, 0, 1, 2, 2, 2 }; gint i; GrisbiWinRun *w_run; devel_debug (NULL); /* raz some variables of structure w_run */ w_run = grisbi_win_get_w_run (); w_run->account_number_is_0 = FALSE; w_run->prefs_expand_tree = TRUE; if (w_run->prefs_selected_row) g_free (w_run->prefs_selected_row); w_run->prefs_selected_row = g_strdup ("0:0"); /* initialise l'ordre des pages du panneau de gauche */ gsb_gui_navigation_init_pages_list ( ); /* if ever there is still something from the previous list, * erase now */ transaction_model_set_model ( NULL ); gsb_data_account_init_variables (); gsb_data_transaction_init_variables (); gsb_data_payee_init_variables (); payees_init_variables_list (); gsb_data_category_init_variables (); categories_init_variables_list (); gsb_data_budget_init_variables (); budgetary_lines_init_variables_list (); gsb_data_report_init_variables (); gsb_data_report_amount_comparison_init_variables (); gsb_data_report_text_comparison_init_variables (); gsb_data_scheduled_init_variables (); gsb_scheduler_list_init_variables (); gsb_data_currency_init_variables (); gsb_data_currency_link_init_variables (); gsb_data_fyear_init_variables (); gsb_data_bank_init_variables (); gsb_data_reconcile_init_variables (); gsb_data_payment_init_variables (); gsb_data_archive_init_variables (); gsb_data_archive_store_init_variables (); gsb_data_import_rule_init_variables (); gsb_import_associations_init_variables ( ); gsb_data_partial_balance_init_variables ( ); gsb_currency_init_variables (); gsb_fyear_init_variables (); gsb_report_init_variables (); gsb_regex_init_variables (); gsb_data_print_config_init (); /* no bank in memory for now */ bank_list_model = NULL; run.mise_a_jour_liste_comptes_accueil = FALSE; run.mise_a_jour_liste_echeances_manuelles_accueil = FALSE; run.mise_a_jour_liste_echeances_auto_accueil = FALSE; run.mise_a_jour_soldes_minimaux = FALSE; run.mise_a_jour_fin_comptes_passifs = FALSE; orphan_child_transactions = NULL; etat.affichage_echeances = SCHEDULER_PERIODICITY_ONCE_VIEW; etat.affichage_echeances_perso_nb_libre = 0; etat.affichage_echeances_perso_j_m_a = PERIODICITY_DAYS; if ( etat.name_logo && strlen ( etat.name_logo ) ) g_free ( etat.name_logo ); etat.name_logo = NULL; etat.utilise_logo = 1; gsb_select_icon_init_logo_variables (); etat.retient_affichage_par_compte = 0; /* reconcile (etat) */ run.reconcile_account_number = -1; g_free ( run.reconcile_final_balance ); if ( run.reconcile_new_date ) g_date_free ( run.reconcile_new_date ); run.reconcile_final_balance = NULL; run.reconcile_new_date = NULL; current_tree_view_width = 0; scheduler_current_tree_view_width = 0; initialise_tab_affichage_ope(); etat.import_files_nb_days = 2; etat.get_fyear_by_value_date = FALSE; /* init default combofix values */ etat.combofix_mixed_sort = FALSE; etat.combofix_case_sensitive = FALSE; etat.combofix_force_payee = FALSE; etat.combofix_force_category = FALSE; /* mis à NULL prévient un plantage aléatoire dans * gsb_currency_update_combobox_currency_list */ detail_devise_compte = NULL; /* the main notebook is set to NULL, * important because it's the checked variable in a new file * to know if the widgets are created or not */ grisbi_win_free_general_notebook (); /* defaut value for width and align of columns */ initialise_largeur_colonnes_tab_affichage_ope ( GSB_ACCOUNT_PAGE, transaction_col_width_init ); initialise_largeur_colonnes_tab_affichage_ope ( GSB_SCHEDULER_PAGE, scheduler_col_width_init ); for ( i = 0 ; i < CUSTOM_MODEL_VISIBLE_COLUMNS ; i++ ) transaction_col_align[i] = transaction_col_align_init[i]; if ( etat.transaction_column_width && strlen ( etat.transaction_column_width ) ) { g_free ( etat.transaction_column_width ); etat.transaction_column_width = NULL; } if ( etat.scheduler_column_width && strlen ( etat.scheduler_column_width ) ) { g_free ( etat.scheduler_column_width ); etat.scheduler_column_width = NULL; } gsb_gui_navigation_init_tree_view ( ); /* free the form */ gsb_form_widget_free_list (); gsb_form_scheduler_free_list (); /* set colors to default */ gsb_rgba_set_colors_to_default (); /* divers */ etat.get_fyear_by_value_date = 0; /* By default use transaction-date */ /* remove the timeout if necessary */ if (id_timeout) { g_source_remove (id_timeout); id_timeout = 0; } /* initializes the variables for the estimate balance module */ /* création de la liste des données à utiliser dans le tableau de résultats */ bet_data_init_variables ( ); /* initialisation des boites de dialogue */ bet_future_initialise_dialog ( ); etat.bet_deb_period = 1; /* defaut value for width of columns */ for ( i = 0 ; i < BET_ARRAY_COLUMNS ; i++ ) bet_array_col_width[i] = bet_array_col_width_init[i]; bet_data_finance_data_simulator_init ( ); bet_data_loan_delete_all_loans (); #ifdef HAVE_GOFFICE bet_graph_set_configuration_variables ( NULL ); #endif /* HAVE_GOFFICE */ }