Update of /cvsroot/grisbi/grisbi/src
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv12030/src
Modified Files:
Makefile.am accueil.c affichage.c banque.c comptes_gestion.c
comptes_traitements.c dialog.c dialog.h etats_affiche.c
etats_config.c etats_html.c etats_onglet.c etats_support.c
etats_support.h export.c export_csv.c fenetre_principale.c
fichiers_gestion.c gsb_assistant.c gsb_assistant.h
gsb_assistant_archive.c gsb_assistant_reconcile_config.c
gsb_assistant_reconcile_config.h gsb_calendar_entry.c
gsb_crypt.c gsb_currency_config.c gsb_currency_link_config.c
gsb_data_account.c gsb_data_reconcile.c gsb_data_transaction.c
gsb_data_transaction.h gsb_file_debug.c gsb_file_load.c
gsb_file_save.c gsb_file_util.c gsb_form.c
gsb_form_transaction.c gsb_form_widget.c gsb_fyear.c
gsb_fyear.h gsb_fyear_config.c gsb_payment_method_config.c
gsb_real.c gsb_reconcile.c gsb_reconcile_config.c
gsb_scheduler_list.c gsb_transaction_model.c
gsb_transaction_model.h gsb_transactions_list.c
gsb_transactions_list.h gsb_transactions_list_sort.c help.c
import.c import_csv.c main.c metatree.c navigation.c
print_config.c qif.c traitement_variables.c
traitement_variables.h utils.c utils.h utils_file_selection.c
utils_str.c
Added Files:
gsb_data_archive.c gsb_data_archive.h gsb_data_archive_store.c
gsb_data_archive_store.h gsb_report.c gsb_report.h
Log Message:
bug testing version
Index: etats_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/etats_config.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- etats_config.c 18 Feb 2007 22:12:01 -0000 1.118
+++ etats_config.c 20 Mar 2007 10:12:52 -0000 1.119
@@ -4169,7 +4169,7 @@
0 );
gtk_widget_show ( hbox );
- label = gtk_label_new ( "" );
+ label = gtk_label_new ( NULL );
gtk_widget_set_usize ( label,
150,
FALSE );
@@ -4240,7 +4240,7 @@
0 );
gtk_widget_show ( hbox );
- label = gtk_label_new ( "" );
+ label = gtk_label_new ( NULL );
gtk_widget_set_usize ( label,
150,
FALSE );
Index: gsb_fyear.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_fyear.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- gsb_fyear.c 18 Feb 2007 12:37:19 -0000 1.5
+++ gsb_fyear.c 20 Mar 2007 10:12:53 -0000 1.6
@@ -1,7 +1,7 @@
/* ************************************************************************** */
/* */
-/* Copyright (C) 2000-2006 Cédric Auger (cedric@...) */
-/* 2003-2006 Benjamin Drieu (bdrieu@...) */
+/* Copyright (C) 2000-2007 Cédric Auger (cedric@...) */
+/* 2003-2007 Benjamin Drieu (bdrieu@...) */
/* http://www.grisbi.org */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -48,7 +48,7 @@
static GtkTreeModel *fyear_model_filter;
-enum currency_list_columns {
+enum fyear_list_columns {
FYEAR_COL_NAME = 0,
FYEAR_COL_NUMBER,
FYEAR_COL_VIEW,
@@ -86,11 +86,11 @@
/**
* create and return a combobox with the financial years
*
- * \param
+ * \param set_automatic if TRUE, will show the choice "Automatic"
*
* \return a widget combobox or NULL
* */
-GtkWidget *gsb_fyear_make_combobox ( void )
+GtkWidget *gsb_fyear_make_combobox ( gboolean set_automatic )
{
GtkCellRenderer *renderer;
GtkWidget *combo_box;
@@ -108,6 +108,8 @@
gtk_combo_box_set_active ( GTK_COMBO_BOX (combo_box),
0 );
+ /* show or hide the automatic line */
+ gsb_fyear_set_automatic ( set_automatic );
return (combo_box);
}
@@ -133,7 +135,7 @@
return FALSE;
if (!fyear_model)
- gsb_fyear_create_combobox_store ();
+ return FALSE;
/* we look for the fyear in the model and not in the filter
* because of if the fyear is not showed */
@@ -189,29 +191,58 @@
gint gsb_fyear_get_fyear_from_combobox ( GtkWidget *combo_box,
const GDate *date )
{
- gint fyear_number;
+ gint fyear_number = 0;
GtkTreeIter iter;
if (!fyear_model_filter)
gsb_fyear_create_combobox_store ();
- gtk_combo_box_get_active_iter ( GTK_COMBO_BOX (combo_box),
- &iter );
- gtk_tree_model_get ( GTK_TREE_MODEL (fyear_model_filter),
+ if (gtk_combo_box_get_active_iter ( GTK_COMBO_BOX (combo_box),
+ &iter ))
+ {
+ gtk_tree_model_get ( GTK_TREE_MODEL (fyear_model_filter),
+ &iter,
+ FYEAR_COL_NUMBER, &fyear_number,
+ -1 );
+ if (!fyear_number
+ &&
+ date )
+ fyear_number = gsb_data_fyear_get_from_date (date);
+ }
+ return fyear_number;
+}
+
+
+/**
+ * show or hide the Automatic line in the fyear list
+ * this will apply to all fyears combobox
+ *
+ * \param set_automatic TRUE to show the "Automatic" line, FALSE to hide it
+ *
+ *
+ * \return TRUE done, FALSE problem
+ * */
+gboolean gsb_fyear_set_automatic ( gboolean set_automatic )
+{
+ GtkTreeIter iter;
+
+ if (!fyear_model)
+ gsb_fyear_create_combobox_store ();
+
+ if (!gtk_tree_model_get_iter_first ( GTK_TREE_MODEL (fyear_model),
+ &iter ))
+ return FALSE;
+
+ gtk_list_store_set ( GTK_LIST_STORE (fyear_model),
&iter,
- FYEAR_COL_NUMBER, &fyear_number,
+ FYEAR_COL_VIEW, set_automatic,
-1 );
- if (!fyear_number
- &&
- date )
- fyear_number = gsb_data_fyear_get_from_date (date);
-
- return fyear_number;
+ return TRUE;
}
/**
- * update the list of the currencies, wich change all
+ * update the list of the financial years, wich change all
* the current combobox content
* set the first row with Automatic with 0 as number
*
Index: gsb_crypt.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_crypt.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- gsb_crypt.c 18 Feb 2007 12:37:16 -0000 1.3
+++ gsb_crypt.c 20 Mar 2007 10:12:52 -0000 1.4
@@ -35,6 +35,7 @@
/*END_INCLUDE*/
/*START_EXTERN*/
+extern gchar *crypt_key;
extern GtkWidget *window;
/*END_EXTERN*/
@@ -233,7 +234,7 @@
vbox = gtk_vbox_new ( FALSE, 6 );
gtk_box_pack_start ( GTK_BOX ( hbox ), vbox, TRUE, TRUE, 6 );
- label = gtk_label_new ("");
+ label = gtk_label_new (NULL);
gtk_label_set_justify ( GTK_LABEL(label), GTK_JUSTIFY_LEFT );
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
gtk_label_set_line_wrap ( GTK_LABEL(label), TRUE );
Index: gsb_scheduler_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_scheduler_list.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- gsb_scheduler_list.c 18 Feb 2007 12:37:19 -0000 1.22
+++ gsb_scheduler_list.c 20 Mar 2007 10:12:53 -0000 1.23
@@ -1447,7 +1447,8 @@
g_strdup_printf ( _("Do you really want to delete the child of breakdown whit the category '%s' ?"),
gsb_data_category_get_name ( gsb_data_scheduled_get_category_number (scheduled_number),
gsb_data_scheduled_get_sub_category_number (scheduled_number),
- NULL ))))
+ NULL )),
+ GTK_RESPONSE_NO ))
return FALSE;
/* !! important to remove first from the list... */
Index: gsb_reconcile_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_reconcile_config.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- gsb_reconcile_config.c 18 Feb 2007 23:10:52 -0000 1.12
+++ gsb_reconcile_config.c 20 Mar 2007 10:12:53 -0000 1.13
@@ -524,7 +524,8 @@
* we ask if the user want to continue and warn him */
if (!question_yes_no_hint ( _("Deleting a reconcile"),
g_strdup_printf (_("Carreful, you are about to deleting a reconcile.\nIf you continue, the reconcile %s will be erased and all the transactions marked by this reconcile will be un-reconciled and marked P.\nAre you sure you want to continue ?"),
- gsb_data_reconcile_get_name (reconcile_number))))
+ gsb_data_reconcile_get_name (reconcile_number)),
+ GTK_RESPONSE_NO ))
return FALSE;
/* ok we delete the reconcile
Index: gsb_currency_link_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_currency_link_config.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- gsb_currency_link_config.c 18 Feb 2007 12:37:17 -0000 1.5
+++ gsb_currency_link_config.c 20 Mar 2007 10:12:52 -0000 1.6
@@ -195,7 +195,7 @@
FALSE, FALSE, 0 );
/* Create warning label */
- label = gtk_label_new ("");
+ label = gtk_label_new (NULL);
g_object_set_data ( G_OBJECT (tree_model),
"warning_label", label );
gtk_box_pack_start ( GTK_BOX ( paddingbox ),
Index: metatree.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/metatree.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- metatree.c 18 Feb 2007 12:37:20 -0000 1.83
+++ metatree.c 20 Mar 2007 10:12:54 -0000 1.84
@@ -678,6 +678,8 @@
if ( no_sub_division != -1 )
{
+ /* xxx pb ici : une categ/tiers/ib peut ne pas avoir de subdivision et pourtant certaines opés archivées peuvent pointer
+ * dessus ; il faut faire le tour des opés archivées en plus... */
supprimer_sub_division ( tree_view, model, iface, pointer, no_division );
return FALSE;
}
@@ -1504,7 +1506,6 @@
if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( bouton_transfert )) )
{
-
if ( !strlen (gtk_combofix_get_text ( GTK_COMBOFIX ( combofix ))))
{
dialogue_warning_hint ( _("It is compulsory to specify a destination division to move transactions but no division was entered."),
@@ -1540,6 +1541,7 @@
gtk_widget_destroy ( GTK_WIDGET ( dialog ) );
+ /* xxx ça va pas marcher ce truc : c'est qd supprime une categ/ib/tiers, maintenant il faut des gsb_data */
if ( no_div)
*no_div = nouveau_no_division;
if ( no_sub_div )
Index: gsb_file_save.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_save.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- gsb_file_save.c 18 Feb 2007 22:12:03 -0000 1.64
+++ gsb_file_save.c 20 Mar 2007 10:12:53 -0000 1.65
@@ -32,6 +32,7 @@
#include "./erreur.h"
#include "./dialog.h"
#include "./gsb_data_account.h"
+#include "./gsb_data_archive.h"
#include "./gsb_data_bank.h"
#include "./gsb_data_budget.h"
#include "./gsb_data_category.h"
@@ -66,6 +67,9 @@
static gulong gsb_file_save_account_part ( gulong iterator,
gulong *length_calculated,
gchar **file_content );
+static gulong gsb_file_save_archive_part ( gulong iterator,
+ gulong *length_calculated,
+ gchar **file_content );
static gulong gsb_file_save_bank_part ( gulong iterator,
gulong *length_calculated,
gchar **file_content );
@@ -152,6 +156,7 @@
gint currency_link_part;
gint bank_part;
gint financial_year_part;
+ gint archive_part;
gint reconcile_part;
gint report_part;
@@ -180,12 +185,13 @@
currency_link_part = 100;
bank_part = 300;
financial_year_part = 100;
+ archive_part = 120;
reconcile_part = 50;
report_part = 2500;
length_calculated = general_part
+ account_part * gsb_data_account_get_accounts_amount ()
- + transaction_part * g_slist_length ( gsb_data_transaction_get_transactions_list ())
+ + transaction_part * g_slist_length ( gsb_data_transaction_get_complete_transactions_list ())
+ party_part * g_slist_length ( gsb_data_payee_get_payees_list ())
+ category_part * g_slist_length ( gsb_data_category_get_categories_list ())
+ budgetary_part * g_slist_length ( gsb_data_budget_get_budgets_list ())
@@ -193,6 +199,7 @@
+ currency_link_part * g_slist_length ( gsb_data_currency_link_get_currency_link_list ())
+ bank_part * g_slist_length ( gsb_data_bank_get_bank_list ())
+ financial_year_part * g_slist_length (gsb_data_fyear_get_fyears_list ())
+ + archive_part * g_slist_length (gsb_data_archive_get_archives_list ())
+ reconcile_part * g_list_length (gsb_data_reconcile_get_reconcile_list ())
+ report_part * g_slist_length ( gsb_data_report_get_report_list ());
@@ -254,6 +261,9 @@
&length_calculated,
&file_content );
+ iterator = gsb_file_save_archive_part ( iterator,
+ &length_calculated,
+ &file_content );
iterator = gsb_file_save_reconcile_part ( iterator,
&length_calculated,
&file_content );
@@ -839,7 +849,7 @@
{
GSList *list_tmp;
- list_tmp = gsb_data_transaction_get_transactions_list ();
+ list_tmp = gsb_data_transaction_get_complete_transactions_list ();
while ( list_tmp )
{
@@ -863,7 +873,7 @@
value_date = gsb_format_gdate_safe ( gsb_data_transaction_get_value_date ( transaction_number ));
/* now we can fill the file content */
- new_string = g_markup_printf_escaped ( "\t<Transaction Ac=\"%d\" Nb=\"%d\" Id=\"%s\" Dt=\"%s\" Dv=\"%s\" Cu=\"%d\" Am=\"%s\" Exb=\"%d\" Exr=\"%s\" Exf=\"%s\" Pa=\"%d\" Ca=\"%d\" Sca=\"%d\" Br=\"%d\" No=\"%s\" Pn=\"%d\" Pc=\"%s\" Ma=\"%d\" Au=\"%d\" Re=\"%d\" Fi=\"%d\" Bu=\"%d\" Sbu=\"%d\" Vo=\"%s\" Ba=\"%s\" Trt=\"%d\" Tra=\"%d\" Mo=\"%d\" />\n",
+ new_string = g_markup_printf_escaped ( "\t<Transaction Ac=\"%d\" Nb=\"%d\" Id=\"%s\" Dt=\"%s\" Dv=\"%s\" Cu=\"%d\" Am=\"%s\" Exb=\"%d\" Exr=\"%s\" Exf=\"%s\" Pa=\"%d\" Ca=\"%d\" Sca=\"%d\" Br=\"%d\" No=\"%s\" Pn=\"%d\" Pc=\"%s\" Ma=\"%d\" Ar=\"%d\" Au=\"%d\" Re=\"%d\" Fi=\"%d\" Bu=\"%d\" Sbu=\"%d\" Vo=\"%s\" Ba=\"%s\" Trt=\"%d\" Tra=\"%d\" Mo=\"%d\" />\n",
gsb_data_transaction_get_account_number ( transaction_number ),
transaction_number,
gsb_data_transaction_get_transaction_id ( transaction_number),
@@ -882,6 +892,7 @@
gsb_data_transaction_get_method_of_payment_number (transaction_number),
gsb_data_transaction_get_method_of_payment_content (transaction_number),
gsb_data_transaction_get_marked_transaction (transaction_number),
+ gsb_data_transaction_get_archive_number (transaction_number),
gsb_data_transaction_get_automatic_transaction (transaction_number),
gsb_data_transaction_get_reconcile_number (transaction_number),
gsb_data_transaction_get_financial_year_number (transaction_number),
@@ -1387,6 +1398,62 @@
/**
+ * save the archives structures
+ *
+ * \param iterator the current iterator
+ * \param length_calculated a pointer to the variable lengh_calculated
+ * \param file_content a pointer to the variable file_content
+ *
+ * \return the new iterator
+ * */
+gulong gsb_file_save_archive_part ( gulong iterator,
+ gulong *length_calculated,
+ gchar **file_content )
+{
+ GSList *list_tmp;
+
+ list_tmp = gsb_data_archive_get_archives_list ();
+
+ while ( list_tmp )
+ {
+ gint archive_number;
+ gchar *new_string;
+ gchar *begining_date;
+ gchar *end_date;
+
+ archive_number = gsb_data_archive_get_no_archive (list_tmp -> data);
+
+ /* set the date */
+ begining_date = gsb_format_gdate_safe (gsb_data_archive_get_begining_date (archive_number));
+ end_date = gsb_format_gdate_safe (gsb_data_archive_get_end_date (archive_number));
+
+ /* now we can fill the file content */
+ new_string = g_markup_printf_escaped( "\t<Archive Nb=\"%d\" Na=\"%s\" Bdte=\"%s\" Edte=\"%s\" Fye=\"%d\" Rep=\"%s\" />\n",
+ archive_number,
+ gsb_data_archive_get_name (archive_number),
+ begining_date,
+ end_date,
+ gsb_data_archive_get_fyear (archive_number),
+ gsb_data_archive_get_report_title (archive_number));
+
+ if (begining_date)
+ g_free (begining_date);
+ if (end_date)
+ g_free (end_date);
+
+ /* append the new string to the file content
+ * and take the new iterator */
+ iterator = gsb_file_save_append_part ( iterator,
+ length_calculated,
+ file_content,
+ new_string );
+ list_tmp = list_tmp -> next;
+ }
+ return iterator;
+}
+
+
+/**
* save the reconcile structures
*
* \param iterator the current iterator
Index: navigation.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/navigation.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- navigation.c 20 Feb 2007 10:20:14 -0000 1.69
+++ navigation.c 20 Mar 2007 10:12:54 -0000 1.70
@@ -1309,11 +1309,6 @@
selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW(navigation_tree_view) );
g_return_val_if_fail ( selection, FALSE );
- /* This is no blocked because we want things like headings to be updated. [benj] */
-/* g_signal_handlers_block_by_func ( selection, */
-/* gsb_gui_navigation_select_line, */
-/* navigation_model ); */
-
gtk_tree_model_get_iter_first ( GTK_TREE_MODEL(navigation_model), &iter );
gsb_gui_navigation_set_selection_branch ( selection, &iter, page, account_number,
@@ -1372,11 +1367,6 @@
}
}
while ( gtk_tree_model_iter_next ( GTK_TREE_MODEL(navigation_model), iter ) );
-
-/* g_signal_handlers_unblock_by_func ( selection, */
-/* gsb_gui_navigation_select_line, */
-/* navigation_model ); */
-
return;
}
Index: etats_support.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/etats_support.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- etats_support.h 18 Feb 2007 12:37:15 -0000 1.6
+++ etats_support.h 20 Mar 2007 10:12:52 -0000 1.7
@@ -5,6 +5,6 @@
/* START_DECLARATION */
-gchar * etats_titre ();
+gchar *etats_titre ( gint report_number);
/* END_DECLARATION */
#endif
Index: etats_onglet.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/etats_onglet.c,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -d -r1.97 -r1.98
--- etats_onglet.c 18 Feb 2007 12:37:15 -0000 1.97
+++ etats_onglet.c 20 Mar 2007 10:12:52 -0000 1.98
@@ -264,7 +264,7 @@
gtk_box_pack_start ( GTK_BOX(frame), option_menu, FALSE, FALSE, 0 );
/* On met une ligne blanche entre les paddingboxes */
- /* gtk_box_pack_start ( GTK_BOX(frame), gtk_label_new(""), FALSE, FALSE, 6 ); */
+ /* gtk_box_pack_start ( GTK_BOX(frame), gtk_label_new(NULL), FALSE, FALSE, 6 ); */
/* on ajoute maintenant la frame */
frame = new_paddingbox_with_title ( GTK_DIALOG(dialog)->vbox, TRUE,
@@ -277,7 +277,7 @@
gtk_box_pack_start ( GTK_BOX(frame), scrolled_window, TRUE, TRUE, 6 );
/* on ajoute maintenant le label */
- label_description = gtk_label_new ( "" );
+ label_description = gtk_label_new ( NULL );
gtk_misc_set_alignment ( GTK_MISC ( label_description ), 0, 0 );
gtk_label_set_line_wrap ( GTK_LABEL ( label_description ), TRUE );
gtk_scrolled_window_add_with_viewport ( GTK_SCROLLED_WINDOW ( scrolled_window ),
@@ -990,7 +990,8 @@
if ( !question_yes_no_hint ( g_strdup_printf (_("Delete report \"%s\"?"),
gsb_data_report_get_report_name (current_report_number) ),
- _("This will irreversibly remove this report. There is no undo for this.") ))
+ _("This will irreversibly remove this report. There is no undo for this."),
+ GTK_RESPONSE_NO ))
return;
/* remove the report */
Index: dialog.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/dialog.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- dialog.c 21 Feb 2007 11:06:11 -0000 1.45
+++ dialog.c 20 Mar 2007 10:12:52 -0000 1.46
@@ -37,7 +37,6 @@
GtkButtonsType buttons );
static void dialogue_conditional_special ( gchar *text, gchar * var, GtkMessageType type );
static gboolean dialogue_update_var ( GtkWidget * checkbox, gint message );
-static gboolean question_yes_no ( gchar *texte );
/*END_STATIC*/
@@ -373,7 +372,8 @@
*/
gboolean question ( gchar *texte )
{
- return question_yes_no ( texte );
+ return question_yes_no ( texte,
+ GTK_RESPONSE_NO );
}
@@ -385,12 +385,15 @@
*
* \param hint Hint to be displayed
* \param texte Text to be displayed
+ * \param default_answer GTK_RESPONSE_OK or GTK_RESPONSE_CANCEL, will give the focus to the button
*
* \return TRUE if user pressed 'OK'. FALSE otherwise.
*/
-gboolean question_yes_no_hint ( gchar * hint, gchar *texte )
+gboolean question_yes_no_hint ( gchar * hint,
+ gchar *texte,
+ gint default_answer )
{
- return question_yes_no ( make_hint ( hint, texte ) );
+ return question_yes_no ( make_hint ( hint, texte ), default_answer );
}
@@ -400,10 +403,12 @@
* press 'OK' or 'Cancel'.
*
* \param texte Text to be displayed
+ * \param default_answer GTK_RESPONSE_OK or GTK_RESPONSE_CANCEL, will give the focus to the button
*
* \return TRUE if user pressed 'OK'. FALSE otherwise.
*/
-gboolean question_yes_no ( gchar *texte )
+gboolean question_yes_no ( gchar *texte,
+ gint default_answer )
{
GtkWidget *dialog;
gint response;
@@ -411,14 +416,17 @@
dialog = gtk_message_dialog_new ( GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_OK_CANCEL,
+ GTK_BUTTONS_YES_NO,
texte );
gtk_label_set_markup ( GTK_LABEL ( GTK_MESSAGE_DIALOG(dialog)->label ), texte );
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog),
+ default_answer );
+
response = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy ( dialog );
- if ( response == GTK_RESPONSE_OK )
+ if ( response == GTK_RESPONSE_YES )
return TRUE;
else
return FALSE;
--- NEW FILE: gsb_data_archive_store.c ---
(This appears to be a binary file; contents omitted.)
Index: gsb_assistant_archive.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_assistant_archive.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- gsb_assistant_archive.c 20 Feb 2007 10:20:14 -0000 1.2
+++ gsb_assistant_archive.c 20 Mar 2007 10:12:52 -0000 1.3
@@ -30,12 +30,30 @@
/*START_INCLUDE*/
#include "gsb_assistant_archive.h"
+#include "./etats_support.h"
#include "./gsb_assistant.h"
-#include "./gsb_assistant_reconcile_config.h"
+#include "./gsb_calendar_entry.h"
+#include "./gsb_data_archive.h"
+#include "./gsb_data_transaction.h"
+#include "./gsb_fyear.h"
+#include "./gsb_report.h"
+#include "./utils_str.h"
+#include "./etats_calculs.h"
+#include "./utils.h"
#include "./include.h"
/*END_INCLUDE*/
/*START_STATIC*/
+static GtkWidget *gsb_assistant_archive_page_menu ( GtkWidget *assistant );
+static GtkWidget *gsb_assistant_archive_page_success ( void );
+static gboolean gsb_assistant_archive_switch_to_intro ( GtkWidget *assistant,
+ gint new_page );
+static gboolean gsb_assistant_archive_switch_to_menu ( GtkWidget *assistant,
+ gint new_page );
+static gboolean gsb_assistant_archive_switch_to_succes ( GtkWidget *assistant,
+ gint new_page );
+static gboolean gsb_assistant_archive_update_labels ( GtkWidget *assistant );
+static void gsb_assistant_archive_update_labels_no_archive ( GtkWidget *assistant );
/*END_STATIC*/
/*START_EXTERN*/
@@ -45,12 +63,24 @@
{
ARCHIVE_ASSISTANT_INTRO= 0,
ARCHIVE_ASSISTANT_MENU,
- ARCHIVE_ASSISTANT_NEW_RECONCILE,
- ARCHIVE_ASSISTANT_AUTOMATICALY_ASSOCIATE,
- ARCHIVE_ASSISTANT_MANUALLY_ASSOCIATE,
ARCHIVE_ASSISTANT_SUCCESS
};
+static GtkWidget *initial_date;
+static GtkWidget *final_date;
+static GtkWidget *financial_year_button;
+static GtkWidget *report_button;
+static GtkWidget *name_entry;
+static GtkWidget *label_nb_archived;
+static GtkWidget *label_nb_loaded;
+static GtkWidget *label_warning;
+
+static GtkWidget *vbox_congratulation;
+static GtkWidget *vbox_failed;
+static GtkWidget *label_congratulation;
+
+static GSList *list_transaction_to_archive = NULL;
+
/**
* this function is called to launch the assistant to make archives
@@ -71,40 +101,731 @@
"but don't work with them anymore.\n"
"Obviously, you will be able to show them again and work on them, and you will be able\n"
"to export them in an archive file if necessary.\n"),
- "grisbi-logo.png" );
-/* gsb_assistant_add_page ( assistant, */
-/* gsb_assistant_reconcile_config_page_menu (assistant), */
-/* ARCHIVE_ASSISTANT_MENU, */
-/* ARCHIVE_ASSISTANT_INTRO, */
-/* ARCHIVE_ASSISTANT_NEW_RECONCILE, */
-/* NULL ); */
-/* gsb_assistant_add_page ( assistant, */
-/* gsb_assistant_reconcile_config_page_new_reconcile (), */
-/* ARCHIVE_ASSISTANT_NEW_RECONCILE, */
-/* ARCHIVE_ASSISTANT_MENU, */
-/* ARCHIVE_ASSISTANT_MENU, */
-/* NULL ); */
-/* gsb_assistant_add_page ( assistant, */
-/* gsb_assistant_reconcile_config_page_automaticaly_associate (assistant), */
-/* ARCHIVE_ASSISTANT_AUTOMATICALY_ASSOCIATE, */
-/* ARCHIVE_ASSISTANT_MENU, */
-/* ARCHIVE_ASSISTANT_MENU, */
-/* G_CALLBACK (gsb_assistant_reconcile_config_update_auto_asso)); */
-/* gsb_assistant_add_page ( assistant, */
-/* gsb_assistant_reconcile_config_page_manually_associate (assistant), */
-/* ARCHIVE_ASSISTANT_MANUALLY_ASSOCIATE, */
-/* ARCHIVE_ASSISTANT_MENU, */
-/* ARCHIVE_ASSISTANT_MENU, */
-/* G_CALLBACK (gsb_assistant_reconcile_config_update_manu_asso)); */
-/* gsb_assistant_add_page ( assistant, */
-/* gsb_assistant_reconcile_config_page_success (), */
-/* ARCHIVE_ASSISTANT_SUCCESS, */
-/* ARCHIVE_ASSISTANT_MENU, */
-/* ARCHIVE_ASSISTANT_MENU, */
-/* NULL ); */
+ "grisbi-logo.png",
+ G_CALLBACK (gsb_assistant_archive_switch_to_intro));
+ gsb_assistant_add_page ( assistant,
+ gsb_assistant_archive_page_menu (assistant),
+ ARCHIVE_ASSISTANT_MENU,
+ ARCHIVE_ASSISTANT_INTRO,
+ ARCHIVE_ASSISTANT_SUCCESS,
+ G_CALLBACK (gsb_assistant_archive_switch_to_menu));
+ gsb_assistant_add_page ( assistant,
+ gsb_assistant_archive_page_success (),
+ ARCHIVE_ASSISTANT_SUCCESS,
+ ARCHIVE_ASSISTANT_MENU,
+ 0,
+ G_CALLBACK (gsb_assistant_archive_switch_to_succes));
return_value = gsb_assistant_run (assistant);
gtk_widget_destroy (assistant);
+
+ /* the fyear combobox in grisbi are used with the "Automatic" line,
+ * so show it again */
+ gsb_fyear_set_automatic (TRUE);
return return_value;
+}
+
+
+/**
+ * create the page 2 of the assistant
+ * show the menu to choose between archive by date, financial year or budget
+ *
+ * \param assistant the GtkWidget assistant
+ *
+ * \return a GtkWidget containing the page
+ * */
+static GtkWidget *gsb_assistant_archive_page_menu ( GtkWidget *assistant )
+{
+ GtkWidget *page;
+ GtkWidget *vbox;
+ GtkWidget *vbox_2;
+ GtkWidget *label;
+ GtkWidget *button;
+ GtkWidget *hbox;
+ GtkWidget *separator;
+
+ page = gtk_hbox_new (FALSE, 15);
+ gtk_container_set_border_width ( GTK_CONTAINER (page),
+ 10 );
+
+ vbox = gtk_vbox_new (FALSE, 5);
+ gtk_box_pack_start ( GTK_BOX (page),
+ vbox,
+ FALSE, FALSE, 0 );
+
+ /* set up the menu */
+ label = gtk_label_new (_("Please choose the way to make your archive :\n"));
+ gtk_misc_set_alignment ( GTK_MISC (label),
+ 0, 0.5 );
+ gtk_box_pack_start ( GTK_BOX (vbox),
+ label,
+ FALSE, FALSE, 0 );
+
+ /* archive by date */
+ button = gtk_radio_button_new_with_label ( NULL,
+ _("Archive by date"));
+ g_signal_connect_object ( G_OBJECT (button),
+ "toggled",
+ G_CALLBACK (gsb_assistant_archive_update_labels),
+ G_OBJECT (assistant),
+ G_CONNECT_AFTER | G_CONNECT_SWAPPED);
+ gtk_box_pack_start ( GTK_BOX (vbox),
+ button,
+ FALSE, FALSE, 0 );
+
+ label = gtk_label_new (_(" Grisbi will archive all the transactions between the initial and final date.\n"));
+ gtk_misc_set_alignment ( GTK_MISC (label),
+ 0, 0.5 );
+ gtk_box_pack_start ( GTK_BOX (vbox),
+ label,
+ FALSE, FALSE, 0 );
+
+ hbox = gtk_hbox_new ( FALSE, 10 );
+ g_signal_connect ( G_OBJECT (button),
+ "toggled",
+ G_CALLBACK (sens_desensitive_pointeur),
+ G_OBJECT (hbox));
+ gtk_box_pack_start ( GTK_BOX (vbox),
+ hbox,
+ FALSE, FALSE, 0 );
+
+ label = gtk_label_new (_(" Initial date :"));
+ gtk_box_pack_start ( GTK_BOX (hbox),
+ label,
+ FALSE, FALSE, 0 );
+ initial_date = gsb_calendar_entry_new (FALSE);
+ g_signal_connect_object ( G_OBJECT (initial_date),
+ "changed",
+ G_CALLBACK (gsb_assistant_archive_update_labels),
+ G_OBJECT (assistant),
+ G_CONNECT_AFTER | G_CONNECT_SWAPPED);
+ gtk_box_pack_start ( GTK_BOX (hbox),
+ initial_date,
+ FALSE, FALSE, 0 );
+
+ label = gtk_label_new (_("Final date :"));
+ gtk_box_pack_start ( GTK_BOX (hbox),
+ label,
+ FALSE, FALSE, 0 );
+ final_date = gsb_calendar_entry_new (FALSE);
+ g_signal_connect_object ( G_OBJECT (final_date),
+ "changed",
+ G_CALLBACK (gsb_assistant_archive_update_labels),
+ G_OBJECT (assistant),
+ G_CONNECT_AFTER | G_CONNECT_SWAPPED);
+ gtk_box_pack_start ( GTK_BOX (hbox),
+ final_date,
+ FALSE, FALSE, 0 );
+
+ /* archive by financial year */
+ button = gtk_radio_button_new_with_label ( gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)),
+ _("Archive by financial year"));
+ g_signal_connect_object ( G_OBJECT (button),
+ "toggled",
+ G_CALLBACK (gsb_assistant_archive_update_labels),
+ G_OBJECT (assistant),
+ G_CONNECT_AFTER | G_CONNECT_SWAPPED);
+ gtk_box_pack_start ( GTK_BOX (vbox),
+ button,
+ FALSE, FALSE, 0 );
+
+ label = gtk_label_new (_(" Grisbi will archive all the transactions belonging to the financial year.\n" ));
+ gtk_misc_set_alignment ( GTK_MISC (label),
+ 0, 0.5 );
+ gtk_box_pack_start ( GTK_BOX (vbox),
+ label,
+ FALSE, FALSE, 0 );
+
+ hbox = gtk_hbox_new ( FALSE, 10 );
+ g_signal_connect ( G_OBJECT (button),
+ "toggled",
+ G_CALLBACK (sens_desensitive_pointeur),
+ G_OBJECT (hbox));
+ gtk_box_pack_start ( GTK_BOX (vbox),
+ hbox,
+ FALSE, FALSE, 0 );
+
+ label = gtk_label_new (_(" Chosen financial year :"));
+ gtk_box_pack_start ( GTK_BOX (hbox),
+ label,
+ FALSE, FALSE, 0 );
+ financial_year_button = gsb_fyear_make_combobox (FALSE);
+ g_signal_connect_object ( G_OBJECT (financial_year_button),
+ "changed",
+ G_CALLBACK (gsb_assistant_archive_update_labels),
+ G_OBJECT (assistant),
+ G_CONNECT_AFTER | G_CONNECT_SWAPPED);
+ gtk_box_pack_start ( GTK_BOX (hbox),
+ financial_year_button,
+ FALSE, FALSE, 0 );
+ gtk_widget_set_sensitive ( hbox, FALSE );
+
+ /* archive by budget */
+ button = gtk_radio_button_new_with_label ( gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)),
+ _("Archive by report"));
+ g_signal_connect_object ( G_OBJECT (button),
+ "toggled",
+ G_CALLBACK (gsb_assistant_archive_update_labels),
+ G_OBJECT (assistant),
+ G_CONNECT_AFTER | G_CONNECT_SWAPPED);
+ gtk_box_pack_start ( GTK_BOX (vbox),
+ button,
+ FALSE, FALSE, 0 );
+
+ label = gtk_label_new (_(" Grisbi will archive the transactions selected by a report.\n" ));
+ gtk_misc_set_alignment ( GTK_MISC (label),
+ 0, 0.5 );
+ gtk_box_pack_start ( GTK_BOX (vbox),
+ label,
+ FALSE, FALSE, 0 );
+
+ hbox = gtk_hbox_new ( FALSE, 10 );
+ g_signal_connect ( G_OBJECT (button),
+ "toggled",
+ G_CALLBACK (sens_desensitive_pointeur),
+ G_OBJECT (hbox));
+ gtk_box_pack_start ( GTK_BOX (vbox),
+ hbox,
+ FALSE, FALSE, 0 );
+
+ label = gtk_label_new (_(" Chosen report :"));
+ gtk_box_pack_start ( GTK_BOX (hbox),
+ label,
+ FALSE, FALSE, 0 );
+ report_button = gsb_report_make_combobox ();
+ g_signal_connect_object ( G_OBJECT (report_button),
+ "changed",
+ G_CALLBACK (gsb_assistant_archive_update_labels),
+ G_OBJECT (assistant),
+ G_CONNECT_AFTER | G_CONNECT_SWAPPED);
+ gtk_box_pack_start ( GTK_BOX (hbox),
+ report_button,
+ FALSE, FALSE, 0 );
+ gtk_widget_set_sensitive ( hbox, FALSE );
+
+ /* now the name of the archive */
+ separator = gtk_vseparator_new ();
+ gtk_box_pack_start ( GTK_BOX (page),
+ separator,
+ FALSE, FALSE, 0 );
+
+ vbox = gtk_vbox_new (FALSE, 5);
+ gtk_box_pack_start ( GTK_BOX (page),
+ vbox,
+ FALSE, FALSE, 0 );
+
+
+ label = gtk_label_new (_("Choose a name for the archive : "));
+ gtk_misc_set_alignment ( GTK_MISC (label),
+ 0, 0.5 );
+ gtk_box_pack_start ( GTK_BOX (vbox),
+ label,
+ FALSE, FALSE, 0 );
+
+ hbox = gtk_hbox_new ( FALSE, 10 );
+ gtk_box_pack_start ( GTK_BOX (vbox),
+ hbox,
+ FALSE, FALSE, 0 );
+
+ name_entry = gtk_entry_new ();
+ g_signal_connect_object ( G_OBJECT (name_entry),
+ "changed",
+ G_CALLBACK (gsb_assistant_archive_update_labels),
+ G_OBJECT (assistant),
+ G_CONNECT_AFTER | G_CONNECT_SWAPPED);
+ gtk_box_pack_end ( GTK_BOX (hbox),
+ name_entry,
+ FALSE, FALSE, 0 );
+
+ /* the vbox now with the informations */
+
+ vbox_2 = gtk_vbox_new ( FALSE, 10 );
+ gtk_box_pack_start ( GTK_BOX (vbox),
+ vbox_2,
+ TRUE, FALSE, 10 );
+
+ /* how much transactions will be archived ? */
+ label_nb_archived = gtk_label_new (NULL);
+ gtk_box_pack_start ( GTK_BOX (vbox_2),
+ label_nb_archived,
+ FALSE, FALSE, 0 );
+
+ /* how much transactions it remains ? */
+ label_nb_loaded = gtk_label_new (NULL);
+ gtk_box_pack_start ( GTK_BOX (vbox_2),
+ label_nb_loaded,
+ FALSE, FALSE, 0 );
+
+ /* why the button is still unsensitive ? */
+ label_warning = gtk_label_new (NULL);
+ gtk_box_pack_start ( GTK_BOX (vbox_2),
+ label_warning,
+ FALSE, FALSE, 0 );
+
+ gtk_widget_show_all (page);
+ return page;
+}
+
+
+/**
+ * create the page showed after the click on the "Create" button
+ * this is a success page or a failed page
+ *
+ * \param
+ *
+ * \return a GtkWidget, the page to the assistant
+ * */
+static GtkWidget *gsb_assistant_archive_page_success ( void )
+{
+ GtkWidget *page;
+ GtkWidget *label;
+
+ page = gtk_vbox_new ( FALSE, 0 );
+ gtk_container_set_border_width ( GTK_CONTAINER (page),
+ 10 );
+
+ /* we create 2 vbox, one for congratulation, one for failed,
+ * only one will be showed */
+ vbox_congratulation = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start ( GTK_BOX (page),
+ vbox_congratulation,
+ FALSE, FALSE, 0 );
+
+ label = gtk_label_new (_("Congratulation !\n"));
+ gtk_misc_set_alignment ( GTK_MISC (label),
+ 0, 0.5 );
+ gtk_box_pack_start ( GTK_BOX (vbox_congratulation),
+ label,
+ FALSE, FALSE,
+ 0 );
+
+ label_congratulation = gtk_label_new (NULL);
+ gtk_box_pack_start ( GTK_BOX (vbox_congratulation),
+ label_congratulation,
+ FALSE, FALSE,
+ 0 );
+
+ label = gtk_label_new (_("You can click on the 'Previous' button to make another archive,\n"
+ "or 'Close' the assistant.\n\n"
+ "If ever grisbi is still too slow after making all the archives,\n"
+ "remember that it exists a function in the configuration to avoid to load\n"
+ "the R marked transactions at the begining, to increase the speed.\n\n"
+ " Please press the Previous or Close button."));
+ gtk_misc_set_alignment ( GTK_MISC (label),
+ 0, 0.5 );
+ gtk_box_pack_start ( GTK_BOX (vbox_congratulation),
+ label,
+ FALSE, FALSE,
+ 0 );
+
+ /* make the failed box */
+ vbox_failed = gtk_vbox_new (FALSE, 0 );
+ gtk_box_pack_start ( GTK_BOX (page),
+ vbox_failed,
+ FALSE, FALSE, 0 );
+
+ label = gtk_label_new (_("An error occurred while creating the archive...\n"
+ "Please try to find the problem and contact the grisbi team to correct it.\n\n"
+ " Please press the Previous or Close button."));
+ gtk_misc_set_alignment ( GTK_MISC (label),
+ 0, 0.5 );
+ gtk_box_pack_start ( GTK_BOX (vbox_failed),
+ label,
+ FALSE, FALSE,
+ 0 );
+
+ gtk_widget_show_all (page);
+ gtk_widget_hide (vbox_failed);
+ return page;
+}
+
+
+/**
+ * called when switch page between to the initial page
+ *
+ * \param assistant
+ * \param new_page
+ *
+ * \return FALSE
+ * */
+static gboolean gsb_assistant_archive_switch_to_intro ( GtkWidget *assistant,
+ gint new_page )
+{
+ /* enter into the intro page */
+ gsb_assistant_change_button_next ( assistant,
+ GTK_STOCK_GO_FORWARD, GTK_RESPONSE_YES );
+ gsb_assistant_sensitive_button_next ( assistant,
+ TRUE );
+ return FALSE;
+}
+
+
+/**
+ * called when switch page to the menu page
+ *
+ * \param assistant
+ * \param new_page
+ *
+ * \return FALSE
+ * */
+static gboolean gsb_assistant_archive_switch_to_menu ( GtkWidget *assistant,
+ gint new_page )
+{
+ /* enter into the menu page */
+ gtk_label_set_text ( GTK_LABEL (label_warning),
+ NULL );
+ gsb_assistant_change_button_next ( assistant,
+ GTK_STOCK_APPLY, GTK_RESPONSE_YES );
+ gsb_assistant_archive_update_labels (assistant);
+
+ return FALSE;
+}
+
+/**
+ * called when switch page to the success page
+ * will create the archived transactions
+ *
+ * \param assistant
+ * \param new_page
+ *
+ * \return FALSE
+ * */
+static gboolean gsb_assistant_archive_switch_to_succes ( GtkWidget *assistant,
+ gint new_page )
+{
+ /* if we come here, we are sure that :
+ * there is a own name to the archive
+ * there is some transasctions to be archived
+ * all the necessary stuff is filled */
+ GSList *tmp_list;
+ gint archive_number;
+ gchar *string;
+
+ if (!list_transaction_to_archive)
+ {
+ /* should not happen */
+ gtk_widget_hide (vbox_congratulation);
+ gtk_widget_show (vbox_failed);
+ return FALSE;
+ }
+
+ /* first, create the archive */
+ archive_number = gsb_data_archive_new (gtk_entry_get_text (GTK_ENTRY (name_entry)));
+ if (!archive_number)
+ {
+ gtk_widget_hide (vbox_congratulation);
+ gtk_widget_show (vbox_failed);
+ return FALSE;
+ }
+
+ /* fill the archive */
+ if (GTK_WIDGET_IS_SENSITIVE (initial_date))
+ {
+ GDate *init_gdate;
+ GDate *final_gdate;
+ init_gdate = gsb_calendar_entry_get_date (initial_date);
+ final_gdate = gsb_calendar_entry_get_date (final_date);
+
+ gsb_data_archive_set_begining_date ( archive_number,
+ init_gdate );
+ gsb_data_archive_set_end_date ( archive_number,
+ final_gdate );
+ g_date_free (init_gdate);
+ g_date_free (final_gdate);
+ }
+ if (GTK_WIDGET_IS_SENSITIVE (financial_year_button))
+ gsb_data_archive_set_fyear ( archive_number,
+ gsb_fyear_get_fyear_from_combobox (financial_year_button,NULL));
+
+ if (GTK_WIDGET_IS_SENSITIVE (report_button))
+ {
+ gint report_number;
+
+ report_number = gsb_report_get_report_from_combobox (report_button);
+
+ gsb_data_archive_set_report_title ( archive_number,
+ etats_titre (report_number));
+ }
+
+ /* mark the transactions as archived */
+ tmp_list = list_transaction_to_archive;
+ while (tmp_list)
+ {
+ gint transaction_number;
+
+ transaction_number = gsb_data_transaction_get_transaction_number (tmp_list -> data);
+ gsb_data_transaction_set_archive_number ( transaction_number,
+ archive_number );
+ tmp_list = tmp_list -> next;
+ }
+
+ /* set the message */
+ string = g_strdup_printf ( _("The archive %s was successfully created, and %d transactions were associated to it.\n(now, %d transactions will be loaded into Grisbi)\n"),
+ gsb_data_archive_get_name (archive_number),
+ g_slist_length (list_transaction_to_archive),
+ g_slist_length (gsb_data_transaction_get_transactions_list ()));
+ gtk_label_set_text ( GTK_LABEL (label_congratulation),
+ string );
+ g_free (string);
+
+ gtk_widget_hide (vbox_failed);
+ gtk_widget_show (vbox_congratulation);
+
+ /* free the transactions list to archive */
+ g_slist_free (list_transaction_to_archive);
+ list_transaction_to_archive = NULL;
+
+ /* erase all the previous entries */
+ gtk_entry_set_text ( GTK_ENTRY (name_entry),
+ "" );
+ gtk_entry_set_text ( GTK_ENTRY (initial_date),
+ "" );
+ gtk_entry_set_text ( GTK_ENTRY (final_date),
+ "" );
+
+ /* propose to go in one or another way */
+ gsb_assistant_sensitive_button_prev ( assistant,
+ TRUE );
+ gsb_assistant_sensitive_button_next ( assistant,
+ TRUE );
return FALSE;
}
+
+
+/**
+ * called for each event to update the labels of number of transactions to archive
+ * and check if all is ok, to sensitive the "Create" button
+ *
+ * \param assistant
+ *
+ * \return FALSE
+ * */
+static gboolean gsb_assistant_archive_update_labels ( GtkWidget *assistant )
+{
+ gchar *string;
+ GSList *tmp_list;
+
+ if (list_transaction_to_archive)
+ {
+ g_slist_free (list_transaction_to_archive);
+ list_transaction_to_archive = NULL;
+ }
+
+ if (GTK_WIDGET_IS_SENSITIVE (initial_date))
+ {
+ /* ok for now the choice is on initial/final date */
+ GDate *init_gdate;
+ GDate *final_gdate;
+ init_gdate = gsb_calendar_entry_get_date (initial_date);
+ final_gdate = gsb_calendar_entry_get_date (final_date);
+ string = NULL;
+
+ if (!strlen ( gtk_entry_get_text (GTK_ENTRY (initial_date))))
+ string = my_strdup (_("<span foreground=\"red\">Please fill the initial date</span>"));
+ if (!string
+ &&
+ !strlen ( gtk_entry_get_text (GTK_ENTRY (final_date))))
+ string = my_strdup (_("<span foreground=\"red\">Please fill the final date</span>"));
+ if ( !string
+ &&
+ init_gdate
+ &&
+ final_gdate
+ &&
+ g_date_compare (init_gdate, final_gdate) > 0 )
+ string = my_strdup (_("<span foreground=\"red\">The initial date is after the final date</span>"));
+ if ( !string
+ &&
+ !init_gdate)
+ string = my_strdup (_("<span foreground=\"red\">The initial date is not valid.</span>"));
+ if ( !string
+ &&
+ !final_gdate)
+ string = my_strdup (_("<span foreground=\"red\">The final date is not valid</span>"));
+ if ( !string
+ &&
+ gsb_data_archive_get_from_date (init_gdate))
+ string = my_strdup (_("<span foreground=\"red\">The initial date belongs already to an archive.</span>"));
+ if ( !string
+ &&
+ gsb_data_archive_get_from_date (final_gdate))
+ string = my_strdup (_("<span foreground=\"red\">The final date belongs already to an archive.</span>"));
+
+ if (string)
+ {
+ gtk_label_set_markup ( GTK_LABEL (label_warning),
+ string );
+ g_free (string);
+ gsb_assistant_archive_update_labels_no_archive (assistant);
+ return FALSE;
+ }
+
+ /* the dates are ok */
+ tmp_list = gsb_data_transaction_get_transactions_list ();
+ while (tmp_list)
+ {
+ gint transaction_number;
+
+ transaction_number = gsb_data_transaction_get_transaction_number (tmp_list -> data);
+
+ if ( g_date_compare ( init_gdate,
+ gsb_data_transaction_get_date (transaction_number)) <= 0
+ &&
+ g_date_compare ( final_gdate,
+ gsb_data_transaction_get_date (transaction_number)) >= 0 )
+ /* the transaction is into the dates, we append its address to the list to reconcile */
+ list_transaction_to_archive = g_slist_append ( list_transaction_to_archive,
+ tmp_list -> data );
+ tmp_list = tmp_list -> next;
+ }
+ }
+
+ if (GTK_WIDGET_IS_SENSITIVE (financial_year_button))
+ {
+ /* ok for now the choice is on fyear */
+ gint fyear_number;
+ string = NULL;
+
+ fyear_number = gsb_fyear_get_fyear_from_combobox (financial_year_button,NULL);
+
+ if (!fyear_number)
+ string = my_strdup (_("<span foreground=\"red\">Please choose a financial year</span>"));
+
+ if ( !string
+ &&
+ gsb_data_archive_get_from_fyear (fyear_number))
+ string = my_strdup (_("<span foreground=\"red\">There is already an archive for that financial year.</span>"));
+
+ if (string)
+ {
+ gtk_label_set_markup ( GTK_LABEL (label_warning),
+ string );
+ g_free (string);
+ gsb_assistant_archive_update_labels_no_archive (assistant);
+ return FALSE;
+ }
+
+ /* the fyear is ok */
+ tmp_list = gsb_data_transaction_get_transactions_list ();
+ while (tmp_list)
+ {
+ gint transaction_number;
+
+ transaction_number = gsb_data_transaction_get_transaction_number (tmp_list -> data);
+
+ if (gsb_data_transaction_get_financial_year_number (transaction_number) == fyear_number)
+ /* the transaction belongs to the fyear, we append its address to the list to reconcile */
+ list_transaction_to_archive = g_slist_append ( list_transaction_to_archive,
+ tmp_list -> data );
+ tmp_list = tmp_list -> next;
+ }
+ }
+
+ if (GTK_WIDGET_IS_SENSITIVE (report_button))
+ {
+ /* ok for now the choice is on fyear */
+ gint report_number;
+ string = NULL;
+
+ report_number = gsb_report_get_report_from_combobox (report_button);
+
+ if (!report_number)
+ string = my_strdup (_("<span foreground=\"red\">Please choose a report</span>"));
+
+ if (string)
+ {
+ gtk_label_set_markup ( GTK_LABEL (label_warning),
+ string );
+ g_free (string);
+ gsb_assistant_archive_update_labels_no_archive (assistant);
+ return FALSE;
+ }
+
+ /* the report is ok */
+ list_transaction_to_archive = recupere_opes_etat (report_number);
+ }
+
+ /* update the labels */
+ if (list_transaction_to_archive)
+ {
+ /* there is some transactions to archive */
+ gint length;
+
+ length = g_slist_length (list_transaction_to_archive);
+
+ string = g_strdup_printf (_("%d transactions will be archived"),
+ length);
+ gtk_label_set_text ( GTK_LABEL (label_nb_archived),
+ string);
+ g_free (string);
+
+ string = g_strdup_printf (_("And %d will be loaded into Grisbi."),
+ g_slist_length (gsb_data_transaction_get_transactions_list ()) - length);
+ gtk_label_set_text ( GTK_LABEL (label_nb_loaded),
+ string );
+ g_free (string);
+ }
+ else
+ {
+ /* there is no transaction to archive */
+ gtk_label_set_text ( GTK_LABEL (label_warning),
+ NULL );
+ gsb_assistant_archive_update_labels_no_archive (assistant);
+ return FALSE;
+ }
+
+ /* we show the next button only if the name is ok */
+ if (strlen ( gtk_entry_get_text (GTK_ENTRY (name_entry))))
+ {
+ if (gsb_data_archive_get_number_by_name (gtk_entry_get_text (GTK_ENTRY (name_entry))))
+ {
+ string = my_strdup (_("<span foreground=\"red\">The name is already use, please change it.</span>"));
+ gtk_label_set_markup ( GTK_LABEL (label_warning),
+ string );
+ g_free (string);
+ gsb_assistant_sensitive_button_next ( assistant, FALSE );
+ }
+ else
+ {
+ gtk_label_set_text ( GTK_LABEL (label_warning),
+ NULL );
+ gsb_assistant_sensitive_button_next ( assistant, TRUE );
+ }
+ }
+ else
+ {
+ string = my_strdup (_("<span foreground=\"red\">Please fill the name of the archive</span>"));
+ gtk_label_set_markup ( GTK_LABEL (label_warning),
+ string );
+ g_free (string);
+
+ gsb_assistant_sensitive_button_next ( assistant, FALSE );
+ }
+
+ return FALSE;
+}
+
+
+/**
+ * set the labels to the default position when no archive can be done
+ *
+ * \param assistant
+ *
+ * \return
+ * */
+void gsb_assistant_archive_update_labels_no_archive ( GtkWidget *assistant )
+{
+ gchar *string;
+
+ gtk_label_set_text ( GTK_LABEL (label_nb_archived),
+ _("For now, no transaction will be archived"));
+
+ string = g_strdup_printf (_("And %d will be loaded into Grisbi."),
+ g_slist_length (gsb_data_transaction_get_transactions_list ()));
+ gtk_label_set_text ( GTK_LABEL (label_nb_loaded),
+ string );
+ g_free (string);
+
+ gsb_assistant_sensitive_button_next ( assistant, FALSE );
+ return ;
+}
Index: dialog.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/dialog.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- dialog.h 18 Feb 2007 12:37:14 -0000 1.24
+++ dialog.h 20 Mar 2007 10:12:52 -0000 1.25
@@ -21,7 +21,11 @@
gchar * make_hint ( gchar * hint, gchar * text );
gboolean question ( gchar *texte );
gboolean question_conditional_yes_no ( gchar * var );
-gboolean question_yes_no_hint ( gchar * hint, gchar *texte );
+gboolean question_yes_no ( gchar *texte,
+ gint default_answer );
+gboolean question_yes_no_hint ( gchar * hint,
+ gchar *texte,
+ gint default_answer );
/* END_DECLARATION */
struct conditional_message
--- NEW FILE: gsb_data_archive.c ---
(This appears to be a binary file; contents omitted.)
Index: utils_file_selection.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils_file_selection.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- utils_file_selection.c 18 Feb 2007 12:37:21 -0000 1.21
+++ utils_file_selection.c 20 Mar 2007 10:12:54 -0000 1.22
@@ -96,7 +96,8 @@
if ( S_ISREG ( test_file.st_mode ) )
{
result = question_yes_no_hint (_("File already exists"),
- g_strdup_printf (_("Do you want to overwrite file \"%s\"?"), filename));
+ g_strdup_printf (_("Do you want to overwrite file \"%s\"?"), filename),
+ GTK_RESPONSE_NO );
}
else
{
Index: Makefile.am
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/Makefile.am,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -d -r1.119 -r1.120
--- Makefile.am 18 Feb 2007 23:10:51 -0000 1.119
+++ Makefile.am 20 Mar 2007 10:12:51 -0000 1.120
@@ -55,6 +55,8 @@
gsb_currency_config.c \
gsb_currency_link_config.c \
gsb_data_account.c \
+ gsb_data_archive.c \
+ gsb_data_archive_store.c \
gsb_data_bank.c \
gsb_data_budget.c \
gsb_data_category.c \
@@ -92,6 +94,7 @@
gsb_reconcile_config.c \
gsb_reconcile_list.c \
gsb_reconcile_sort_config.c \
+ gsb_report.c \
gsb_scheduler.c \
gsb_scheduler_list.c \
gsb_status.c \
@@ -155,6 +158,8 @@
gsb_currency_config.h \
gsb_currency_link_config.h \
gsb_data_account.h \
+ gsb_data_archive.h \
+ gsb_data_archive_store.h \
gsb_data_bank.h \
gsb_data_budget.h \
gsb_data_category.h \
@@ -190,6 +195,7 @@
gsb_reconcile_config.h \
gsb_reconcile_list.h \
gsb_reconcile_sort_config.h \
+ gsb_report.h \
gsb_scheduler.h \
gsb_scheduler_list.h \
gsb_transaction_model.h \
Index: gsb_data_transaction.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_transaction.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- gsb_data_transaction.c 18 Feb 2007 22:12:02 -0000 1.24
+++ gsb_data_transaction.c 20 Mar 2007 10:12:53 -0000 1.25
@@ -57,6 +57,7 @@
gint party_number;
gchar *notes;
gint marked_transaction; /**< OPERATION_NORMALE=nothing, OPERATION_POINTEE=P, OPERATION_TELERAPPROCHEE=T, OPERATION_RAPPROCHEE=R */
+ gint archive_number; /**< if it's an archived transaction, contains the number of the archive */
gshort automatic_transaction; /**< 0=manual, 1=automatic (scheduled transaction) */
gint reconcile_number; /**< the number of reconcile, carreful : can be filled without marked_transaction=OPERATION_RAPPROCHEE sometimes,
it happen if the user did ctrl R to un-R the transaction, we keep reconcile_number because most of them
@@ -104,9 +105,12 @@
/*END_EXTERN*/
-/** the g_slist which contains all the transactions structures */
+/** the g_slist which contains the transactions structures not archived */
static GSList *transactions_list = NULL;
+/** that list contains all the transactions, archived and not archived */
+static GSList *complete_transactions_list = NULL;
+
/** the g_slist which contains all the white transactions structures
* ie : 1 general white line
* and 1 white line per breakdown of transaction */
@@ -119,8 +123,11 @@
static gint current_transaction_buffer;
-/** set the transactions global variables to NULL, usually when we init all the global variables
- * \param none
+/**
+ * set the transactions global variables to NULL, usually when we init all the global variables
+ *
+ * \param
+ *
* \return FALSE
* */
gboolean gsb_data_transaction_init_variables ( void )
@@ -129,6 +136,7 @@
transaction_buffer[1] = NULL;
current_transaction_buffer = 0;
transactions_list = NULL;
+ complete_transactions_list = NULL;
return FALSE;
}
@@ -138,8 +146,10 @@
* return a pointer to the g_slist of transactions structure
* it's not a copy, so we must not free or change it
* if we want to change something, use gsb_data_transaction_copy_transactions_list instead
+ * THIS IS THE LIST WITHOUT THE ARCHIVED TRANSACTIONS
*
* \param none
+ *
* \return the slist of transactions structures
* */
GSList *gsb_data_transaction_get_transactions_list ( void )
@@ -147,11 +157,54 @@
return transactions_list;
}
+/**
+ * return a pointer to the complete g_slist of transactions structure
+ * it's not a copy, so we must not free or change it
+ * if we want to change something, use gsb_data_transaction_copy_transactions_list instead
+ * THIS IS THE COMPLETE LIST (WITH THE ARCHIVED TRANSACTIONS)
+ *
+ * \param none
+ *
+ * \return the slist of transactions structures
+ * */
+GSList *gsb_data_transaction_get_complete_transactions_list ( void )
+{
+ return complete_transactions_list;
+}
+
+/**
+ * just append the archived transaction given in param
+ * into the non archived transactions list
+ * called when want to load archived transactions into grisbi
+ *
+ * \param transaction_number the transaction to append
+ *
+ * \return TRUE ok, FALSE pb
+ * */
+gboolean gsb_data_transaction_add_archived_to_list ( gint transaction_number )
+{
+ struct_transaction *transaction;
+
+ transaction = gsb_data_transaction_get_transaction_by_no ( transaction_number);
+ if ( !transaction )
+ return FALSE;
-/** transitionnal fonction, give back the pointer to the transaction,
+ transactions_list = g_slist_append ( transactions_list,
+ transaction );
+ return TRUE;
+}
+
+
+/**
+ * transitionnal fonction, give back the pointer to the transaction,
* normally deleted when the transfer from old transactions is finished
- * set also in the transactions list, check if it's fast enough with only the transactions number ? */
+ * set also in the transactions list, check if it's fast enough with only the transactions number ?
+ *
+ * \param transaction_number
+ *
+ * \return a pointer to the structure of the transation
+ * */
gpointer gsb_data_transaction_get_pointer_to_transaction ( gint transaction_number )
{
struct_transaction *transaction;
@@ -170,7 +223,7 @@
gint last_number = 0;
GSList *transactions_list_tmp;
- transactions_list_tmp = transactions_list;
+ transactions_list_tmp = complete_transactions_list;
while (transactions_list_tmp)
{
@@ -297,7 +350,7 @@
if ( transaction_number < 0 )
transactions_list_tmp = white_transactions_list;
else
- transactions_list_tmp = transactions_list;
+ transactions_list_tmp = complete_transactions_list;
while ( transactions_list_tmp )
{
@@ -1142,6 +1195,73 @@
}
+/**
+ * get the number of the archive
+ *
+ * \param transaction_number the number of the transaction
+ *
+ * \return the archive number or 0 if not archived
+ * */
+gint gsb_data_transaction_get_archive_number ( gint transaction_number )
+{
+ struct_transaction *transaction;
+
+ transaction = gsb_data_transaction_get_transaction_by_no ( transaction_number);
+
+ if ( !transaction )
+ return -1;
+
+ return transaction -> archive_number;
+}
+
+
+/**
+ * set the number of the archive if it's an archived transaction
+ * add or remove the transaction from the list of transactions without archive according to the value
+ *
+ * \param transaction_number
+ * \param archive_number or 0 if not an archive
+ *
+ * \return TRUE if ok
+ * */
+gboolean gsb_data_transaction_set_archive_number ( gint transaction_number,
+ gint archive_number )
+{
+ struct_transaction *transaction;
+
+ transaction = gsb_data_transaction_get_transaction_by_no ( transaction_number);
+
+ if ( !transaction )
+ return FALSE;
+return FALSE;
+ /* we choose to set or not the transaction to the transactions_list
+ * if the archive_number of the transaction is 0 for now, it's already in that list,
+ * so we mustn't add it,
+ * else, according to the new value, we remove it or append it */
+ if (transaction -> archive_number)
+ {
+ /* that transaction was an archive, so it's only in the complete_transactions_list */
+ if (!archive_number)
+ /* the transaction was an archive, and we transform it as non archived transaction,
+ * so we add it into the transactions_list */
+ transactions_list = g_slist_append ( transactions_list,
+ transaction );
+ }
+ else
+ {
+ /* the transaction was not an archive, so it's into the 2 lists,
+ * if we transform it as an archive, we remove it from the transactions_list */
+
+/* transactions_list = g_slist_remove ( transactions_list, */
+/* transaction ); */
+ }
+
+/* transaction -> archive_number = archive_number; */
+
+ return TRUE;
+}
+
+
/** get the automatic_transaction
* \param transaction_number the number of the transaction
@@ -1579,8 +1699,11 @@
transaction -> voucher = "";
transaction -> bank_references = "";
+ /* we append the transaction to the complete transactions list and the non archive transaction list */
transactions_list = g_slist_append ( transactions_list,
transaction );
+ complete_transactions_list = g_slist_append ( complete_transactions_list,
+ transaction );
gsb_data_transaction_save_transaction_pointer (transaction);
@@ -1731,8 +1854,11 @@
contra_transaction = gsb_data_transaction_get_transaction_by_no (transaction -> transaction_number_transfer);
if (contra_transaction)
{
+ /* we remove the transaction from the 2 lists */
transactions_list = g_slist_remove ( transactions_list,
contra_transaction );
+ complete_transactions_list = g_slist_remove ( complete_transactions_list,
+ contra_transaction );
g_free (contra_transaction);
}
}
@@ -1756,6 +1882,8 @@
/* it's a transfer, delete the transfer */
transactions_list = g_slist_remove ( transactions_list,
contra_transaction );
+ complete_transactions_list = g_slist_remove ( complete_transactions_list,
+ contra_transaction );
g_free (contra_transaction);
/* we free the buffer to avoid big possibly crashes */
transaction_buffer[0] = NULL;
@@ -1765,6 +1893,8 @@
/* delete the child */
transactions_list = g_slist_remove ( transactions_list,
child_transaction );
+ complete_transactions_list = g_slist_remove ( complete_transactions_list,
+ child_transaction );
g_free (child_transaction);
tmp_list = tmp_list -> next;
}
@@ -1773,6 +1903,8 @@
/* now can remove safely the transaction */
transactions_list = g_slist_remove ( transactions_list,
transaction );
+ complete_transactions_list = g_slist_remove ( complete_transactions_list,
+ transaction );
/* we free the buffer to avoid big possibly crashes */
transaction_buffer[0] = NULL;
@@ -1911,6 +2043,7 @@
/**
* return the number of transaction in the given account
+ * (the archived transactions are not counted, if need, should append a new param with include archived transactions)
*
* \param account_number
* \param include_breakdown TRUE if we want to include the breakdown children in the amount, FALSE if we want only the first level transactions
Index: traitement_variables.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/traitement_variables.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- traitement_variables.h 18 Feb 2007 12:37:21 -0000 1.12
+++ traitement_variables.h 20 Mar 2007 10:12:54 -0000 1.13
@@ -22,6 +22,10 @@
#define COULEUR_GRISE_GREEN 50000
#define COULEUR_GRISE_BLUE 50000
+#define COLOR_ARCHIVE_BG_RED 15000
+#define COLOR_ARCHIVE_BG_GREEN 30000
+#define COLOR_ARCHIVE_BG_BLUE 10000
+
/* START_INCLUDE_H */
#include "./structures.h"
Index: gsb_payment_method_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_payment_method_config.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- gsb_payment_method_config.c 18 Feb 2007 12:37:19 -0000 1.11
+++ gsb_payment_method_config.c 20 Mar 2007 10:12:53 -0000 1.12
@@ -371,7 +371,7 @@
gtk_tree_store_append (GTK_TREE_STORE (model), &account_iter, NULL);
gtk_tree_store_set (GTK_TREE_STORE (model), &account_iter,
PAYMENT_METHODS_NAME_COLUMN, gsb_data_account_get_name (account_number),
- PAYMENT_METHODS_NUMBERING_COLUMN, "",
+ PAYMENT_METHODS_NUMBERING_COLUMN, NULL,
PAYMENT_METHODS_TYPE_COLUMN, 0,
PAYMENT_METHODS_DEFAULT_COLUMN, FALSE,
PAYMENT_METHODS_ACTIVABLE_COLUMN, FALSE,
@@ -384,7 +384,7 @@
gtk_tree_store_append (GTK_TREE_STORE (model), &debit_iter, &account_iter);
gtk_tree_store_set (GTK_TREE_STORE (model), &debit_iter,
PAYMENT_METHODS_NAME_COLUMN, _("Debit"),
- PAYMENT_METHODS_NUMBERING_COLUMN, "",
+ PAYMENT_METHODS_NUMBERING_COLUMN, NULL,
PAYMENT_METHODS_TYPE_COLUMN, 0,
PAYMENT_METHODS_DEFAULT_COLUMN, FALSE,
PAYMENT_METHODS_ACTIVABLE_COLUMN, FALSE,
@@ -397,7 +397,7 @@
gtk_tree_store_append (GTK_TREE_STORE (model), &credit_iter, &account_iter);
gtk_tree_store_set (GTK_TREE_STORE (model), &credit_iter,
PAYMENT_METHODS_NAME_COLUMN, _("Credit"),
- PAYMENT_METHODS_NUMBERING_COLUMN, "",
+ PAYMENT_METHODS_NUMBERING_COLUMN, NULL,
/* This is a hack: account number is put in
Debit/Credit nodes */
PAYMENT_METHODS_TYPE_COLUMN, 0,
@@ -831,7 +831,7 @@
{
gtk_widget_set_sensitive ( payment_last_number_entry, FALSE );
gtk_tree_store_set (GTK_TREE_STORE (model), &iter,
- PAYMENT_METHODS_NUMBERING_COLUMN, "",
+ PAYMENT_METHODS_NUMBERING_COLUMN, NULL,
-1);
}
}
@@ -1118,7 +1118,7 @@
gtk_tree_store_append (GTK_TREE_STORE (model), &iter, final);
gtk_tree_store_set (GTK_TREE_STORE (model), &iter,
PAYMENT_METHODS_NAME_COLUMN, gsb_data_payment_get_name (payment_number),
- PAYMENT_METHODS_NUMBERING_COLUMN, "",
+ PAYMENT_METHODS_NUMBERING_COLUMN, NULL,
PAYMENT_METHODS_TYPE_COLUMN, type_final,
PAYMENT_METHODS_DEFAULT_COLUMN, FALSE,
PAYMENT_METHODS_ACTIVABLE_COLUMN, type_final != 0,
@@ -1182,7 +1182,7 @@
* if yes, we propose to switch to another method of payment or cancel */
/* first, check if there is some transactions */
- list_tmp_transactions = gsb_data_transaction_get_transactions_list ();
+ list_tmp_transactions = gsb_data_transaction_get_complete_transactions_list ();
while (list_tmp_transactions)
{
gint transaction_number;
@@ -1321,7 +1321,7 @@
new_payment_number = gsb_payment_method_get_selected_number (combo_box);
/* Then, we change the method of payment for related operations. */
- tmp_list = gsb_data_transaction_get_transactions_list ();
+ tmp_list = gsb_data_transaction_get_complete_transactions_list ();
while (tmp_list)
{
gint transaction_number;
Index: print_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/print_config.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- print_config.c 18 Feb 2007 12:37:21 -0000 1.26
+++ print_config.c 20 Mar 2007 10:12:54 -0000 1.27
@@ -122,7 +122,8 @@
fclose ( test );
if ( question_yes_no_hint ( g_strdup_printf ( _("File %s already exists."),
filename ),
- _("Do you want to overwrite it? There is no undo for this.") ) )
+ _("Do you want to overwrite it? There is no undo for this."),
+ GTK_RESPONSE_NO ) )
{
break;
}
Index: gsb_calendar_entry.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_calendar_entry.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- gsb_calendar_entry.c 18 Feb 2007 12:37:16 -0000 1.4
+++ gsb_calendar_entry.c 20 Mar 2007 10:12:52 -0000 1.5
@@ -89,6 +89,9 @@
GtkWidget *entry;
entry = gtk_entry_new ();
+ gtk_widget_set_usize ( entry,
+ 100,
+ FALSE );
g_signal_connect ( G_OBJECT (entry),
"button-press-event",
G_CALLBACK (gsb_calendar_entry_button_press), NULL );
Index: traitement_variables.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/traitement_variables.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- traitement_variables.c 21 Feb 2007 11:10:41 -0000 1.108
+++ traitement_variables.c 20 Mar 2007 10:12:54 -0000 1.109
@@ -34,6 +34,8 @@
#include "./gsb_calendar_entry.h"
#include "./gsb_currency.h"
#include "./gsb_data_account.h"
+#include "./gsb_data_archive.h"
+#include "./gsb_data_archive_store.h"
#include "./gsb_data_bank.h"
#include "./gsb_data_budget.h"
#include "./gsb_data_category.h"
@@ -88,6 +90,7 @@
GdkColor couleur_fond[2];
GdkColor couleur_grise;
+GdkColor archive_background_color;
GdkColor couleur_selection;
GdkColor breakdown_background;
@@ -119,7 +122,6 @@
extern gint affichage_echeances;
extern gint affichage_echeances_perso_nb_libre;
extern gchar *chemin_logo;
-extern gchar *crypt_key;
extern gint ligne_affichage_une_ligne;
extern GSList *lignes_affichage_deux_lignes;
extern GSList *lignes_affichage_trois_lignes;
@@ -205,6 +207,8 @@
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_currency_init_variables ();
gsb_fyear_init_variables ();
@@ -308,12 +312,17 @@
couleur_rouge.pixel = 0;
/* couleur grise de l'échéancier */
-
couleur_grise.red = COULEUR_GRISE_RED;
couleur_grise.green = COULEUR_GRISE_GREEN;
couleur_grise.blue = COULEUR_GRISE_BLUE;
couleur_grise.pixel = 0;
+ /* set the archive background color */
+ archive_background_color.red = COLOR_ARCHIVE_BG_RED;
+ archive_background_color.green = COLOR_ARCHIVE_BG_GREEN;
+ archive_background_color.blue = COLOR_ARCHIVE_BG_BLUE;
+ archive_background_color.pixel = 0;
+
/* color for breakdown children */
breakdown_background.red = BREAKDOWN_BACKGROUND_COLOR_RED;
--- NEW FILE: gsb_data_archive_store.h ---
#ifndef _GSB_DATA_ARCHIVE_STORE_H
#define _GSB_DATA_ARCHIVE_STORE_H (1)
/* START_INCLUDE_H */
#include "./gsb_real.h"
/* END_INCLUDE_H */
/* START_DECLARATION */
void gsb_data_archive_store_create_list ( void );
gint gsb_data_archive_store_get_account_number ( gint archive_store_number );
gint gsb_data_archive_store_get_archive_number ( gint archive_store_number );
GSList *gsb_data_archive_store_get_archives_list ( void );
gsb_real gsb_data_archive_store_get_balance ( gint archive_store_number );
gint gsb_data_archive_store_get_number ( gpointer archive_ptr );
gpointer gsb_data_archive_store_get_structure ( gint archive_store_number );
gint gsb_data_archive_store_get_transactions_number ( gint archive_store_number );
gboolean gsb_data_archive_store_init_variables ( void );
gboolean gsb_data_archive_store_remove ( gint archive_store_number );
/* END_DECLARATION */
#endif
Index: gsb_data_transaction.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_transaction.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- gsb_data_transaction.h 18 Feb 2007 22:12:02 -0000 1.12
+++ gsb_data_transaction.h 20 Mar 2007 10:12:53 -0000 1.13
@@ -17,6 +17,7 @@
/* START_DECLARATION */
+gboolean gsb_data_transaction_add_archived_to_list ( gint transaction_number );
gint gsb_data_transaction_check_content_payment ( gint payment_number,
gint number );
gboolean gsb_data_transaction_copy_transaction ( gint source_transaction_number,
@@ -32,12 +33,14 @@
gint return_currency_number,
gint return_exponent );
gsb_real gsb_data_transaction_get_amount ( gint transaction_number );
+gint gsb_data_transaction_get_archive_number ( gint transaction_number );
gint gsb_data_transaction_get_automatic_transaction ( gint transaction_number );
const gchar *gsb_data_transaction_get_bank_references ( gint transaction_number );
gint gsb_data_transaction_get_breakdown_of_transaction ( gint transaction_number );
gint gsb_data_transaction_get_budgetary_number ( gint transaction_number );
gint gsb_data_transaction_get_category_number ( gint transaction_number );
gint gsb_data_transaction_get_change_between ( gint transaction_number );
+GSList *gsb_data_transaction_get_complete_transactions_list ( void );
gint gsb_data_transaction_get_currency_number ( gint transaction_number );
GDate *gsb_data_transaction_get_date ( gint transaction_number );
gsb_real gsb_data_transaction_get_exchange_fees ( gint transaction_number );
@@ -76,6 +79,8 @@
gint account_number_transfer );
gboolean gsb_data_transaction_set_amount ( gint transaction_number,
gsb_real amount );
+gboolean gsb_data_transaction_set_archive_number ( gint transaction_number,
+ gint archive_number );
gboolean gsb_data_transaction_set_automatic_transaction ( gint transaction_number,
gint automatic_transaction );
gboolean gsb_data_transaction_set_bank_references ( gint transaction_number,
Index: gsb_assistant_reconcile_config.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_assistant_reconcile_config.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- gsb_assistant_reconcile_config.h 20 Feb 2007 10:20:14 -0000 1.4
+++ gsb_assistant_reconcile_config.h 20 Mar 2007 10:12:52 -0000 1.5
@@ -8,7 +8,5 @@
/* START_DECLARATION */
GtkResponseType gsb_assistant_reconcile_config_run ( void );
-gboolean gsb_assistant_reconcile_config_update_auto_asso ( GtkWidget *assistant );
-gboolean gsb_assistant_reconcile_config_update_manu_asso ( GtkWidget *assistant );
/* END_DECLARATION */
#endif
Index: gsb_file_debug.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_debug.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- gsb_file_debug.c 18 Feb 2007 22:12:02 -0000 1.15
+++ gsb_file_debug.c 20 Mar 2007 10:12:53 -0000 1.16
@@ -121,7 +121,8 @@
_("This assistant will help you to search your account "
"file for inconsistencies, which can be caused either "
"by bugs or by erroneous manipulation."),
- "bug.png" );
+ "bug.png",
+ NULL );
text_view = gtk_text_view_new ();
gtk_text_view_set_wrap_mode ( GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD );
@@ -228,7 +229,7 @@
GtkWidget * vbox, * label, * button;
vbox = gtk_vbox_new ( FALSE, 6 );
- label = gtk_label_new ( "" );
+ label = gtk_label_new ( NULL );
gtk_label_set_markup ( GTK_LABEL(label), make_hint ( _( test -> name ), summary ) );
gtk_label_set_line_wrap ( GTK_LABEL(label), TRUE );
gtk_label_set_justify ( GTK_LABEL(label), GTK_JUSTIFY_LEFT );
@@ -242,7 +243,7 @@
GtkWidget * expander, * label;
expander = gtk_expander_new ( g_strconcat ( "<b>",_("Details"), "</b>", NULL ) );
gtk_expander_set_use_markup ( GTK_EXPANDER(expander), TRUE );
- label = gtk_label_new ( "" );
+ label = gtk_label_new ( NULL );
gtk_label_set_line_wrap ( GTK_LABEL(label), TRUE );
gtk_label_set_markup ( GTK_LABEL(label), _( test -> instructions ) );
gtk_misc_set_padding ( GTK_MISC(label), 12, 6 );
Index: etats_support.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/etats_support.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- etats_support.c 18 Feb 2007 12:37:15 -0000 1.23
+++ etats_support.c 20 Mar 2007 10:12:52 -0000 1.24
@@ -27,7 +27,6 @@
#include "./utils_dates.h"
#include "./gsb_data_fyear.h"
#include "./gsb_data_report.h"
-#include "./navigation.h"
#include "./include.h"
/*END_INCLUDE*/
@@ -45,23 +44,21 @@
-gchar * etats_titre ()
+gchar *etats_titre ( gint report_number)
{
gchar *titre;
- gint current_report_number;
GDate *today_date;
- current_report_number = gsb_gui_navigation_get_current_report ();
- titre = gsb_data_report_get_report_name (current_report_number);
+ titre = gsb_data_report_get_report_name (report_number);
today_date = gdate_today ();
- if ( gsb_data_report_get_use_financial_year (current_report_number))
+ if ( gsb_data_report_get_use_financial_year (report_number))
{
GSList *tmp_list;
gint fyear_number;
gint last_fyear_number;
- switch (gsb_data_report_get_financial_year_type (current_report_number))
+ switch (gsb_data_report_get_financial_year_type (report_number))
{
case 0:
/* all the financial years */
@@ -132,7 +129,7 @@
case 3:
/* personal selection of financial years */
- tmp_list = gsb_data_report_get_financial_year_list (current_report_number);
+ tmp_list = gsb_data_report_get_financial_year_list (report_number);
if ( g_slist_length ( tmp_list ) > 1 )
titre = g_strconcat ( titre,
@@ -149,7 +146,7 @@
fyear_number = GPOINTER_TO_INT (tmp_list -> data);
- if ( tmp_list == g_slist_last (gsb_data_report_get_financial_year_list (current_report_number)))
+ if ( tmp_list == g_slist_last (gsb_data_report_get_financial_year_list (report_number)))
titre = g_strconcat ( titre,
gsb_data_fyear_get_name (fyear_number),
NULL );
@@ -171,7 +168,7 @@
gchar buffer_date_2[15];
GDate *date_tmp;
- switch ( gsb_data_report_get_date_type (current_report_number))
+ switch ( gsb_data_report_get_date_type (report_number))
{
case 0:
/* toutes */
@@ -185,14 +182,14 @@
case 1:
/* plage perso */
- if ( gsb_data_report_get_personal_date_start (current_report_number)
+ if ( gsb_data_report_get_personal_date_start (report_number)
&&
- gsb_data_report_get_personal_date_end (current_report_number))
+ gsb_data_report_get_personal_date_end (report_number))
titre = g_strconcat ( titre,
", ",
g_strdup_printf ( _("Result from %s to %s"),
- gsb_format_gdate ( gsb_data_report_get_personal_date_start (current_report_number)),
- gsb_format_gdate ( gsb_data_report_get_personal_date_end (current_report_number)) ),
+ gsb_format_gdate ( gsb_data_report_get_personal_date_start (report_number)),
+ gsb_format_gdate ( gsb_data_report_get_personal_date_end (report_number)) ),
NULL );
else
titre = g_strconcat ( titre,
Index: gsb_real.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_real.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- gsb_real.c 21 Feb 2007 11:08:20 -0000 1.11
+++ gsb_real.c 20 Mar 2007 10:12:53 -0000 1.12
@@ -57,7 +57,7 @@
*
* \param number
*
- * \return a newly allocated string of the number
+ * \return a newly allocated string of the number (this function will never return NULL)
* */
gchar *gsb_real_get_string ( gsb_real number )
{
Index: gsb_data_reconcile.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_reconcile.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- gsb_data_reconcile.c 18 Feb 2007 22:12:02 -0000 1.7
+++ gsb_data_reconcile.c 20 Mar 2007 10:12:53 -0000 1.8
@@ -248,7 +248,7 @@
g_free (reconcile);
/* remove that reconcile of the transactions */
- list_tmp = gsb_data_transaction_get_transactions_list ();
+ list_tmp = gsb_data_transaction_get_complete_transactions_list ();
while (list_tmp)
{
@@ -700,7 +700,7 @@
gint gsb_data_reconcile_get_number_by_date ( GDate *date,
gint account_number )
{
- GSList *tmp_list;
+ GList *tmp_list;
if (!date
||
Index: gsb_data_account.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- gsb_data_account.c 18 Feb 2007 22:12:02 -0000 1.34
+++ gsb_data_account.c 20 Mar 2007 10:12:52 -0000 1.35
@@ -888,7 +888,7 @@
current_balance = gsb_real_adjust_exponent ( account -> init_balance,
floating_point );
- tmp_list = gsb_data_transaction_get_transactions_list ();
+ tmp_list = gsb_data_transaction_get_complete_transactions_list ();
while (tmp_list)
{
@@ -940,7 +940,7 @@
marked_balance = gsb_real_adjust_exponent ( account -> init_balance,
floating_point );
- tmp_list = gsb_data_transaction_get_transactions_list ();
+ tmp_list = gsb_data_transaction_get_complete_transactions_list ();
while (tmp_list)
{
@@ -1037,7 +1037,7 @@
marked_balance = gsb_real_adjust_exponent ( account -> init_balance,
floating_point );
- tmp_list = gsb_data_transaction_get_transactions_list ();
+ tmp_list = gsb_data_transaction_get_complete_transactions_list ();
while (tmp_list)
{
Index: comptes_gestion.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/comptes_gestion.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- comptes_gestion.c 18 Feb 2007 22:12:01 -0000 1.113
+++ comptes_gestion.c 20 Mar 2007 10:12:51 -0000 1.114
@@ -265,7 +265,7 @@
gtk_size_group_add_widget ( GTK_SIZE_GROUP ( size_group ), label );
gtk_box_pack_start ( GTK_BOX(hbox), label, FALSE, FALSE, 0);
- label_code_banque = gtk_label_new ("");
+ label_code_banque = gtk_label_new (NULL);
gtk_misc_set_alignment ( GTK_MISC(label), MISC_LEFT, MISC_VERT_CENTER );
gtk_label_set_justify ( GTK_LABEL(label), GTK_JUSTIFY_RIGHT );
gtk_box_pack_start ( GTK_BOX(hbox), label_code_banque, FALSE, FALSE, 0 );
@@ -629,14 +629,14 @@
string );
else
gtk_label_set_text ( GTK_LABEL ( label_code_banque ),
- "" );
+ NULL );
}
else
{
gtk_option_menu_set_history ( GTK_OPTION_MENU ( detail_option_menu_banque ),
0 );
gtk_label_set_text ( GTK_LABEL ( label_code_banque ),
- "" );
+ NULL );
}
if ( gsb_data_account_get_bank_branch_code (compte_courant_onglet) )
@@ -644,21 +644,21 @@
gsb_data_account_get_bank_branch_code (compte_courant_onglet) );
else
gtk_entry_set_text ( GTK_ENTRY ( detail_guichet ),
- "" );
+ NULL );
if ( gsb_data_account_get_bank_account_number (compte_courant_onglet) )
gtk_entry_set_text ( GTK_ENTRY ( detail_no_compte ),
gsb_data_account_get_bank_account_number (compte_courant_onglet) );
else
gtk_entry_set_text ( GTK_ENTRY ( detail_no_compte ),
- "" );
+ NULL );
if ( gsb_data_account_get_bank_account_key (compte_courant_onglet) )
gtk_entry_set_text ( GTK_ENTRY ( detail_cle_compte ),
gsb_data_account_get_bank_account_key (compte_courant_onglet) );
else
gtk_entry_set_text ( GTK_ENTRY ( detail_cle_compte ),
- "" );
+ NULL );
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON( detail_compte_cloture ),
gsb_data_account_get_closed_account (compte_courant_onglet) );
@@ -770,13 +770,13 @@
result = question_yes_no_hint ( _("Change the transactions currency"),
g_strdup_printf ( _("You are changing the currency of the account, do you want to change the currency of the transactions too ?\(yes will change all the transactions currency from %s to %s, all the transactions with another currency will stay the same)"),
gsb_data_currency_get_name (account_currency_number),
- gsb_data_currency_get_name (new_currency_number)));
+ gsb_data_currency_get_name (new_currency_number)),
+ GTK_RESPONSE_NO );
if (result)
{
/* we have to change the currency of the transactions */
-
- list_tmp = gsb_data_transaction_get_transactions_list ();
+ list_tmp = gsb_data_transaction_get_complete_transactions_list ();
while ( list_tmp )
{
@@ -1021,7 +1021,8 @@
result = question_yes_no_hint ( _("Apply changes to account?"),
g_strdup_printf ( _("Account \"%s\" has been modified.\nDo you want to save changes?"),
- gsb_data_account_get_name (compte_courant_onglet) ) );
+ gsb_data_account_get_name (compte_courant_onglet) ),
+ GTK_RESPONSE_NO );
if ( !result )
gtk_widget_set_sensitive ( hbox_boutons_modif, FALSE );
@@ -1058,14 +1059,14 @@
}
else
gtk_label_set_text ( GTK_LABEL ( label_code_banque ),
- "" );
+ NULL );
gtk_widget_set_sensitive ( bouton_detail,
TRUE );
}
else
{
gtk_label_set_text ( GTK_LABEL ( label_code_banque ),
- "" );
+ NULL );
gtk_widget_set_sensitive ( bouton_detail,
FALSE );
}
Index: banque.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/banque.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- banque.c 18 Feb 2007 12:37:13 -0000 1.69
+++ banque.c 20 Mar 2007 10:12:51 -0000 1.70
@@ -230,11 +230,13 @@
if ( bank_is_used )
resultat = question_yes_no_hint ( _("Confirmation of bank removal"),
g_strdup_printf ( _("Bank \"%s\" is used by one or several accounts.\nDo you really want to remove it?"),
- gsb_data_bank_get_name (bank_number)));
+ gsb_data_bank_get_name (bank_number)),
+ GTK_RESPONSE_NO );
else
resultat = question_yes_no_hint ( _("Confirmation of bank removal"),
g_strdup_printf ( _("Are you sure you want to remove bank \"%s\"?\n"),
- gsb_data_bank_get_name (bank_number)));
+ gsb_data_bank_get_name (bank_number)),
+ GTK_RESPONSE_NO );
if ( resultat )
{
--- NEW FILE: gsb_report.h ---
#ifndef _GSB_REPORT_H
#define _GSB_REPORT_H (1)
/* START_INCLUDE_H */
/* END_INCLUDE_H */
/* START_DECLARATION */
gint gsb_report_get_report_from_combobox ( GtkWidget *combo_box );
GtkWidget *gsb_report_make_combobox ( void );
/* END_DECLARATION */
#endif
Index: qif.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/qif.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- qif.c 18 Feb 2007 12:37:21 -0000 1.109
+++ qif.c 20 Mar 2007 10:12:54 -0000 1.110
@@ -995,7 +995,8 @@
if (utf8_stat ( filename, &test_file ) != -1)
{
if ( ! question_yes_no_hint (_("File already exists"),
- g_strdup_printf (_("Do you want to overwrite file \"%s\"?"), filename) ) )
+ g_strdup_printf (_("Do you want to overwrite file \"%s\"?"), filename),
+ GTK_RESPONSE_NO ) )
{
return;
}
Index: gsb_file_util.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_util.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- gsb_file_util.c 18 Feb 2007 12:37:18 -0000 1.20
+++ gsb_file_util.c 20 Mar 2007 10:12:53 -0000 1.21
@@ -191,7 +191,7 @@
devel_debug ( "switch_t_r");
- list_tmp_transactions = gsb_data_transaction_get_transactions_list ();
+ list_tmp_transactions = gsb_data_transaction_get_complete_transactions_list ();
while ( list_tmp_transactions )
{
--- NEW FILE: gsb_report.c ---
(This appears to be a binary file; contents omitted.)
Index: etats_affiche.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/etats_affiche.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- etats_affiche.c 18 Feb 2007 22:12:01 -0000 1.83
+++ etats_affiche.c 20 Mar 2007 10:12:52 -0000 1.84
@@ -117,7 +117,7 @@
{
gchar *titre;
- titre = etats_titre () ;
+ titre = etats_titre (gsb_gui_navigation_get_current_report ()) ;
etat_affiche_attach_label ( titre, TEXT_BOLD | TEXT_HUGE, 0, nb_colonnes,
ligne, ligne + 1, LEFT, 0 );
Index: gsb_transactions_list.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- gsb_transactions_list.h 18 Feb 2007 12:37:20 -0000 1.10
+++ gsb_transactions_list.h 20 Mar 2007 10:12:54 -0000 1.11
@@ -18,21 +18,25 @@
* as the data are filled above, the number here
* begin at TRANSACTION_LIST_COL_NB */
-#define TRANSACTION_COL_NB_BACKGROUND 7 /*< color of the background */
-#define TRANSACTION_COL_NB_AMOUNT_COLOR 8 /*< color of the amount */
+#define TRANSACTION_COL_NB_BACKGROUND 7 /*< color of the background (a GdkColor) */
+#define TRANSACTION_COL_NB_AMOUNT_COLOR 8 /*< color of the amount (a string like "red" or NULL)*/
#define TRANSACTION_COL_NB_TRANSACTION_ADDRESS 9
-#define TRANSACTION_COL_NB_SAVE_BACKGROUND 10 /*< when selection, save of the normal color of background */
-#define TRANSACTION_COL_NB_FONT 11 /*< PangoFontDescription if used */
-#define TRANSACTION_COL_NB_TRANSACTION_LINE 12 /*< the line in the transaction (1, 2, 3 or 4) */
-#define TRANSACTION_COL_NB_VISIBLE 13 /*< whether that transaction is visible or not */
-
-#define TRANSACTION_COL_NB_TOTAL 14
+#define TRANSACTION_COL_NB_WHAT_IS_LINE 10 /*< on what the address point to ? IS_TRANSACTION, IS_ARCHIVE (see below) */
+#define TRANSACTION_COL_NB_SAVE_BACKGROUND 11 /*< when selection, save of the normal color of background (a GdkColor) */
+#define TRANSACTION_COL_NB_FONT 12 /*< PangoFontDescription if used */
+#define TRANSACTION_COL_NB_TRANSACTION_LINE 13 /*< the line in the transaction (1, 2, 3 or 4) */
+#define TRANSACTION_COL_NB_VISIBLE 14 /*< whether that transaction is visible or not */
+#define TRANSACTION_COL_NB_TOTAL 15
+/* definition of the number of max rows for a line, for now limit to 4 */
#define TRANSACTION_LIST_ROWS_NB 4
-/* constantes qui définissent le no associé au paramÃÅ¡tre
- * dans la liste d'opé */
+/* possible values to TRANSACTION_COL_NB_WHAT_IS_LINE */
+#define IS_TRANSACTION 0
+#define IS_ARCHIVE 1
+
+/* the element number for each showable in the list */
# define TRANSACTION_LIST_DATE 1
# define TRANSACTION_LIST_VALUE_DATE 2
# define TRANSACTION_LIST_PARTY 3
@@ -52,7 +56,7 @@
# define TRANSACTION_LIST_NO 17
# define TRANSACTION_LIST_CHQ 18
-/* Constantes pour la fonction gtk_tree_view_column_set_alignment() (GTK2) */
+/* used for gtk_tree_view_column_set_alignment() (GTK2) */
#define COLUMN_LEFT 0.0
#define COLUMN_CENTER 0.5
#define COLUMN_RIGHT 1.0
Index: affichage.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/affichage.c,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -d -r1.122 -r1.123
--- affichage.c 18 Feb 2007 12:37:13 -0000 1.122
+++ affichage.c 20 Mar 2007 10:12:51 -0000 1.123
@@ -228,7 +228,7 @@
TRUE, TRUE, 5 );
gtk_box_pack_start ( GTK_BOX ( hbox_font ), gtk_vseparator_new (),
FALSE, FALSE, 0 );
- list_font_size_label = gtk_label_new ("");
+ list_font_size_label = gtk_label_new (NULL);
gtk_box_pack_start ( GTK_BOX ( hbox_font ), list_font_size_label,
FALSE, FALSE, 5 );
gtk_container_add (GTK_CONTAINER(font_button), hbox_font);
Index: etats_html.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/etats_html.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- etats_html.c 18 Feb 2007 12:37:15 -0000 1.16
+++ etats_html.c 20 Mar 2007 10:12:52 -0000 1.17
@@ -298,7 +298,7 @@
" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n"
" <title>");
/* FIXME: be sure this works if displayed report is not the current one. */
- html_safe (etats_titre());
+ html_safe (etats_titre(gsb_gui_navigation_get_current_report ()));
fprintf (html_out,
"</title>\n"
" </head>\n\n"
Index: import.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import.c,v
retrieving revision 1.172
retrieving revision 1.173
diff -u -d -r1.172 -r1.173
--- import.c 18 Feb 2007 12:37:20 -0000 1.172
+++ import.c 20 Mar 2007 10:12:54 -0000 1.173
@@ -219,7 +219,8 @@
"So far, the following formats are supported:"
"\n\n",
formats, NULL ),
- "csv.png" );
+ "csv.png",
+ NULL );
gsb_assistant_add_page ( a, import_create_file_selection_page ( a ),
@@ -991,7 +992,7 @@
short_filename = _("file");
}
- label = gtk_label_new ( "" );
+ label = gtk_label_new ( NULL );
gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0.5);
gtk_label_set_justify ( GTK_LABEL ( label ), GTK_JUSTIFY_LEFT );
gtk_label_set_markup ( GTK_LABEL ( label ),
@@ -1393,9 +1394,9 @@
gsb_data_transaction_get_account_number (transaction_number_tmp));
gsb_data_transaction_set_bank_references ( transaction_number_tmp,
- "" );
+ NULL );
gsb_data_transaction_set_bank_references ( contra_transaction_number_tmp,
- "" );
+ NULL );
}
list_tmp_transactions_2 = list_tmp_transactions_2 -> next;
}
@@ -1408,7 +1409,7 @@
0);
gsb_data_transaction_set_transaction_number_transfer ( transaction_number_tmp,
0);
- gsb_data_transaction_set_bank_references ( transaction_number_tmp, "" );
+ gsb_data_transaction_set_bank_references ( transaction_number_tmp, NULL );
}
}
}
@@ -1561,7 +1562,8 @@
if ( question_yes_no_hint ( _("The id of the imported and chosen accounts are different"),
- _("Perhaps you choose a wrong account ? If you choose to continue, the id of the account will be changed. Do you want to continue ?")))
+ _("Perhaps you choose a wrong account ? If you choose to continue, the id of the account will be changed. Do you want to continue ?"),
+ GTK_RESPONSE_NO ))
gsb_data_account_set_id (account_number,
my_strdup ( imported_account -> id_compte ));
else
@@ -2129,8 +2131,8 @@
imported_transaction -> p_r );
/* Various things we have to set. */
- gsb_data_transaction_set_bank_references ( transaction_number, "" );
- gsb_data_transaction_set_voucher ( transaction_number, "" );
+ gsb_data_transaction_set_bank_references ( transaction_number, NULL );
+ gsb_data_transaction_set_voucher ( transaction_number, NULL );
/* si c'est une ope de ventilation, lui ajoute le no de l'opération précédente */
@@ -2170,7 +2172,8 @@
/* l'id du compte choisi et l'id du compte importé sont différents */
/* on propose encore d'arrêter... */
if ( question_yes_no_hint ( _("The id of the imported and chosen accounts are different"),
- _("Perhaps you choose a wrong account ? If you choose to continue, the id of the account will be changed. Do you want to continue ?")))
+ _("Perhaps you choose a wrong account ? If you choose to continue, the id of the account will be changed. Do you want to continue ?"),
+ GTK_RESPONSE_NO ))
gsb_data_account_set_id (account_number,
my_strdup ( imported_account -> id_compte ));
else
Index: export.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/export.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- export.c 18 Feb 2007 12:37:15 -0000 1.10
+++ export.c 20 Mar 2007 10:12:52 -0000 1.11
@@ -77,7 +77,8 @@
"As QIF and CSV do not support currencies, all "
"transactions will be converted into currency of their "
"respective account."),
- "xxx" );
+ "xxx",
+ NULL );
gsb_assistant_add_page ( dialog, export_create_selection_page(dialog), 1, 0, 2,
G_CALLBACK ( export_resume_maybe_sensitive_next ) );
@@ -344,7 +345,7 @@
vbox = gtk_vbox_new ( FALSE, 6 );
gtk_container_set_border_width ( GTK_CONTAINER(vbox), 12 );
- label = gtk_label_new ( "" );
+ label = gtk_label_new ( NULL );
gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0.5);
gtk_label_set_justify ( GTK_LABEL ( label ), GTK_JUSTIFY_LEFT );
gtk_label_set_markup ( GTK_LABEL ( label ),
Index: gsb_file_load.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_load.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- gsb_file_load.c 21 Feb 2007 11:06:11 -0000 1.84
+++ gsb_file_load.c 20 Mar 2007 10:12:53 -0000 1.85
@@ -26,6 +26,7 @@
#include "./dialog.h"
#include "./gsb_assistant_archive.h"
#include "./gsb_data_account.h"
+#include "./gsb_data_archive.h"
#include "./gsb_data_bank.h"
#include "./gsb_data_budget.h"
#include "./gsb_data_category.h"
@@ -68,6 +69,8 @@
const gchar **attribute_values );
static void gsb_file_load_account_part_before_0_6 ( GMarkupParseContext *context,
const gchar *text );
+static void gsb_file_load_archive ( const gchar **attribute_names,
+ const gchar **attribute_values );
static void gsb_file_load_bank ( const gchar **attribute_names,
const gchar **attribute_values );
static gboolean gsb_file_load_check_new_structure ( gchar *file_content );
@@ -564,6 +567,14 @@
}
if ( !strcmp ( element_name,
+ "Archive" ))
+ {
+ gsb_file_load_archive ( attribute_names,
+ attribute_values );
+ return;
+ }
+
+ if ( !strcmp ( element_name,
"Reconcile" ))
{
gsb_file_load_reconcile ( attribute_names,
@@ -1598,6 +1609,15 @@
continue;
}
+ if ( !strcmp ( attribute_names[i],
+ "Ar" ))
+ {
+ gsb_data_transaction_set_archive_number ( transaction_number,
+ utils_str_atoi (attribute_values[i]));
+ i++;
+ continue;
+ }
+
if ( !strcmp ( attribute_names[i],
"Au" ))
@@ -2668,6 +2688,102 @@
gsb_data_fyear_check_for_invalid (fyear_number);
}
+/**
+ * load the archives in the grisbi file
+ *
+ * \param attribute_names
+ * \param attribute_values
+ *
+ * */
+void gsb_file_load_archive ( const gchar **attribute_names,
+ const gchar **attribute_values )
+{
+ gint i=0;
+ gint archive_number;
+ GDate *date;
+
+ if ( !attribute_names[i] )
+ return;
+
+ archive_number = gsb_data_archive_new (NULL);
+
+ do
+ {
+ /* we test at the begining if the attribute_value is NULL, if yes, */
+ /* go to the next */
+ if ( !strcmp (attribute_values[i],
+ "(null)"))
+ {
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i],
+ "Nb" ))
+ {
+ archive_number = gsb_data_archive_set_new_number (archive_number,
+ utils_str_atoi (attribute_values[i]));
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i],
+ "Na" ))
+ {
+ gsb_data_archive_set_name ( archive_number,
+ attribute_values[i]);
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i],
+ "Bdte" ))
+ {
+ date = gsb_parse_date_string_safe (attribute_values[i]);
+ gsb_data_archive_set_begining_date ( archive_number,
+ date );
+ if ( date )
+ g_date_free (date);
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i],
+ "Edte" ))
+ {
+ date = gsb_parse_date_string_safe (attribute_values[i]);
+ gsb_data_archive_set_end_date ( archive_number,
+ date );
+ if ( date )
+ g_date_free (date);
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i],
+ "Fye" ))
+ {
+ gsb_data_archive_set_fyear ( archive_number,
+ utils_str_atoi (attribute_values[i]));
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i],
+ "Rep" ))
+ {
+ gsb_data_archive_set_report_title ( archive_number,
+ attribute_values[i]);
+ i++;
+ continue;
+ }
+
+ /* normally, shouldn't come here */
+ i++;
+ }
+ while ( attribute_names[i] );
+}
+
/**
* load the reconcile structure in the grisbi file
@@ -6319,7 +6435,7 @@
/* sauf que la 0.4.0 n'attribuait pas le no de relevé aux opés filles */
/* d'une ventilation */
- list_tmp_transactions = gsb_data_transaction_get_transactions_list ();
+ list_tmp_transactions = gsb_data_transaction_get_complete_transactions_list ();
while ( list_tmp_transactions )
{
@@ -6331,7 +6447,7 @@
if ( gsb_data_transaction_get_breakdown_of_transaction (transaction_number_tmp))
{
GSList *list_tmp_transactions_2;
- list_tmp_transactions_2 = gsb_data_transaction_get_transactions_list ();
+ list_tmp_transactions_2 = gsb_data_transaction_get_complete_transactions_list ();
while ( list_tmp_transactions_2 )
{
@@ -6455,7 +6571,7 @@
* with the same number
* the change is done while downloading the file, all we need to do now is to change
* the payment number of all the transactions and scheduled transactions to set the new number */
- list_tmp_transactions = gsb_data_transaction_get_transactions_list ();
+ list_tmp_transactions = gsb_data_transaction_get_complete_transactions_list ();
while ( list_tmp_transactions )
{
gint transaction_number;
@@ -6564,7 +6680,7 @@
/* another fix, some children of breakdown have not the same values of the mother
* for some fields wich should be ; fix here */
- list_tmp_transactions = gsb_data_transaction_get_transactions_list ();
+ list_tmp_transactions = gsb_data_transaction_get_complete_transactions_list ();
while ( list_tmp_transactions )
{
@@ -6580,7 +6696,7 @@
if (gsb_data_transaction_get_marked_transaction (transaction_number) == 3)
{
GSList *list_tmp_transactions_2;
- list_tmp_transactions_2 = gsb_data_transaction_get_transactions_list ();
+ list_tmp_transactions_2 = gsb_data_transaction_get_complete_transactions_list ();
while ( list_tmp_transactions_2 )
{
@@ -6744,7 +6860,7 @@
* hopefully, we can do that because each reconciled transaction has its number of reconcile */
/* first step, fill the account numbers and try to fill the init and final dates */
- list_tmp_transactions = gsb_data_transaction_get_transactions_list ();
+ list_tmp_transactions = gsb_data_transaction_get_complete_transactions_list ();
while ( list_tmp_transactions )
{
@@ -6910,12 +7026,13 @@
/* check now if a lot of transactions,
* if yes, we propose to file the transactions
* by default take the 2000 transactions as limit
- * FIXME : should configure the value to ask to archive */
+ * FIXME : should be possible to configure the value to ask to archive */
if ( g_slist_length (gsb_data_transaction_get_transactions_list ()) > 2000 )
{
if (question_yes_no_hint ( _("Archive some transactions ?"),
g_strdup_printf ( _("There is %d transactions to load into the lists,\nThis is much and the display would be faster if you archive some transactions.\n\nDo you want to launch the assistant to archive some transactions ?"),
- g_slist_length (gsb_data_transaction_get_transactions_list ()))))
+ g_slist_length (gsb_data_transaction_get_transactions_list ())),
+ GTK_RESPONSE_YES ))
gsb_assistant_archive_run ();
}
Index: import_csv.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import_csv.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- import_csv.c 18 Feb 2007 12:37:20 -0000 1.40
+++ import_csv.c 20 Mar 2007 10:12:54 -0000 1.41
@@ -179,7 +179,7 @@
gtk_box_pack_start ( GTK_BOX(hbox), warn, FALSE, FALSE, 0 );
g_object_set_data ( G_OBJECT(assistant), "validity_icon", warn );
- validity_label = gtk_label_new ("");
+ validity_label = gtk_label_new (NULL);
gtk_misc_set_alignment ( GTK_MISC ( validity_label ), 0, 0.5);
gtk_label_set_justify ( GTK_LABEL ( validity_label ), GTK_JUSTIFY_LEFT );
g_object_set_data ( G_OBJECT(assistant), "validity_label", validity_label );
--- NEW FILE: gsb_data_archive.h ---
#ifndef _GSB_DATA_ARCHIVE_H
#define _GSB_DATA_ARCHIVE_H (1)
/* START_INCLUDE_H */
/* END_INCLUDE_H */
/* START_DECLARATION */
GSList *gsb_data_archive_get_archives_list ( void );
GDate *gsb_data_archive_get_begining_date ( gint archive_number );
GDate *gsb_data_archive_get_end_date ( gint archive_number );
gint gsb_data_archive_get_from_date ( const GDate *date );
gint gsb_data_archive_get_from_fyear ( gint fyear_number );
gint gsb_data_archive_get_fyear ( gint archive_number );
const gchar *gsb_data_archive_get_name ( gint archive_number );
gint gsb_data_archive_get_no_archive ( gpointer archive_ptr );
gint gsb_data_archive_get_number_by_name ( const gchar *name );
const gchar *gsb_data_archive_get_report_title ( gint archive_number );
gboolean gsb_data_archive_init_variables ( void );
gint gsb_data_archive_new ( const gchar *name );
gboolean gsb_data_archive_set_begining_date ( gint archive_number,
const GDate *date );
gboolean gsb_data_archive_set_end_date ( gint archive_number,
const GDate *date );
gboolean gsb_data_archive_set_fyear ( gint archive_number,
gint fyear_number );
gboolean gsb_data_archive_set_name ( gint archive_number,
const gchar *name );
gint gsb_data_archive_set_new_number ( gint archive_number,
gint new_no_archive );
gboolean gsb_data_archive_set_report_title ( gint archive_number,
const gchar *report_title );
/* END_DECLARATION */
#endif
Index: comptes_traitements.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/comptes_traitements.c,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -d -r1.120 -r1.121
--- comptes_traitements.c 18 Feb 2007 12:37:14 -0000 1.120
+++ comptes_traitements.c 20 Mar 2007 10:12:52 -0000 1.121
@@ -160,7 +160,8 @@
if ( !question_yes_no_hint ( g_strdup_printf (_("Delete account \"%s\"?"),
gsb_data_account_get_name (deleted_account)),
- _("This will irreversibly remove this account and all operations that were previously contained. There is no undo for this. Usually it's a better way to close an account.") ))
+ _("This will irreversibly remove this account and all operations that were previously contained. There is no undo for this. Usually it's a better way to close an account."),
+ GTK_RESPONSE_NO ))
return FALSE;
/* if the las account, close the file */
@@ -204,7 +205,7 @@
i = gsb_data_account_get_no_account ( list_tmp -> data );
- list_tmp_transactions = gsb_data_transaction_get_transactions_list ();
+ list_tmp_transactions = gsb_data_transaction_get_complete_transactions_list ();
while ( list_tmp_transactions )
{
Index: main.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/main.c,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -d -r1.103 -r1.104
--- main.c 18 Feb 2007 12:37:20 -0000 1.103
+++ main.c 20 Mar 2007 10:12:54 -0000 1.104
@@ -58,7 +58,6 @@
#include "./gsb_file_config.h"
#include "./include.h"
#include "./structures.h"
-#include "./gsb_plugins.h"
/*END_INCLUDE*/
@@ -95,7 +94,6 @@
{
GtkWidget * statusbar;
gboolean first_use = FALSE;
- gsb_plugin * plugin;
initialize_debugging();
Index: fichiers_gestion.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/fichiers_gestion.c,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -d -r1.164 -r1.165
--- fichiers_gestion.c 18 Feb 2007 12:37:16 -0000 1.164
+++ fichiers_gestion.c 20 Mar 2007 10:12:52 -0000 1.165
@@ -37,6 +37,7 @@
#include "./utils_file_selection.h"
#include "./gsb_currency_config.h"
#include "./gsb_data_account.h"
+#include "./gsb_data_archive_store.h"
#include "./gsb_data_category.h"
#include "./gsb_data_payment.h"
#include "./gsb_data_scheduled.h"
@@ -388,15 +389,12 @@
}
/* ok, here the file or backup is loaded */
-
gsb_status_message ( _("Checking schedulers"));
/* the the name in the last opened files */
-
ajoute_new_file_liste_ouverture ( filename );
/* get the names of the columns */
-
recuperation_noms_colonnes_et_tips ();
/* we show and update the menus */
@@ -441,6 +439,10 @@
gtk_box_pack_start ( GTK_BOX (window_vbox_principale), main_widget, TRUE, TRUE, 0 );
gtk_widget_show ( main_widget );
+ /* create the archives store data, ie the transaction wich will replace the archive in
+ * the list of transactions */
+ gsb_data_archive_store_create_list ();
+
/* create and fill the gui transactions list */
gtk_box_pack_start ( GTK_BOX ( tree_view_vbox ),
gsb_transactions_list_make_gui_list (),
@@ -745,6 +747,7 @@
/* libère les opérations de tous les comptes */
g_slist_free ( gsb_data_transaction_get_transactions_list ());
+ g_slist_free ( gsb_data_transaction_get_complete_transactions_list ());
g_slist_free ( gsb_data_account_get_list_accounts () );
/* libère les échéances */
Index: export_csv.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/export_csv.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- export_csv.c 18 Feb 2007 22:12:01 -0000 1.10
+++ export_csv.c 20 Mar 2007 10:12:52 -0000 1.11
@@ -236,7 +236,8 @@
if (utf8_stat ( filename, &test_file ) != -1)
{
if ( ! question_yes_no_hint (_("File already exists"),
- g_strdup_printf (_("Do you want to overwrite file \"%s\"?"), filename) ) )
+ g_strdup_printf (_("Do you want to overwrite file \"%s\"?"), filename),
+ GTK_RESPONSE_NO ))
{
return;
}
Index: gsb_assistant_reconcile_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_assistant_reconcile_config.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- gsb_assistant_reconcile_config.c 21 Feb 2007 11:05:34 -0000 1.5
+++ gsb_assistant_reconcile_config.c 20 Mar 2007 10:12:52 -0000 1.6
@@ -65,6 +65,10 @@
GtkWidget *assistant );
static GtkWidget *gsb_assistant_reconcile_config_page_new_reconcile ( void );
static GtkWidget *gsb_assistant_reconcile_config_page_success ( void );
+static gboolean gsb_assistant_reconcile_config_update_auto_asso ( GtkWidget *assistant,
+ gint new_page );
+static gboolean gsb_assistant_reconcile_config_update_manu_asso ( GtkWidget *assistant,
+ gint new_page );
/*END_STATIC*/
/*START_EXTERN*/
@@ -192,7 +196,8 @@
"(you will be able to create new reconciliations in the next step). "
"Previous reconciliations will be available too."),
transactions_to_link ),
- "grisbi-logo.png" );
+ "grisbi-logo.png",
+ NULL );
gsb_assistant_add_page ( assistant,
gsb_assistant_reconcile_config_page_menu (assistant),
@@ -473,7 +478,7 @@
0 );
/* create the label */
- label = gtk_label_new ("");
+ label = gtk_label_new (NULL);
gtk_box_pack_start ( GTK_BOX (page),
label,
TRUE, TRUE,
@@ -531,7 +536,7 @@
/* for now we juste create the widgets, but cannot fill here,
* we will fill when the user come to that page */
/* first show the total of transactions to link, same as in the menu assistant */
- label_transactions_to_link_2 = gtk_label_new ("");
+ label_transactions_to_link_2 = gtk_label_new (NULL);
gtk_box_pack_start ( GTK_BOX (page),
label_transactions_to_link_2,
FALSE, FALSE, 0 );
@@ -553,7 +558,7 @@
FALSE, FALSE, 0 );
/* set the number of possible association, filled when come in that page */
- label_possible_association = gtk_label_new ("");
+ label_possible_association = gtk_label_new (NULL);
gtk_box_pack_start ( GTK_BOX (page),
label_possible_association,
FALSE, FALSE, 12 );
@@ -603,7 +608,7 @@
gtk_container_set_border_width ( GTK_CONTAINER(page), 12 );
/* the number of transactions to link */
- label_transactions_to_link_3 = gtk_label_new ("");
+ label_transactions_to_link_3 = gtk_label_new (NULL);
gtk_box_pack_start ( GTK_BOX (page),
label_transactions_to_link_3,
FALSE, FALSE, 0 );
@@ -859,7 +864,7 @@
GtkWidget *label )
{
gtk_label_set_text ( GTK_LABEL (label),
- "" );
+ NULL );
return FALSE;
}
@@ -869,10 +874,12 @@
* fill the label and show the button if possible
*
* \param assistant
+ * \param new_page
*
* \return FALSE
* */
-gboolean gsb_assistant_reconcile_config_update_auto_asso ( GtkWidget *assistant )
+gboolean gsb_assistant_reconcile_config_update_auto_asso ( GtkWidget *assistant,
+ gint new_page )
{
gchar *string;
GSList *tmp_list;
@@ -1028,10 +1035,12 @@
* update the list of transactions to associate and fill the labels
*
* \param assistant
+ * \param new_page
*
* \return FALSE
* */
-gboolean gsb_assistant_reconcile_config_update_manu_asso ( GtkWidget *assistant )
+gboolean gsb_assistant_reconcile_config_update_manu_asso ( GtkWidget *assistant,
+ gint new_page )
{
gchar *string;
GSList *tmp_list;
Index: help.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/help.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- help.c 18 Feb 2007 12:37:20 -0000 1.60
+++ help.c 20 Mar 2007 10:12:54 -0000 1.61
@@ -162,7 +162,7 @@
gtk_box_pack_start ( GTK_BOX ( vbox ), label, TRUE, TRUE, 0 );
/* Authors */
- label = gtk_label_new ("");
+ label = gtk_label_new (NULL);
gtk_label_set_markup ( GTK_LABEL(label), g_strjoinv ( "@",
g_strsplit ( auteurs,
"[at]", 0 ) ) );
Index: gsb_form_widget.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form_widget.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- gsb_form_widget.c 18 Feb 2007 12:37:19 -0000 1.7
+++ gsb_form_widget.c 20 Mar 2007 10:12:53 -0000 1.8
@@ -202,7 +202,7 @@
break;
case TRANSACTION_FORM_EXERCICE:
- widget = gsb_fyear_make_combobox ();
+ widget = gsb_fyear_make_combobox (TRUE);
gtk_tooltips_set_tip ( GTK_TOOLTIPS ( tooltips_general_grisbi ),
widget,
_("Choose the financial year"),
@@ -304,7 +304,7 @@
case TRANSACTION_FORM_OP_NB:
case TRANSACTION_FORM_MODE:
- widget = gtk_label_new ( "" );
+ widget = gtk_label_new ( NULL );
break;
}
Index: utils.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- utils.h 18 Feb 2007 12:37:21 -0000 1.17
+++ utils.h 20 Mar 2007 10:12:54 -0000 1.18
@@ -17,8 +17,8 @@
GtkWidget *new_paddingbox_with_title (GtkWidget * parent, gboolean fill, gchar * title);
GtkWidget *new_vbox_with_title_and_icon ( gchar * title,
gchar * image_filename);
-void sens_desensitive_pointeur ( GtkWidget *bouton,
- GtkWidget *widget );
+gboolean sens_desensitive_pointeur ( GtkWidget *bouton,
+ GtkWidget *widget );
void sensitive_widget ( GtkWidget *widget );
void update_ecran ( void );
/* END_DECLARATION */
Index: gsb_form_transaction.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form_transaction.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- gsb_form_transaction.c 18 Feb 2007 22:12:03 -0000 1.19
+++ gsb_form_transaction.c 20 Mar 2007 10:12:53 -0000 1.20
@@ -185,7 +185,7 @@
gint last_transaction_with_party_in_account = 0;
gint last_transaction_with_party_not_in_account = 0;
- list_tmp_transactions = gsb_data_transaction_get_transactions_list ();
+ list_tmp_transactions = gsb_data_transaction_get_complete_transactions_list ();
while ( list_tmp_transactions )
{
@@ -272,7 +272,7 @@
return FALSE;
/* go around the transactions list to get the daughters of the last breakdown */
- list_tmp_transactions = gsb_data_transaction_get_transactions_list ();
+ list_tmp_transactions = gsb_data_transaction_get_complete_transactions_list ();
while ( list_tmp_transactions )
{
@@ -309,7 +309,6 @@
parties_list = NULL;
/* check that the party's form exist, else, append -1 and go away */
-
if ( gsb_data_form_check_for_value (TRANSACTION_FORM_PARTY))
{
const gchar *string;
Index: fenetre_principale.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/fenetre_principale.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- fenetre_principale.c 18 Feb 2007 12:37:16 -0000 1.88
+++ fenetre_principale.c 20 Mar 2007 10:12:52 -0000 1.89
@@ -127,11 +127,11 @@
gtk_box_pack_start ( GTK_BOX(hbox), arrow_eb, FALSE, FALSE, 3 );
/* Define labels. */
- headings_title = gtk_label_new ( "" );
+ headings_title = gtk_label_new ( NULL );
gtk_label_set_justify ( GTK_LABEL(headings_title), GTK_JUSTIFY_LEFT );
gtk_misc_set_alignment (GTK_MISC (headings_title), 0.0, 0.5);
gtk_box_pack_start ( GTK_BOX(hbox), headings_title, TRUE, TRUE, 3 );
- headings_suffix = gtk_label_new ("");
+ headings_suffix = gtk_label_new (NULL);
gtk_box_pack_start ( GTK_BOX(hbox), headings_suffix, FALSE, FALSE, 0 );
/* Change color with an event box trick. */
Index: gsb_transactions_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- gsb_transactions_list.c 18 Feb 2007 23:10:52 -0000 1.48
+++ gsb_transactions_list.c 20 Mar 2007 10:12:54 -0000 1.49
@@ -29,6 +29,8 @@
#include "./erreur.h"
#include "./dialog.h"
#include "./gsb_data_account.h"
+#include "./gsb_data_archive.h"
+#include "./gsb_data_archive_store.h"
#include "./gsb_data_budget.h"
#include "./gsb_data_category.h"
#include "./gsb_data_currency.h"
@@ -77,6 +79,7 @@
static GtkWidget * gsb_gui_create_cell_contents_menu ( int x, int y );
static gboolean gsb_gui_update_row_foreach ( GtkTreeModel *model, GtkTreePath *path,
[...1249 lines suppressed...]
+
+ /* all the transactions of the archive have been added, we just need to clean the list,
+ * but don't touch to the main page and to the current balances... we didn't change anything */
+ account_number = gsb_form_get_origin ();
+ if (account_number >= 0)
+ {
+ gsb_transactions_list_set_visibles_rows_on_account (account_number);
+ gsb_transactions_list_set_background_color (account_number);
+ gsb_transactions_list_set_transactions_balances (account_number);
+ gsb_transactions_list_move_to_current_transaction (account_number);
+ }
+
+ /* xxx si met les archives dans les menus pour les afficher, il faut retirer ici l'archive du menu */
+ gtk_widget_destroy (message_window);
+ return FALSE;
+}
+
/* Local Variables: */
/* c-basic-offset: 4 */
Index: gsb_form.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- gsb_form.c 18 Feb 2007 12:37:18 -0000 1.38
+++ gsb_form.c 20 Mar 2007 10:12:53 -0000 1.39
@@ -208,7 +208,7 @@
gtk_expander_set_label_widget ( GTK_EXPANDER(form_expander), hbox );
/* set the label transaction form */
- label = gtk_label_new ( "" );
+ label = gtk_label_new ( NULL );
gtk_label_set_markup_with_mnemonic ( GTK_LABEL ( label ),
g_strconcat ( "<span weight=\"bold\">",
_("Transaction/Scheduled _form"),
@@ -218,7 +218,7 @@
FALSE, FALSE, 0 );
/* set the last statement label */
- label_last_statement = gtk_label_new ( "" );
+ label_last_statement = gtk_label_new ( NULL );
gtk_box_pack_end ( GTK_BOX ( hbox ),
label_last_statement,
FALSE, FALSE, 0 );
@@ -1274,13 +1274,13 @@
case TRANSACTION_FORM_OP_NB:
gtk_label_set_text ( GTK_LABEL ( element -> element_widget ),
- "" );
+ NULL );
break;
case TRANSACTION_FORM_MODE:
gtk_label_set_text ( GTK_LABEL ( element -> element_widget ),
- "" );
+ NULL );
break;
}
}
Index: gsb_assistant.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_assistant.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- gsb_assistant.c 18 Feb 2007 12:37:16 -0000 1.22
+++ gsb_assistant.c 20 Mar 2007 10:12:52 -0000 1.23
@@ -36,8 +36,6 @@
/*START_STATIC*/
static gboolean gsb_assistant_change_page ( GtkNotebook * notebook, GtkNotebookPage * npage,
gint page, gpointer assistant );
-static gboolean gsb_assistant_sensitive_button_next ( GtkWidget * assistant, gboolean state );
-static gboolean gsb_assistant_sensitive_button_prev ( GtkWidget * assistant, gboolean state );
/*END_STATIC*/
/*START_EXTERN*/
@@ -55,10 +53,14 @@
* \param explanation Short text to display in the first
* page of the assistant.
* \param image_filename Icon to display in the title.
+ * \param enter_callback A callback to connect to the "switch-page" callback when go to the first page
+ * of the Grisbi assistant notebook. (the callback should
+ * be : gboolean callback ( GtkWidget *assistant, gint new_page ) )
*
*/
GtkWidget * gsb_assistant_new ( gchar * title, gchar * explanation,
- gchar * image_filename )
+ gchar * image_filename,
+ GCallback enter_callback )
{
GtkWidget * assistant, *notebook, *hbox, *label, *image, *view, *eb;
GtkWidget * button_cancel, * button_prev, * button_next;
@@ -91,7 +93,7 @@
gtk_container_add ( GTK_CONTAINER(eb), hbox );
gtk_container_set_border_width ( GTK_CONTAINER(hbox), 12 );
- label = gtk_label_new ( "" );
+ label = gtk_label_new ( NULL );
gtk_label_set_markup ( GTK_LABEL(label), g_strconcat ( "<b><span size=\"x-large\">",
title, "</span></b>", NULL ) );
gtk_box_pack_start ( GTK_BOX(hbox), label, TRUE, TRUE, 0 );
@@ -118,7 +120,7 @@
gtk_text_view_set_left_margin ( GTK_TEXT_VIEW(view), 12 );
gtk_text_view_set_right_margin ( GTK_TEXT_VIEW(view), 12 );
- gtk_notebook_append_page ( GTK_NOTEBOOK(notebook), view, gtk_label_new("") );
+ gtk_notebook_append_page ( GTK_NOTEBOOK(notebook), view, gtk_label_new(NULL) );
g_signal_connect_after ( notebook, "switch-page",
G_CALLBACK ( gsb_assistant_change_page ), assistant );
@@ -126,6 +128,7 @@
gsb_assistant_set_next ( assistant, 0, 1 );
g_object_set_data ( G_OBJECT(assistant), "notebook", notebook );
g_object_set_data ( G_OBJECT(assistant), "title", title );
+ g_object_set_data ( G_OBJECT(assistant), "enter0", enter_callback );
return assistant;
}
@@ -144,7 +147,7 @@
* \param next Page to display when the "Next" button is clicked.
* \param enter_callback A callback to connect to the "switch-page" callback
* of the Grisbi assistant notebook. (the callback should
- * be : gboolean callback ( GtkWidget *assistant ) )
+ * be : gboolean callback ( GtkWidget *assistant, gint new_page ) )
*/
void gsb_assistant_add_page ( GtkWidget * assistant, GtkWidget * widget, gint position,
gint prev, gint next, GCallback enter_callback )
@@ -152,7 +155,7 @@
GtkWidget * notebook;
notebook = g_object_get_data ( G_OBJECT(assistant), "notebook" );
- gtk_notebook_insert_page ( GTK_NOTEBOOK(notebook), widget, gtk_label_new(""), position );
+ gtk_notebook_insert_page ( GTK_NOTEBOOK(notebook), widget, gtk_label_new(NULL), position );
gsb_assistant_set_prev ( assistant, position, prev );
gsb_assistant_set_next ( assistant, position, next );
@@ -185,6 +188,8 @@
notebook = g_object_get_data ( G_OBJECT(assistant), "notebook" );
gtk_notebook_set_page ( GTK_NOTEBOOK (notebook),
0 );
+ gtk_widget_grab_focus (GTK_WIDGET (g_object_get_data (G_OBJECT (assistant),
+ "button_next")));
while ( TRUE )
{
@@ -265,7 +270,7 @@
gboolean gsb_assistant_change_page ( GtkNotebook * notebook, GtkNotebookPage * npage,
gint page, gpointer assistant )
{
- typedef gboolean ( * gsb_assistant_callback ) ( GtkWidget * );
+ typedef gboolean ( * gsb_assistant_callback ) ( GtkWidget *, gint );
gsb_assistant_callback callback;
/* gpointer padding[32]; /\* Don't touch, looks like we have a */
/* * buffer overflow problem. *\/ */
@@ -274,7 +279,7 @@
if ( callback )
{
- return callback ( assistant );
+ return callback ( assistant, page );
}
return FALSE;
Index: utils.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- utils.c 18 Feb 2007 12:37:21 -0000 1.38
+++ utils.c 20 Mar 2007 10:12:54 -0000 1.39
@@ -69,15 +69,23 @@
-/******************************************************************************/
-void sens_desensitive_pointeur ( GtkWidget *bouton,
- GtkWidget *widget )
+/**
+ * called by a "clicked" callback on a check button,
+ * according to its state, sensitive or not the widget given in param
+ *
+ * \param button a GtkCheckButton
+ * \param widget a widget to sensitive or unsensitive
+ *
+ * \return FALSE
+ * */
+gboolean sens_desensitive_pointeur ( GtkWidget *bouton,
+ GtkWidget *widget )
{
gtk_widget_set_sensitive ( widget,
gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( bouton )));
+ return FALSE;
}
-/******************************************************************************/
/******************************************************************************/
@@ -195,7 +203,7 @@
}
/* Creating labe */
- label = gtk_label_new ( "" );
+ label = gtk_label_new ( NULL );
gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 1 );
gtk_label_set_markup ( GTK_LABEL ( label ),
g_strconcat ("<span weight=\"bold\">",
Index: gsb_reconcile.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_reconcile.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- gsb_reconcile.c 18 Feb 2007 22:12:03 -0000 1.7
+++ gsb_reconcile.c 20 Mar 2007 10:12:53 -0000 1.8
@@ -102,7 +102,7 @@
GtkWidget *frame, *label, *table, *vbox, *hbox, *button, *separator;
GtkTooltips *tips;
- frame = gtk_frame_new ( "" );
+ frame = gtk_frame_new ( NULL );
vbox = gtk_vbox_new ( FALSE, 3 );
gtk_container_set_border_width ( GTK_CONTAINER ( vbox ), 3 );
gtk_container_add ( GTK_CONTAINER ( frame ), vbox );
@@ -112,7 +112,7 @@
G_CALLBACK ( gsb_transactions_list_key_press ), NULL );
/* the title of the frame */
- label = gtk_label_new ( "" );
+ label = gtk_label_new ( NULL );
gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT );
gtk_misc_set_alignment ( GTK_MISC (label), 0.0, 0.0 );
gtk_frame_set_label_widget ( GTK_FRAME(frame), label);
@@ -159,7 +159,7 @@
label = gtk_label_new ( _("Balance") );
gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 2, 3, 0, 1);
- reconcile_last_date_label = gtk_label_new ( "" );
+ reconcile_last_date_label = gtk_label_new ( NULL );
gtk_table_attach_defaults ( GTK_TABLE ( table ), reconcile_last_date_label,
0, 1, 2, 3 );
@@ -210,7 +210,7 @@
gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0.5 );
gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 0, 1, 0, 1);
- reconcile_initial_balance_label = gtk_label_new ( "" );
+ reconcile_initial_balance_label = gtk_label_new ( NULL );
gtk_misc_set_alignment ( GTK_MISC ( reconcile_initial_balance_label ), 1, 0.5 );
gtk_table_attach_defaults ( GTK_TABLE ( table ), reconcile_initial_balance_label, 1, 2, 0, 1);
@@ -218,7 +218,7 @@
gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0.5 );
gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 0, 1, 1, 2);
- reconcile_final_balance_label = gtk_label_new ( "" );
+ reconcile_final_balance_label = gtk_label_new ( NULL );
gtk_misc_set_alignment ( GTK_MISC ( reconcile_final_balance_label ), 1, 0.5 );
gtk_table_attach_defaults ( GTK_TABLE ( table ), reconcile_final_balance_label, 1, 2, 1, 2);
@@ -226,7 +226,7 @@
gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0.5 );
gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 0, 1, 2, 3);
- reconcile_marked_balance_label = gtk_label_new ( "" );
+ reconcile_marked_balance_label = gtk_label_new ( NULL );
gtk_misc_set_alignment ( GTK_MISC ( reconcile_marked_balance_label ), 1, 0.5 );
gtk_table_attach_defaults ( GTK_TABLE ( table ), reconcile_marked_balance_label, 1, 2, 2, 3);
@@ -237,7 +237,7 @@
gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0.5 );
gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 0, 1, 4, 5);
- reconcile_variation_balance_label = gtk_label_new ( "" );
+ reconcile_variation_balance_label = gtk_label_new ( NULL );
gtk_misc_set_alignment ( GTK_MISC ( reconcile_variation_balance_label ), 1, 0.5 );
gtk_table_attach_defaults ( GTK_TABLE ( table ), reconcile_variation_balance_label, 1, 2, 4, 5);
Index: gsb_transaction_model.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transaction_model.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- gsb_transaction_model.c 18 Feb 2007 12:37:19 -0000 1.2
+++ gsb_transaction_model.c 20 Mar 2007 10:12:54 -0000 1.3
@@ -32,6 +32,7 @@
/*START_INCLUDE*/
#include "gsb_transaction_model.h"
#include "./erreur.h"
+#include "./gsb_data_archive_store.h"
#include "./gsb_data_transaction.h"
#include "./gsb_transactions_list.h"
#include "./gsb_transactions_list.h"
@@ -41,6 +42,8 @@
static GtkTreePath *gsb_transaction_model_get_model_path ( gint transaction_number,
gint line_in_transaction );
static gint gsb_transaction_model_get_transaction_from_model_path ( GtkTreePath *path_model );
+static const gchar *gsb_transation_model_get_cell_content ( GtkTreePath *path_sorted,
+ gint column );
/*END_STATIC*/
@@ -79,15 +82,19 @@
* return the number of transaction on the sorted path
* this is the path on the sorted model, ie what we see after been sorted and filtered
*
+ * this is the same function as gsb_transaction_model_get_archive_store_from_sorted_path but used for a transaction
+ *
* \param path_sorted the path in the sorted model
*
- * \return the transaction number or -1 (white line) if problem
+ * \return the transaction number, -1 (white line) if problem or 0 if archive
* */
gint gsb_transaction_model_get_transaction_from_sorted_path ( GtkTreePath *path_sorted )
{
gpointer transaction;
GtkTreeIter iter;
GtkTreePath *path_model;
+ gint what_is_line;
+ GtkTreeModel *model;
/* if no path, return -1, wich is the white line */
if ( !path_sorted )
@@ -98,20 +105,73 @@
if (!path_model)
return -1;
- gtk_tree_model_get_iter ( GTK_TREE_MODEL (gsb_transactions_list_get_store()),
+ model = GTK_TREE_MODEL (gsb_transactions_list_get_store());
+ gtk_tree_model_get_iter ( model,
&iter,
path_model );
- gtk_tree_model_get ( GTK_TREE_MODEL (gsb_transactions_list_get_store()),
+ gtk_tree_model_get ( model,
&iter,
TRANSACTION_COL_NB_TRANSACTION_ADDRESS, &transaction,
+ TRANSACTION_COL_NB_WHAT_IS_LINE, &what_is_line,
-1 );
gtk_tree_path_free (path_model);
+ /* if it's an archive, we return 0 */
+ if (what_is_line == IS_ARCHIVE)
+ return 0;
+
return gsb_data_transaction_get_transaction_number (transaction);
}
+/**
+ * return the number of archive store on the sorted path
+ * this is the path on the sorted model, ie what we see after been sorted and filtered
+ *
+ * this is the same function as gsb_transaction_model_get_transaction_from_sorted_path but used for an archive
+ *
+ * \param path_sorted the path in the sorted model
+ *
+ * \return the archive_store number, -1 if problem or 0 if transaction or white line
+ * */
+gint gsb_transaction_model_get_archive_store_from_sorted_path ( GtkTreePath *path_sorted )
+{
+ gpointer archive_store;
+ GtkTreeIter iter;
+ GtkTreePath *path_model;
+ gint what_is_line;
+ GtkTreeModel *model;
+
+ /* if no path, return -1, wich is the white line */
+ if ( !path_sorted )
+ return -1;
+
+ path_model = gsb_transaction_model_get_model_path_from_sorted_path (path_sorted);
+
+ if (!path_model)
+ return -1;
+
+ model = GTK_TREE_MODEL (gsb_transactions_list_get_store());
+ gtk_tree_model_get_iter ( model,
+ &iter,
+ path_model );
+ gtk_tree_model_get ( model,
+ &iter,
+ TRANSACTION_COL_NB_TRANSACTION_ADDRESS, &archive_store,
+ TRANSACTION_COL_NB_WHAT_IS_LINE, &what_is_line,
+ -1 );
+ gtk_tree_path_free (path_model);
+
+ /* if it's an archive, we return 0 */
+ if (what_is_line == IS_TRANSACTION)
+ return 0;
+
+ return gsb_data_archive_store_get_number (archive_store);
+}
+
+
+
/**
* return the path of a line of the transaction, in the model
@@ -236,13 +296,19 @@
gpointer transaction_pointer;
gint line;
GtkTreeIter iter_child;
+ gint what_is_line;
gtk_tree_model_get ( GTK_TREE_MODEL ( model ),
&iter,
TRANSACTION_COL_NB_TRANSACTION_ADDRESS, &transaction_pointer,
TRANSACTION_COL_NB_TRANSACTION_LINE, &line,
+ TRANSACTION_COL_NB_WHAT_IS_LINE, &what_is_line,
-1 );
+ /* if we are on an archive, we are not on a transaction... */
+ if (what_is_line == IS_ARCHIVE)
+ continue;
+
if ( line == line_in_transaction
&&
gsb_data_transaction_get_transaction_number (transaction_pointer) == transaction_number )
@@ -268,7 +334,6 @@
}
}
while (gtk_tree_model_iter_next ( GTK_TREE_MODEL ( model ),&iter ));
-
}
return NULL;
}
@@ -300,3 +365,40 @@
}
+/**
+ * get the content of the cell on the path given in param
+ *
+ * \param path_sorted the path in the sorted tree view
+ * \param column a number between 0 and TRANSACTION_LIST_COL_NB
+ *
+ * \return a const string wich is the content of the cell or NULL
+ * */
+const gchar *gsb_transation_model_get_cell_content ( GtkTreePath *path_sorted,
+ gint column )
+{
+ gchar *return_string;
+ GtkTreeIter iter;
+ GtkTreePath *path_model;
+
+ if (column < 0
+ ||
+ column > TRANSACTION_LIST_COL_NB)
+ return NULL;
+
+ /* transform the path to be in the orinal model */
+ path_model = gsb_transaction_model_get_model_path_from_sorted_path (path_sorted);
+
+ if (!path_model)
+ return NULL;
+
+ gtk_tree_model_get_iter ( GTK_TREE_MODEL (gsb_transactions_list_get_store()),
+ &iter,
+ path_model );
+ gtk_tree_model_get ( GTK_TREE_MODEL (gsb_transactions_list_get_store()),
+ &iter,
+ column, &return_string,
+ -1 );
+ gtk_tree_path_free (path_model);
+ return return_string;
+}
+
Index: gsb_fyear_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_fyear_config.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- gsb_fyear_config.c 18 Feb 2007 12:37:19 -0000 1.11
+++ gsb_fyear_config.c 20 Mar 2007 10:12:53 -0000 1.12
@@ -716,7 +716,7 @@
return FALSE;
/* first, we check if one transaction uses that financial year */
- tmp_list = gsb_data_transaction_get_transactions_list ();
+ tmp_list = gsb_data_transaction_get_complete_transactions_list ();
while (tmp_list)
{
@@ -740,7 +740,8 @@
gint result;
result = question_yes_no_hint ( _("The selected financial year is used in the file"),
- _("If you really remove it, all the associated transactions will be without financial year.\nAre you sure ?"));
+ _("If you really remove it, all the associated transactions will be without financial year.\nAre you sure ?"),
+ GTK_RESPONSE_NO );
if (result)
{
gsb_data_transaction_set_financial_year_number (transaction_number, 0);
@@ -794,10 +795,11 @@
gint modification_number = 0;
if (!question_yes_no_hint ( _("Automatic association of financial years?"),
- _("This function assigns each transaction without a financial year to the one related to its transaction date. If no financial year matches, the transaction will not be changed.")))
+ _("This function assigns each transaction without a financial year to the one related to its transaction date. If no financial year matches, the transaction will not be changed."),
+ GTK_RESPONSE_NO ))
return FALSE;
- list_tmp = gsb_data_transaction_get_transactions_list ();
+ list_tmp = gsb_data_transaction_get_complete_transactions_list ();
while ( list_tmp )
{
Index: gsb_transactions_list_sort.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list_sort.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- gsb_transactions_list_sort.c 18 Feb 2007 12:37:20 -0000 1.2
+++ gsb_transactions_list_sort.c 20 Mar 2007 10:12:54 -0000 1.3
@@ -33,6 +33,7 @@
#include "gsb_transactions_list_sort.h"
#include "./erreur.h"
#include "./gsb_data_account.h"
+#include "./gsb_data_archive.h"
#include "./gsb_data_budget.h"
#include "./gsb_data_fyear.h"
#include "./gsb_data_payee.h"
@@ -123,6 +124,10 @@
GtkTreeIter *iter_1,
GtkTreeIter *iter_2,
GtkSortType sort_type );
+static gint gsb_transactions_list_sort_check_archive ( GtkTreeModel *model,
+ GtkTreeIter *iter_1,
+ GtkTreeIter *iter_2,
+ GtkSortType sort_type );
static gint gsb_transactions_list_sort_general_test ( GtkTreeModel *model,
GtkTreeIter *iter_1,
GtkTreeIter *iter_2,
@@ -158,6 +163,8 @@
{
gint account_number;
gint element_number;
+ gint return_value;
+ GtkSortType sort_type;
account_number = gsb_gui_navigation_get_current_account ();
if (account_number == -1)
@@ -165,6 +172,19 @@
* of grisbi, and must return 0 if we don't want a crash */
return 0;
+ sort_type = gtk_tree_view_column_get_sort_order ( GTK_TREE_VIEW_COLUMN ( transactions_tree_view_columns[GPOINTER_TO_INT (column_number)]));
+
+ /* first of all, check the archive */
+/* return_value = gsb_transactions_list_sort_check_archive ( model, */
+/* iter_1, */
+/* iter_2, */
+/* sort_type ); */
+/* if (return_value) */
+/* { */
+ /* there is an archive in the tested line, return now */
+/* printf ( "sort archive\n"); */
+/* return return_value; */
+/* } */
/* get the element used to sort the list */
element_number = gsb_data_account_get_element_sort ( account_number,
GPOINTER_TO_INT (column_number));
@@ -172,11 +192,77 @@
return gsb_transactions_list_sort_by_no_sort ( model,
iter_1,
iter_2,
- gtk_tree_view_column_get_sort_order ( GTK_TREE_VIEW_COLUMN ( transactions_tree_view_columns[GPOINTER_TO_INT (column_number)])),
+ sort_type,
element_number );
}
+/**
+ * this is the first check of all : the archive
+ * we put them always at the top of the list
+ *
+ * \param model
+ * \param iter_1
+ * \param iter_2
+ * \param sort_type GTK_SORT_ASCENDING or GTK_SORT_DESCENDING
+ *
+ * \return -1 if iter_1 is above iter_2
+ * */
+gint gsb_transactions_list_sort_check_archive ( GtkTreeModel *model,
+ GtkTreeIter *iter_1,
+ GtkTreeIter *iter_2,
+ GtkSortType sort_type )
+
+{
+ gint return_value = 0;
+ gpointer archive_1;
+ gpointer archive_2;
+ gint what_is_line_1;
+ gint what_is_line_2;
+
+ gtk_tree_model_get ( model,
+ iter_1,
+ TRANSACTION_COL_NB_TRANSACTION_ADDRESS, &archive_1,
+ TRANSACTION_COL_NB_WHAT_IS_LINE, &what_is_line_1,
+ -1 );
+ gtk_tree_model_get ( model,
+ iter_2,
+ TRANSACTION_COL_NB_TRANSACTION_ADDRESS, &archive_2,
+ TRANSACTION_COL_NB_WHAT_IS_LINE, &what_is_line_2,
+ -1 );
+
+ if (what_is_line_1 == IS_ARCHIVE)
+ {
+ if (what_is_line_2 == IS_ARCHIVE)
+ {
+ /* the first and second line are archives, we return a comparison by number of archive
+ * we can do better, by date or by financial year, but more complex because no check for now
+ * that the date must be different, and problem when created by report
+ * so we assume the user created the archive in the good order, if some complains about that
+ * can change here later */
+ return_value = gsb_data_archive_get_no_archive (archive_1) - gsb_data_archive_get_no_archive (archive_2);
+ }
+ else
+ /* the first line is an archive and not the second, so first line before */
+ return_value = -1;
+ }
+ else
+ {
+ if (what_is_line_2 == IS_ARCHIVE)
+ /* the first line is not an archive but the second one is, so second line before */
+ return_value = 1;
+ else
+ /* we have 2 transactions, just return 0 here to make tests later */
+ return 0;
+ }
+ /* for a descending sort, gtk invert the values and -1 is to set iter_1 after iter_2
+ * so invert here */
+ if ( sort_type == GTK_SORT_ASCENDING )
+ return return_value;
+ else
+ return -return_value;
+}
+
/**
* find the right function to sort the list and sort the 2 iters given
Index: gsb_fyear.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_fyear.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- gsb_fyear.h 18 Feb 2007 12:37:19 -0000 1.5
+++ gsb_fyear.h 20 Mar 2007 10:12:53 -0000 1.6
@@ -9,7 +9,8 @@
gint gsb_fyear_get_fyear_from_combobox ( GtkWidget *combo_box,
const GDate *date );
void gsb_fyear_init_variables ( void );
-GtkWidget *gsb_fyear_make_combobox ( void );
+GtkWidget *gsb_fyear_make_combobox ( gboolean set_automatic );
+gboolean gsb_fyear_set_automatic ( gboolean set_automatic );
gboolean gsb_fyear_set_combobox_history ( GtkWidget *combo_box,
gint fyear_number );
gboolean gsb_fyear_update_fyear_list ( void );
Index: gsb_currency_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_currency_config.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- gsb_currency_config.c 18 Feb 2007 12:37:17 -0000 1.12
+++ gsb_currency_config.c 20 Mar 2007 10:12:52 -0000 1.13
@@ -596,7 +596,7 @@
/* we look for that currency in all the transactions,
* if we find it, we cannot delete it */
- list_tmp = gsb_data_transaction_get_transactions_list ();
+ list_tmp = gsb_data_transaction_get_complete_transactions_list ();
while ( list_tmp )
{
Index: gsb_assistant.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_assistant.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- gsb_assistant.h 18 Feb 2007 12:37:16 -0000 1.8
+++ gsb_assistant.h 20 Mar 2007 10:12:52 -0000 1.9
@@ -10,9 +10,12 @@
void gsb_assistant_change_button_next ( GtkWidget * assistant, gchar * title,
GtkResponseType response );
GtkWidget * gsb_assistant_new ( gchar * title, gchar * explanation,
- gchar * image_filename );
+ gchar * image_filename,
+ GCallback enter_callback );
void gsb_assistant_next_page ( GtkWidget *assistant );
GtkResponseType gsb_assistant_run ( GtkWidget * assistant );
+gboolean gsb_assistant_sensitive_button_next ( GtkWidget * assistant, gboolean state );
+gboolean gsb_assistant_sensitive_button_prev ( GtkWidget * assistant, gboolean state );
void gsb_assistant_set_additional_button ( GtkWidget * assistant, gchar * title );
void gsb_assistant_set_next ( GtkWidget * assistant, gint page, gint next );
void gsb_assistant_set_prev ( GtkWidget * assistant, gint page, gint prev );
Index: gsb_transaction_model.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transaction_model.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- gsb_transaction_model.h 18 Feb 2007 12:37:19 -0000 1.2
+++ gsb_transaction_model.h 20 Mar 2007 10:12:54 -0000 1.3
@@ -8,6 +8,7 @@
/* START_DECLARATION */
void gsb_transaction_model_convert_sorted_iter_to_model_iter ( GtkTreeIter *tree_iter,
GtkTreeIter *sorted_iter );
+gint gsb_transaction_model_get_archive_store_from_sorted_path ( GtkTreePath *path_sorted );
GtkTreeIter *gsb_transaction_model_get_iter_from_transaction ( gint transaction_number,
gint line_in_transaction );
GtkTreePath *gsb_transaction_model_get_model_path_from_sorted_path ( GtkTreePath *path_sorted );
Index: utils_str.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils_str.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- utils_str.c 18 Feb 2007 12:37:21 -0000 1.38
+++ utils_str.c 20 Mar 2007 10:12:54 -0000 1.39
@@ -744,7 +744,7 @@
* Return a newly created strings, truncating original. It should be
* truncated at the end of the word containing the nth letter.
*
- * \param string String to truncate.
+ * \param string String to truncate
* \param n Max lenght to truncate at.
* \param hard_trunc Cut in the middle of a word if needed.
*
Index: accueil.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/accueil.c,v
retrieving revision 1.149
retrieving revision 1.150
diff -u -d -r1.149 -r1.150
--- accueil.c 20 Feb 2007 10:20:14 -0000 1.149
+++ accueil.c 20 Mar 2007 10:12:51 -0000 1.150
@@ -168,7 +168,7 @@
}
else
{
- label_titre_fichier = gtk_label_new ( "" );
+ label_titre_fichier = gtk_label_new ( NULL );
gtk_box_pack_start ( GTK_BOX ( base ), label_titre_fichier, FALSE, FALSE, 0 );
}
@@ -364,7 +364,7 @@
/* Création d'un label juste pour en récupérer le style */
- pLabel = gtk_label_new ("");
+ pLabel = gtk_label_new (NULL);
/* Initialisation du style « Nom du compte » */
pStyleLabelNomCompte = gtk_style_copy ( gtk_widget_get_style ( pLabel ));
@@ -1315,7 +1315,7 @@
gtk_widget_show ( vbox );
/* on met une ligne vide pour faire joli */
- label = gtk_label_new ("");
+ label = gtk_label_new (NULL);
/* création du style normal -> bleu */
/* pointeur dessus -> jaune-rouge */
|