[grisbi-cvs] grisbi/src gsb_file.c, 1.51, 1.52 gsb_form.c, 1.123, 1.124 gsb_form_widget.c, 1.31, 1.32 utils_dates.c, 1.53, 1.54 utils_dates_cunit.c, 1.3, 1.4

Pierre Biava pbiava at users.sourceforge.net
Sun May 24 18:42:41 CEST 2009


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

Modified Files:
	gsb_file.c gsb_form.c gsb_form_widget.c utils_dates.c 
	utils_dates_cunit.c 
Log Message:
578 bug fixes and minor adjustments

Index: utils_dates.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils_dates.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- utils_dates.c	19 May 2009 18:24:58 -0000	1.53
+++ utils_dates.c	24 May 2009 16:42:39 -0000	1.54
@@ -423,7 +423,8 @@
             break;
         }
     }
-    g_strfreev ( tab_date );
+    /* comment for random crash. Memory allocation problem in split_unique_datefield () */
+    //~ g_strfreev ( tab_date );
 
     /* need here to check if the date is valid, else an error occurs when
      * write for example only 31, and the current month has only 30 days... */

Index: gsb_form.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form.c,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -d -r1.123 -r1.124
--- gsb_form.c	19 May 2009 18:24:58 -0000	1.123
+++ gsb_form.c	24 May 2009 16:42:39 -0000	1.124
@@ -1,8 +1,8 @@
 /* ************************************************************************** */
 /*                                                                            */
-/*     copyright (c)	2000-2008 Cédric Auger (cedric at grisbi.org)	          */
-/*			2004-2008 Benjamin Drieu (bdrieu at april.org) 	                  */
-/*			http://www.grisbi.org   			                              */
+/*     copyright (c)    2000-2008 Cédric Auger (cedric at grisbi.org)            */
+/*          2004-2008 Benjamin Drieu (bdrieu at april.org)                       */
+/*          http://www.grisbi.org                                             */
 /*                                                                            */
 /*  This program is free software; you can redistribute it and/or modify      */
 /*  it under the terms of the GNU General Public License as published by      */
@@ -85,23 +85,23 @@
 
 /*START_STATIC*/
 static gboolean gsb_form_activate_expander ( GtkWidget *expander,
-				      gpointer null );
+                        gpointer null );
 static gboolean gsb_form_button_press ( GtkWidget *vbox,
-				 GdkEventButton *ev,
-				 gpointer null );
+                        GdkEventButton *ev,
+                        gpointer null );
 static gint gsb_form_check_for_transfer ( const gchar *entry_string );
 static gboolean gsb_form_get_categories ( gint transaction_number,
-				   gint new_transaction,
-				   gboolean is_transaction );
+                        gint new_transaction,
+                        gboolean is_transaction );
 static gint gsb_form_get_element_expandable ( gint element_number );
 static gboolean gsb_form_hide ( void );
 static  gboolean gsb_form_size_allocate ( GtkWidget *widget,
-					 GtkAllocation *allocation,
-					 gpointer null );
+                        GtkAllocation *allocation,
+                        gpointer null );
 static void gsb_form_take_datas_from_form ( gint transaction_number,
-				     gboolean is_transaction );
+                        gboolean is_transaction );
 static gboolean gsb_form_validate_form_transaction ( gint transaction_number,
-					      gboolean is_transaction );
+                        gboolean is_transaction );
 /*END_STATIC*/
 
 /*START_EXTERN*/
@@ -375,8 +375,8 @@
  * \return FALSE
  * */
 static gboolean gsb_form_size_allocate ( GtkWidget *widget,
-					 GtkAllocation *allocation,
-					 gpointer null )
+                        GtkAllocation *allocation,
+                        gpointer null )
 {
     if (gsb_form_is_visible () && !block_size_allocate)
     {
@@ -400,8 +400,8 @@
  * \return FALSE
  * */
 gboolean gsb_form_fill_by_transaction ( gint transaction_number,
-					gint is_transaction,
-					gboolean grab_focus )
+                        gint is_transaction,
+                        gboolean grab_focus )
 {
     gint mother_number;
     gint account_number;
@@ -581,7 +581,7 @@
  * \return FALSE
  * */
 gboolean gsb_form_set_sensitive ( gboolean split,
-				  gboolean split_child)
+                        gboolean split_child)
 {
     GSList *tmp_list;
 
@@ -653,9 +653,9 @@
  * \return
  * */
 void gsb_form_fill_element ( gint element_number,
-			     gint account_number,
-			     gint transaction_number,
-			     gboolean is_transaction )
+                        gint account_number,
+                        gint transaction_number,
+                        gboolean is_transaction )
 {
     GtkWidget *widget;
     gchar *char_tmp;
@@ -928,7 +928,7 @@
  * return FALSE
  * */
 gboolean gsb_form_set_expander_visible ( gboolean visible,
-					 gboolean transactions_list )
+                        gboolean transactions_list )
 {
     if ( visible )
     {
@@ -974,7 +974,7 @@
  * \return FALSE
  * */
 gboolean gsb_form_activate_expander ( GtkWidget *expander,
-				      gpointer null )
+                        gpointer null )
 {
     devel_debug (NULL);
 
@@ -1499,8 +1499,8 @@
  * \return FALSE
  * */
 gboolean gsb_form_entry_lose_focus ( GtkWidget *entry,
-				     GdkEventFocus *ev,
-				     gint *ptr_origin )
+                        GdkEventFocus *ev,
+                        gint *ptr_origin )
 {
     gchar *string;
     gint element_number;
@@ -1836,8 +1836,8 @@
  * \return FALSE
  * */
 gboolean gsb_form_button_press_event ( GtkWidget *entry,
-				       GdkEventButton *ev,
-				       gint *ptr_origin )
+                        GdkEventButton *ev,
+                        gint *ptr_origin )
 {
     gint element_number;
     GtkWidget *widget;
@@ -1945,8 +1945,8 @@
  * \return FALSE
  * */
 gboolean gsb_form_key_press_event ( GtkWidget *widget,
-				    GdkEventKey *ev,
-				    gint *ptr_origin )
+                        GdkEventKey *ev,
+                        gint *ptr_origin )
 {
     gint element_number;
     gint account_number;
@@ -1986,9 +1986,22 @@
 	    break;
 
 	case GDK_ISO_Left_Tab:
-	    element_suivant = gsb_form_widget_next_element ( account_number,
+        element_suivant = gsb_form_widget_next_element ( account_number,
 							     element_number,
 							     GSB_LEFT );
+
+        if ( element_number == TRANSACTION_FORM_VALUE_DATE )
+        {
+            GtkWidget * widget_prov = gsb_form_widget_get_widget (
+                        TRANSACTION_FORM_VALUE_DATE);
+
+            if (strlen (gtk_entry_get_text (GTK_ENTRY (widget_prov))) == 0 )
+            {
+                gsb_form_widget_set_empty ( widget_prov, TRUE );
+                gtk_entry_set_text ( GTK_ENTRY ( widget_prov ), _("Value date") );
+            }
+            gsb_form_widget_set_focus ( element_suivant );
+        }
 	    if ( element_suivant == TRANSACTION_FORM_CREDIT )
         {
             if ( gsb_form_widget_check_empty (
@@ -2026,6 +2039,20 @@
 	    element_suivant = gsb_form_widget_next_element ( account_number,
 							     element_number,
 							     GSB_RIGHT );
+
+        /* si élément = date de valeur fix the bug 578 */
+        if ( element_number == TRANSACTION_FORM_VALUE_DATE )
+        {
+            GtkWidget * widget_prov = gsb_form_widget_get_widget (
+                        TRANSACTION_FORM_VALUE_DATE);
+
+            if (strlen (gtk_entry_get_text ( GTK_ENTRY ( widget_prov ) ) ) == 0 )
+            {
+                gsb_form_widget_set_empty ( widget_prov, TRUE );
+                gtk_entry_set_text ( GTK_ENTRY ( widget_prov ), _("Value date") );
+            }
+            gsb_form_widget_set_focus ( element_suivant );
+        }
 	    if ( element_suivant == -2 )
             gsb_form_finish_edition();
         /* fix the bug 494 */
@@ -2466,7 +2493,7 @@
  * \return TRUE or FALSE
  * */
 gboolean gsb_form_validate_form_transaction ( gint transaction_number,
-					      gboolean is_transaction )
+                        gboolean is_transaction )
 {
     gint account_number;
     GtkWidget *widget;
@@ -2690,7 +2717,7 @@
  * \return
  * */
 void gsb_form_take_datas_from_form ( gint transaction_number,
-				     gboolean is_transaction )
+                        gboolean is_transaction )
 {
     GSList *tmp_list;
     GDate *date;
@@ -2874,8 +2901,8 @@
  * \return FALSE
  * */
 gboolean gsb_form_get_categories ( gint transaction_number,
-				   gint new_transaction,
-				   gboolean is_transaction )
+                        gint new_transaction,
+                        gboolean is_transaction )
 {
     GtkWidget *category_combofix;
 
@@ -3124,8 +3151,8 @@
  * \return FALSE
  * */
 gboolean gsb_form_allocate_size ( GtkWidget *table,
-				  GtkAllocation *allocation,
-				  gpointer null )
+                        GtkAllocation *allocation,
+                        gpointer null )
 {
     gint row, column;
     gint account_number;
@@ -3215,8 +3242,8 @@
  * \return FALSE
  * */
 gboolean gsb_form_button_press ( GtkWidget *vbox,
-				 GdkEventButton *ev,
-				 gpointer null )
+                        GdkEventButton *ev,
+                        gpointer null )
 {
     GtkWidget *menu, *menu_item;
 

Index: utils_dates_cunit.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils_dates_cunit.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- utils_dates_cunit.c	24 May 2009 08:59:57 -0000	1.3
+++ utils_dates_cunit.c	24 May 2009 16:42:39 -0000	1.4
@@ -55,7 +55,7 @@
 /* The suite cleanup function.
  * Returns zero on success, non-zero otherwise.
  */
-int utils_dates_cunit_clean_suite(void)
+int utils_dates_cunit_clean_suite ( void )
 {
     return 0;
 }

Index: gsb_form_widget.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form_widget.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- gsb_form_widget.c	10 May 2009 13:06:56 -0000	1.31
+++ gsb_form_widget.c	24 May 2009 16:42:39 -0000	1.32
@@ -1,8 +1,8 @@
 /* ************************************************************************** */
 /*                                                                            */
-/*     Copyright (C)	2000-2008 Cédric Auger (cedric at grisbi.org)	          */
-/*			2003-2008 Benjamin Drieu (bdrieu at april.org)	                      */
-/* 			http://www.grisbi.org				                              */
+/*     Copyright (C)    2000-2008 Cédric Auger (cedric at grisbi.org)            */
+/*          2003-2008 Benjamin Drieu (bdrieu at april.org)	                      */
+/*          http://www.grisbi.org                                             */
 /*                                                                            */
 /*  This program is free software; you can redistribute it and/or modify      */
 /*  it under the terms of the GNU General Public License as published by      */
@@ -150,7 +150,7 @@
  * \return the widget or NULL (if the element number is zero)
  * */
 GtkWidget *gsb_form_widget_create ( gint element_number,
-				    gint account_number )
+                        gint account_number )
 {
     GtkWidget *widget;
 
@@ -163,7 +163,7 @@
     {
 	case TRANSACTION_FORM_DATE:
 	case TRANSACTION_FORM_VALUE_DATE:
-	    widget = gsb_calendar_entry_new (TRUE);
+	    widget = gsb_calendar_entry_new ( FALSE );
 	    break;
 
 	case TRANSACTION_FORM_DEBIT:
@@ -483,8 +483,8 @@
  * 		-2 if end of the form and need to finish it
  * */
 gint gsb_form_widget_next_element ( gint account_number,
-				    gint element_number,
-				    gint direction )
+                        gint element_number,
+                        gint direction )
 {
     gint row;
     gint column;
@@ -636,7 +636,7 @@
     GtkWidget *widget;
 
     gchar* tmpstr = g_strdup_printf ( "gsb_form_widget_set_focus %d", element_number );
-    devel_debug ( tmpstr );
+
     g_free ( tmpstr );
 
     widget = gsb_form_widget_get_widget (element_number);
@@ -685,7 +685,7 @@
  * \return 
  * */
 void gsb_form_widget_set_empty ( GtkWidget *entry,
-				 gboolean empty )
+                    gboolean empty )
 {
     GdkColor gray, black;
 

Index: gsb_file.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- gsb_file.c	21 May 2009 21:58:55 -0000	1.51
+++ gsb_file.c	24 May 2009 16:42:39 -0000	1.52
@@ -962,21 +962,20 @@
     devel_debug ( "gsb_file_update_window_title" );
 
     if ( titre_fichier && strlen(titre_fichier) )
-      titre = g_strdup(titre_fichier);
+        titre = g_strdup(titre_fichier);
     else
     {
-	if ( nom_fichier_comptes )
-	    titre = g_path_get_basename (nom_fichier_comptes);
-	else
-	    titre = g_strconcat ( "<", _("unnamed"), ">", NULL );
+        if ( nom_fichier_comptes )
+            titre = g_path_get_basename (nom_fichier_comptes);
+        else
+            titre = g_strconcat ( "<", _("unnamed"), ">", NULL );
     }
 
-    gchar* tmpstr = titre;
-    titre = g_strconcat ( tmpstr, " - ", _("Grisbi"), NULL );
-    g_free ( tmpstr );
-
+    titre = g_strconcat ( titre, " - ", _("Grisbi"), NULL );
     gtk_window_set_title ( GTK_WINDOW ( window ), titre );
-    g_free ( titre );
+
+    if ( titre && strlen ( titre ) > 0 )
+        g_free ( titre );
 }
 
 



More information about the cvs mailing list