[grisbi-cvs] grisbi/src gsb_form.c, 1.139, 1.140 gsb_form_widget.c, 1.40, 1.41 transaction_list.c, 1.54, 1.55

Pierre Biava pbiava at users.sourceforge.net
Tue Dec 15 22:08:29 CET 2009


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

Modified Files:
	gsb_form.c gsb_form_widget.c transaction_list.c 
Log Message:
fixed bug 784

Index: gsb_form_widget.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form_widget.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- gsb_form_widget.c	13 Dec 2009 17:23:45 -0000	1.40
+++ gsb_form_widget.c	15 Dec 2009 21:08:27 -0000	1.41
@@ -2,6 +2,7 @@
 /*                                                                            */
 /*     Copyright (C)    2000-2008 Cédric Auger (cedric at grisbi.org)            */
 /*          2003-2008 Benjamin Drieu (bdrieu at april.org)	                      */
+/*                      2009 Pierre Biava (grisbi at pierre.biava.name)          */
 /*          http://www.grisbi.org                                             */
 /*                                                                            */
 /*  This program is free software; you can redistribute it and/or modify      */
@@ -643,10 +644,6 @@
 {
     GtkWidget *widget;
 
-    gchar* tmpstr = g_strdup_printf ( "gsb_form_widget_set_focus %d", element_number );
-
-    g_free ( tmpstr );
-
     widget = gsb_form_widget_get_widget (element_number);
 
     if ( !widget )
@@ -781,12 +778,7 @@
         /* empty the credit */
         widget = gsb_form_widget_get_widget ( TRANSACTION_FORM_CREDIT );
         if ( !gsb_form_widget_check_empty ( widget ) )
-        {
             old_credit = g_strdup ( gtk_entry_get_text ( GTK_ENTRY ( widget ) ) );
-            //~ gtk_entry_set_text ( GTK_ENTRY ( widget ),
-                     //~ gsb_form_widget_get_name ( TRANSACTION_FORM_CREDIT ) );
-            //~ gsb_form_widget_set_empty ( widget, TRUE );
-        }
 
         widget = gsb_form_widget_get_widget ( TRANSACTION_FORM_TYPE);
 
@@ -826,12 +818,8 @@
         /* empty the credit */
         widget = gsb_form_widget_get_widget ( TRANSACTION_FORM_DEBIT );
         if ( !gsb_form_widget_check_empty ( widget ) )
-        {
             old_debit = g_strdup ( gtk_entry_get_text ( GTK_ENTRY ( widget ) ) );
-            //~ gtk_entry_set_text ( GTK_ENTRY (widget),
-                        //~ gsb_form_widget_get_name (TRANSACTION_FORM_DEBIT));
-            //~ gsb_form_widget_set_empty ( widget, TRUE );
-        }
+
         widget = gsb_form_widget_get_widget ( TRANSACTION_FORM_TYPE);
 
         /* change the method of payment if necessary

Index: gsb_form.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form.c,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -d -r1.139 -r1.140
--- gsb_form.c	13 Dec 2009 20:08:31 -0000	1.139
+++ gsb_form.c	15 Dec 2009 21:08:23 -0000	1.140
@@ -147,6 +147,7 @@
 /** to avoid recursive allocate size */
 gint saved_allocation_size;
 
+static GDate *save_form_date;
 
 /**
  * the value transaction_form is static,
@@ -968,9 +969,19 @@
 
     if ( gtk_expander_get_expanded (GTK_EXPANDER (expander)))
     {
-	gsb_form_widget_free_list ();
-	gsb_form_show ( TRUE );
-	etat.formulaire_toujours_affiche = TRUE;
+        GtkWidget *date_entry;
+
+        gsb_form_widget_free_list ();
+        gsb_form_show ( TRUE );
+        etat.formulaire_toujours_affiche = TRUE;
+        gsb_form_widget_set_focus ( TRANSACTION_FORM_DATE );
+        date_entry = gsb_form_widget_get_widget ( TRANSACTION_FORM_DATE );
+        gsb_form_widget_set_empty ( date_entry, TRUE );
+        gsb_form_button_press_event ( date_entry,
+                        NULL,
+                        GINT_TO_POINTER ( TRANSACTION_FORM_DATE ) );
+        gtk_widget_grab_focus ( GTK_WIDGET ( date_entry ) );
+        gtk_editable_set_position (GTK_EDITABLE ( date_entry ), -1 );
     }
     else
     {
@@ -1930,10 +1941,13 @@
 	date_entry = gsb_form_widget_get_widget (TRANSACTION_FORM_DATE);
 	if ( gsb_form_widget_check_empty (date_entry))
 	{
-	    gtk_entry_set_text ( GTK_ENTRY (date_entry),
-				 gsb_date_today ());
-	    gsb_form_widget_set_empty ( date_entry,
-					FALSE );
+        if ( save_form_date )
+            gtk_entry_set_text ( GTK_ENTRY ( date_entry ),
+                        gsb_format_gdate ( save_form_date ) );
+        else
+            gtk_entry_set_text ( GTK_ENTRY ( date_entry ),
+                         gsb_date_today ( ) );
+	    gsb_form_widget_set_empty ( date_entry, FALSE );
 	}
 
 	/* set the form sensitive */
@@ -2561,12 +2575,16 @@
 					   gtk_entry_get_text (GTK_ENTRY (widget)));
 	dialogue_error ( tmpstr );
 	g_free(tmpstr);
-	gtk_editable_select_region ( GTK_EDITABLE (widget),
-				  0,
-				  -1);
+	gtk_editable_select_region ( GTK_EDITABLE (widget), 0, -1);
 	gtk_widget_grab_focus (widget);
 	return (FALSE);
     }
+    else
+    {
+        if ( save_form_date )
+            g_date_free ( save_form_date );
+        save_form_date = gsb_date_copy ( gsb_calendar_entry_get_date ( widget ) );
+    }
 
     /* work with value date */
     widget = gsb_form_widget_get_widget (TRANSACTION_FORM_VALUE_DATE);

Index: transaction_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/transaction_list.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- transaction_list.c	14 Dec 2009 22:33:10 -0000	1.54
+++ transaction_list.c	15 Dec 2009 21:08:27 -0000	1.55
@@ -200,7 +200,6 @@
 	/* set the white line if necessary */
 	if (children_rows)
 	{
-
 	    newrecord[i] -> number_of_children = 1;
 	    newrecord[i] -> children_rows = children_rows;
 	}



More information about the cvs mailing list