[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_1_1_1-21-g674c488

Philippe Delorme nobody at users.sourceforge.net
Thu Jan 10 21:26:39 CET 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grisbi".

The branch, master has been updated
       via  674c488093727971385cbaad33a21009a1c79d3e (commit)
       via  9a7551696c9d21c0cfb3e46118268b11a4a7411b (commit)
      from  103d622a8a8ef017226a891095cf8d585fadbade (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 674c488093727971385cbaad33a21009a1c79d3e
Author: Philippe Delorme <philippedelorme at users.sourceforge.net>
Date:   Thu Jan 10 21:20:29 2013 +0100

    Date autocompletion does no go in the future anymore

commit 9a7551696c9d21c0cfb3e46118268b11a4a7411b
Author: Philippe Delorme <philippedelorme at users.sourceforge.net>
Date:   Thu Jan 10 21:04:31 2013 +0100

    Move regex functions to init and clean handlers

-----------------------------------------------------------------------

Changes:
diff --git a/src/tests/utils_dates_cunit.c b/src/tests/utils_dates_cunit.c
index b9312ce..1de2d3a 100644
--- a/src/tests/utils_dates_cunit.c
+++ b/src/tests/utils_dates_cunit.c
@@ -57,6 +57,7 @@ static int utils_dates_cunit_init_suite ( void );
  */
 int utils_dates_cunit_init_suite ( void )
 {
+    gsb_regex_init_variables ( );
     return 0;
 }
 
@@ -66,6 +67,7 @@ int utils_dates_cunit_init_suite ( void )
  */
 int utils_dates_cunit_clean_suite ( void )
 {
+    gsb_regex_destroy ( );
     return 0;
 }
 
@@ -74,8 +76,6 @@ void utils_dates_cunit__gsb_parse_date_string ( void )
 {
     GDate *date = NULL;
 
-    gsb_regex_init_variables ( );
-
     /**
      * month-first tests
      */
@@ -302,8 +302,6 @@ void utils_dates_cunit__gsb_parse_date_string ( void )
      * tear down
      */
     gsb_date_set_format_date ( NULL );
-
-    gsb_regex_destroy ( );
 }
 
 
diff --git a/src/utils_dates.c b/src/utils_dates.c
index 00ab66d..d7fecb8 100644
--- a/src/utils_dates.c
+++ b/src/utils_dates.c
@@ -239,25 +239,33 @@ gboolean gsb_date_check_and_complete_entry ( GtkWidget *entry,
     const gchar *string;
 
     if (!entry)
-    return FALSE;
+        return FALSE;
 
     /* if the entry is grey (empty), go away */
     if (gsb_form_widget_check_empty (entry))
-    return (TRUE);
+        return (TRUE);
 
     string = gtk_entry_get_text ( GTK_ENTRY (entry));
     if (!string)
-    return FALSE;
+        return FALSE;
 
     if ( strlen (string))
     {
+        GDate *today;
         GDate *date;
-		gchar* tmpstr;
+        gchar* tmpstr;
 
         date = gsb_date_get_last_entry_date ( string );
         if (!date)
             return FALSE;
 
+        /* if date > today, then we go back one year before
+         * usefull when entering operations just after the new year */
+        today = gdate_today ( );
+        if ( g_date_compare ( today, date ) < 0 )
+            g_date_subtract_years ( date, 1 );
+        g_date_free ( today );
+
         tmpstr = gsb_format_gdate (date);
         gtk_entry_set_text ( GTK_ENTRY ( entry ), tmpstr);
         if ( buffer_entry_date == NULL )
@@ -268,8 +276,8 @@ gboolean gsb_date_check_and_complete_entry ( GtkWidget *entry,
     }
     else
     {
-    if (set_today)
-        gtk_entry_set_text ( GTK_ENTRY (entry), gsb_date_today() );
+        if (set_today)
+            gtk_entry_set_text ( GTK_ENTRY (entry), gsb_date_today() );
     }
     return ( TRUE );
 }


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list