[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_1_1_1-22-gd74fc22
Philippe Delorme
nobody at users.sourceforge.net
Thu Jan 10 22:02:52 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 d74fc22e07268281f904a79c9a556a71b1ad79e7 (commit)
from 674c488093727971385cbaad33a21009a1c79d3e (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 d74fc22e07268281f904a79c9a556a71b1ad79e7
Author: Philippe Delorme <philippedelorme at users.sourceforge.net>
Date: Thu Jan 10 21:59:32 2013 +0100
Date autocompletion does no go in the future anymore
This only applies when the year has been auto completed.
Otherwise, a future date is authorized (scheduler for example).
-----------------------------------------------------------------------
Changes:
diff --git a/src/utils_dates.c b/src/utils_dates.c
index d7fecb8..3be0114 100644
--- a/src/utils_dates.c
+++ b/src/utils_dates.c
@@ -251,7 +251,6 @@ gboolean gsb_date_check_and_complete_entry ( GtkWidget *entry,
if ( strlen (string))
{
- GDate *today;
GDate *date;
gchar* tmpstr;
@@ -259,13 +258,6 @@ gboolean gsb_date_check_and_complete_entry ( GtkWidget *entry,
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 )
@@ -332,6 +324,7 @@ GDate *gsb_parse_date_string ( const gchar *date_string )
GRegex *date_regex;
gchar **date_tokens = NULL;
gchar **tab_date = NULL;
+ gboolean year_auto = TRUE;
int num_tokens, num_fields;
int i, j;
@@ -415,6 +408,7 @@ GDate *gsb_parse_date_string ( const gchar *date_string )
if ( ! g_date_valid_year ( nvalue ) && num_fields >= 3 )
goto invalid;
g_date_set_year ( date, nvalue );
+ year_auto = FALSE;
break;
default:
@@ -428,6 +422,16 @@ GDate *gsb_parse_date_string ( const gchar *date_string )
if ( ! g_date_valid ( date ) )
goto invalid;
+ /* if date > today, then we go back one year before
+ * usefull when entering operations just after the new year */
+ if ( year_auto )
+ {
+ GDate *today = gdate_today ( );
+ if ( g_date_compare ( today, date ) < 0 )
+ g_date_set_year ( date, g_date_get_year ( today ) - 1 );
+ g_date_free ( today );
+ }
+
g_strfreev ( tab_date );
g_strfreev ( date_tokens );
return date;
hooks/post-receive
--
grisbi
More information about the cvs
mailing list