[grisbi-cvs] grisbi/src balance_estimate_tab.c, 1.26, 1.27 custom_list.c, 1.6, 1.7 gsb_assistant_archive.c, 1.42, 1.43 gsb_assistant_file.c, 1.18, 1.19 gsb_assistant_reconcile_config.c, 1.28, 1.29 gsb_data_payment.c, 1.13, 1.14 gsb_form.c, 1.143, 1.144 gsb_reconcile.c, 1.43, 1.44 gsb_scheduler.c, 1.27, 1.28 utils_dates.c, 1.60, 1.61 utils_dates.h, 1.22, 1.23

Pierre Biava pbiava at users.sourceforge.net
Sat Jan 9 21:57:40 CET 2010


Update of /cvsroot/grisbi/grisbi/src
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv2817/src

Modified Files:
	balance_estimate_tab.c custom_list.c gsb_assistant_archive.c 
	gsb_assistant_file.c gsb_assistant_reconcile_config.c 
	gsb_data_payment.c gsb_form.c gsb_reconcile.c gsb_scheduler.c 
	utils_dates.c utils_dates.h 
Log Message:
update strings and debug budgetary module

Index: custom_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/custom_list.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- custom_list.c	26 Oct 2009 22:38:21 -0000	1.6
+++ custom_list.c	9 Jan 2010 20:57:38 -0000	1.7
@@ -87,7 +87,7 @@
 
 /**
  * create the new custom list
- * add automaticaly the white line
+ * add automatically the white line
  *
  * \param
  *

Index: gsb_assistant_reconcile_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_assistant_reconcile_config.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- gsb_assistant_reconcile_config.c	3 Oct 2009 22:14:56 -0000	1.28
+++ gsb_assistant_reconcile_config.c	9 Jan 2010 20:57:38 -0000	1.29
@@ -58,7 +58,7 @@
                         GtkWidget *assistant );
 static  gboolean gsb_assistant_reconcile_config_page_add_new_reconcile ( GtkWidget *button,
                         GtkWidget *label );
-static  GtkWidget *gsb_assistant_reconcile_config_page_automaticaly_associate ( GtkWidget *assistant );
+static  GtkWidget *gsb_assistant_reconcile_config_page_automatically_associate ( GtkWidget *assistant );
 static  GtkWidget *gsb_assistant_reconcile_config_page_manually_associate ( GtkWidget *assistant );
 static  GtkWidget *gsb_assistant_reconcile_config_page_menu ( GtkWidget *assistant );
 static  gboolean gsb_assistant_reconcile_config_page_menu_toggled ( GtkWidget *button,
@@ -79,7 +79,7 @@
     RECONCILE_ASSISTANT_INTRO= 0,
     RECONCILE_ASSISTANT_MENU,
     RECONCILE_ASSISTANT_NEW_RECONCILE,
-    RECONCILE_ASSISTANT_AUTOMATICALY_ASSOCIATE,
+    RECONCILE_ASSISTANT_AUTOMATICALLY_ASSOCIATE,
     RECONCILE_ASSISTANT_MANUALLY_ASSOCIATE,
     RECONCILE_ASSISTANT_SUCCESS
 };
@@ -103,13 +103,13 @@
 
 
 
-/* variables for the page to automaticaly associate */
+/* variables for the page to automatically associate */
 static GtkWidget *label_transactions_to_link_2 = NULL;
 static GtkWidget *label_possible_association = NULL;
 static GtkWidget *button_run_association = NULL;
 
 /* structure making the link between a transaction and the corresponding reconcile,
- * used for automaticaly association */
+ * used for automatically association */
 struct association_transaction_reconcile
 {
     gint transaction_number;
@@ -183,7 +183,7 @@
      * 	-permit to choose a reconcile number for each transactions without reconcile
      * 	- do an automatic find for reconcile, usefull in the first item, when very much
      * 		transactions without reconcile, but we need to make the old reconciles before,
-     * 		and set the good date for all the reconciles (because grisbi set them automaticaly
+     * 		and set the good date for all the reconciles (because grisbi set them automatically
      * 		at the first update to grisbi 0.6.0 )*/
 
     /* first, create the assistant */
@@ -214,8 +214,8 @@
 			     RECONCILE_ASSISTANT_MENU,
 			     NULL );
     gsb_assistant_add_page ( assistant,
-			     gsb_assistant_reconcile_config_page_automaticaly_associate (assistant),
-			     RECONCILE_ASSISTANT_AUTOMATICALY_ASSOCIATE,
+			     gsb_assistant_reconcile_config_page_automatically_associate (assistant),
+			     RECONCILE_ASSISTANT_AUTOMATICALLY_ASSOCIATE,
 			     RECONCILE_ASSISTANT_MENU,
 			     RECONCILE_ASSISTANT_MENU,
 			     G_CALLBACK (gsb_assistant_reconcile_config_update_auto_asso));
@@ -241,7 +241,7 @@
  * create the page 2 of the assistant to make the link between marked transactions and reconciles
  * that page propose to :
  * 	create new reconciles
- * 	automaticaly associate transactions to known reconciles
+ * 	automatically associate transactions to known reconciles
  * 	associate transactions to a reconcile, by hand
  * a change to that menu will change the next page, according to it
  *
@@ -305,11 +305,11 @@
 			 label,
 			 FALSE, FALSE, 0 );
 
-    /* automaticaly associate the transactions without reconcile number */
+    /* automatically associate the transactions without reconcile number */
     button = gtk_radio_button_new_with_label ( gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)),
-					       _("Automaticaly associate transactions without reconciliation number with the known reconciliations"));
+					       _("Automatically associate transactions without reconciliation number with the known reconciliations"));
     g_object_set_data ( G_OBJECT (button),
-			"next_page", GINT_TO_POINTER (RECONCILE_ASSISTANT_AUTOMATICALY_ASSOCIATE));
+			"next_page", GINT_TO_POINTER (RECONCILE_ASSISTANT_AUTOMATICALLY_ASSOCIATE));
     g_signal_connect ( G_OBJECT (button),
 		       "toggled",
 		       G_CALLBACK (gsb_assistant_reconcile_config_page_menu_toggled),
@@ -504,13 +504,13 @@
 
 
 /**
- * create the page to automaticaly associate the transactions to the reconciles
+ * create the page to automatically associate the transactions to the reconciles
  *
  * \param assistant
  *
  * \return a GtkWidget, the page to the assistant
  * */
-static GtkWidget *gsb_assistant_reconcile_config_page_automaticaly_associate ( GtkWidget *assistant )
+static GtkWidget *gsb_assistant_reconcile_config_page_automatically_associate ( GtkWidget *assistant )
 {
     GtkWidget *page;
     GtkWidget *separator;
@@ -865,7 +865,7 @@
 
 
 /**
- * function called when the user come to the automaticaly association page
+ * function called when the user come to the automatically association page
  * fill the label and show the button if possible
  *
  * \param assistant
@@ -890,7 +890,7 @@
     gtk_misc_set_alignment ( GTK_MISC (label_transactions_to_link_2),
 			     0, 0.5 );
 
-    /* calculate how many transactions can be associated automaticaly,
+    /* calculate how many transactions can be associated automatically,
      * to avoid to do that 2 times, we set each transactions in a structure with
      * the associated number of reconcile */
     if (list_association)
@@ -1018,7 +1018,7 @@
     {
 	/* go to the success page */
 	gsb_assistant_set_next ( assistant,
-				 RECONCILE_ASSISTANT_AUTOMATICALY_ASSOCIATE,
+				 RECONCILE_ASSISTANT_AUTOMATICALLY_ASSOCIATE,
 				 RECONCILE_ASSISTANT_SUCCESS );
 	gsb_assistant_next_page (assistant);
     }

Index: gsb_form.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form.c,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -d -r1.143 -r1.144
--- gsb_form.c	6 Jan 2010 22:17:45 -0000	1.143
+++ gsb_form.c	9 Jan 2010 20:57:38 -0000	1.144
@@ -2514,7 +2514,7 @@
         gsb_form_hide ();
 
     /* if it was a modification of transaction, we need to update the sort and colors
-     * (done automaticaly for new transaction) */
+     * (done automatically for new transaction) */
     if (!new_transaction && !execute_scheduled)
         gsb_transactions_list_update_tree_view (account_number, TRUE);
 

Index: gsb_assistant_archive.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_assistant_archive.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- gsb_assistant_archive.c	12 Dec 2009 18:14:39 -0000	1.42
+++ gsb_assistant_archive.c	9 Jan 2010 20:57:38 -0000	1.43
@@ -113,7 +113,7 @@
 /**
  * this function is called to launch the assistant to make archives
  *
- * \param origin : FALSE by menu, TRUE automaticaly after a file opening
+ * \param origin : FALSE by menu, TRUE automatically after a file opening
  *
  * \return a GtkResponseType containing the return value at the end of the assistant
  * */

Index: gsb_data_payment.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_payment.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- gsb_data_payment.c	5 Jul 2009 09:24:48 -0000	1.13
+++ gsb_data_payment.c	9 Jan 2010 20:57:38 -0000	1.14
@@ -342,7 +342,7 @@
 /**
  * set a new number for the payment
  * normally used only while loading the file because
- * the number are given automaticaly
+ * the number are given automatically
  *
  * \param payment_number the number of the payment
  * \param new_no_payment the new number of the payment
@@ -555,7 +555,7 @@
  * return the automatic_numbering of the method of payment
  * if automatic_numbering is set and if show_entry is set,
  * 	when choosing the method of payment in the form, an entry
- * 	is showed and the content contains automaticaly the
+ * 	is showed and the content contains automatically the
  * 	last_number for that method of payment + 1
  *
  * \param payment_number the number of the method of payment
@@ -634,7 +634,7 @@
 
 /**
  * return the last_number of the method of payment
- * this is the last number to set automaticaly that number + 1
+ * this is the last number to set automatically that number + 1
  * 	in the cheque entry ; nothing to deal with gsb_data_payment_max_number
  * 	wich give the last payment_number, internal number to count the method of payment
  *

Index: gsb_assistant_file.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_assistant_file.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- gsb_assistant_file.c	27 Apr 2009 19:41:03 -0000	1.18
+++ gsb_assistant_file.c	9 Jan 2010 20:57:38 -0000	1.19
@@ -522,7 +522,7 @@
     update_homepage_title (GTK_ENTRY (title_entry), NULL, 0, 0);
 
     /* first get the last content of the title to see if the filename
-     * was automaticaly created, and in that case, we continue the automatic mode,
+     * was automatically created, and in that case, we continue the automatic mode,
      * else we don't touch the filename entry */
     last_title = g_object_get_data ( G_OBJECT (title_entry),
 				     "last_title");

Index: utils_dates.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils_dates.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- utils_dates.h	4 Nov 2009 19:52:14 -0000	1.22
+++ utils_dates.h	9 Jan 2010 20:57:38 -0000	1.23
@@ -20,5 +20,6 @@
 gchar *gsb_format_gdate_safe ( const GDate *date );
 GDate *gsb_parse_date_string ( const gchar *date_string );
 GDate *gsb_parse_date_string_safe ( const gchar *date_string );
+GDate *gsb_date_get_last_day_of_month ( const GDate *date );
 /* END_DECLARATION */
 #endif

Index: gsb_scheduler.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_scheduler.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- gsb_scheduler.c	24 Aug 2009 13:56:59 -0000	1.27
+++ gsb_scheduler.c	9 Jan 2010 20:57:38 -0000	1.28
@@ -511,7 +511,7 @@
 		/* this is an automatic scheduled, we get it */
 		gint transaction_number;
 
-		/* take automaticaly the scheduled transaction untill today */
+		/* take automatically the scheduled transaction untill today */
 		transaction_number = gsb_scheduler_create_transaction_from_scheduled_transaction (scheduled_number,
 												  0 );
 		if ( gsb_data_scheduled_get_split_of_scheduled (scheduled_number))

Index: utils_dates.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils_dates.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- utils_dates.c	26 Dec 2009 16:57:13 -0000	1.60
+++ utils_dates.c	9 Jan 2010 20:57:38 -0000	1.61
@@ -590,6 +590,22 @@
 
     return gsb_format_gdate ( date );
 }
+
+
+/**
+ * returns a date with the last day of the month.
+ * 
+ * */
+GDate *gsb_date_get_last_day_of_month ( const GDate *date )
+{
+    GDate *tmp_date;
+
+    tmp_date = gsb_date_copy ( date );
+    g_date_set_day ( tmp_date, 1 );
+    g_date_subtract_days ( tmp_date, 1 );
+
+    return tmp_date;
+}
 /* Local Variables: */
 /* c-basic-offset: 4 */
 /* End: */

Index: balance_estimate_tab.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- balance_estimate_tab.c	8 Jan 2010 19:24:34 -0000	1.26
+++ balance_estimate_tab.c	9 Jan 2010 20:57:38 -0000	1.27
@@ -50,13 +50,15 @@
 #include "./gsb_transactions_list_sort.h"
 #include "./main.h"
 #include "./include.h"
+#include "./structures.h"
+#include "./traitement_variables.h"
 #include "./gsb_real.h"
 /*END_INCLUDE*/
 
 /*START_STATIC*/
 static  void bet_account_selection_changed (GtkTreeSelection *treeselection, gpointer user_data);
 static  gint bet_date_sort_function (GtkTreeModel *model, GtkTreeIter *itera, GtkTreeIter *iterb, gpointer user_data);
-static  void bet_duration_button_clicked (GtkToggleButton *togglebutton, gpointer data);
+static  void bet_duration_button_clicked ( GtkWidget *togglebutton, GtkWidget *spin_button );
 static  void bet_estimate_refresh (void);
 static  gboolean bet_update_average_column (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data);
 static  gboolean bet_update_graph (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data);
@@ -64,6 +66,10 @@
                         GtkTreeIter *a,
                         GtkTreeIter *b,
                         gpointer user_data);
+static GtkWidget *bet_estimate_get_list_accounts ( GtkWidget *container );
+static GtkWidget *bet_estimate_get_duration_widget ( GtkWidget *container );
+static gboolean bet_duration_number_changed ( GtkWidget *spin_button, GtkWidget *togglebutton );
+static void bet_duration_period_clicked ( GtkWidget *togglebutton, gpointer data );
 /*END_STATIC*/
 
 /*START_EXTERN*/
@@ -73,19 +79,12 @@
 /*END_EXTERN*/
 
 
-
-#include "balance_estimate_tab.h"
-#include "gsb_data_account.h"
-#include "gsb_scheduler.h"
-#include "gsb_data_scheduled.h"
-#include "gsb_data_account.h"
-#include "gsb_data_transaction.h"
-#include "utils_dates.h"
-#include "gsb_transactions_list_sort.h"
 enum bet_account_tree_columns {
     SPP_ACCOUNT_TREE_NAME_COLUMN,
     SPP_ACCOUNT_TREE_NUM_COLUMNS
 };
+
+
 enum bet_estimation_tree_columns {
     SPP_ESTIMATE_TREE_DATE_COLUMN,
     SPP_ESTIMATE_TREE_DESC_COLUMN,
@@ -96,18 +95,15 @@
     SPP_ESTIMATE_TREE_AMOUNT_COLUMN,	/* the amount without currency */
     SPP_ESTIMATE_TREE_NUM_COLUMNS
 };
+
+
 static gchar* bet_duration_array[] = {
-    N_("One month"),
-    N_("Two months"),
-    N_("Three months"),
-    N_("Six months"),
-    N_("One year"),
-    N_("Two years"),
+    N_("Month"),
+    N_("Year"),
     NULL
 };
-static gint bet_months_array[] = {
-    1, 2, 3, 6, 12, 24
-};
+
+
 struct bet_range
 {
     gboolean first_pass;
@@ -118,33 +114,10 @@
     gsb_real current_balance;
 };
 
+
 /* the notebook of the bet */
 static GtkWidget *bet_container = NULL;
 
-/*
- * bet_duration_button_clicked
- * This function is called when a radio button is called to change the estimate duration.
- * It copies the new durations from the data parameter (of the radio button) into
- * the bet_months property of the bet container
- */
-static void bet_duration_button_clicked ( GtkToggleButton *togglebutton, gpointer data )
-{
-    gint months = GPOINTER_TO_INT(data);
-    g_object_set_data (G_OBJECT(bet_container),
-		       "bet_months", GINT_TO_POINTER(months));
-    bet_estimate_refresh();
-}
-
-/*
- * bet_account_selection_changed
- * This function is called for each change in the selected line in the account list.
- * It refreshs balance estimation.
- */
-static void bet_account_selection_changed ( GtkTreeSelection *treeselection,
-                        gpointer user_data )
-{
-    bet_estimate_refresh();
-}
 
 /*
  * bet_create_balance_estimate_tab
@@ -161,107 +134,52 @@
     GtkWidget *hbox;
     GtkWidget *scrolled_window;
     GtkWidget *tree_view;
-    GtkWidget *previous = NULL;
     GtkTreeStore *tree_model;
-    GtkTreeSelection *tree_selection;
     GtkCellRenderer *cell;
     GtkTreeViewColumn *column;
-    gint iduration;
 
     /* create a notebook for array and graph */
-    notebook = gtk_notebook_new();
-    gtk_widget_show(notebook);
+    notebook = gtk_notebook_new ( );
+    gtk_widget_show ( notebook );
     bet_container = notebook;
 
     /****** Parameter page ******/
-    widget = gtk_label_new(_("Choice the prevision"));
-    gtk_widget_show(GTK_WIDGET(widget));
+    widget = gtk_label_new ( _("Choice the prevision") );
+    gtk_widget_show ( GTK_WIDGET ( widget ) );
 
-    page = gtk_vbox_new(FALSE, 5);
-    gtk_widget_show(GTK_WIDGET(page));
-    gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
-			     GTK_WIDGET(page), GTK_WIDGET(widget));
+    page = gtk_vbox_new ( FALSE, 5 );
+    gtk_widget_show ( GTK_WIDGET ( page ) );
+    gtk_notebook_append_page ( GTK_NOTEBOOK ( notebook ),
+                        GTK_WIDGET ( page ), GTK_WIDGET ( widget ) );
 
-    hbox = gtk_hbox_new(FALSE, 5);
+    /* titre de la page */
+    hbox = gtk_hbox_new ( FALSE, 5 );
     gtk_widget_show(GTK_WIDGET(hbox));
-    gtk_box_pack_start(GTK_BOX(page), hbox, FALSE, FALSE, 15);
-
+    gtk_box_pack_start ( GTK_BOX ( page ), hbox, FALSE, FALSE, 15 );
+ 
     widget = gtk_image_new_from_stock(
 				      GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
-    gtk_widget_show(GTK_WIDGET(widget));
-    gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 5);
+    gtk_widget_show ( GTK_WIDGET ( widget ) );
+    gtk_box_pack_start ( GTK_BOX ( hbox ), widget, FALSE, FALSE, 5 );
 
-    widget = gtk_label_new(NULL);
-    gtk_label_set_markup(GTK_LABEL(widget),
+    widget = gtk_label_new ( NULL );
+    gtk_label_set_markup ( GTK_LABEL ( widget ),
 			 _("Please select an account and a duration\n"\
-			   "and select the estimate array tab."));
-    gtk_widget_show(GTK_WIDGET(widget));
-    gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 5);
+			   "and select the estimate array tab.") );
+    gtk_widget_show ( GTK_WIDGET ( widget ) );
+    gtk_box_pack_start ( GTK_BOX ( hbox ), widget, FALSE, FALSE, 5 );
 
-    hbox = gtk_hbox_new(FALSE, 5);
-    gtk_widget_show(GTK_WIDGET(hbox));
-    gtk_box_pack_start(GTK_BOX(page), hbox, FALSE, FALSE, 5);
+    /* boite des paramètres */
+    vbox = gtk_hbox_new ( FALSE, 5 );
+    gtk_widget_show ( GTK_WIDGET ( vbox ) );
+    gtk_box_pack_start ( GTK_BOX ( page ), vbox, FALSE, FALSE, 5 );
 
     /* create the account list */
-    tree_view = gtk_tree_view_new();
+    tree_view = bet_estimate_get_list_accounts ( vbox );
     g_object_set_data (G_OBJECT(notebook), "bet_account_treeview", tree_view);
-    gtk_widget_show(tree_view);
-
-    tree_model = gtk_tree_store_new(SPP_ACCOUNT_TREE_NUM_COLUMNS, G_TYPE_STRING);
-    gtk_tree_view_set_model(GTK_TREE_VIEW(tree_view), GTK_TREE_MODEL(tree_model));
-    g_object_unref (G_OBJECT(tree_model));
-
-    tree_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view));
-    gtk_tree_selection_set_mode(tree_selection, GTK_SELECTION_SINGLE);
-    g_signal_connect(G_OBJECT(tree_selection),
-                        "changed",
-                        G_CALLBACK(bet_account_selection_changed),
-                        NULL);
-
-    scrolled_window = gtk_scrolled_window_new ( NULL, NULL );
-    gtk_widget_show(scrolled_window);
-    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
-				   GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-    gtk_container_add (GTK_CONTAINER(scrolled_window), tree_view);
-    gtk_widget_show(scrolled_window);
-    gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(scrolled_window), TRUE, TRUE, 0);
-
-    cell = gtk_cell_renderer_text_new ();
-    column = gtk_tree_view_column_new_with_attributes (
-                        _("Account"), cell,
-                        "text", SPP_ACCOUNT_TREE_NAME_COLUMN,
-                        NULL);
-    gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view),
-				GTK_TREE_VIEW_COLUMN(column));
 
     /* create duration selection */
-    vbox = gtk_vbox_new(FALSE, 5);
-    gtk_widget_show(GTK_WIDGET(vbox));
-    gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(vbox), FALSE, FALSE, 5);
-
-    for (iduration = 0; bet_duration_array[iduration] != NULL; iduration++)
-    {
-        GtkWidget *widget;
-
-        if (previous == NULL)
-        {
-            widget = gtk_radio_button_new_with_label(NULL,
-                        _(bet_duration_array[iduration]));
-            previous = widget;
-        } 
-        else 
-        {
-            widget = gtk_radio_button_new_with_label_from_widget(
-                        GTK_RADIO_BUTTON(previous),
-                        _(bet_duration_array[iduration]));
-        }
-        gtk_widget_show(GTK_WIDGET(widget));
-        gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(widget), FALSE, FALSE, 5);
-        g_signal_connect(G_OBJECT(widget),
-                        "toggled",
-                        G_CALLBACK(bet_duration_button_clicked),
-                        GINT_TO_POINTER(bet_months_array[iduration]));
-    }
+    vbox = bet_estimate_get_duration_widget ( vbox );
 
     /****** Estimation array page ******/
     widget = gtk_label_new(_("Array"));
@@ -395,6 +313,7 @@
     return notebook;
 }
 
+
 /*
  * bet_update_balance_estimate_tab
  *
@@ -452,6 +371,7 @@
         bet_estimate_refresh ();
 }
 
+
 /*
  * bet_date_sort_function
  * This function is called by the Tree Model to sort
@@ -490,6 +410,7 @@
     return result;
 }
 
+
 /*
  * bet_update_average_column
  *
@@ -571,6 +492,7 @@
     return FALSE;
 }
 
+
 /*
  * bet_update_graph
  * This function is called for each line of the estimate array and it updates
@@ -627,6 +549,7 @@
     gchar *tmp_str;
     gint selected_account;
     gint months;
+    gint period;
     GDate *date_min;
     GDate *date_max;
     gsb_real current_balance;
@@ -655,10 +578,19 @@
     /* calculatextern gboolean balances_with_scheduled;e date_max with user choice */
     data = g_object_get_data ( G_OBJECT ( bet_container ), "bet_months" );
     months = ( data ) ? GPOINTER_TO_INT ( data ): 1;
+    data = g_object_get_data ( G_OBJECT ( bet_container ), "bet_period" );
+    period = ( data ) ? GPOINTER_TO_INT ( data ): 2;
+
     date_min = gdate_today ();
     date_max = gdate_today ();
     g_date_add_months (date_max, months );
 
+    if ( period == 1 )
+    {
+        g_date_set_day ( date_min, 1 );
+        date_max = gsb_date_get_last_day_of_month ( date_max );
+    }
+
     /* set the graph title and the array title */
     str_date_min = gsb_format_gdate ( date_min );
     g_value_init ( &date_value, G_TYPE_DATE );
@@ -815,10 +747,9 @@
         gchar *str_value;
         gchar *str_debit = NULL;
         gchar *str_credit = NULL;
-        const gchar *str_description;
+        const gchar *str_description = NULL;
         gchar *str_date;
         gint scheduled_number;
-        //~ gint transfer_number;
         gint account_number;
         gint transfer_account_number;
         GDate *date;
@@ -826,29 +757,54 @@
         gsb_real amount;
 
         scheduled_number = gsb_data_scheduled_get_scheduled_number ( tmp_list->data );
+
         tmp_list = tmp_list->next;
 
         /* ignore children scheduled operations */
-        if (gsb_data_scheduled_get_mother_scheduled_number(scheduled_number))
+        if (gsb_data_scheduled_get_mother_scheduled_number ( scheduled_number ) )
             continue;
 
         /* ignore scheduled operations of other account */
         account_number = gsb_data_scheduled_get_account_number ( scheduled_number );
-        if ( account_number != selected_account )
-            continue;
 
-        transfer_account_number =
-            gsb_data_scheduled_get_account_number_transfer ( scheduled_number );
-        //~ if ( account_number != selected_account &&
-            //~ transfer_account_number != selected_account)
-            //~ continue;
+        if ( gsb_data_scheduled_is_transfer ( scheduled_number ) )
+        {
+            transfer_account_number = gsb_data_scheduled_get_account_number_transfer (
+                        scheduled_number );
+            if ( transfer_account_number == selected_account )
+            {
+                str_description = g_strdup_printf ( _("Transfer between account: %s\n"
+                        "and account: %s"),
+                        gsb_data_account_get_name ( transfer_account_number ),
+                        gsb_data_account_get_name ( account_number ) );
+            
+                amount = gsb_real_opposite ( gsb_data_scheduled_get_amount (
+                        scheduled_number ) );
+            }
+            else if ( account_number == selected_account )
+            {
+                str_description = g_strdup_printf ( _("Transfer between account: %s\n"
+                        "and account: %s"),
+                        gsb_data_account_get_name ( account_number ),
+                        gsb_data_account_get_name ( transfer_account_number ) );
 
-        str_description = gsb_data_scheduled_get_notes ( scheduled_number );
-        amount = gsb_data_scheduled_get_amount ( scheduled_number );
+                amount = gsb_data_scheduled_get_amount ( scheduled_number );
+            }
+            else
+                continue;
+        }
+        else if ( account_number == selected_account )
+        {
+            str_description = gsb_data_scheduled_get_notes ( scheduled_number );
 
-        if ( !str_description || !strlen (str_description))
-            str_description = gsb_data_payee_get_name (
-                        gsb_data_scheduled_get_party_number ( scheduled_number ), TRUE );
+            if ( !str_description || !strlen ( str_description ) )
+                str_description = gsb_data_payee_get_name (
+                            gsb_data_scheduled_get_party_number ( scheduled_number ), TRUE );
+
+            amount = gsb_data_scheduled_get_amount ( scheduled_number );
+        }
+        else
+            continue;
 
         str_value = gsb_real_get_string ( amount );
         if (amount.mantissa < 0)
@@ -858,15 +814,6 @@
             str_credit = gsb_real_get_string_with_currency ( gsb_real_abs ( amount ),
                         gsb_data_scheduled_get_currency_number ( scheduled_number ), TRUE );
 
-        /* with transfer transactions, reverse debit and credit */
-        //~ if (transfer_account_number == selected_account)
-        //~ {
-            //~ gchar *tmpstr;
-            //~ tmpstr = str_debit;
-            //~ str_debit = str_credit;
-            //~ str_credit = tmpstr;
-        //~ }
-
         /* calculate each instance of the scheduled operation
          * in the range from date_min (today) to date_max */
         date = gsb_data_scheduled_get_date ( scheduled_number );
@@ -934,4 +881,245 @@
 			   bet_update_graph, widget );
 }
 
+
+/*
+ * bet_duration_period_clicked
+ * This function is called when a radio button is called to change the inial period.
+ * It copies the new durations from the data parameter (of the radio button) into
+ * the bet_period property of the bet container
+ */
+static void bet_duration_period_clicked ( GtkWidget *togglebutton, gpointer data )
+{
+    gint period = 0;
+    const gchar *name;
+    
+    name = gtk_widget_get_name ( GTK_WIDGET ( togglebutton ) );
+    if ( g_strcmp0 ( name, "button_1" ) == 0 )
+        period = 1;
+    else
+        period = 2;
+
+    g_object_set_data ( G_OBJECT ( bet_container ), "bet_period",
+                        GINT_TO_POINTER ( period ) );
+
+    bet_estimate_refresh ( );
+}
+
+
+/*
+ * bet_duration_button_clicked
+ * This function is called when a radio button is called to change the estimate duration.
+ * It copies the new durations from the data parameter (of the radio button) into
+ * the bet_months property of the bet container
+ */
+static void bet_duration_button_clicked ( GtkWidget *togglebutton, GtkWidget *spin_button )
+{
+    gint months;
+    const gchar *name;
+    
+    name = gtk_widget_get_name ( GTK_WIDGET ( togglebutton ) );
+    months = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON ( spin_button ) );
+
+    if ( g_strcmp0 ( name, "Year" ) == 0 )
+    {
+        gtk_spin_button_set_range ( GTK_SPIN_BUTTON ( spin_button ), 1.0, 20.0 );
+        if ( months > 20 )
+        {
+            gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( spin_button ), 20 );
+            months = 240;
+        }
+        else
+            months *= 12;
+    }
+    else
+        gtk_spin_button_set_range ( GTK_SPIN_BUTTON ( spin_button ), 1.0, 240.0 );
+
+    g_object_set_data ( G_OBJECT ( bet_container ), "bet_months",
+                        GINT_TO_POINTER ( months ) );
+
+    if ( etat.modification_fichier == 0 )
+        modification_fichier ( TRUE );
+
+    bet_estimate_refresh ( );
+}
+
+
+/*
+ * bet_duration_button changed
+ * This function is called when a spin button is changed.
+ * It copies the new duration from the spin_button into the bet_months property of
+ * the bet container
+ */
+gboolean bet_duration_number_changed ( GtkWidget *spin_button, GtkWidget *togglebutton )
+{
+    gint months = 0;
+    gboolean toggled;
+
+    months = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON ( spin_button ) );
+
+    toggled = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( togglebutton ) );
+    if ( toggled == 1 )
+        months *= 12;
+
+    g_object_set_data ( G_OBJECT ( bet_container ), "bet_months", GINT_TO_POINTER ( months ) );
+
+    if ( etat.modification_fichier == 0 )
+        modification_fichier ( TRUE );
+
+    bet_estimate_refresh();
+
+    return ( FALSE );
+}
+
+
+/*
+ * bet_account_selection_changed
+ * This function is called for each change in the selected line in the account list.
+ * It refreshs balance estimation.
+ */
+static void bet_account_selection_changed ( GtkTreeSelection *treeselection,
+                        gpointer user_data )
+{
+    bet_estimate_refresh();
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+GtkWidget *bet_estimate_get_list_accounts ( GtkWidget *container )
+{
+    GtkWidget *scrolled_window;
+    GtkWidget *tree_view;
+    GtkTreeStore *tree_model;
+    GtkTreeSelection *tree_selection;
+    GtkCellRenderer *cell;
+    GtkTreeViewColumn *column;
+
+    tree_view = gtk_tree_view_new();
+
+    tree_model = gtk_tree_store_new (SPP_ACCOUNT_TREE_NUM_COLUMNS, G_TYPE_STRING );
+    gtk_tree_view_set_model ( GTK_TREE_VIEW (tree_view), GTK_TREE_MODEL ( tree_model ) );
+    g_object_unref ( G_OBJECT ( tree_model ) );
+
+    tree_selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW ( tree_view ) );
+    gtk_tree_selection_set_mode ( tree_selection, GTK_SELECTION_SINGLE );
+    g_signal_connect ( G_OBJECT ( tree_selection ),
+                        "changed",
+                        G_CALLBACK (bet_account_selection_changed),
+                        NULL );
+
+    scrolled_window = gtk_scrolled_window_new ( NULL, NULL );
+    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scrolled_window),
+				   GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
+    gtk_widget_set_size_request ( scrolled_window, -1, 250 );
+    gtk_container_add (GTK_CONTAINER(scrolled_window), tree_view);
+    gtk_widget_show(scrolled_window);
+    gtk_box_pack_start ( GTK_BOX ( container ), scrolled_window, TRUE, TRUE, 15 );
+
+    cell = gtk_cell_renderer_text_new ();
+    column = gtk_tree_view_column_new_with_attributes (
+                        _("Account"), cell,
+                        "text", SPP_ACCOUNT_TREE_NAME_COLUMN,
+                        NULL);
+    gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view),
+				GTK_TREE_VIEW_COLUMN(column));
+
+    gtk_widget_show_all ( scrolled_window );
+
+    return tree_view;
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+GtkWidget *bet_estimate_get_duration_widget ( GtkWidget *container )
+{
+    GtkWidget* main_vbox;
+    GtkWidget *label;
+    GtkWidget *spin_button, *button_1, *button_2;
+    GtkWidget *widget;
+    GtkWidget *vbox;
+    GtkWidget *hbox;
+    GtkWidget *previous = NULL;
+    gint iduration;
+
+    main_vbox = gtk_vbox_new ( FALSE, 5 );
+    gtk_box_pack_start ( GTK_BOX ( container ), main_vbox, FALSE, FALSE, 5) ;
+
+    label = gtk_label_new ( _("Calculation of period") );
+    gtk_box_pack_start ( GTK_BOX ( main_vbox ), label, FALSE, FALSE, 5) ;
+
+    vbox = gtk_vbox_new ( FALSE, 5 );
+    gtk_box_pack_start ( GTK_BOX ( main_vbox ), vbox, FALSE, FALSE, 5) ;
+
+    button_1 = gtk_radio_button_new_with_label ( NULL,
+                        _("1st day of month to last day of the month concerned") );
+    gtk_widget_set_name ( button_1, "button_1" );
+    
+    g_signal_connect (G_OBJECT ( button_1 ),
+                        "released",
+                        G_CALLBACK ( bet_duration_period_clicked ),
+                        NULL );
+    g_object_set_data ( G_OBJECT ( bet_container ), "bet_period", GINT_TO_POINTER ( 1 ) );
+    button_2 = gtk_radio_button_new_with_label_from_widget (
+                        GTK_RADIO_BUTTON ( button_1 ),
+                        _("From date to date") );
+    gtk_widget_set_name ( button_2, "button_2" );
+    g_signal_connect (G_OBJECT ( button_2 ),
+                        "released",
+                        G_CALLBACK ( bet_duration_period_clicked ),
+                        NULL );
+
+                        gtk_box_pack_start ( GTK_BOX ( vbox ), button_1, FALSE, FALSE, 5) ;
+    gtk_box_pack_start ( GTK_BOX ( vbox ), button_2, FALSE, FALSE, 5) ;
+    
+    /* partie mensuelle */
+    label = gtk_label_new ( _("Duration estimation") );
+    gtk_box_pack_start ( GTK_BOX ( main_vbox ), label, FALSE, FALSE, 5) ;
+
+    hbox = gtk_hbox_new ( FALSE, 5 );
+    gtk_box_pack_start ( GTK_BOX ( main_vbox ), hbox, FALSE, FALSE, 5) ;
+
+    spin_button = gtk_spin_button_new_with_range ( 1.0, 240.0, 1.0);
+
+    for (iduration = 0; bet_duration_array[iduration] != NULL; iduration++)
+    {
+        if (previous == NULL)
+        {
+            widget = gtk_radio_button_new_with_label ( NULL,
+                        _(bet_duration_array[iduration]) );
+            previous = widget;
+        } 
+        else 
+        {
+            widget = gtk_radio_button_new_with_label_from_widget (
+                        GTK_RADIO_BUTTON ( previous ),
+                        _(bet_duration_array[iduration]) );
+        }
+        gtk_widget_set_name ( widget, bet_duration_array[iduration] );
+        gtk_box_pack_start ( GTK_BOX ( hbox ), widget, FALSE, FALSE, 5 );
+        g_signal_connect (G_OBJECT ( widget ),
+                        "released",
+                        G_CALLBACK ( bet_duration_button_clicked ),
+                        spin_button );
+    }
+
+    g_signal_connect ( G_OBJECT ( spin_button ),
+                        "value-changed",
+                        G_CALLBACK ( bet_duration_number_changed ),
+                        widget );
+    gtk_box_pack_start ( GTK_BOX ( hbox ), spin_button, FALSE, FALSE, 0 );
+    
+    gtk_widget_show_all ( main_vbox );
+
+    return main_vbox;
+}
 #endif /* ENABLE_BALANCE_ESTIMATE */

Index: gsb_reconcile.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_reconcile.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- gsb_reconcile.c	5 Dec 2009 06:54:43 -0000	1.43
+++ gsb_reconcile.c	9 Jan 2010 20:57:38 -0000	1.44
@@ -516,7 +516,7 @@
 
     if (!strlen (gtk_entry_get_text ( GTK_ENTRY ( reconcile_number_entry ))))
     {
-	dialogue_warning_hint ( _("You need to set a name to the reconciliation ; at least, set a number,\nit will be automaticaly incremented later"),
+	dialogue_warning_hint ( _("You need to set a name to the reconciliation ; at least, set a number,\nit will be automatically incremented later"),
 				_("Reconciliation can't be completed.") );
 	return FALSE;
     }



More information about the cvs mailing list