static void gnc_date_cell_leave (BasicCell *bcell) { Timespec ts; PopBox *box = bcell->gui_private; date_picker_disconnect_signals ((DateCell *) bcell); gnc_item_edit_set_popup (box->item_edit, NULL, NULL, NULL, NULL, NULL, NULL, NULL); box->calendar_popped = FALSE; /* Refresh the date to expand any shortcuts. */ gnc_date_cell_get_date ((DateCell *)bcell, &ts); gnc_date_cell_set_value_secs ((DateCell *)bcell, ts.tv_sec); }
static void gnc_split_register_save_due_date_cell (BasicCell * cell, gpointer save_data, gpointer user_data) { SRSaveData *sd = save_data; const char *value; Timespec ts; g_return_if_fail (gnc_basic_cell_has_name (cell, DDUE_CELL)); value = gnc_basic_cell_get_value (cell); /* commit any pending changes */ gnc_date_cell_commit ((DateCell *) cell); DEBUG ("DATE: %s", value ? value : "(null)"); gnc_date_cell_get_date ((DateCell *) cell, &ts); xaccTransSetDateDueTS (sd->trans, &ts); }
static char * get_date_help (VirtualLocation virt_loc, gpointer user_data) { GncEntryLedger *ledger = user_data; BasicCell *cell; char string[1024]; struct tm tm; Timespec ts; time64 tt; cell = gnc_table_get_cell (ledger->table, virt_loc); if (!cell) return NULL; if (!cell->value || *cell->value == '\0') return NULL; gnc_date_cell_get_date ((DateCell *) cell, &ts); tt = ts.tv_sec; gnc_localtime_r (&tt, &tm); qof_strftime (string, sizeof(string), "%A %d %B %Y", &tm); return g_strdup (string); }