Bug 723216 - Cannot change the accounting period using the pop-up calendar

Set the GncDateEditor's time property, to which the GncPreference is bound.
If the property isn't set in a way that emits the "notify" signal the binding
doesn't know that it should change its value.
This commit is contained in:
John Ralls 2014-03-01 15:04:04 -08:00
parent 594aa3263d
commit 511a5562cd
2 changed files with 16 additions and 11 deletions

View File

@ -165,14 +165,14 @@ gnc_date_edit_popdown(GNCDateEdit *gde)
static void static void
day_selected (GtkCalendar *calendar, GNCDateEdit *gde) day_selected (GtkCalendar *calendar, GNCDateEdit *gde)
{ {
char buffer [40]; Timespec t;
guint year, month, day; guint year, month, day;
gde->in_selected_handler = TRUE;
gtk_calendar_get_date (calendar, &year, &month, &day); gtk_calendar_get_date (calendar, &year, &month, &day);
/* GtkCalendar returns a 0-based month */
qof_print_date_dmy_buff (buffer, 40, day, month + 1, year); t = gnc_dmy2timespec (day, month + 1, year);
gtk_entry_set_text (GTK_ENTRY (gde->date_entry), buffer); gnc_date_edit_set_time_ts (gde, t);
g_signal_emit (G_OBJECT (gde), date_edit_signals [DATE_CHANGED], 0); gde->in_selected_handler = FALSE;
} }
static void static void
@ -516,10 +516,13 @@ gnc_date_edit_set_time_internal (GNCDateEdit *gde, time64 the_time)
gtk_entry_set_text(GTK_ENTRY(gde->date_entry), buffer); gtk_entry_set_text(GTK_ENTRY(gde->date_entry), buffer);
/* Update the calendar. */ /* Update the calendar. */
if (!gde->in_selected_handler)
{
gtk_calendar_select_day(GTK_CALENDAR (gde->calendar), 1); gtk_calendar_select_day(GTK_CALENDAR (gde->calendar), 1);
gtk_calendar_select_month(GTK_CALENDAR (gde->calendar), gtk_calendar_select_month(GTK_CALENDAR (gde->calendar),
mytm->tm_mon, 1900 + mytm->tm_year); mytm->tm_mon, 1900 + mytm->tm_year);
gtk_calendar_select_day(GTK_CALENDAR (gde->calendar), mytm->tm_mday); gtk_calendar_select_day(GTK_CALENDAR (gde->calendar), mytm->tm_mday);
}
/* Set the time of day. */ /* Set the time of day. */
if (gde->flags & GNC_DATE_EDIT_24_HR) if (gde->flags & GNC_DATE_EDIT_24_HR)
@ -643,6 +646,7 @@ gnc_date_edit_init (GNCDateEdit *gde)
gde->lower_hour = 7; gde->lower_hour = 7;
gde->upper_hour = 19; gde->upper_hour = 19;
gde->flags = GNC_DATE_EDIT_SHOW_TIME; gde->flags = GNC_DATE_EDIT_SHOW_TIME;
gde->in_selected_handler = FALSE;
} }
static void static void

View File

@ -80,6 +80,7 @@ typedef struct
int disposed; int disposed;
gboolean popup_in_progress; gboolean popup_in_progress;
gboolean in_selected_handler;
} GNCDateEdit; } GNCDateEdit;
typedef struct typedef struct