gnucash maint: Multiple changes pushed
Geert Janssens
gjanssens at code.gnucash.org
Wed Aug 24 15:10:36 EDT 2016
Updated via https://github.com/Gnucash/gnucash/commit/a4f96d04 (commit)
via https://github.com/Gnucash/gnucash/commit/80890b62 (commit)
from https://github.com/Gnucash/gnucash/commit/bd34059d (commit)
commit a4f96d04766d9aa5e6b9d847d5d03519c4274103
Author: Geert Janssens <janssens-geert at telenet.be>
Date: Wed Aug 24 21:10:04 2016 +0200
SX - recalculate all occurrences of all SX if the calendar is updated to start on another month
This potentially fixes the jumping dates issues as mentioned in bug 644898
diff --git a/src/gnome-utils/gnc-dense-cal.c b/src/gnome-utils/gnc-dense-cal.c
index abd6cd1..4224535 100644
--- a/src/gnome-utils/gnc-dense-cal.c
+++ b/src/gnome-utils/gnc-dense-cal.c
@@ -1738,17 +1738,25 @@ gdc_add_tag_markings(GncDenseCal *cal, guint tag)
}
if (g_date_valid(dates[0]))
{
- if (g_date_get_julian(dates[0]) < g_date_get_julian(calDate))
- {
- _gnc_dense_cal_set_month(cal, g_date_get_month(dates[0]), FALSE);
- _gnc_dense_cal_set_year(cal, g_date_get_year(dates[0]), FALSE);
- }
+ if (g_date_get_julian(dates[0]) < g_date_get_julian(calDate))
+ {
+ /* Oops, first marking is earlier than months displayed.
+ * Choose new first month and recalculate all markings for all
+ * tags. Their offsets are all wrong with the newly added month(s).
+ */
+ _gnc_dense_cal_set_month(cal, g_date_get_month(dates[0]), FALSE);
+ _gnc_dense_cal_set_year(cal, g_date_get_year(dates[0]), FALSE);
+
+ gdc_remove_markings (cal);
+ gdc_add_markings (cal);
+ }
+ else
+ gdc_mark_add(cal, tag, name, info, num_marks, dates);
}
else
{
- g_warning("Bad date, skipped.");
+ g_warning("Bad date, skipped.");
}
- gdc_mark_add(cal, tag, name, info, num_marks, dates);
for (idx = 0; idx < num_marks; idx++)
{
commit 80890b627298504e48d6288ee77cd6325ad646e5
Author: Geert Janssens <janssens-geert at telenet.be>
Date: Wed Aug 24 20:16:28 2016 +0200
SX Window: correctly show first sx on calendar when it is moved to next weekday
diff --git a/src/gnome-utils/gnc-dense-cal-store.c b/src/gnome-utils/gnc-dense-cal-store.c
index 8036591..9bfce1e 100644
--- a/src/gnome-utils/gnc-dense-cal-store.c
+++ b/src/gnome-utils/gnc-dense-cal-store.c
@@ -182,9 +182,6 @@ gdcs_generic_update_recurrences(GncDenseCalStore *trans, GDate *start, GList *re
GDate date, next;
date = *start;
- /* go one day before what's in the box so we can get the correct start
- * date. */
- g_date_subtract_days(&date, 1);
recurrenceListNextInstance(recurrences, &date, &next);
i = 0;
diff --git a/src/gnome/dialog-sx-editor.c b/src/gnome/dialog-sx-editor.c
index b5cf59a..2363d5b 100644
--- a/src/gnome/dialog-sx-editor.c
+++ b/src/gnome/dialog-sx-editor.c
@@ -1609,9 +1609,15 @@ gnc_sxed_update_cal(GncSxEditorDialog *sxed)
&& g_date_valid(&first_date)
&& g_date_compare(last_sx_inst, &first_date) != 0)
{
+ /* last occurrence will be passed as initial date to update store
+ * later on as well */
start_date = *last_sx_inst;
recurrenceListNextInstance(recurrences, &start_date, &first_date);
}
+ else
+ /* move one day back so the store can get the proper first recurrence. */
+ g_date_subtract_days(&start_date, 1);
+
}
if (!g_date_valid(&first_date))
@@ -1637,17 +1643,17 @@ gnc_sxed_update_cal(GncSxEditorDialog *sxed)
GDate end_date;
g_date_clear (&end_date, 1);
gnc_gdate_set_time64 (&end_date, gnc_date_edit_get_date(sxed->endDateEntry));
- gnc_dense_cal_store_update_recurrences_date_end(sxed->dense_cal_model, &first_date, recurrences, &end_date);
+ gnc_dense_cal_store_update_recurrences_date_end(sxed->dense_cal_model, &start_date, recurrences, &end_date);
}
else if (gtk_toggle_button_get_active(sxed->optEndNone))
{
- gnc_dense_cal_store_update_recurrences_no_end(sxed->dense_cal_model, &first_date, recurrences);
+ gnc_dense_cal_store_update_recurrences_no_end(sxed->dense_cal_model, &start_date, recurrences);
}
else if (gtk_toggle_button_get_active(sxed->optEndCount))
{
gint num_remain
= gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sxed->endRemainSpin));
- gnc_dense_cal_store_update_recurrences_count_end(sxed->dense_cal_model, &first_date, recurrences, num_remain);
+ gnc_dense_cal_store_update_recurrences_count_end(sxed->dense_cal_model, &start_date, recurrences, num_remain);
}
else
{
diff --git a/src/gnome/dialog-sx-editor2.c b/src/gnome/dialog-sx-editor2.c
index 7ff7764..4ced23a 100644
--- a/src/gnome/dialog-sx-editor2.c
+++ b/src/gnome/dialog-sx-editor2.c
@@ -1587,9 +1587,14 @@ gnc_sxed_update_cal (GncSxEditorDialog2 *sxed)
&& g_date_valid (&first_date)
&& g_date_compare (last_sx_inst, &first_date) != 0)
{
+ /* last occurrence will be passed as initial date to update store
+ * later on as well */
start_date = *last_sx_inst;
recurrenceListNextInstance (recurrences, &start_date, &first_date);
}
+ else
+ /* move one day back so the store can get the proper first recurrence. */
+ g_date_subtract_days(&start_date, 1);
}
if (!g_date_valid (&first_date))
@@ -1615,17 +1620,17 @@ gnc_sxed_update_cal (GncSxEditorDialog2 *sxed)
GDate end_date;
g_date_clear (&end_date, 1);
gnc_gdate_set_time64 (&end_date, gnc_date_edit_get_date (sxed->endDateEntry));
- gnc_dense_cal_store_update_recurrences_date_end (sxed->dense_cal_model, &first_date, recurrences, &end_date);
+ gnc_dense_cal_store_update_recurrences_date_end (sxed->dense_cal_model, &start_date, recurrences, &end_date);
}
else if (gtk_toggle_button_get_active (sxed->optEndNone))
{
- gnc_dense_cal_store_update_recurrences_no_end (sxed->dense_cal_model, &first_date, recurrences);
+ gnc_dense_cal_store_update_recurrences_no_end (sxed->dense_cal_model, &start_date, recurrences);
}
else if (gtk_toggle_button_get_active (sxed->optEndCount))
{
gint num_remain
= gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (sxed->endRemainSpin));
- gnc_dense_cal_store_update_recurrences_count_end (sxed->dense_cal_model, &first_date, recurrences, num_remain);
+ gnc_dense_cal_store_update_recurrences_count_end (sxed->dense_cal_model, &start_date, recurrences, num_remain);
}
else
{
diff --git a/src/gnome/dialog-sx-from-trans.c b/src/gnome/dialog-sx-from-trans.c
index 5fbeb98..596512c 100644
--- a/src/gnome/dialog-sx-from-trans.c
+++ b/src/gnome/dialog-sx-from-trans.c
@@ -715,16 +715,17 @@ sxftd_update_example_cal( SXFromTransInfo *sxfti )
gtk_widget_set_sensitive( GTK_WIDGET(sxfti->endDateGDE), (get.type == END_ON_DATE) );
gtk_widget_set_sensitive( GTK_WIDGET(sxfti->n_occurences), (get.type == END_AFTER_N_OCCS) );
+ /* Use the day preceding the start date for the store to find the correct real start date */
switch (get.type)
{
case NEVER_END:
- gnc_dense_cal_store_update_recurrences_no_end(sxfti->dense_cal_model, &startDate, schedule);
+ gnc_dense_cal_store_update_recurrences_no_end(sxfti->dense_cal_model, &date, schedule);
break;
case END_ON_DATE:
- gnc_dense_cal_store_update_recurrences_date_end(sxfti->dense_cal_model, &startDate, schedule, &get.end_date);
+ gnc_dense_cal_store_update_recurrences_date_end(sxfti->dense_cal_model, &date, schedule, &get.end_date);
break;
case END_AFTER_N_OCCS:
- gnc_dense_cal_store_update_recurrences_count_end(sxfti->dense_cal_model, &startDate, schedule, get.n_occurrences);
+ gnc_dense_cal_store_update_recurrences_count_end(sxfti->dense_cal_model, &date, schedule, get.n_occurrences);
break;
default:
g_warning("unknown get.type [%d]\n", get.type);
Summary of changes:
src/gnome-utils/gnc-dense-cal-store.c | 3 ---
src/gnome-utils/gnc-dense-cal.c | 22 +++++++++++++++-------
src/gnome/dialog-sx-editor.c | 12 +++++++++---
src/gnome/dialog-sx-editor2.c | 11 ++++++++---
src/gnome/dialog-sx-from-trans.c | 7 ++++---
5 files changed, 36 insertions(+), 19 deletions(-)
More information about the gnucash-changes
mailing list