[grisbi-cvs] grisbi/src Makefile.am, 1.159, 1.160 affichage_liste.c, 1.113, 1.114 dialog.h, 1.30, 1.31 gsb_data_budget.c, 1.52, 1.53 gsb_file_config.c, 1.85, 1.86 gsb_scheduler_list.c, 1.73, 1.74 gsb_transactions_list.c, 1.183, 1.184 gsb_transactions_list_sort.c, 1.18, 1.19 structures.h, 1.233, 1.234

Pierre Biava pbiava at users.sourceforge.net
Wed Sep 23 22:28:23 CEST 2009


Update of /cvsroot/grisbi/grisbi/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8529/src

Modified Files:
	Makefile.am affichage_liste.c dialog.h gsb_data_budget.c 
	gsb_file_config.c gsb_scheduler_list.c gsb_transactions_list.c 
	gsb_transactions_list_sort.c structures.h 
Log Message:
Adding options for sorting by value date

Index: structures.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/structures.h,v
retrieving revision 1.233
retrieving revision 1.234
diff -u -d -r1.233 -r1.234
--- structures.h	30 Aug 2009 17:59:48 -0000	1.233
+++ structures.h	23 Sep 2009 20:28:21 -0000	1.234
@@ -54,8 +54,6 @@
     gint alerte_permission;                 /* à un si le message d'alerte s'affiche */
     gint fichier_deja_ouvert;               /* à un si lors de l'ouverture, le fichier semblait déjà ouvert */
     gint force_enregistrement;              /* à un si on force l'enregistrement */
-    gint show_transaction_selected_in_form; /* TRUE will show the selected transaction in the form */
-    gint show_transaction_gives_balance;    /* TRUE si on visualise l'opération qui donne le solde du jour */
     gint affichage_exercice_automatique;    /* automatic fyear :0 to set according to the date, 2 according to value date */
     gint automatic_completion_payee;        /* 1 pour autoriser la completion automatique des opérations */
     gboolean limit_completion_to_current_account;   /** Limit payee *
@@ -139,6 +137,12 @@
     gint add_archive_in_total_balance;      /* Add transactions archived in the totals */
 } etat;
 
+
+/**
+ * variables containing just 0 or 1
+ * configured by the file grisbi.conf
+ *
+ */
 struct {
 
     /* geometry */
@@ -151,6 +155,11 @@
     /* general part */
     gint r_modifiable;                              /* Changes in reconciled transactions */
 
+    /* variables pour la liste des opérations */
+    gint show_transaction_selected_in_form;         /* TRUE will show the selected transaction in the form */
+    gint show_transaction_gives_balance;            /* TRUE si on visualise l'opération qui donne le solde du jour */
+    gboolean transactions_list_sort_by_value_date;  /* Options for sorting by value date */
+
     /* archive stuff */
     gint check_for_archival; /* TRUE if we want to check the number of non archived transactions at the opening */
     gint max_non_archived_transactions_for_check; /* the max number of transaction before grisbi warm at the opening */

Index: gsb_data_budget.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_budget.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- gsb_data_budget.c	30 Aug 2009 17:59:47 -0000	1.52
+++ gsb_data_budget.c	23 Sep 2009 20:28:20 -0000	1.53
@@ -1524,7 +1524,7 @@
      * but the 2 parts are exactly the same, exept the call to the functions */
     if (is_transaction)
     {
-	if (!string)
+	if (!string || strlen ( string ) == 0 )
 	{
 	    gsb_data_transaction_set_budgetary_number ( transaction_number, 0 );
 	    gsb_data_transaction_set_sub_budgetary_number ( transaction_number, 0 );

Index: gsb_scheduler_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_scheduler_list.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- gsb_scheduler_list.c	24 Aug 2009 13:56:59 -0000	1.73
+++ gsb_scheduler_list.c	23 Sep 2009 20:28:20 -0000	1.74
@@ -1426,8 +1426,8 @@
     if (tmp_number)
         last_scheduled_number = tmp_number;
 
-    /* if etat.show_transaction_selected_in_form => edit the scheduled transaction */
-    if ( tmp_number != 0 && etat.show_transaction_selected_in_form )
+    /* if conf.show_transaction_selected_in_form => edit the scheduled transaction */
+    if ( tmp_number != 0 && conf.show_transaction_selected_in_form )
             gsb_scheduler_list_edit_transaction (tmp_number);
     else if ( tmp_number == 0 )
     {

Index: affichage_liste.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/affichage_liste.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- affichage_liste.c	24 Aug 2009 08:57:45 -0000	1.113
+++ affichage_liste.c	23 Sep 2009 20:28:20 -0000	1.114
@@ -38,6 +38,7 @@
 #include "./utils_str.h"
 #include "./structures.h"
 #include "./custom_list.h"
+#include "./fenetre_principale.h"
 #include "./gtk_combofix.h"
 #include "./gsb_data_form.h"
 #include "./include.h"
@@ -50,6 +51,8 @@
 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 );
 static gboolean gsb_transactions_list_display_update_auto_completion ( GtkWidget *checkbutton,
                         GtkWidget *button );
 static gboolean gsb_transactions_list_display_update_combofix ( void );
@@ -176,17 +179,26 @@
     gtk_box_pack_start ( GTK_BOX ( paddingbox ),
                         gsb_automem_checkbutton_new (
                         _("Use simple click to select transactions"),
-                        &etat.show_transaction_selected_in_form,
+                        &conf.show_transaction_selected_in_form,
                         NULL, NULL ),
                         FALSE, FALSE, 0 );
 
     gtk_box_pack_start ( GTK_BOX ( paddingbox ),
                         gsb_automem_checkbutton_new (
                         _("Highlights the transaction that gives the balance today"),
-                        &etat.show_transaction_gives_balance,
+                        &conf.show_transaction_gives_balance,
                         G_CALLBACK ( gsb_transactions_list_display_show_gives_balance ), NULL ),
                         FALSE, FALSE, 0 );
 
+    /* Sorting the transactions by value date */
+    gsb_automem_radiobutton_new_with_title ( vbox_pref,
+                        _("Options for sorting by value date"),
+                        _("Sort by value date (if fail, try with the date)"),
+                        _("Sort by value date and then by date"),
+                        &conf.transactions_list_sort_by_value_date,
+                        G_CALLBACK ( gsb_transactions_list_display_sort_by_value_date ),
+                        NULL );
+
     /* Account distinction */
     paddingbox = new_paddingbox_with_title (vbox_pref, FALSE, 
                         _("Account differentiation"));
@@ -208,6 +220,31 @@
 
 
 /**
+ *
+ *
+ * */
+gboolean gsb_transactions_list_display_sort_by_value_date ( GtkWidget *checkbutton,
+                        gpointer null )
+{
+    gint page_number;
+    gint account_nb;
+
+    page_number = gsb_gui_navigation_get_current_page ( );
+
+    switch ( page_number )
+    {
+	case GSB_ACCOUNT_PAGE:
+        account_nb = gsb_gui_navigation_get_current_account ();
+        if (account_nb != -1)
+            gsb_transactions_list_update_tree_view (account_nb, TRUE);
+	    break;
+    }
+
+    return FALSE;
+}
+
+
+/**
  * called when we change a button for the display mode
  *
  * \param button 	the combo box wich changed

Index: gsb_transactions_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list.c,v
retrieving revision 1.183
retrieving revision 1.184
diff -u -d -r1.183 -r1.184
--- gsb_transactions_list.c	12 Sep 2009 19:33:40 -0000	1.183
+++ gsb_transactions_list.c	23 Sep 2009 20:28:21 -0000	1.184
@@ -232,7 +232,7 @@
     transaction_list_filter ( account_number );
     transaction_list_sort ();
     transaction_list_colorize ();
-    if ( etat.show_transaction_gives_balance )
+    if ( conf.show_transaction_gives_balance )
         transaction_list_set_color_jour ( account_number );
     transaction_list_set_balances ( );
     if ( keep_selected_transaction )
@@ -1324,7 +1324,7 @@
 
     /* show the content of the transaction in the form,
      * only if the form is shown */
-    if ( etat.show_transaction_selected_in_form
+    if ( conf.show_transaction_selected_in_form
     &&
     gsb_form_is_visible () )
         gsb_form_fill_by_transaction (new_selected_transaction, TRUE, FALSE);
@@ -1897,7 +1897,7 @@
 
     /* update the tree view */
     transaction_list_colorize ();
-    if ( etat.show_transaction_gives_balance )
+    if ( conf.show_transaction_gives_balance )
         transaction_list_set_color_jour ( account_number );
     transaction_list_set_balances ();
     transaction_list_select (gsb_data_account_get_current_transaction_number (account_number));
@@ -3026,7 +3026,7 @@
 				       sort_type );
     transaction_list_sort ();
     transaction_list_colorize ();
-    if ( etat.show_transaction_gives_balance )
+    if ( conf.show_transaction_gives_balance )
         transaction_list_set_color_jour ( account_number );
     transaction_list_set_balances ();
     transaction_list_select (selected_transaction);

Index: gsb_transactions_list_sort.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list_sort.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- gsb_transactions_list_sort.c	22 Sep 2009 20:58:29 -0000	1.18
+++ gsb_transactions_list_sort.c	23 Sep 2009 20:28:21 -0000	1.19
@@ -46,6 +46,7 @@
 #include "./custom_list.h"
 #include "./gsb_transactions_list.h"
 #include "./include.h"
+#include "./structures.h"
 #include "./gsb_real.h"
 #include "./erreur.h"
 /*END_INCLUDE*/
@@ -487,11 +488,11 @@
     /* need to work a little more here because value date is not obligatory filled,
      * if we compare 2 transactions and 1 has no value date, set the value date before */
     value_date_1 = gsb_data_transaction_get_value_date ( transaction_number_1 );
-    if ( ! value_date_1 )
+    if ( ! value_date_1 && !conf.transactions_list_sort_by_value_date )
         value_date_1 = gsb_data_transaction_get_date ( transaction_number_1 );
 
     value_date_2 = gsb_data_transaction_get_value_date ( transaction_number_2 );
-    if ( ! value_date_2 )
+    if ( ! value_date_2 && !conf.transactions_list_sort_by_value_date )
         value_date_2 = gsb_data_transaction_get_date ( transaction_number_2 );
 
     if ( value_date_1 )
@@ -501,12 +502,12 @@
         else
             return_value = -1;
     }
-    else 
+    else
     {
         if (value_date_2)
             return_value = 1;
         else
-            return 0;
+            return_value = 0;
     }
 
     if ( return_value )
@@ -517,7 +518,6 @@
 }
 
 
-
 /** used to compare 2 iters and sort the by party first, and 
  * by date and no transaction after
  * always put the white line below

Index: dialog.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/dialog.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- dialog.h	2 Sep 2008 17:02:05 -0000	1.30
+++ dialog.h	23 Sep 2009 20:28:20 -0000	1.31
@@ -15,7 +15,7 @@
 const gchar *dialogue_hint_with_entry ( gchar *text, gchar *hint, gchar *entry_description );
 void dialogue_special ( GtkMessageType param, gchar * text );
 GtkWidget * dialogue_special_no_run ( GtkMessageType param, GtkButtonsType buttons,
-				      gchar * text );
+				      gchar *text );
 void dialogue_warning ( gchar *text );
 void dialogue_warning_hint ( gchar *text, gchar * hint );
 gchar * make_hint ( gchar * hint, gchar * text );

Index: Makefile.am
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/Makefile.am,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- Makefile.am	22 Jul 2009 19:45:42 -0000	1.159
+++ Makefile.am	23 Sep 2009 20:28:20 -0000	1.160
@@ -157,15 +157,15 @@
 	categories_onglet.h	\
 	classement_echeances.h	\
 	comptes_onglet.h	\
-        csv_parse.h             \
+    csv_parse.h             \
 	custom_list.h		\
-        etats_affiche.h         \
-        etats_csv.h             \
-        etats_html.h            \
-        export.h                \
-        export_csv.h            \
-        go-charmap-sel.h        \
-        go-optionmenu.h         \
+    etats_affiche.h         \
+    etats_csv.h             \
+    etats_html.h            \
+    export.h                \
+    export_csv.h            \
+    go-charmap-sel.h        \
+    go-optionmenu.h         \
 	gsb_account.h		\
 	gsb_account_property.h	\
 	gsb_archive_config.h	\
@@ -183,8 +183,7 @@
 	gsb_combo_box.h		\
 	gsb_calendar.h		\
 	gsb_calendar_entry.h	\
-        gsb_crypt.h             \
-	gsb_currency.h		\
+    gsb_currency.h		\
 	gsb_currency_config.h	\
 	gsb_currency_link_config.h	\
 	gsb_data_account.h	\
@@ -225,14 +224,14 @@
 	gsb_fyear_config.h	\
 	gsb_payment_method.h	\
 	gsb_payment_method_config.h	\
-        gsb_plugins.h           \
+    gsb_plugins.h           \
 	gsb_real.h		\
 	gsb_reconcile.h		\
 	gsb_reconcile_config.h	\
 	gsb_reconcile_list.h	\
 	gsb_reconcile_sort_config.h	\
 	gsb_report.h		\
-        gsb_status.h            \
+    gsb_status.h            \
 	gsb_select_icon.h 	\
 	gsb_scheduler.h		\
 	gsb_scheduler_list.h	\

Index: gsb_file_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_config.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- gsb_file_config.c	6 Sep 2009 20:13:52 -0000	1.85
+++ gsb_file_config.c	23 Sep 2009 20:28:20 -0000	1.86
@@ -320,16 +320,21 @@
                         "Show transaction form",
                         NULL );
 
-    etat.show_transaction_selected_in_form = g_key_file_get_integer ( config,
+    conf.show_transaction_selected_in_form = g_key_file_get_integer ( config,
                         "Display",
                         "Show selected transaction in form",
                         NULL );
 
-    etat.show_transaction_gives_balance = g_key_file_get_integer ( config,
+    conf.show_transaction_gives_balance = g_key_file_get_integer ( config,
                         "Display",
                         "Show transaction gives balance",
                         NULL );
 
+    conf.transactions_list_sort_by_value_date = g_key_file_get_integer ( config,
+                        "Display",
+                        "Transactions list sort by value date",
+                        NULL );
+
     etat.largeur_auto_colonnes = g_key_file_get_integer ( config,
                         "Display",
                         "Columns width auto",
@@ -659,12 +664,17 @@
     g_key_file_set_integer ( config,
                         "Display",
                         "Show selected transaction in form",
-                        etat.show_transaction_selected_in_form );
+                        conf.show_transaction_selected_in_form );
 
     g_key_file_set_integer ( config,
                         "Display",
                         "Show transaction gives balance",
-                        etat.show_transaction_gives_balance );
+                        conf.show_transaction_gives_balance );
+
+    g_key_file_set_integer ( config,
+                        "Display",
+                        "Transactions list sort by value date",
+                        conf.transactions_list_sort_by_value_date );
 
     g_key_file_set_integer ( config,
                         "Display",
@@ -1216,8 +1226,9 @@
     etat.display_toolbar = GSB_BUTTON_BOTH;         /* How to display toolbar icons. */
     etat.show_toolbar = TRUE;                       /* Show toolbar or not. */
     etat.show_headings_bar = TRUE;                  /* Show toolbar or not. */
-    etat.show_transaction_selected_in_form = 1;     /* show selected transaction in form */
-    etat.show_transaction_gives_balance = 1;         /* show transaction that gives the balance of the day */
+    conf.show_transaction_selected_in_form = 1;     /* show selected transaction in form */
+    conf.show_transaction_gives_balance = 1;        /* show transaction that gives the balance of the day */
+    conf.transactions_list_sort_by_value_date = 1;  /* Options for sorting by value date */  
     etat.show_closed_accounts = FALSE;
 
     if (etat.font_string)



More information about the cvs mailing list