[grisbi-cvs] grisbi/src affichage_liste.c, 1.116, 1.117 gsb_assistant_archive.c, 1.41, 1.42 gsb_data_archive_store.c, 1.16, 1.17 gsb_transactions_list.c, 1.189, 1.190 gsb_transactions_list.h, 1.37, 1.38 transaction_list.c, 1.52, 1.53
Pierre Biava
pbiava at users.sourceforge.net
Sat Dec 12 19:14:41 CET 2009
Update of /cvsroot/grisbi/grisbi/src
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv19722/src
Modified Files:
affichage_liste.c gsb_assistant_archive.c
gsb_data_archive_store.c gsb_transactions_list.c
gsb_transactions_list.h transaction_list.c
Log Message:
fixed bug 750
Index: gsb_transactions_list.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- gsb_transactions_list.h 24 Aug 2009 11:54:22 -0000 1.37
+++ gsb_transactions_list.h 12 Dec 2009 18:14:39 -0000 1.38
@@ -81,5 +81,6 @@
void schedule_selected_transaction ();
gsb_real solde_debut_affichage ( gint account_number,
gint floating_point);
+gint find_element_col_for_archive ( void );
/* END_DECLARATION */
#endif
Index: gsb_assistant_archive.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_assistant_archive.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- gsb_assistant_archive.c 29 Nov 2009 18:53:39 -0000 1.41
+++ gsb_assistant_archive.c 12 Dec 2009 18:14:39 -0000 1.42
@@ -178,7 +178,6 @@
}
-
/**
* create the page 2 of the assistant
* show the menu to choose between archive by date, financial year or budget
@@ -194,7 +193,7 @@
GtkWidget *label;
GtkWidget *button;
GtkWidget *hbox;
-printf ("gsb_assistant_archive_page_menu\n");
+
page = gtk_hbox_new (FALSE, 15);
gtk_container_set_border_width ( GTK_CONTAINER (page), 10 );
@@ -348,7 +347,7 @@
GtkWidget *page;
GtkWidget *vbox;
GtkWidget *label;
-printf ("gsb_assistant_archive_page_archive_name\n");
+
page = gtk_hbox_new (FALSE, 15);
gtk_container_set_border_width ( GTK_CONTAINER (page),
10 );
@@ -397,7 +396,7 @@
GtkWidget * page;
GtkTextBuffer * buffer;
GtkTextIter iter;
-printf ("gsb_assistant_archive_page_success\n");
+
page = gtk_vbox_new ( FALSE, 0 );
gtk_container_set_border_width ( GTK_CONTAINER (page),
0 );
@@ -500,7 +499,7 @@
static gboolean gsb_assistant_archive_switch_to_intro ( GtkWidget *assistant,
gint new_page )
{
-printf ("gsb_assistant_archive_switch_to_intro\n");
+
/* enter into the intro page */
gsb_assistant_change_button_next ( assistant,
GTK_STOCK_GO_FORWARD, GTK_RESPONSE_YES );
@@ -524,7 +523,7 @@
{
GSList *tmp_list;
const GDate *date = NULL;
-printf ("gsb_assistant_archive_switch_to_menu\n");
+
/* enter into the menu page */
gtk_label_set_text ( GTK_LABEL (label_archived), NULL );
gsb_assistant_change_button_next ( assistant,
@@ -560,7 +559,6 @@
}
-
/**
* Switch to the "name archive" page.
*
@@ -573,7 +571,7 @@
gint new_page )
{
gchar * string = NULL;
-printf ("gsb_assistant_archive_switch_to_archive_name\n");
+
gsb_assistant_change_button_next ( assistant,
GTK_STOCK_APPLY, GTK_RESPONSE_YES );
@@ -638,27 +636,25 @@
GtkTextBuffer * buffer;
GtkTextIter iter;
gint account_nb;
-printf ("gsb_assistant_archive_switch_to_succes\n");
+
/* This would typically happen if user selected a time period
* with no transactions related. */
-printf ("nbre de transactions dans l'archive = %d\n",
- g_slist_length ( list_transaction_to_archive ) );
if (!list_transaction_to_archive)
{
- gtk_widget_hide (vbox_congratulation);
- gtk_widget_show (vbox_failed);
- gsb_assistant_sensitive_button_prev ( assistant, TRUE );
- gsb_assistant_sensitive_button_next ( assistant, FALSE );
- return FALSE;
+ gtk_widget_hide (vbox_congratulation);
+ gtk_widget_show (vbox_failed);
+ gsb_assistant_sensitive_button_prev ( assistant, TRUE );
+ gsb_assistant_sensitive_button_next ( assistant, FALSE );
+ 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;
+ gtk_widget_hide (vbox_congratulation);
+ gtk_widget_show (vbox_failed);
+ return FALSE;
}
gsb_assistant_change_button_next ( assistant,
@@ -667,27 +663,27 @@
/* 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);
+ GDate *init_gdate;
+ GDate *final_gdate;
- gsb_data_archive_set_beginning_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));
+ init_gdate = gsb_calendar_entry_get_date (initial_date);
+ final_gdate = gsb_calendar_entry_get_date (final_date);
- if (GTK_WIDGET_IS_SENSITIVE (report_button))
+ gsb_data_archive_set_beginning_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);
+ }
+ else 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 ) );
+ else if (GTK_WIDGET_IS_SENSITIVE (report_button) )
{
- gint report_number;
+ gint report_number;
- report_number = gsb_report_get_report_from_combobox (report_button);
+ report_number = gsb_report_get_report_from_combobox (report_button);
- gsb_data_archive_set_report_title ( archive_number,
+ gsb_data_archive_set_report_title ( archive_number,
etats_titre (report_number));
}
@@ -710,7 +706,7 @@
gsb_data_archive_store_init_variables ();
gsb_data_archive_store_create_list ( );
gsb_transactions_list_fill_archive_store ( );
-printf ("retour de gsb_transactions_list_fill_archive_store\n");
+
/* set the message */
string = g_strdup_printf ( _("Archive '%s' was successfully created and %d transactions "
"out of %d were archived.\n\n"),
@@ -723,16 +719,14 @@
gtk_text_buffer_get_iter_at_mark ( buffer, &iter,
gtk_text_buffer_get_mark ( buffer, "status" ) );
gtk_text_buffer_insert ( buffer, &iter, string, strlen(string) );
-printf ("avant g_free (string);\n");
+
g_free (string);
-printf ("après g_free (string);\n");
+
gtk_widget_hide (vbox_failed);
gtk_widget_show (vbox_congratulation);
/* free the transactions list to archive */
-printf ("avant g_slist_free (list_transaction_to_archive);\n");
g_slist_free (list_transaction_to_archive);
-printf ("après g_slist_free (list_transaction_to_archive);\n");
list_transaction_to_archive = NULL;
/* erase all the previous entries */
@@ -789,15 +783,14 @@
GSList *tmp_list;
GtkWidget * notebook;
GSList *report_transactions_list;
-printf ("gsb_assistant_archive_update_labels\n");
+
notebook = g_object_get_data ( G_OBJECT(assistant), "notebook" );
/* erase the last list of transactions to archive */
if (gtk_notebook_get_current_page (GTK_NOTEBOOK(notebook)) == ARCHIVE_ASSISTANT_MENU
&&
- list_transaction_to_archive)
+ list_transaction_to_archive )
{
- printf ("current_page = ARCHIVE_ASSISTANT_MENU\n");
g_slist_free (list_transaction_to_archive);
list_transaction_to_archive = NULL;
gsb_assistant_sensitive_button_next ( assistant, TRUE );
@@ -861,19 +854,21 @@
{
gint transaction_number;
- transaction_number = gsb_data_transaction_get_transaction_number (tmp_list -> data);
+ 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
+ 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 archive
- * we could use gsb_assistant_archive_add_transaction_to_list but it's a lost of time
- * because all the linked transactions will be taken because we work with dates,
- * so don't use that function and add the transaction directly */
- list_transaction_to_archive = g_slist_append ( list_transaction_to_archive,
+ gsb_data_transaction_get_date (transaction_number)) >= 0 )
+ /* the transaction is into the dates, we append its address to the list to archive
+ * we could use gsb_assistant_archive_add_transaction_to_list but it's a lost of time
+ * because all the linked transactions will be taken because we work with dates,
+ * so don't use that function and add the transaction directly */
+ list_transaction_to_archive = g_slist_append ( list_transaction_to_archive,
tmp_list -> data );
+
tmp_list = tmp_list -> next;
}
printf ("nbre de transactions dans l'archive = %d\n",
@@ -969,7 +964,6 @@
else if ( gtk_notebook_get_current_page (GTK_NOTEBOOK(notebook)) ==
ARCHIVE_ASSISTANT_ARCHIVE_NAME )
{
- printf ("current_page = ARCHIVE_ASSISTANT_ARCHIVE_NAME\n");
if ( strlen ( gtk_entry_get_text ( GTK_ENTRY ( name_entry ) ) ) )
gsb_assistant_sensitive_button_next ( assistant, TRUE );
else
Index: affichage_liste.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/affichage_liste.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -d -r1.116 -r1.117
--- affichage_liste.c 24 Nov 2009 05:18:30 -0000 1.116
+++ affichage_liste.c 12 Dec 2009 18:14:39 -0000 1.117
@@ -48,8 +48,8 @@
/*START_STATIC*/
static gboolean display_mode_button_changed ( GtkWidget *button,
gint *line_ptr );
-static gboolean gsb_transactions_list_display_change_max_items ( GtkWidget *entry,
- gpointer null );
+//~ static gboolean gsb_transactions_list_display_change_max_items ( GtkWidget *entry,
+ //~ gpointer null );
static void gsb_transactions_list_display_show_gives_balance ( void );
static gboolean gsb_transactions_list_display_sort_by_value_date ( GtkWidget *checkbutton,
gpointer null );
@@ -641,14 +641,14 @@
*
* \return FALSE
* */
-gboolean gsb_transactions_list_display_change_max_items ( GtkWidget *entry,
+/*gboolean gsb_transactions_list_display_change_max_items ( GtkWidget *entry,
gpointer null )
{
etat.combofix_max_item = utils_str_atoi ( gtk_entry_get_text (GTK_ENTRY (entry)));
gsb_transactions_list_display_update_combofix ();
return FALSE;
-}
+}*/
/**
Index: gsb_transactions_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list.c,v
retrieving revision 1.189
retrieving revision 1.190
diff -u -d -r1.189 -r1.190
--- gsb_transactions_list.c 29 Nov 2009 18:53:39 -0000 1.189
+++ gsb_transactions_list.c 12 Dec 2009 18:14:39 -0000 1.190
@@ -568,20 +568,15 @@
devel_debug (NULL);
tmp_list = gsb_data_archive_store_get_archives_list ();
-printf ("nbre d'archives = %d\n", g_slist_length ( tmp_list ));
while (tmp_list)
{
gint archive_store_number;
/* get the store archive struct */
archive_store_number = gsb_data_archive_store_get_number (tmp_list -> data);
- printf ("archive_store_number = %d account_nb = %d\n",
- archive_store_number ,
- gsb_data_archive_store_get_account_number ( archive_store_number ));
transaction_list_append_archive (archive_store_number);
tmp_list = tmp_list -> next;
}
- printf ("sortie de gsb_transactions_list_fill_archive_store\n");
return FALSE;
}
@@ -3443,6 +3438,29 @@
}
+/**
+ * find column number for the archive texte
+ *
+ * \param element_number the element we look for
+ *
+ * \return column number or an other element
+ * */
+gint find_element_col_for_archive ( void )
+{
+ gint retour;
+
+ if ( (retour = find_element_col ( ELEMENT_PARTY )) >= 0 )
+ return retour;
+ if ( (retour = find_element_col ( ELEMENT_CATEGORY )) >= 0 )
+ return retour;
+ if ( (retour = find_element_col ( ELEMENT_BUDGET )) >= 0 )
+ return retour;
+ if ( (retour = find_element_col ( ELEMENT_NOTES )) >= 0 )
+ return retour;
+
+ return -1;
+}
+
/* Local Variables: */
/* c-basic-offset: 4 */
/* End: */
Index: gsb_data_archive_store.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_archive_store.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- gsb_data_archive_store.c 22 Aug 2009 15:34:51 -0000 1.16
+++ gsb_data_archive_store.c 12 Dec 2009 18:14:39 -0000 1.17
@@ -176,33 +176,28 @@
transaction_number = gsb_data_transaction_get_transaction_number (tmp_list -> data);
- /* we are not interested on children transactions */
- if (gsb_data_transaction_get_mother_transaction_number (transaction_number))
- {
- tmp_list = tmp_list -> next;
- continue;
- }
-
archive_number = gsb_data_transaction_get_archive_number (transaction_number);
if (archive_number)
{
- struct_store_archive *archive;
+ struct_store_archive *archive_store;
gint floating_point;
gint account_number;
account_number = gsb_data_transaction_get_account_number (transaction_number);
floating_point = gsb_data_currency_get_floating_point (
gsb_data_account_get_currency (account_number) );
- archive = gsb_data_archive_store_find_struct ( archive_number, account_number);
- if (archive)
+ archive_store = gsb_data_archive_store_find_struct ( archive_number, account_number);
+ if (archive_store)
{
/* there is already a struct_store_archive for the same archive and the same account,
- * we increase the balance */
- archive -> balance = gsb_real_add ( archive -> balance,
- gsb_data_transaction_get_adjusted_amount (transaction_number,
+ * we increase the balance except for operations */
+ if ( !gsb_data_transaction_get_mother_transaction_number ( transaction_number ) )
+ archive_store -> balance = gsb_real_add ( archive_store -> balance,
+ gsb_data_transaction_get_adjusted_amount (
+ transaction_number,
floating_point));
- archive -> nb_transactions++;
+ archive_store -> nb_transactions++;
}
else
{
@@ -211,13 +206,14 @@
gint archive_store_number;
archive_store_number = gsb_data_archive_store_new ();
- archive = gsb_data_archive_store_get_structure (archive_store_number);
+ archive_store = gsb_data_archive_store_get_structure (archive_store_number);
- archive -> archive_number = archive_number;
- archive -> account_number = account_number;
- archive -> balance = gsb_data_transaction_get_adjusted_amount (
+ archive_store -> archive_number = archive_number;
+ archive_store -> account_number = account_number;
+ archive_store -> balance = gsb_data_transaction_get_adjusted_amount (
transaction_number, floating_point);
- archive -> nb_transactions = 1;
+ if ( ! gsb_data_transaction_get_mother_transaction_number ( transaction_number ) )
+ archive_store -> nb_transactions = 1;
}
}
tmp_list = tmp_list -> next;
Index: transaction_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/transaction_list.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- transaction_list.c 29 Nov 2009 18:53:40 -0000 1.52
+++ transaction_list.c 12 Dec 2009 18:14:39 -0000 1.53
@@ -293,7 +293,8 @@
CustomRecord *newrecord;
gint amount_col;
CustomList *custom_list;
-devel_debug_int ( archive_store_number);
+ gint col_archive;
+
custom_list = transaction_model_get_model ();
g_return_if_fail ( custom_list != NULL );
@@ -304,24 +305,11 @@
* 1 for the archive */
custom_list->num_rows = custom_list -> num_rows + 1;
newsize = custom_list->num_rows * sizeof(CustomRecord*);
- //~ printf ("pos = %d custom_list->num_rows = %d newsize = %ld\n", pos,
- //~ custom_list->num_rows, newsize );
- custom_list->rows = g_try_realloc ( custom_list->rows, newsize );
- if ( custom_list->rows == NULL )
- {
- printf ("realloc Non OK\n");
- return;
- }
-//~ printf ("realloc custom_list->rows OK\n");
+ custom_list->rows = g_realloc(custom_list->rows, newsize);
+
/* increase too the size of visibles rows, either if that row is not visible,
* it's the only way to be sure to never go throw the end while filtering */
- custom_list->visibles_rows = g_try_realloc (custom_list->visibles_rows, newsize);
- if ( custom_list->visibles_rows == NULL )
- {
- printf ("realloc Non OK\n");
- return;
- }
-//~ printf ("realloc custom_list->visibles_rows OK\n");
+ custom_list->visibles_rows = g_realloc(custom_list->visibles_rows, newsize);
/* create and fill the record */
newrecord = g_malloc0 (sizeof (CustomRecord));
@@ -330,16 +318,18 @@
newrecord -> visible_col[find_element_col (ELEMENT_DATE)] = gsb_format_gdate (
gsb_data_archive_get_beginning_date ( archive_number ) );
- newrecord -> visible_col[find_element_col (ELEMENT_PARTY)] = g_strdup_printf (
+
+ if ( ( col_archive = find_element_col_for_archive ( ) ) >= 0 )
+ newrecord -> visible_col[col_archive] = g_strdup_printf (
_("%s (%d transactions)"),
gsb_data_archive_get_name (archive_number),
gsb_data_archive_store_get_transactions_number (
archive_store_number ) );
- printf ("texte archive = %s\n", newrecord -> visible_col[find_element_col (ELEMENT_PARTY)] );
+
if ((gsb_data_archive_store_get_balance (archive_store_number)).mantissa < 0)
- amount_col = find_element_col (ELEMENT_DEBIT);
+ amount_col = find_element_col (ELEMENT_DEBIT);
else
- amount_col = find_element_col (ELEMENT_CREDIT);
+ amount_col = find_element_col (ELEMENT_CREDIT);
newrecord -> visible_col[amount_col] = gsb_real_get_string_with_currency (
gsb_data_archive_store_get_balance (archive_store_number),
More information about the cvs
mailing list