Bug 796812 - gnc_date_cell_get_date and gnc_date_cell_get_date_gdate have different date validation behaviour - part 2

Change the two register get_help functions to use gnc_date_cell_get_date
with the warn parameter FALSE, this way we only get one warning when the
date is out of range.

Also as no functions use gnc_date_cell_get_date_gdate it can be removed.
pull/400/head
Robert Fewell 8 years ago
parent aabae1caf9
commit 67ee1d99a4

@ -564,19 +564,18 @@ static char * get_date_help (VirtualLocation virt_loc, gpointer user_data)
{
GncEntryLedger *ledger = user_data;
BasicCell *cell;
char string[1024];
GDate date;
const char *date_string;
time64 cell_time;
cell = gnc_table_get_cell (ledger->table, virt_loc);
if (!cell || !cell->value || *cell->value == '\0')
return NULL;
g_date_clear (&date, 1);
gnc_date_cell_get_date_gdate ((DateCell *) cell, &date);
gnc_date_cell_get_date ((DateCell *) cell, &cell_time, FALSE);
g_date_strftime (string, sizeof (string), _("%A %d %B %Y"), &date);
date_string = gnc_print_time64 (cell_time, _("%A %d %B %Y"));
return g_strdup (string);
return g_strdup (date_string);
}
static char * get_desc_help (VirtualLocation virt_loc, gpointer user_data)

@ -968,19 +968,18 @@ gnc_split_register_get_date_help (VirtualLocation virt_loc,
{
SplitRegister *reg = user_data;
BasicCell *cell;
char string[1024];
GDate date;
const char *date_string;
time64 cell_time;
cell = gnc_table_get_cell (reg->table, virt_loc);
if (!cell || !cell->value || *cell->value == '\0')
return NULL;
g_date_clear (&date, 1);
gnc_date_cell_get_date_gdate ((DateCell *) cell, &date);
gnc_date_cell_get_date ((DateCell *) cell, &cell_time, FALSE);
g_date_strftime (string, sizeof (string), _("%A %d %B %Y"), &date);
date_string = gnc_print_time64 (cell_time, _("%A %d %B %Y"));
return g_strdup (string);
return g_strdup (date_string);
}
static const char *

@ -127,11 +127,5 @@ void gnc_date_cell_commit (DateCell *cell);
*/
void gnc_date_cell_get_date (DateCell *cell, time64 *time, gboolean warn);
/** Set a GDate to the value in the DateCell.
* @param cell The DateCell
* @param date A GDate* into which the functino will write the date.
*/
void gnc_date_cell_get_date_gdate (DateCell *cell, GDate *date);
/** @} */
#endif

@ -714,22 +714,6 @@ gnc_date_cell_leave (BasicCell *bcell)
gnc_date_cell_set_value_secs ((DateCell *)bcell, time);
}
void
gnc_date_cell_get_date_gdate (DateCell *cell, GDate *date)
{
PopBox *box = cell->cell.gui_private;
if (!cell || !date)
return;
gnc_parse_date (&(box->date), cell->cell.value, FALSE);
g_date_set_dmy(date,
box->date.tm_mday,
box->date.tm_mon + 1,
box->date.tm_year + 1900);
}
void
gnc_date_cell_get_date (DateCell *cell, time64 *time, gboolean warn)
{

Loading…
Cancel
Save