mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Convert all time_t to time64: gnome
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22626 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -73,7 +73,7 @@ typedef struct
|
||||
GtkWidget * apply_label;
|
||||
GtkWidget * summary;
|
||||
|
||||
time_t earliest;
|
||||
time64 earliest;
|
||||
char * earliest_str;
|
||||
GDate closing_date;
|
||||
GDate prev_closing_date;
|
||||
@@ -102,13 +102,13 @@ void ap_assistant_close (GtkAssistant *gtkassistant, gpointer us
|
||||
* a query and sorting by date. Since the truncated sort returns
|
||||
* only the *last* search results, sort in decreasing order.
|
||||
*/
|
||||
static time_t
|
||||
static time64
|
||||
get_earliest_in_book (QofBook *book)
|
||||
{
|
||||
QofQuery *q;
|
||||
GSList *p1, *p2;
|
||||
GList *res;
|
||||
time_t earliest;
|
||||
time64 earliest;
|
||||
|
||||
q = qof_query_create_for(GNC_ID_SPLIT);
|
||||
qof_query_set_max_results(q, 1);
|
||||
@@ -133,7 +133,7 @@ get_earliest_in_book (QofBook *book)
|
||||
else
|
||||
{
|
||||
/* If no results, we don't want to bomb totally */
|
||||
earliest = time (0);
|
||||
earliest = gnc_time (NULL);
|
||||
}
|
||||
|
||||
qof_query_destroy (q);
|
||||
@@ -146,7 +146,7 @@ get_earliest_in_book (QofBook *book)
|
||||
*/
|
||||
|
||||
static int
|
||||
get_num_xactions_before_date(QofBook *book, time_t close_date)
|
||||
get_num_xactions_before_date(QofBook *book, time64 close_date)
|
||||
{
|
||||
QofQuery *q;
|
||||
GSList *param;
|
||||
@@ -161,7 +161,7 @@ get_num_xactions_before_date(QofBook *book, time_t close_date)
|
||||
|
||||
/* Look for transactions earlier than the closing date */
|
||||
param = g_slist_prepend (NULL, TRANS_DATE_POSTED);
|
||||
timespecFromTime_t (&ts, close_date);
|
||||
timespecFromTime64 (&ts, close_date);
|
||||
pred = qof_query_date_predicate (QOF_COMPARE_LTE, QOF_DATE_MATCH_NORMAL, ts);
|
||||
qof_query_add_term (q, param, pred, QOF_QUERY_FIRST_TERM);
|
||||
|
||||
@@ -284,7 +284,7 @@ ap_assistant_menu_prepare (GtkAssistant *assistant, gpointer user_data)
|
||||
g_date_clear (&date_now, 1);
|
||||
nperiods = 0;
|
||||
period_end = info->closing_date;
|
||||
g_date_set_time_t (&date_now, time(NULL));
|
||||
gnc_gdate_set_time64 (&date_now, gnc_time (NULL));
|
||||
|
||||
while (0 > g_date_compare(&period_end, &date_now ))
|
||||
{
|
||||
@@ -306,7 +306,8 @@ ap_assistant_menu_prepare (GtkAssistant *assistant, gpointer user_data)
|
||||
* we may have closed books since last time. */
|
||||
info->earliest = get_earliest_in_book (gnc_get_current_book());
|
||||
info->earliest_str = qof_print_date(info->earliest);
|
||||
PINFO ("Date of earliest transaction is %ld %s", info->earliest, ctime (&info->earliest));
|
||||
PINFO ("Date of earliest transaction is %lld %s", info->earliest,
|
||||
gnc_ctime (&info->earliest));
|
||||
|
||||
/* Display the results */
|
||||
str = g_strdup_printf (
|
||||
@@ -361,7 +362,7 @@ ap_assistant_book_prepare (GtkAssistant *assistant, gpointer user_data)
|
||||
|
||||
currbook = gnc_get_current_book();
|
||||
ntrans = get_num_xactions_before_date(currbook,
|
||||
gnc_timet_get_day_end_gdate (&info->closing_date));
|
||||
gnc_time64_get_day_end_gdate (&info->closing_date));
|
||||
|
||||
nacc = gnc_account_n_descendants (gnc_book_get_root_account (currbook));
|
||||
|
||||
@@ -448,7 +449,7 @@ ap_validate_menu (GtkAssistant *assistant, gpointer user_data)
|
||||
}
|
||||
|
||||
g_date_clear (&date_now, 1);
|
||||
g_date_set_time_t (&date_now, time(NULL));
|
||||
gnc_gdate_set_today (&date_now);
|
||||
if (0 < g_date_compare(&info->closing_date, &date_now))
|
||||
{
|
||||
/* Closing date must be in the future */
|
||||
@@ -481,8 +482,8 @@ ap_assistant_finish (GtkAssistant *assistant, gpointer user_data)
|
||||
bnotes = gtk_text_buffer_get_text(buffer, &startiter, &enditer , 0);
|
||||
PINFO("Book title is - %s\n", btitle);
|
||||
|
||||
timespecFromTime_t (&closing_date,
|
||||
gnc_timet_get_day_end_gdate (&info->closing_date));
|
||||
timespecFromTime64 (&closing_date,
|
||||
gnc_time64_get_day_end_gdate (&info->closing_date));
|
||||
g_free(bnotes);
|
||||
|
||||
/* Report the status back to the user. */
|
||||
@@ -490,17 +491,20 @@ ap_assistant_finish (GtkAssistant *assistant, gpointer user_data)
|
||||
|
||||
/* Find the next closing date ... */
|
||||
info->prev_closing_date = info->closing_date;
|
||||
recurrenceListNextInstance(info->period, &info->prev_closing_date, &info->closing_date);
|
||||
recurrenceListNextInstance (info->period, &info->prev_closing_date,
|
||||
&info->closing_date);
|
||||
|
||||
|
||||
/* FIXME Test for valid closing date, not sure why it wont be!!! */
|
||||
if (g_date_valid(&info->closing_date) == TRUE)
|
||||
{
|
||||
/* If the next closing date is in the future, then we are done. */
|
||||
if (time(NULL) > gnc_timet_get_day_end_gdate (&info->closing_date))
|
||||
if (gnc_time (NULL) >
|
||||
gnc_time64_get_day_end_gdate (&info->closing_date))
|
||||
{
|
||||
/* Load up the GUI for the next closing period. */
|
||||
gnc_frequency_setup_recurrence(info->period_menu, NULL, &info->closing_date);
|
||||
gnc_frequency_setup_recurrence (info->period_menu, NULL,
|
||||
&info->closing_date);
|
||||
/* Jump back to the Close Book page. */
|
||||
gtk_assistant_set_current_page (GTK_ASSISTANT(info->window), 1);
|
||||
}
|
||||
@@ -567,11 +571,11 @@ ap_assistant_create (AcctPeriodInfo *info)
|
||||
* and use that to set up the freq spec widget. */
|
||||
info->earliest = get_earliest_in_book (gnc_get_current_book());
|
||||
info->earliest_str = qof_print_date(info->earliest);
|
||||
PINFO ("date of earliest transaction is %ld %s",
|
||||
info->earliest, ctime (&info->earliest));
|
||||
PINFO ("date of earliest transaction is %lld %s",
|
||||
info->earliest, gnc_ctime (&info->earliest));
|
||||
|
||||
g_date_clear (&info->closing_date, 1);
|
||||
g_date_set_time_t (&info->closing_date, info->earliest);
|
||||
gnc_gdate_set_time64 (&info->closing_date, info->earliest);
|
||||
g_date_clear (&info->prev_closing_date, 1);
|
||||
info->prev_closing_date = info->closing_date;
|
||||
g_date_add_years (&info->closing_date, 1);
|
||||
|
||||
@@ -1006,7 +1006,7 @@ starting_balance_helper (Account *account, hierarchy_data *data)
|
||||
if (gnc_reverse_balance(account))
|
||||
balance = gnc_numeric_neg(balance);
|
||||
if (!gnc_numeric_zero_p (balance))
|
||||
gnc_account_create_opening_balance (account, balance, time (NULL),
|
||||
gnc_account_create_opening_balance (account, balance, gnc_time (NULL),
|
||||
gnc_get_current_book ());
|
||||
}
|
||||
|
||||
|
||||
@@ -655,7 +655,7 @@ gnc_loan_assistant_create( LoanAssistantData *ldd )
|
||||
{
|
||||
*gde_data[i].loc =
|
||||
GNC_DATE_EDIT(
|
||||
gnc_date_edit_new( time(NULL),
|
||||
gnc_date_edit_new( gnc_time (NULL),
|
||||
FALSE, FALSE ) );
|
||||
gtk_table_attach( gde_data[i].table,
|
||||
GTK_WIDGET( *gde_data[i].loc ),
|
||||
@@ -901,7 +901,7 @@ loan_assistant_data_init( LoanAssistantData *ldd )
|
||||
ldd->ld.principal = gnc_numeric_zero();
|
||||
ldd->ld.startDate = g_date_new();
|
||||
ldd->ld.varStartDate = g_date_new();
|
||||
g_date_set_time_t( ldd->ld.startDate, time(NULL) );
|
||||
gnc_gdate_set_time64( ldd->ld.startDate, gnc_time (NULL) );
|
||||
ldd->ld.loan_schedule = NULL;
|
||||
ldd->ld.repayment_schedule = NULL;
|
||||
{
|
||||
@@ -967,10 +967,10 @@ loan_info_prep( GtkAssistant *assistant, gpointer user_data )
|
||||
|
||||
tmpTm = g_new0( struct tm, 1 );
|
||||
|
||||
g_date_to_struct_tm( ldd->ld.startDate, tmpTm );
|
||||
gnc_date_edit_set_time( ldd->prmStartDateGDE,
|
||||
mktime(tmpTm) );
|
||||
g_free( tmpTm );
|
||||
g_date_to_struct_tm (ldd->ld.startDate, tmpTm);
|
||||
gnc_date_edit_set_time (ldd->prmStartDateGDE,
|
||||
gnc_mktime (tmpTm));
|
||||
g_free (tmpTm);
|
||||
}
|
||||
|
||||
/* length: total and remaining */
|
||||
@@ -1005,8 +1005,8 @@ loan_info_calc_update_cb( GtkWidget *w, gpointer user_data )
|
||||
|
||||
g_date_clear( &start, 1 );
|
||||
g_date_clear( &now, 1 );
|
||||
g_date_set_time_t( &start, gnc_date_edit_get_date( ldd->prmStartDateGDE ) );
|
||||
g_date_set_time_t( &now, time(NULL) );
|
||||
gnc_gdate_set_time64( &start, gnc_date_edit_get_date( ldd->prmStartDateGDE ) );
|
||||
gnc_gdate_set_time64( &now, gnc_time (NULL) );
|
||||
for ( i = 0; g_date_compare( &start, &now ) < 0; i++ )
|
||||
{
|
||||
g_date_add_months( &start, 1 );
|
||||
@@ -1083,15 +1083,16 @@ loan_info_page_save( GtkAssistant *assistant, gpointer user_data )
|
||||
|
||||
/* start date */
|
||||
{
|
||||
time_t tmpTT;
|
||||
time64 tmpTT;
|
||||
struct tm *tmpTm;
|
||||
|
||||
tmpTT = gnc_date_edit_get_date( ldd->prmStartDateGDE );
|
||||
tmpTm = localtime( &tmpTT );
|
||||
tmpTm = gnc_localtime ( &tmpTT );
|
||||
g_date_set_dmy( ldd->ld.startDate,
|
||||
tmpTm->tm_mday,
|
||||
(tmpTm->tm_mon + 1),
|
||||
(1900 + tmpTm->tm_year) );
|
||||
gnc_tm_free (tmpTm);
|
||||
}
|
||||
|
||||
/* len / periods */
|
||||
@@ -1923,12 +1924,12 @@ loan_rev_get_loan_range( LoanAssistantData *ldd, GDate *start, GDate *end )
|
||||
*start = *ldd->ld.startDate;
|
||||
|
||||
endDateMath = g_new0( struct tm, 1 );
|
||||
g_date_to_struct_tm( ldd->ld.startDate, endDateMath );
|
||||
g_date_to_struct_tm (ldd->ld.startDate, endDateMath);
|
||||
monthsTotal = ( (ldd->ld.numPer - 1)
|
||||
* ( ldd->ld.perSize == GNC_MONTHS ? 1 : 12 ) );
|
||||
endDateMath->tm_mon += monthsTotal;
|
||||
g_date_set_time_t( end, mktime( endDateMath ) );
|
||||
g_free( endDateMath );
|
||||
gnc_gdate_set_time64 (end, gnc_mktime (endDateMath));
|
||||
g_free (endDateMath);
|
||||
}
|
||||
|
||||
|
||||
@@ -1940,12 +1941,12 @@ loan_rev_get_dates( LoanAssistantData *ldd, GDate *start, GDate *end )
|
||||
switch ( range )
|
||||
{
|
||||
case CURRENT_YEAR:
|
||||
g_date_set_time_t( start, time(NULL) );
|
||||
gnc_gdate_set_time64( start, gnc_time (NULL) );
|
||||
g_date_set_dmy( start, 1, G_DATE_JANUARY, g_date_get_year( start ) );
|
||||
g_date_set_dmy( end, 31, G_DATE_DECEMBER, g_date_get_year( start ) );
|
||||
break;
|
||||
case NOW_PLUS_ONE:
|
||||
g_date_set_time_t( start, time(NULL) );
|
||||
gnc_gdate_set_time64( start, gnc_time (NULL) );
|
||||
*end = *start;
|
||||
g_date_add_years( end, 1 );
|
||||
break;
|
||||
@@ -1953,9 +1954,9 @@ loan_rev_get_dates( LoanAssistantData *ldd, GDate *start, GDate *end )
|
||||
loan_rev_get_loan_range( ldd, start, end );
|
||||
break;
|
||||
case CUSTOM:
|
||||
g_date_set_time_t( start,
|
||||
gnc_gdate_set_time64( start,
|
||||
gnc_date_edit_get_date( ldd->revStartDate ) );
|
||||
g_date_set_time_t( end,
|
||||
gnc_gdate_set_time64( end,
|
||||
gnc_date_edit_get_date( ldd->revEndDate ) );
|
||||
break;
|
||||
default:
|
||||
@@ -2524,7 +2525,7 @@ ld_calc_sx_instance_num(GDate *start_date, GList *schedule)
|
||||
|
||||
g_date_clear(&next_date, 1);
|
||||
g_date_clear(&today, 1);
|
||||
g_date_set_time_t(&today, time(NULL));
|
||||
gnc_gdate_set_time64 (&today, gnc_time (NULL));
|
||||
|
||||
if (g_date_compare(start_date, &today) > 0)
|
||||
return 0;
|
||||
|
||||
@@ -365,7 +365,7 @@ gnc_stock_split_assistant_finish (GtkAssistant *assistant,
|
||||
Transaction *trans;
|
||||
Account *account;
|
||||
Split *split;
|
||||
time_t date;
|
||||
time64 date;
|
||||
|
||||
account = info->acct;
|
||||
g_return_if_fail (account != NULL);
|
||||
@@ -632,7 +632,7 @@ gnc_stock_split_assistant_create (StockSplitInfo *info)
|
||||
info->description_entry = GTK_WIDGET(gtk_builder_get_object(builder, "description_entry"));
|
||||
|
||||
box = GTK_WIDGET(gtk_builder_get_object(builder, "date_box"));
|
||||
date = gnc_date_edit_new(time(NULL), FALSE, FALSE);
|
||||
date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (box), date, TRUE, TRUE, 0);
|
||||
info->date_edit = date;
|
||||
label = GTK_WIDGET(gtk_builder_get_object(builder, "date_label"));
|
||||
|
||||
@@ -357,7 +357,7 @@ gnc_lot_viewer_fill (GNCLotViewer *lv)
|
||||
GNCLot *lot = node->data;
|
||||
Split *esplit = gnc_lot_get_earliest_split (lot);
|
||||
Transaction *etrans = xaccSplitGetParent (esplit);
|
||||
time_t open_date = xaccTransGetDate (etrans);
|
||||
time64 open_date = xaccTransGetDate (etrans);
|
||||
gnc_numeric amt_baln = gnc_lot_get_balance (lot);
|
||||
gnc_commodity *currency = find_first_currency (lot);
|
||||
gnc_numeric gains_baln = get_realized_gains (lot, currency);
|
||||
@@ -388,7 +388,7 @@ gnc_lot_viewer_fill (GNCLotViewer *lv)
|
||||
{
|
||||
Split *fsplit = gnc_lot_get_latest_split (lot);
|
||||
Transaction *ftrans = xaccSplitGetParent (fsplit);
|
||||
time_t close_date = xaccTransGetDate (ftrans);
|
||||
time64 close_date = xaccTransGetDate (ftrans);
|
||||
|
||||
qof_print_date_buff (cbuff, MAX_DATE_LENGTH, close_date);
|
||||
gtk_list_store_set(store, &iter, LOT_COL_CLOSE, cbuff, -1);
|
||||
@@ -500,7 +500,7 @@ gnc_split_viewer_fill (GNCLotViewer *lv, GtkListStore *store, SplitList *split_l
|
||||
char balnbuff[200];
|
||||
gnc_commodity *currency;
|
||||
Transaction *trans = xaccSplitGetParent (split);
|
||||
time_t date = xaccTransGetDate (trans);
|
||||
time64 date = xaccTransGetDate (trans);
|
||||
gnc_numeric amnt, valu, gains;
|
||||
|
||||
/* Do not show gains splits */
|
||||
|
||||
@@ -170,7 +170,7 @@ price_to_gui (PriceEditDialog *pedit_dialog)
|
||||
else
|
||||
{
|
||||
currency = gnc_default_currency ();
|
||||
date.tv_sec = time (NULL);
|
||||
date.tv_sec = gnc_time (NULL);
|
||||
date.tv_nsec = 0;
|
||||
source = DIALOG_PRICE_EDIT_SOURCE;
|
||||
type = "";
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <locale.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <gnc-gdate-utils.h>
|
||||
#include "qof.h"
|
||||
#include "gnc-date.h"
|
||||
#include "gnc-gconf-utils.h"
|
||||
@@ -2124,7 +2125,6 @@ draw_page_items(GtkPrintContext *context,
|
||||
GSList *elem;
|
||||
check_item_t *item;
|
||||
gdouble width;
|
||||
GDate *date;
|
||||
gchar *address = NULL;
|
||||
|
||||
trans = xaccSplitGetParent(pcd->split);
|
||||
@@ -2145,16 +2145,18 @@ draw_page_items(GtkPrintContext *context,
|
||||
switch (item->type)
|
||||
{
|
||||
case DATE:
|
||||
date = g_date_new();
|
||||
g_date_set_time_t(date, xaccTransGetDate(trans));
|
||||
{
|
||||
GDate date;
|
||||
g_date_clear (&date, 1);
|
||||
gnc_gdate_set_time64 (&date, xaccTransGetDate(trans));
|
||||
date_format =
|
||||
gnc_date_format_get_custom(GNC_DATE_FORMAT
|
||||
(pcd->date_format));
|
||||
g_date_strftime(buf, 100, date_format, date);
|
||||
g_date_strftime(buf, 100, date_format, &date);
|
||||
width = draw_text(context, buf, item, default_desc);
|
||||
draw_date_format(context, date_format, item, default_desc, width);
|
||||
g_date_free(date);
|
||||
break;
|
||||
}
|
||||
|
||||
case PAYEE:
|
||||
draw_text(context, xaccTransGetDescription(trans), item, default_desc);
|
||||
@@ -2331,7 +2333,7 @@ draw_check_custom(GtkPrintContext *context, gpointer user_data)
|
||||
gchar *text = NULL, buf[100];
|
||||
check_item_t item = { 0 };
|
||||
gdouble x, y, multip, degrees;
|
||||
GDate *date;
|
||||
GDate date;
|
||||
gchar *address;
|
||||
|
||||
trans = xaccSplitGetParent(pcd->split);
|
||||
@@ -2357,12 +2359,11 @@ draw_check_custom(GtkPrintContext *context, gpointer user_data)
|
||||
|
||||
item.x = multip * gtk_spin_button_get_value(pcd->date_x);
|
||||
item.y = multip * gtk_spin_button_get_value(pcd->date_y);
|
||||
date = g_date_new();
|
||||
g_date_set_time_t(date, xaccTransGetDate(trans));
|
||||
g_date_clear (&date, 1);
|
||||
gnc_gdate_set_time64 (&date, xaccTransGetDate(trans));
|
||||
date_format = gnc_date_format_get_custom(GNC_DATE_FORMAT(pcd->date_format));
|
||||
g_date_strftime(buf, 100, date_format, date);
|
||||
g_date_strftime(buf, 100, date_format, &date);
|
||||
draw_text(context, buf, &item, desc);
|
||||
g_date_free(date);
|
||||
|
||||
item.x = multip * gtk_spin_button_get_value(pcd->number_x);
|
||||
item.y = multip * gtk_spin_button_get_value(pcd->number_y);
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <locale.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <gnc-gdate-utils.h>
|
||||
#include "qof.h"
|
||||
#include "Account.h"
|
||||
#include "SchedXaction.h"
|
||||
@@ -314,7 +314,7 @@ gnc_sxed_check_changed( GncSxEditorDialog *sxed )
|
||||
return TRUE;
|
||||
}
|
||||
sxEndDate = *xaccSchedXactionGetEndDate( sxed->sx );
|
||||
g_date_set_time_t( &dlgEndDate,
|
||||
gnc_gdate_set_time64( &dlgEndDate,
|
||||
gnc_date_edit_get_date( sxed->
|
||||
endDateEntry ) );
|
||||
|
||||
@@ -858,7 +858,7 @@ gnc_sxed_check_consistent( GncSxEditorDialog *sxed )
|
||||
g_date_clear( &endDate, 1 );
|
||||
if ( gtk_toggle_button_get_active(sxed->optEndDate) )
|
||||
{
|
||||
g_date_set_time_t( &endDate,
|
||||
gnc_gdate_set_time64( &endDate,
|
||||
gnc_date_edit_get_date( sxed->
|
||||
endDateEntry ) );
|
||||
}
|
||||
@@ -913,7 +913,7 @@ gnc_sxed_save_sx( GncSxEditorDialog *sxed )
|
||||
if ( gtk_toggle_button_get_active(sxed->optEndDate) )
|
||||
{
|
||||
/* get the end date data */
|
||||
g_date_set_time_t( &gdate,
|
||||
gnc_gdate_set_time64( &gdate,
|
||||
gnc_date_edit_get_date(
|
||||
sxed->endDateEntry ) );
|
||||
xaccSchedXactionSetEndDate( sxed->sx, &gdate );
|
||||
@@ -1194,7 +1194,8 @@ gnc_ui_scheduled_xaction_editor_dialog_create (SchedXaction *sx,
|
||||
/* Setup the end-date GNC widget */
|
||||
{
|
||||
GtkWidget *endDateBox = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_hbox"));
|
||||
sxed->endDateEntry = GNC_DATE_EDIT(gnc_date_edit_new( time(NULL), FALSE, FALSE ));
|
||||
sxed->endDateEntry = GNC_DATE_EDIT(gnc_date_edit_new (gnc_time (NULL),
|
||||
FALSE, FALSE));
|
||||
gtk_widget_show(GTK_WIDGET(sxed->endDateEntry));
|
||||
g_signal_connect( sxed->endDateEntry, "date-changed",
|
||||
G_CALLBACK( sxed_excal_update_adapt_cb ), sxed );
|
||||
@@ -1354,7 +1355,7 @@ void
|
||||
schedXact_editor_populate( GncSxEditorDialog *sxed )
|
||||
{
|
||||
char *name;
|
||||
time_t tmpDate;
|
||||
time64 tmpDate;
|
||||
SplitRegister *splitReg;
|
||||
struct tm *tmpTm;
|
||||
const GDate *gd;
|
||||
@@ -1385,11 +1386,7 @@ schedXact_editor_populate( GncSxEditorDialog *sxed )
|
||||
if ( g_date_valid( gd ) )
|
||||
{
|
||||
gtk_toggle_button_set_active( sxed->optEndDate, TRUE );
|
||||
/* fill in date data. */
|
||||
tmpTm = g_new0( struct tm, 1 );
|
||||
g_date_to_struct_tm( gd, tmpTm );
|
||||
tmpDate = mktime( tmpTm );
|
||||
g_free( tmpTm );
|
||||
tmpDate = gnc_time64_get_day_start_gdate (gd);
|
||||
gnc_date_edit_set_time( sxed->endDateEntry, tmpDate );
|
||||
|
||||
set_endgroup_toggle_states( sxed, END_DATE );
|
||||
@@ -1632,7 +1629,8 @@ gnc_sxed_update_cal(GncSxEditorDialog *sxed)
|
||||
if (gtk_toggle_button_get_active(sxed->optEndDate))
|
||||
{
|
||||
GDate end_date;
|
||||
g_date_set_time_t(&end_date, gnc_date_edit_get_date(sxed->endDateEntry));
|
||||
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);
|
||||
}
|
||||
else if (gtk_toggle_button_get_active(sxed->optEndNone))
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gnc-gdate-utils.h>
|
||||
#include "dialog-sx-editor.h"
|
||||
#include "dialog-sx-from-trans.h"
|
||||
#include "dialog-utils.h"
|
||||
@@ -165,11 +166,11 @@ sxftd_get_end_info(SXFromTransInfo *sxfti)
|
||||
|
||||
if (gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(sxfti->ed_but)))
|
||||
{
|
||||
time_t end_tt;
|
||||
time64 end_tt;
|
||||
retval.type = END_ON_DATE;
|
||||
g_date_clear( &(retval.end_date), 1 );
|
||||
end_tt = gnc_date_edit_get_date(sxfti->endDateGDE);
|
||||
g_date_set_time_t( &(retval.end_date), end_tt);
|
||||
gnc_gdate_set_time64( &(retval.end_date), end_tt);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -336,7 +337,7 @@ sxftd_init( SXFromTransInfo *sxfti )
|
||||
const char *transName;
|
||||
gint pos;
|
||||
GList *schedule = NULL;
|
||||
time_t start_tt;
|
||||
time64 start_tt;
|
||||
struct tm *tmpTm;
|
||||
GDate date, nextDate;
|
||||
|
||||
@@ -391,8 +392,8 @@ sxftd_init( SXFromTransInfo *sxfti )
|
||||
{
|
||||
GtkWidget *paramTable = GTK_WIDGET(gtk_builder_get_object(sxfti->builder, "param_table" ));
|
||||
sxfti->startDateGDE =
|
||||
GNC_DATE_EDIT( gnc_date_edit_new( time( NULL ),
|
||||
FALSE, FALSE ) );
|
||||
GNC_DATE_EDIT( gnc_date_edit_new (gnc_time (NULL),
|
||||
FALSE, FALSE));
|
||||
gtk_table_attach( GTK_TABLE(paramTable),
|
||||
GTK_WIDGET( sxfti->startDateGDE ),
|
||||
1, 2, 2, 3,
|
||||
@@ -406,8 +407,8 @@ sxftd_init( SXFromTransInfo *sxfti )
|
||||
{
|
||||
GtkWidget *endDateBox = GTK_WIDGET(gtk_builder_get_object(sxfti->builder, "end_date_hbox" ));
|
||||
sxfti->endDateGDE =
|
||||
GNC_DATE_EDIT( gnc_date_edit_new( time( NULL ),
|
||||
FALSE, FALSE ) );
|
||||
GNC_DATE_EDIT( gnc_date_edit_new (gnc_time (NULL),
|
||||
FALSE, FALSE));
|
||||
gtk_box_pack_start( GTK_BOX( endDateBox ),
|
||||
GTK_WIDGET( sxfti->endDateGDE ),
|
||||
TRUE, TRUE, 0 );
|
||||
@@ -419,7 +420,7 @@ sxftd_init( SXFromTransInfo *sxfti )
|
||||
/* Setup the initial start date for user display/confirmation */
|
||||
/* compute good initial date. */
|
||||
start_tt = xaccTransGetDate( sxfti->trans );
|
||||
g_date_set_time_t( &date, start_tt );
|
||||
gnc_gdate_set_time64( &date, start_tt );
|
||||
sxfti->freq_combo = GTK_COMBO_BOX(gtk_builder_get_object(sxfti->builder, "freq_combo_box"));
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(sxfti->freq_combo), 0);
|
||||
g_signal_connect( sxfti->freq_combo, "changed",
|
||||
@@ -428,11 +429,7 @@ sxftd_init( SXFromTransInfo *sxfti )
|
||||
sxftd_update_schedule( sxfti, &date, &schedule);
|
||||
recurrenceListNextInstance(schedule, &date, &nextDate);
|
||||
recurrenceListFree(&schedule);
|
||||
|
||||
tmpTm = g_new0( struct tm, 1 );
|
||||
g_date_to_struct_tm( &nextDate, tmpTm );
|
||||
start_tt = mktime( tmpTm );
|
||||
g_free( tmpTm );
|
||||
start_tt = gnc_time64_get_day_start_gdate (&nextDate);
|
||||
gnc_date_edit_set_time( sxfti->startDateGDE, start_tt );
|
||||
|
||||
g_signal_connect( GTK_OBJECT(sxfti->name), "destroy",
|
||||
@@ -462,7 +459,7 @@ sxftd_compute_sx(SXFromTransInfo *sxfti)
|
||||
xaccSchedXactionSetName(sx, name);
|
||||
g_free(name);
|
||||
|
||||
g_date_set_time_t( &date, gnc_date_edit_get_date( sxfti->startDateGDE ) );
|
||||
gnc_gdate_set_time64( &date, gnc_date_edit_get_date( sxfti->startDateGDE ) );
|
||||
|
||||
sxftd_update_schedule(sxfti, &date, &schedule);
|
||||
if (sxftd_errno == 0)
|
||||
@@ -579,21 +576,17 @@ sxftd_freq_combo_changed( GtkWidget *w, gpointer user_data )
|
||||
{
|
||||
SXFromTransInfo *sxfti = (SXFromTransInfo*)user_data;
|
||||
GDate date, nextDate;
|
||||
time_t tmp_tt;
|
||||
time64 tmp_tt;
|
||||
struct tm *tmpTm;
|
||||
GList *schedule = NULL;
|
||||
|
||||
tmp_tt = xaccTransGetDate( sxfti->trans );
|
||||
g_date_set_time_t( &date, tmp_tt );
|
||||
gnc_gdate_set_time64 (&date, tmp_tt);
|
||||
|
||||
g_date_clear(&nextDate, 1);
|
||||
sxftd_update_schedule(sxfti, &date, &schedule);
|
||||
recurrenceListNextInstance(schedule, &date, &nextDate);
|
||||
|
||||
tmpTm = g_new0( struct tm, 1 );
|
||||
g_date_to_struct_tm( &nextDate, tmpTm );
|
||||
tmp_tt = mktime( tmpTm );
|
||||
g_free( tmpTm );
|
||||
tmp_tt = gnc_time64_get_day_start_gdate (&nextDate);
|
||||
gnc_date_edit_set_time( sxfti->startDateGDE, tmp_tt );
|
||||
|
||||
recurrenceListFree(&schedule);
|
||||
@@ -682,7 +675,7 @@ static void
|
||||
sxftd_update_example_cal( SXFromTransInfo *sxfti )
|
||||
{
|
||||
struct tm *tmpTm;
|
||||
time_t tmp_tt;
|
||||
time64 tmp_tt;
|
||||
GDate date, startDate, nextDate;
|
||||
GList *schedule = NULL;
|
||||
getEndTuple get;
|
||||
@@ -690,13 +683,7 @@ sxftd_update_example_cal( SXFromTransInfo *sxfti )
|
||||
get = sxftd_get_end_info( sxfti );
|
||||
|
||||
tmp_tt = gnc_date_edit_get_date( sxfti->startDateGDE );
|
||||
tmpTm = g_new0( struct tm, 1 );
|
||||
*tmpTm = *localtime( &tmp_tt );
|
||||
g_date_clear(&date, 1);
|
||||
g_date_set_day( &date, tmpTm->tm_mday );
|
||||
g_date_set_month( &date, tmpTm->tm_mon + 1 );
|
||||
g_date_set_year( &date, tmpTm->tm_year + 1900 );
|
||||
g_free( tmpTm );
|
||||
gnc_gdate_set_time64 (&date, tmp_tt);
|
||||
|
||||
sxftd_update_schedule(sxfti, &date, &schedule);
|
||||
|
||||
|
||||
@@ -118,8 +118,8 @@ void gnc_plugin_page_register_filter_status_all_cb(GtkButton *button, GncPluginP
|
||||
void gnc_plugin_page_register_filter_status_one_cb(GtkToggleButton *button, GncPluginPageRegister *page);
|
||||
void gnc_plugin_page_register_filter_save_cb(GtkToggleButton *button, GncPluginPageRegister *page);
|
||||
|
||||
static time_t gnc_plugin_page_register_filter_dmy2time (char *date_string);
|
||||
static gchar *gnc_plugin_page_register_filter_time2dmy (time_t raw_time);
|
||||
static time64 gnc_plugin_page_register_filter_dmy2time (char *date_string);
|
||||
static gchar *gnc_plugin_page_register_filter_time2dmy (time64 raw_time);
|
||||
static gchar *gnc_plugin_page_register_get_filter (GncPluginPage *plugin_page);
|
||||
void gnc_plugin_page_register_set_filter (GncPluginPage *plugin_page, const gchar *filter);
|
||||
|
||||
@@ -501,10 +501,10 @@ typedef struct GncPluginPageRegisterPrivate
|
||||
GtkWidget *end_date;
|
||||
cleared_match_t original_cleared_match;
|
||||
cleared_match_t cleared_match;
|
||||
time_t original_start_time;
|
||||
time_t original_end_time;
|
||||
time_t start_time;
|
||||
time_t end_time;
|
||||
time64 original_start_time;
|
||||
time64 original_end_time;
|
||||
time64 start_time;
|
||||
time64 end_time;
|
||||
gboolean original_save_filter;
|
||||
gboolean save_filter;
|
||||
} fd;
|
||||
@@ -942,16 +942,16 @@ gnc_plugin_page_register_create_widget (GncPluginPage *plugin_page)
|
||||
{
|
||||
PINFO("Loaded Filter Start Date is %s", filter[1]);
|
||||
|
||||
priv->fd.start_time = gnc_plugin_page_register_filter_dmy2time( filter[1] );
|
||||
priv->fd.start_time = gnc_timet_get_day_start(priv->fd.start_time);
|
||||
priv->fd.start_time = gnc_plugin_page_register_filter_dmy2time (filter[1] );
|
||||
priv->fd.start_time = gnc_time64_get_day_start(priv->fd.start_time);
|
||||
filter_changed = filter_changed + 1;
|
||||
|
||||
if (filter[2] && (g_strcmp0 (filter[2], "0") != 0 ))
|
||||
{
|
||||
PINFO("Loaded Filter End Date is %s", filter[2]);
|
||||
|
||||
priv->fd.end_time = gnc_plugin_page_register_filter_dmy2time( filter[2] );
|
||||
priv->fd.end_time = gnc_timet_get_day_end(priv->fd.end_time);
|
||||
priv->fd.end_time = gnc_plugin_page_register_filter_dmy2time (filter[2] );
|
||||
priv->fd.end_time = gnc_time64_get_day_end(priv->fd.end_time);
|
||||
filter_changed = filter_changed + 1;
|
||||
}
|
||||
}
|
||||
@@ -1824,42 +1824,38 @@ gnc_ppr_update_date_query (GncPluginPageRegister *page)
|
||||
}
|
||||
|
||||
|
||||
/* This function converts a time_t value date to a string */
|
||||
/* This function converts a time64 value date to a string */
|
||||
static gchar *
|
||||
gnc_plugin_page_register_filter_time2dmy ( time_t raw_time)
|
||||
gnc_plugin_page_register_filter_time2dmy ( time64 raw_time)
|
||||
{
|
||||
struct tm * timeinfo;
|
||||
gchar date_string[11];
|
||||
|
||||
timeinfo = localtime ( &raw_time );
|
||||
strftime(date_string, 11, "%d-%m-%Y", timeinfo );
|
||||
timeinfo = gnc_localtime (&raw_time);
|
||||
strftime (date_string, 11, "%d-%m-%Y", timeinfo);
|
||||
PINFO("Date string is %s", date_string);
|
||||
gnc_tm_free (timeinfo);
|
||||
|
||||
return g_strdup(date_string);
|
||||
}
|
||||
|
||||
|
||||
/* This function converts a string date to a time_t value */
|
||||
static time_t
|
||||
gnc_plugin_page_register_filter_dmy2time ( char *date_string)
|
||||
/* This function converts a string date to a time64 value */
|
||||
static time64
|
||||
gnc_plugin_page_register_filter_dmy2time (char *date_string)
|
||||
{
|
||||
struct tm *when;
|
||||
gint yy = 0, mm = 0, dd = 0;
|
||||
|
||||
time_t raw_time;
|
||||
struct tm when;
|
||||
|
||||
PINFO("Date string is %s", date_string);
|
||||
memset (&when, 0, sizeof (when));
|
||||
|
||||
sscanf(date_string, "%d-%d-%d", &dd, &mm, &yy );
|
||||
sscanf (date_string, "%d-%d-%d", &when.tm_mday,
|
||||
&when.tm_mon, &when.tm_year);
|
||||
|
||||
time(&raw_time);
|
||||
when = localtime ( &raw_time );
|
||||
when.tm_mon -= 1;
|
||||
when.tm_year -= 1900;
|
||||
|
||||
when->tm_year = yy - 1900;
|
||||
when->tm_mon = mm - 1 ;
|
||||
when->tm_mday = dd;
|
||||
|
||||
return mktime(when);
|
||||
return gnc_mktime (&when);
|
||||
}
|
||||
|
||||
|
||||
@@ -1963,20 +1959,20 @@ static void
|
||||
get_filter_times(GncPluginPageRegister *page)
|
||||
{
|
||||
GncPluginPageRegisterPrivate *priv;
|
||||
time_t time_val;
|
||||
time64 time_val;
|
||||
|
||||
priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_choose)))
|
||||
{
|
||||
time_val = gnc_date_edit_get_date(GNC_DATE_EDIT(priv->fd.start_date));
|
||||
time_val = gnc_timet_get_day_start(time_val);
|
||||
time_val = gnc_time64_get_day_start(time_val);
|
||||
priv->fd.start_time = time_val;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_today)))
|
||||
{
|
||||
priv->fd.start_time = gnc_timet_get_today_start();
|
||||
priv->fd.start_time = gnc_time64_get_today_start();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1987,14 +1983,14 @@ get_filter_times(GncPluginPageRegister *page)
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.end_date_choose)))
|
||||
{
|
||||
time_val = gnc_date_edit_get_date(GNC_DATE_EDIT(priv->fd.end_date));
|
||||
time_val = gnc_timet_get_day_end(time_val);
|
||||
time_val = gnc_time64_get_day_end(time_val);
|
||||
priv->fd.end_time = time_val;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_today)))
|
||||
{
|
||||
priv->fd.end_time = gnc_timet_get_today_end();
|
||||
priv->fd.end_time = gnc_time64_get_today_end();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2738,8 +2734,8 @@ gnc_plugin_page_register_cmd_reverse_transaction (GtkAction *action,
|
||||
new_trans = xaccTransReverse(trans);
|
||||
|
||||
/* Clear transaction level info */
|
||||
xaccTransSetDatePostedSecs(new_trans, time(NULL));
|
||||
xaccTransSetDateEnteredSecs(new_trans, time(NULL));
|
||||
xaccTransSetDatePostedSecs (new_trans, gnc_time (NULL));
|
||||
xaccTransSetDateEnteredSecs (new_trans, gnc_time (NULL));
|
||||
|
||||
qof_event_resume();
|
||||
|
||||
@@ -2841,7 +2837,7 @@ gnc_plugin_page_register_cmd_view_filter_by (GtkAction *action,
|
||||
{
|
||||
GncPluginPageRegisterPrivate *priv;
|
||||
GtkWidget *dialog, *toggle, *button, *table, *hbox;
|
||||
time_t start_time, end_time, time_val;
|
||||
time64 start_time, end_time, time_val;
|
||||
GtkBuilder *builder;
|
||||
gboolean sensitive, value;
|
||||
Query *query;
|
||||
@@ -2918,8 +2914,8 @@ gnc_plugin_page_register_cmd_view_filter_by (GtkAction *action,
|
||||
else
|
||||
{
|
||||
time_val = start_time;
|
||||
if ((start_time >= gnc_timet_get_today_start()) &&
|
||||
(start_time <= gnc_timet_get_today_end()))
|
||||
if ((start_time >= gnc_time64_get_today_start()) &&
|
||||
(start_time <= gnc_time64_get_today_end()))
|
||||
{
|
||||
button = priv->fd.start_date_today;
|
||||
sensitive = FALSE;
|
||||
@@ -2931,12 +2927,12 @@ gnc_plugin_page_register_cmd_view_filter_by (GtkAction *action,
|
||||
}
|
||||
}
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
|
||||
priv->fd.start_date = gnc_date_edit_new (time (NULL), FALSE, FALSE);
|
||||
priv->fd.start_date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
|
||||
hbox = GTK_WIDGET(gtk_builder_get_object (builder, "start_date_hbox"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), priv->fd.start_date, TRUE, TRUE, 0);
|
||||
gtk_widget_show (priv->fd.start_date);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(priv->fd.start_date), sensitive);
|
||||
gnc_date_edit_set_time(GNC_DATE_EDIT(priv->fd.start_date), time_val);
|
||||
gnc_date_edit_set_time (GNC_DATE_EDIT(priv->fd.start_date), time_val);
|
||||
g_signal_connect (G_OBJECT (priv->fd.start_date), "date-changed",
|
||||
G_CALLBACK (gnc_plugin_page_register_filter_gde_changed_cb),
|
||||
page);
|
||||
@@ -2953,8 +2949,8 @@ gnc_plugin_page_register_cmd_view_filter_by (GtkAction *action,
|
||||
else
|
||||
{
|
||||
time_val = end_time;
|
||||
if ((end_time >= gnc_timet_get_today_start()) &&
|
||||
(end_time <= gnc_timet_get_today_end()))
|
||||
if ((end_time >= gnc_time64_get_today_start()) &&
|
||||
(end_time <= gnc_time64_get_today_end()))
|
||||
{
|
||||
button = priv->fd.end_date_today;
|
||||
sensitive = FALSE;
|
||||
@@ -2966,12 +2962,12 @@ gnc_plugin_page_register_cmd_view_filter_by (GtkAction *action,
|
||||
}
|
||||
}
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
|
||||
priv->fd.end_date = gnc_date_edit_new (time (NULL), FALSE, FALSE);
|
||||
priv->fd.end_date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
|
||||
hbox = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_hbox"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), priv->fd.end_date, TRUE, TRUE, 0);
|
||||
gtk_widget_show (priv->fd.end_date);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(priv->fd.end_date), sensitive);
|
||||
gnc_date_edit_set_time(GNC_DATE_EDIT(priv->fd.end_date), time_val);
|
||||
gnc_date_edit_set_time (GNC_DATE_EDIT(priv->fd.end_date), time_val);
|
||||
g_signal_connect (G_OBJECT (priv->fd.end_date), "date-changed",
|
||||
G_CALLBACK (gnc_plugin_page_register_filter_gde_changed_cb),
|
||||
page);
|
||||
|
||||
@@ -120,8 +120,8 @@ void gnc_plugin_page_register2_filter_status_all_cb(GtkButton *button, GncPlugin
|
||||
void gnc_plugin_page_register2_filter_status_one_cb(GtkToggleButton *button, GncPluginPageRegister2 *page);
|
||||
void gnc_plugin_page_register2_filter_save_cb(GtkToggleButton *button, GncPluginPageRegister2 *page);
|
||||
|
||||
static time_t gnc_plugin_page_register2_filter_dmy2time (char *date_string);
|
||||
static gchar *gnc_plugin_page_register2_filter_time2dmy (time_t raw_time);
|
||||
static time64 gnc_plugin_page_register2_filter_dmy2time (char *date_string);
|
||||
static gchar *gnc_plugin_page_register2_filter_time2dmy (time64 raw_time);
|
||||
static gchar *gnc_plugin_page_register2_get_filter (GncPluginPage *plugin_page);
|
||||
void gnc_plugin_page_register2_set_filter (GncPluginPage *plugin_page, const gchar *filter);
|
||||
|
||||
@@ -503,10 +503,10 @@ typedef struct GncPluginPageRegister2Private
|
||||
GtkWidget *end_date;
|
||||
cleared_match_t original_cleared_match;
|
||||
cleared_match_t cleared_match;
|
||||
time_t original_start_time;
|
||||
time_t original_end_time;
|
||||
time_t start_time;
|
||||
time_t end_time;
|
||||
time64 original_start_time;
|
||||
time64 original_end_time;
|
||||
time64 start_time;
|
||||
time64 end_time;
|
||||
gboolean original_save_filter;
|
||||
gboolean save_filter;
|
||||
} fd;
|
||||
@@ -977,16 +977,16 @@ g_print("Register New Create - page %p\n", page);
|
||||
{
|
||||
PINFO("Loaded Filter Start Date is %s", filter[1]);
|
||||
|
||||
priv->fd.start_time = gnc_plugin_page_register2_filter_dmy2time( filter[1] );
|
||||
priv->fd.start_time = gnc_timet_get_day_start(priv->fd.start_time);
|
||||
priv->fd.start_time = gnc_plugin_page_register2_filter_dmy2time ( filter[1] );
|
||||
priv->fd.start_time = gnc_time64_get_day_start(priv->fd.start_time);
|
||||
filter_changed = filter_changed + 1;
|
||||
|
||||
if (filter[2] && (g_strcmp0 (filter[2], "0") != 0 ))
|
||||
{
|
||||
PINFO("Loaded Filter End Date is %s", filter[2]);
|
||||
|
||||
priv->fd.end_time = gnc_plugin_page_register2_filter_dmy2time( filter[2] );
|
||||
priv->fd.end_time = gnc_timet_get_day_end(priv->fd.end_time);
|
||||
priv->fd.end_time = gnc_plugin_page_register2_filter_dmy2time ( filter[2] );
|
||||
priv->fd.end_time = gnc_time64_get_day_end(priv->fd.end_time);
|
||||
filter_changed = filter_changed + 1;
|
||||
}
|
||||
}
|
||||
@@ -1884,43 +1884,38 @@ gnc_ppr_update_date_query (GncPluginPageRegister2 *page, gboolean refresh_page)
|
||||
}
|
||||
|
||||
|
||||
/* This function converts a time_t value date to a string */
|
||||
/* This function converts a time64 value date to a string */
|
||||
static gchar *
|
||||
gnc_plugin_page_register2_filter_time2dmy ( time_t raw_time)
|
||||
gnc_plugin_page_register2_filter_time2dmy ( time64 raw_time)
|
||||
{
|
||||
struct tm * timeinfo;
|
||||
gchar date_string[11];
|
||||
gint i;
|
||||
|
||||
timeinfo = localtime ( &raw_time );
|
||||
i = strftime(date_string, 11, "%d-%m-%Y", timeinfo );
|
||||
timeinfo = gnc_localtime ( &raw_time );
|
||||
i = strftime (date_string, 11, "%d-%m-%Y", timeinfo );
|
||||
PINFO("Date string is %s", date_string);
|
||||
|
||||
gnc_tm_free (timeinfo);
|
||||
return g_strdup(date_string);
|
||||
}
|
||||
|
||||
|
||||
/* This function converts a string date to a time_t value */
|
||||
static time_t
|
||||
/* This function converts a string date to a time64 value */
|
||||
static time64
|
||||
gnc_plugin_page_register2_filter_dmy2time ( char *date_string)
|
||||
{
|
||||
struct tm *when;
|
||||
gint yy = 0, mm = 0, dd = 0;
|
||||
|
||||
time_t raw_time;
|
||||
struct tm when;
|
||||
|
||||
PINFO("Date string is %s", date_string);
|
||||
memset (&when, 0, sizeof (when));
|
||||
sscanf(date_string, "%d-%d-%d", &when.tm_mday,
|
||||
&when.tm_mon, &when.tm_year );
|
||||
|
||||
sscanf(date_string, "%d-%d-%d", &dd, &mm, &yy );
|
||||
when.tm_year -= 1900;
|
||||
when.tm_mon -= 1 ;
|
||||
|
||||
time(&raw_time);
|
||||
when = localtime ( &raw_time );
|
||||
|
||||
when->tm_year = yy - 1900;
|
||||
when->tm_mon = mm - 1 ;
|
||||
when->tm_mday = dd;
|
||||
|
||||
return mktime(when);
|
||||
return gnc_mktime (&when);
|
||||
}
|
||||
|
||||
|
||||
@@ -2025,20 +2020,20 @@ get_filter_times(GncPluginPageRegister2 *page)
|
||||
{
|
||||
GncPluginPageRegister2Private *priv;
|
||||
GtkWidget *button, *today, *gde;
|
||||
time_t time_val;
|
||||
time64 time_val;
|
||||
|
||||
priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_choose)))
|
||||
{
|
||||
time_val = gnc_date_edit_get_date(GNC_DATE_EDIT(priv->fd.start_date));
|
||||
time_val = gnc_timet_get_day_start(time_val);
|
||||
time_val = gnc_time64_get_day_start(time_val);
|
||||
priv->fd.start_time = time_val;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_today)))
|
||||
{
|
||||
priv->fd.start_time = gnc_timet_get_today_start();
|
||||
priv->fd.start_time = gnc_time64_get_today_start();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2049,14 +2044,14 @@ get_filter_times(GncPluginPageRegister2 *page)
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.end_date_choose)))
|
||||
{
|
||||
time_val = gnc_date_edit_get_date(GNC_DATE_EDIT(priv->fd.end_date));
|
||||
time_val = gnc_timet_get_day_end(time_val);
|
||||
time_val = gnc_time64_get_day_end(time_val);
|
||||
priv->fd.end_time = time_val;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_today)))
|
||||
{
|
||||
priv->fd.end_time = gnc_timet_get_today_end();
|
||||
priv->fd.end_time = gnc_time64_get_today_end();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2803,8 +2798,8 @@ gnc_plugin_page_register2_cmd_reverse_transaction (GtkAction *action,
|
||||
new_trans = xaccTransReverse(trans);
|
||||
|
||||
/* Clear transaction level info */
|
||||
xaccTransSetDatePostedSecs(new_trans, time(NULL));
|
||||
xaccTransSetDateEnteredSecs(new_trans, time(NULL));
|
||||
xaccTransSetDatePostedSecs(new_trans, gnc_time (NULL));
|
||||
xaccTransSetDateEnteredSecs(new_trans, gnc_time (NULL));
|
||||
|
||||
qof_event_resume();
|
||||
|
||||
@@ -2907,7 +2902,7 @@ gnc_plugin_page_register2_cmd_view_filter_by (GtkAction *action,
|
||||
{
|
||||
GncPluginPageRegister2Private *priv;
|
||||
GtkWidget *dialog, *toggle, *button, *start_date, *end_date, *table, *hbox;
|
||||
time_t start_time, end_time, time_val;
|
||||
time64 start_time, end_time, time_val;
|
||||
GtkBuilder *builder;
|
||||
gboolean sensitive, value;
|
||||
Query *query;
|
||||
@@ -2984,8 +2979,8 @@ gnc_plugin_page_register2_cmd_view_filter_by (GtkAction *action,
|
||||
else
|
||||
{
|
||||
time_val = start_time;
|
||||
if ((start_time >= gnc_timet_get_today_start()) &&
|
||||
(start_time <= gnc_timet_get_today_end()))
|
||||
if ((start_time >= gnc_time64_get_today_start()) &&
|
||||
(start_time <= gnc_time64_get_today_end()))
|
||||
{
|
||||
button = priv->fd.start_date_today;
|
||||
sensitive = FALSE;
|
||||
@@ -2997,12 +2992,12 @@ gnc_plugin_page_register2_cmd_view_filter_by (GtkAction *action,
|
||||
}
|
||||
}
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
|
||||
priv->fd.start_date = gnc_date_edit_new (time (NULL), FALSE, FALSE);
|
||||
priv->fd.start_date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
|
||||
hbox = GTK_WIDGET(gtk_builder_get_object (builder, "start_date_hbox"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), priv->fd.start_date, TRUE, TRUE, 0);
|
||||
gtk_widget_show (priv->fd.start_date);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(priv->fd.start_date), sensitive);
|
||||
gnc_date_edit_set_time(GNC_DATE_EDIT(priv->fd.start_date), time_val);
|
||||
gnc_date_edit_set_time (GNC_DATE_EDIT(priv->fd.start_date), time_val);
|
||||
g_signal_connect (G_OBJECT (priv->fd.start_date), "date-changed",
|
||||
G_CALLBACK (gnc_plugin_page_register2_filter_gde_changed_cb),
|
||||
page);
|
||||
@@ -3019,8 +3014,8 @@ gnc_plugin_page_register2_cmd_view_filter_by (GtkAction *action,
|
||||
else
|
||||
{
|
||||
time_val = end_time;
|
||||
if ((end_time >= gnc_timet_get_today_start()) &&
|
||||
(end_time <= gnc_timet_get_today_end()))
|
||||
if ((end_time >= gnc_time64_get_today_start()) &&
|
||||
(end_time <= gnc_time64_get_today_end()))
|
||||
{
|
||||
button = priv->fd.end_date_today;
|
||||
sensitive = FALSE;
|
||||
@@ -3032,12 +3027,12 @@ gnc_plugin_page_register2_cmd_view_filter_by (GtkAction *action,
|
||||
}
|
||||
}
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
|
||||
priv->fd.end_date = gnc_date_edit_new (time (NULL), FALSE, FALSE);
|
||||
priv->fd.end_date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
|
||||
hbox = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_hbox"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), priv->fd.end_date, TRUE, TRUE, 0);
|
||||
gtk_widget_show (priv->fd.end_date);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(priv->fd.end_date), sensitive);
|
||||
gnc_date_edit_set_time(GNC_DATE_EDIT(priv->fd.end_date), time_val);
|
||||
gnc_date_edit_set_time (GNC_DATE_EDIT(priv->fd.end_date), time_val);
|
||||
g_signal_connect (G_OBJECT (priv->fd.end_date), "date-changed",
|
||||
G_CALLBACK (gnc_plugin_page_register2_filter_gde_changed_cb),
|
||||
page);
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include <gnc-gdate-utils.h>
|
||||
#include "SX-book.h"
|
||||
#include "Split.h"
|
||||
#include "Transaction.h"
|
||||
@@ -363,7 +365,7 @@ gnc_plugin_page_sx_list_create_widget (GncPluginPage *plugin_page)
|
||||
{
|
||||
GDate end;
|
||||
g_date_clear(&end, 1);
|
||||
g_date_set_time_t(&end, time(NULL));
|
||||
gnc_gdate_set_today (&end);
|
||||
g_date_add_years(&end, 1);
|
||||
priv->instances = GNC_SX_INSTANCE_MODEL(gnc_sx_get_instances(&end, TRUE));
|
||||
}
|
||||
@@ -551,7 +553,7 @@ gnc_plugin_page_sx_list_cmd_new(GtkAction *action, GncPluginPageSxList *page)
|
||||
GList *schedule;
|
||||
|
||||
g_date_clear(&now, 1);
|
||||
g_date_set_time_t(&now, time(NULL));
|
||||
gnc_gdate_set_today (&now);
|
||||
recurrenceSet(r, 1, PERIOD_MONTH, &now, WEEKEND_ADJ_NONE);
|
||||
schedule = gnc_sx_get_schedule(new_sx);
|
||||
schedule = g_list_append(schedule, r);
|
||||
|
||||
@@ -88,7 +88,7 @@ static void gnc_split_reg_refresh_toolbar( GNCSplitReg *gsr );
|
||||
static void gnc_split_reg_ld_destroy( GNCLedgerDisplay *ledger );
|
||||
|
||||
static Transaction* create_balancing_transaction(QofBook *book, Account *account,
|
||||
time_t statement_date, gnc_numeric balancing_amount);
|
||||
time64 statement_date, gnc_numeric balancing_amount);
|
||||
|
||||
void gsr_default_enter_handler ( GNCSplitReg *w, gpointer ud );
|
||||
void gsr_default_cancel_handler ( GNCSplitReg *w, gpointer ud );
|
||||
@@ -111,7 +111,7 @@ void gsr_default_reverse_txn_handler ( GNCSplitReg *w, gpointer ud );
|
||||
|
||||
static void gsr_emit_simple_signal( GNCSplitReg *gsr, const char *sigName );
|
||||
static void gsr_emit_help_changed( GnucashRegister *reg, gpointer user_data );
|
||||
static void gsr_emit_include_date_signal( GNCSplitReg *gsr, time_t date );
|
||||
static void gsr_emit_include_date_signal( GNCSplitReg *gsr, time64 date );
|
||||
|
||||
void gnc_split_reg_cut_cb(GtkWidget *w, gpointer data);
|
||||
void gnc_split_reg_copy_cb(GtkWidget *w, gpointer data);
|
||||
@@ -284,7 +284,7 @@ gnc_split_reg_class_init( GNCSplitRegClass *class )
|
||||
G_SIGNAL_RUN_LAST,
|
||||
signals[i++].defaultOffset,
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__INT, /* time_t == int */
|
||||
g_cclosure_marshal_VOID__INT, /* time64 == int */
|
||||
G_TYPE_NONE, 1, G_TYPE_INT );
|
||||
|
||||
g_assert( i == LAST_SIGNAL );
|
||||
@@ -897,8 +897,8 @@ gsr_default_reverse_txn_handler (GNCSplitReg *gsr, gpointer data)
|
||||
new_trans = xaccTransReverse(trans);
|
||||
|
||||
/* Clear transaction level info */
|
||||
xaccTransSetDatePostedSecs(new_trans, time(NULL));
|
||||
xaccTransSetDateEnteredSecs(new_trans, time(NULL));
|
||||
xaccTransSetDatePostedSecs(new_trans, gnc_time (NULL));
|
||||
xaccTransSetDateEnteredSecs(new_trans, gnc_time (NULL));
|
||||
|
||||
/* Now jump to new trans */
|
||||
gnc_split_reg_jump_to_split(gsr, xaccTransGetSplit(new_trans, 0));
|
||||
@@ -1409,7 +1409,7 @@ gnc_split_reg_jump_to_blank (GNCSplitReg *gsr)
|
||||
|
||||
void
|
||||
gnc_split_reg_balancing_entry(GNCSplitReg *gsr, Account *account,
|
||||
time_t statement_date, gnc_numeric balancing_amount)
|
||||
time64 statement_date, gnc_numeric balancing_amount)
|
||||
{
|
||||
|
||||
Transaction *transaction;
|
||||
@@ -1436,7 +1436,7 @@ gnc_split_reg_balancing_entry(GNCSplitReg *gsr, Account *account,
|
||||
|
||||
static Transaction*
|
||||
create_balancing_transaction(QofBook *book, Account *account,
|
||||
time_t statement_date, gnc_numeric balancing_amount)
|
||||
time64 statement_date, gnc_numeric balancing_amount)
|
||||
{
|
||||
|
||||
Transaction *trans;
|
||||
@@ -2070,7 +2070,7 @@ gsr_emit_help_changed( GnucashRegister *reg, gpointer user_data )
|
||||
|
||||
static
|
||||
void
|
||||
gsr_emit_include_date_signal( GNCSplitReg *gsr, time_t date )
|
||||
gsr_emit_include_date_signal( GNCSplitReg *gsr, time64 date )
|
||||
{
|
||||
g_signal_emit_by_name( gsr, "include-date", date, NULL );
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ struct _GNCSplitRegClass
|
||||
void (*unvoid_txn_cb) ( GNCSplitReg *w, gpointer user_data );
|
||||
void (*reverse_txn_cb) ( GNCSplitReg *w, gpointer user_data );
|
||||
void (*help_changed_cb) ( GNCSplitReg *w, gpointer user_data );
|
||||
void (*include_date_cb) ( GNCSplitReg *w, time_t date, gpointer user_data );
|
||||
void (*include_date_cb) ( GNCSplitReg *w, time64 date, gpointer user_data );
|
||||
};
|
||||
|
||||
typedef enum
|
||||
@@ -231,7 +231,7 @@ void gnc_split_reg_jump_to_split_amount(GNCSplitReg *gsr, Split *split);
|
||||
* window.
|
||||
*/
|
||||
void gnc_split_reg_balancing_entry (GNCSplitReg *gsr, Account *account,
|
||||
time_t statement_date, gnc_numeric balancing_amount);
|
||||
time64 statement_date, gnc_numeric balancing_amount);
|
||||
|
||||
void gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data );
|
||||
void gnc_split_reg_enter( GNCSplitReg *gsr, gboolean next_transaction );
|
||||
|
||||
@@ -97,7 +97,7 @@ static void gnc_split_reg2_refresh_toolbar( GNCSplitReg2 *gsr );
|
||||
static void gnc_split_reg2_ld_destroy( GNCLedgerDisplay2 *ledger );
|
||||
|
||||
static Transaction* create_balancing_transaction(QofBook *book, Account *account,
|
||||
time_t statement_date, gnc_numeric balancing_amount);
|
||||
time64 statement_date, gnc_numeric balancing_amount);
|
||||
|
||||
void gsr2_default_enter_handler ( GNCSplitReg2 *w, gpointer ud );
|
||||
void gsr2_default_cancel_handler ( GNCSplitReg2 *w, gpointer ud );
|
||||
@@ -120,7 +120,7 @@ void gsr2_default_reverse_txn_handler ( GNCSplitReg2 *w, gpointer ud );
|
||||
|
||||
static void gsr2_emit_simple_signal( GNCSplitReg2 *gsr, const char *sigName );
|
||||
static void gsr2_emit_help_changed (GncTreeViewSplitReg *view, gpointer user_data);
|
||||
static void gsr2_emit_include_date_signal( GNCSplitReg2 *gsr, time_t date );
|
||||
static void gsr2_emit_include_date_signal( GNCSplitReg2 *gsr, time64 date );
|
||||
|
||||
void gnc_split_reg2_cut_cb(GtkWidget *w, gpointer data);
|
||||
void gnc_split_reg2_copy_cb(GtkWidget *w, gpointer data);
|
||||
@@ -295,7 +295,7 @@ gnc_split_reg2_class_init( GNCSplitReg2Class *class )
|
||||
G_SIGNAL_RUN_LAST,
|
||||
signals[i++].defaultOffset,
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__INT, /* time_t == int */
|
||||
g_cclosure_marshal_VOID__INT, /* time64 == int */
|
||||
G_TYPE_NONE, 1, G_TYPE_INT );
|
||||
|
||||
g_assert( i == LAST_SIGNAL );
|
||||
@@ -975,8 +975,8 @@ gsr2_default_reverse_txn_handler (GNCSplitReg2 *gsr, gpointer data)
|
||||
new_trans = xaccTransReverse(trans);
|
||||
|
||||
/* Clear transaction level info */
|
||||
xaccTransSetDatePostedSecs(new_trans, time(NULL));
|
||||
xaccTransSetDateEnteredSecs(new_trans, time(NULL));
|
||||
xaccTransSetDatePostedSecs(new_trans, gnc_time (NULL));
|
||||
xaccTransSetDateEnteredSecs(new_trans, gnc_time (NULL));
|
||||
|
||||
/* Now jump to new trans */
|
||||
gnc_split_reg2_jump_to_split(gsr, xaccTransGetSplit(new_trans, 0));
|
||||
@@ -1479,7 +1479,7 @@ gnc_split_reg2_jump_to_blank (GNCSplitReg2 *gsr)
|
||||
|
||||
void
|
||||
gnc_split_reg2_balancing_entry(GNCSplitReg2 *gsr, Account *account,
|
||||
time_t statement_date, gnc_numeric balancing_amount)
|
||||
time64 statement_date, gnc_numeric balancing_amount)
|
||||
{
|
||||
/*FIXME*/
|
||||
#ifdef skip
|
||||
@@ -1508,7 +1508,7 @@ gnc_split_reg2_balancing_entry(GNCSplitReg2 *gsr, Account *account,
|
||||
|
||||
static Transaction*
|
||||
create_balancing_transaction(QofBook *book, Account *account,
|
||||
time_t statement_date, gnc_numeric balancing_amount)
|
||||
time64 statement_date, gnc_numeric balancing_amount)
|
||||
{
|
||||
/*FIXME*/
|
||||
#ifdef skip
|
||||
@@ -2171,7 +2171,7 @@ gsr2_emit_help_changed (GncTreeViewSplitReg *view, gpointer user_data ) //this w
|
||||
|
||||
static
|
||||
void
|
||||
gsr2_emit_include_date_signal( GNCSplitReg2 *gsr, time_t date )
|
||||
gsr2_emit_include_date_signal( GNCSplitReg2 *gsr, time64 date )
|
||||
{
|
||||
g_signal_emit_by_name( gsr, "include-date", date, NULL );
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ struct _GNCSplitReg2Class
|
||||
void (*unvoid_txn_cb) ( GNCSplitReg2 *w, gpointer user_data );
|
||||
void (*reverse_txn_cb) ( GNCSplitReg2 *w, gpointer user_data );
|
||||
void (*help_changed_cb) ( GNCSplitReg2 *w, gpointer user_data );
|
||||
void (*include_date_cb) ( GNCSplitReg2 *w, time_t date, gpointer user_data );
|
||||
void (*include_date_cb) ( GNCSplitReg2 *w, time64 date, gpointer user_data );
|
||||
};
|
||||
|
||||
#ifdef skip // Coming from original gnc-split-reg.h
|
||||
@@ -243,7 +243,7 @@ void gnc_split_reg2_jump_to_split_amount (GNCSplitReg2 *gsr, Split *split);
|
||||
* window.
|
||||
*/
|
||||
void gnc_split_reg2_balancing_entry (GNCSplitReg2 *gsr, Account *account,
|
||||
time_t statement_date, gnc_numeric balancing_amount);
|
||||
time64 statement_date, gnc_numeric balancing_amount);
|
||||
|
||||
void gsr2_default_delete_handler (GNCSplitReg2 *gsr, gpointer data );
|
||||
void gnc_split_reg2_enter (GNCSplitReg2 *gsr, gboolean next_transaction );
|
||||
|
||||
@@ -137,7 +137,7 @@ gnc_reconcile_view_construct (GNCReconcileView *view, Query *query)
|
||||
|
||||
GtkWidget *
|
||||
gnc_reconcile_view_new (Account *account, GNCReconcileViewType type,
|
||||
time_t statement_date)
|
||||
time64 statement_date)
|
||||
{
|
||||
GNCReconcileView *view;
|
||||
GtkListStore *liststore;
|
||||
@@ -203,14 +203,14 @@ gnc_reconcile_view_new (Account *account, GNCReconcileViewType type,
|
||||
{
|
||||
Split *split = splits->data;
|
||||
char recn = xaccSplitGetReconcile (split);
|
||||
time_t trans_date = xaccTransGetDate (xaccSplitGetParent (split));
|
||||
time64 trans_date = xaccTransGetDate (xaccSplitGetParent (split));
|
||||
|
||||
/* Just an extra verification that our query is correct ;) */
|
||||
g_assert (recn == NREC || recn == CREC);
|
||||
|
||||
if (recn == CREC &&
|
||||
difftime (trans_date, statement_date) <= 0)
|
||||
g_hash_table_insert (view->reconciled, split, split);
|
||||
gnc_difftime (trans_date, statement_date) <= 0)
|
||||
g_hash_table_insert (view->reconciled, split, split);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -706,14 +706,14 @@ static void
|
||||
grv_commit_hash_helper (gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
Split *split = key;
|
||||
time_t *date = user_data;
|
||||
time64 *date = user_data;
|
||||
|
||||
xaccSplitSetReconcile (split, YREC);
|
||||
xaccSplitSetDateReconciledSecs (split, *date);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_reconcile_view_commit (GNCReconcileView *view, time_t date)
|
||||
gnc_reconcile_view_commit (GNCReconcileView *view, time64 date)
|
||||
{
|
||||
g_return_if_fail (view != NULL);
|
||||
g_return_if_fail (GNC_IS_RECONCILE_VIEW (view));
|
||||
@@ -764,8 +764,8 @@ gnc_reconcile_view_postpone (GNCReconcileView *view)
|
||||
|
||||
// Don't change splits past reconciliation date that haven't been
|
||||
// set to be reconciled
|
||||
if ( difftime(view->statement_date,
|
||||
xaccTransGetDate (xaccSplitGetParent (entry))) >= 0 ||
|
||||
if (gnc_difftime (view->statement_date,
|
||||
xaccTransGetDate (xaccSplitGetParent (entry))) >= 0 ||
|
||||
g_hash_table_lookup (view->reconciled, entry))
|
||||
{
|
||||
recn = g_hash_table_lookup (view->reconciled, entry) ? CREC : NREC;
|
||||
|
||||
@@ -52,7 +52,7 @@ struct GNCReconcileView
|
||||
Account *account;
|
||||
GList *column_list;
|
||||
|
||||
time_t statement_date;
|
||||
time64 statement_date;
|
||||
|
||||
GNCReconcileView *sibling;
|
||||
GNCReconcileViewType view_type;
|
||||
@@ -78,7 +78,7 @@ GType gnc_reconcile_view_get_type (void);
|
||||
|
||||
GtkWidget * gnc_reconcile_view_new (Account * account,
|
||||
GNCReconcileViewType type,
|
||||
time_t date);
|
||||
time64 date);
|
||||
|
||||
gint gnc_reconcile_view_get_num_splits (GNCReconcileView *view);
|
||||
|
||||
@@ -92,7 +92,7 @@ void gnc_reconcile_view_refresh (GNCReconcileView *view);
|
||||
|
||||
gnc_numeric gnc_reconcile_view_reconciled_balance (GNCReconcileView *view);
|
||||
|
||||
void gnc_reconcile_view_commit (GNCReconcileView *view, time_t date);
|
||||
void gnc_reconcile_view_commit (GNCReconcileView *view, time64 date);
|
||||
|
||||
void gnc_reconcile_view_postpone (GNCReconcileView *view);
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "gnc-event.h"
|
||||
#include "gnc-filepath-utils.h"
|
||||
#include "gnc-gconf-utils.h"
|
||||
#include <gnc-gdate-utils.h>
|
||||
#include "gnc-gnome-utils.h"
|
||||
#include "gnc-main-window.h"
|
||||
#include "gnc-plugin-page-register.h"
|
||||
@@ -66,7 +67,7 @@ struct _RecnWindow
|
||||
{
|
||||
GncGUID account; /* The account that we are reconciling */
|
||||
gnc_numeric new_ending; /* The new ending balance */
|
||||
time_t statement_date; /* The statement date */
|
||||
time64 statement_date; /* The statement date */
|
||||
|
||||
gint component_id; /* id of component */
|
||||
|
||||
@@ -117,7 +118,7 @@ typedef struct _startRecnWindowData
|
||||
XferDialog *xferData; /* the interest xfer dialog (if it exists) */
|
||||
gboolean include_children;
|
||||
|
||||
time_t date; /* the interest xfer reconcile date */
|
||||
time64 date; /* the interest xfer reconcile date */
|
||||
} startRecnWindowData;
|
||||
|
||||
|
||||
@@ -162,7 +163,7 @@ static gboolean find_by_account (gpointer find_data, gpointer user_data);
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
G_GNUC_UNUSED static QofLogModule log_module = GNC_MOD_GUI;
|
||||
|
||||
static time_t gnc_reconcile_last_statement_date = 0;
|
||||
static time64 gnc_reconcile_last_statement_date = 0;
|
||||
|
||||
|
||||
/** IMPLEMENTATIONS *************************************************/
|
||||
@@ -342,7 +343,7 @@ gnc_start_recn_date_changed (GtkWidget *widget, startRecnWindowData *data)
|
||||
{
|
||||
GNCDateEdit *gde = GNC_DATE_EDIT (widget);
|
||||
gnc_numeric new_balance;
|
||||
time_t new_date;
|
||||
time64 new_date;
|
||||
|
||||
if (data->user_set_value)
|
||||
return;
|
||||
@@ -584,9 +585,9 @@ gnc_start_recn_interest_clicked_cb(GtkButton *button, startRecnWindowData *data)
|
||||
|
||||
|
||||
static void
|
||||
gnc_save_reconcile_interval(Account *account, time_t statement_date)
|
||||
gnc_save_reconcile_interval(Account *account, time64 statement_date)
|
||||
{
|
||||
time_t prev_statement_date;
|
||||
time64 prev_statement_date;
|
||||
int days = 0, months = 0;
|
||||
double seconds;
|
||||
|
||||
@@ -596,7 +597,7 @@ gnc_save_reconcile_interval(Account *account, time_t statement_date)
|
||||
/*
|
||||
* Compute the number of days difference.
|
||||
*/
|
||||
seconds = difftime(statement_date, prev_statement_date);
|
||||
seconds = gnc_difftime (statement_date, prev_statement_date);
|
||||
days = (int)(seconds / 60 / 60 / 24);
|
||||
|
||||
/*
|
||||
@@ -619,8 +620,8 @@ gnc_save_reconcile_interval(Account *account, time_t statement_date)
|
||||
{
|
||||
struct tm current, prev;
|
||||
|
||||
current = * localtime(&statement_date);
|
||||
prev = * localtime(&prev_statement_date);
|
||||
gnc_localtime_r (&statement_date, ¤t);
|
||||
gnc_localtime_r (&prev_statement_date, &prev);
|
||||
months = ((12 * current.tm_year + current.tm_mon) -
|
||||
(12 * prev.tm_year + prev.tm_mon));
|
||||
days = 0;
|
||||
@@ -649,7 +650,7 @@ gnc_save_reconcile_interval(Account *account, time_t statement_date)
|
||||
\********************************************************************/
|
||||
static gboolean
|
||||
startRecnWindow(GtkWidget *parent, Account *account,
|
||||
gnc_numeric *new_ending, time_t *statement_date,
|
||||
gnc_numeric *new_ending, time64 *statement_date,
|
||||
gboolean enable_subaccount)
|
||||
{
|
||||
GtkWidget *dialog, *end_value, *date_value, *include_children_button;
|
||||
@@ -1182,7 +1183,7 @@ gnc_ui_reconcile_window_change_cb(GtkAction *action, gpointer data)
|
||||
RecnWindow *recnData = data;
|
||||
Account *account = recn_get_account (recnData);
|
||||
gnc_numeric new_ending = recnData->new_ending;
|
||||
time_t statement_date = recnData->statement_date;
|
||||
time64 statement_date = recnData->statement_date;
|
||||
|
||||
if (gnc_reverse_balance (account))
|
||||
new_ending = gnc_numeric_neg (new_ending);
|
||||
@@ -1203,7 +1204,7 @@ gnc_ui_reconcile_window_balance_cb(GtkButton *button, gpointer data)
|
||||
GNCSplitReg *gsr;
|
||||
Account *account;
|
||||
gnc_numeric balancing_amount;
|
||||
time_t statement_date;
|
||||
time64 statement_date;
|
||||
|
||||
|
||||
gsr = gnc_reconcile_window_open_register(recnData);
|
||||
@@ -1220,7 +1221,7 @@ gnc_ui_reconcile_window_balance_cb(GtkButton *button, gpointer data)
|
||||
|
||||
statement_date = recnData->statement_date;
|
||||
if (statement_date == 0)
|
||||
statement_date = time(NULL); // default to 'now'
|
||||
statement_date = gnc_time (NULL); // default to 'now'
|
||||
|
||||
gnc_split_reg_balancing_entry(gsr, account, statement_date, balancing_amount);
|
||||
}
|
||||
@@ -1434,11 +1435,11 @@ gnc_toolbar_change_cb (GConfClient *client,
|
||||
static void
|
||||
gnc_get_reconcile_info (Account *account,
|
||||
gnc_numeric *new_ending,
|
||||
time_t *statement_date)
|
||||
time64 *statement_date)
|
||||
{
|
||||
gboolean always_today;
|
||||
GDate date;
|
||||
time_t today;
|
||||
time64 today;
|
||||
struct tm tm;
|
||||
|
||||
g_date_clear(&date, 1);
|
||||
@@ -1451,7 +1452,7 @@ gnc_get_reconcile_info (Account *account,
|
||||
{
|
||||
int months = 1, days = 0;
|
||||
|
||||
g_date_set_time_t(&date, *statement_date);
|
||||
gnc_gdate_set_time64(&date, *statement_date);
|
||||
|
||||
xaccAccountGetReconcileLastInterval (account, &months, &days);
|
||||
|
||||
@@ -1464,20 +1465,18 @@ gnc_get_reconcile_info (Account *account,
|
||||
/* Track last day of the month, i.e. 1/31 -> 2/28 -> 3/31 */
|
||||
if (was_last_day_of_month)
|
||||
{
|
||||
g_date_set_day(&date, g_date_get_days_in_month(g_date_get_month(&date),
|
||||
g_date_get_year(&date)));
|
||||
g_date_set_day (&date, g_date_get_days_in_month(g_date_get_month(&date),
|
||||
g_date_get_year( &date)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_date_add_days(&date, days);
|
||||
g_date_add_days (&date, days);
|
||||
}
|
||||
|
||||
g_date_to_struct_tm(&date, &tm);
|
||||
gnc_tm_set_day_end (&tm);
|
||||
*statement_date = mktime (&tm);
|
||||
*statement_date = gnc_time64_get_day_end_gdate (&date);
|
||||
|
||||
today = gnc_timet_get_day_end(time(NULL));
|
||||
today = gnc_time64_get_day_end (gnc_time (NULL));
|
||||
if (*statement_date > today)
|
||||
*statement_date = today;
|
||||
}
|
||||
@@ -1630,7 +1629,7 @@ RecnWindow *
|
||||
recnWindow (GtkWidget *parent, Account *account)
|
||||
{
|
||||
gnc_numeric new_ending;
|
||||
time_t statement_date;
|
||||
time64 statement_date;
|
||||
|
||||
if (account == NULL)
|
||||
return NULL;
|
||||
@@ -1641,7 +1640,7 @@ recnWindow (GtkWidget *parent, Account *account)
|
||||
* statements are issued at the same time, like multiple bank
|
||||
* accounts on a single statement. */
|
||||
if (!gnc_reconcile_last_statement_date)
|
||||
statement_date = time (NULL);
|
||||
statement_date = gnc_time (NULL);
|
||||
else
|
||||
statement_date = gnc_reconcile_last_statement_date;
|
||||
|
||||
@@ -1680,7 +1679,7 @@ recnWindow_add_widget (GtkUIManager *merge,
|
||||
\********************************************************************/
|
||||
RecnWindow *
|
||||
recnWindowWithBalance (GtkWidget *parent, Account *account,
|
||||
gnc_numeric new_ending, time_t statement_date)
|
||||
gnc_numeric new_ending, time64 statement_date)
|
||||
{
|
||||
RecnWindow *recnData;
|
||||
GtkWidget *statusbar;
|
||||
@@ -2098,7 +2097,7 @@ recnFinishCB (GtkAction *action, RecnWindow *recnData)
|
||||
{
|
||||
gboolean auto_payment;
|
||||
Account *account;
|
||||
time_t date;
|
||||
time64 date;
|
||||
|
||||
if (!gnc_numeric_zero_p (recnRecalculateBalance(recnData)))
|
||||
{
|
||||
|
||||
@@ -61,7 +61,7 @@ RecnWindow *recnWindow (GtkWidget *parent, Account *account);
|
||||
RecnWindow *recnWindowWithBalance (GtkWidget *parent,
|
||||
Account *account,
|
||||
gnc_numeric new_ending,
|
||||
time_t statement_date);
|
||||
time64 statement_date);
|
||||
|
||||
void gnc_ui_reconcile_window_raise(RecnWindow * recnData);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user