[Gnucash-changes] r13677 - gnucash/trunk - Fill the filter by dialog with given start/end time instead of calculating earliest/latest date found. Fix 335237.

Andreas Köhler andi5 at cvs.gnucash.org
Tue Mar 21 01:16:41 EST 2006


Author: andi5
Date: 2006-03-21 01:16:40 -0500 (Tue, 21 Mar 2006)
New Revision: 13677
Trac: http://svn.gnucash.org/trac/changeset/13677

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/gnome-utils/gnc-date-edit.c
   gnucash/trunk/src/gnome/gnc-plugin-page-register.c
Log:
Fill the filter by dialog with given start/end time instead of calculating earliest/latest date found. Fix 335237.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-03-20 22:19:48 UTC (rev 13676)
+++ gnucash/trunk/ChangeLog	2006-03-21 06:16:40 UTC (rev 13677)
@@ -1,3 +1,12 @@
+2006-03-21  Andreas Köhler  <andi5.py at gmx.net>
+
+	* src/gnome/gnc-plugin-page-register.c: Fill the filter by dialog
+	  with given start/end time instead of calculating earliest/latest
+	  date found. Fix 335237.
+
+	* src/gnome-utils/gnc-date-edit.c (gnc_date_edit_get_date): Avoid
+	  needless second call to mktime.
+
 2006-03-19  Chris Lyttle  <chris at wilddev.net>
 
 	* NEWS: Added some text about the release.

Modified: gnucash/trunk/src/gnome/gnc-plugin-page-register.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-register.c	2006-03-20 22:19:48 UTC (rev 13676)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-register.c	2006-03-21 06:16:40 UTC (rev 13677)
@@ -2188,8 +2188,10 @@
     /* Start date info */
     if (start_time == 0) {
       button = glade_xml_get_widget(xml, "start_date_earliest");
+      time_val = xaccQueryGetEarliestDateFound (query); 
       sensitive = FALSE;
     } else {
+      time_val = start_time;
       if ((start_time >= gnc_timet_get_today_start()) &&
 	  (start_time <= gnc_timet_get_today_end())) {
 	button = glade_xml_get_widget(xml, "start_date_today");
@@ -2202,7 +2204,6 @@
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
     start_date = glade_xml_get_widget(xml, "start_date");
     gtk_widget_set_sensitive(GTK_WIDGET(start_date), sensitive);
-    time_val = xaccQueryGetEarliestDateFound (query); 
     gnc_date_edit_set_time(GNC_DATE_EDIT(start_date), time_val);
     g_signal_connect (G_OBJECT (start_date), "date-changed",
 		      G_CALLBACK (gnc_plugin_page_register_filter_gde_changed_cb),
@@ -2213,8 +2214,10 @@
     /* End date info */
     if (end_time == 0) {
       button = glade_xml_get_widget(xml, "end_date_latest");
+      time_val = xaccQueryGetLatestDateFound (query); 
       sensitive = FALSE;
     } else {
+      time_val = end_time;
       if ((end_time >= gnc_timet_get_today_start()) &&
 	  (end_time <= gnc_timet_get_today_end())) {
 	button = glade_xml_get_widget(xml, "end_date_today");
@@ -2227,7 +2230,6 @@
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
     end_date = glade_xml_get_widget(xml, "end_date");
     gtk_widget_set_sensitive(GTK_WIDGET(end_date), sensitive);
-    time_val = xaccQueryGetLatestDateFound (query); 
     gnc_date_edit_set_time(GNC_DATE_EDIT(end_date), time_val);
     g_signal_connect (G_OBJECT (end_date), "date-changed",
 		      G_CALLBACK (gnc_plugin_page_register_filter_gde_changed_cb),

Modified: gnucash/trunk/src/gnome-utils/gnc-date-edit.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-date-edit.c	2006-03-20 22:19:48 UTC (rev 13676)
+++ gnucash/trunk/src/gnome-utils/gnc-date-edit.c	2006-03-21 06:16:40 UTC (rev 13677)
@@ -871,16 +871,18 @@
 time_t
 gnc_date_edit_get_date (GNCDateEdit *gde)
 {
- 	struct tm tm;
+        struct tm tm;
+        time_t retval;
 
         g_return_val_if_fail (gde != NULL, 0);
         g_return_val_if_fail (GNC_IS_DATE_EDIT (gde), 0);
 
         tm = gnc_date_edit_get_date_internal (gde);
 
-        if (mktime (&tm) == -1)
-		return gnc_timet_get_today_start();
-	return mktime (&tm);
+        retval = mktime (&tm);
+        if (retval == -1)
+                return gnc_timet_get_today_start ();
+        return retval;
 }
 
 void



More information about the gnucash-changes mailing list