mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Andreas Köhler's patch to replace some deprecated glib functions.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@11995 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
130255cc9a
commit
042f050b9b
16
ChangeLog
16
ChangeLog
@ -1,5 +1,21 @@
|
||||
2005-11-20 David Hampton <hampton@employees.org>
|
||||
|
||||
* src/core-utils/gnc-gdate-utils.c:
|
||||
* src/backend/postgres/test/test-db.c:
|
||||
* src/import-export/hbci/gnc-hbci-gettrans.c:
|
||||
* src/engine/gnc-filepath-utils.c:
|
||||
* src/engine/FreqSpec.c:
|
||||
* src/engine/test/test-freq-spec.c:
|
||||
* src/gnome/druid-loan.c:
|
||||
* src/gnome/druid-acct-period.c:
|
||||
* src/gnome/dialog-sx-from-trans.c:
|
||||
* src/gnome/dialog-scheduledxaction.c:
|
||||
* src/gnome/dialog-sxsincelast.c:
|
||||
* src/app-utils/gnc-exp-parser.c:
|
||||
* lib/libqof/qof/qofquery.c:
|
||||
* lib/libqof/qof/gnc-date.c: Andreas Köhler's patch to replace
|
||||
some deprecated glib functions.
|
||||
|
||||
* src/backend/file/gnc-backend-file.c:
|
||||
* src/gnome-utils/dialog-utils.c: Fix some build problems on FC3
|
||||
related to the include file changes.
|
||||
|
@ -512,9 +512,9 @@ size_t
|
||||
qof_print_gdate( char *buf, size_t len, GDate *gd )
|
||||
{
|
||||
return qof_print_date_dmy_buff( buf, len,
|
||||
g_date_day(gd),
|
||||
g_date_month(gd),
|
||||
g_date_year(gd) );
|
||||
g_date_get_day(gd),
|
||||
g_date_get_month(gd),
|
||||
g_date_get_year(gd) );
|
||||
}
|
||||
|
||||
char *
|
||||
@ -1328,9 +1328,9 @@ gnc_timet_get_day_start_gdate (GDate *date)
|
||||
struct tm stm;
|
||||
time_t secs;
|
||||
|
||||
stm.tm_year = g_date_year (date) - 1900;
|
||||
stm.tm_mon = g_date_month (date) - 1;
|
||||
stm.tm_mday = g_date_day (date);
|
||||
stm.tm_year = g_date_get_year (date) - 1900;
|
||||
stm.tm_mon = g_date_get_month (date) - 1;
|
||||
stm.tm_mday = g_date_get_day (date);
|
||||
gnc_tm_set_day_start(&stm);
|
||||
|
||||
/* Compute number of seconds */
|
||||
@ -1344,9 +1344,9 @@ gnc_timet_get_day_end_gdate (GDate *date)
|
||||
struct tm stm;
|
||||
time_t secs;
|
||||
|
||||
stm.tm_year = g_date_year (date) - 1900;
|
||||
stm.tm_mon = g_date_month (date) - 1;
|
||||
stm.tm_mday = g_date_day (date);
|
||||
stm.tm_year = g_date_get_year (date) - 1900;
|
||||
stm.tm_mon = g_date_get_month (date) - 1;
|
||||
stm.tm_mday = g_date_get_day (date);
|
||||
gnc_tm_set_day_end(&stm);
|
||||
|
||||
/* Compute number of seconds */
|
||||
|
@ -1473,7 +1473,7 @@ qof_query_print (QofQuery * query)
|
||||
}
|
||||
|
||||
str = g_string_new (" ");
|
||||
g_string_sprintf (str, "Maximum number of results: %d", maxResults);
|
||||
g_string_printf (str, "Maximum number of results: %d", maxResults);
|
||||
output = g_list_append (output, str);
|
||||
|
||||
qof_query_printOutput (output);
|
||||
@ -1566,17 +1566,17 @@ qof_query_printSorts (QofQuerySort *s[], const gint numSorts, GList * output)
|
||||
increasing = qof_query_sort_get_increasing (s[curSort]);
|
||||
|
||||
gsl = qof_query_sort_get_param_path (s[curSort]);
|
||||
if (gsl) g_string_sprintfa (gs, " Param: ");
|
||||
if (gsl) g_string_append_printf (gs, " Param: ");
|
||||
for (n=gsl; n; n = n->next)
|
||||
{
|
||||
QofIdType param_name = n->data;
|
||||
if (gsl != n)g_string_sprintfa (gs, "\n ");
|
||||
g_string_sprintfa (gs, "%s", param_name);
|
||||
if (gsl != n)g_string_append_printf (gs, "\n ");
|
||||
g_string_append_printf (gs, "%s", param_name);
|
||||
}
|
||||
if (gsl)
|
||||
{
|
||||
g_string_sprintfa (gs, " %s\n", increasing ? "DESC" : "ASC");
|
||||
g_string_sprintfa (gs, " Options: 0x%x\n", s[curSort]->options);
|
||||
g_string_append_printf (gs, " %s\n", increasing ? "DESC" : "ASC");
|
||||
g_string_append_printf (gs, " Options: 0x%x\n", s[curSort]->options);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1608,7 +1608,7 @@ qof_query_printAndTerms (GList * terms, GList * output)
|
||||
invert = qof_query_term_is_inverted (qt);
|
||||
|
||||
if (invert) output = g_list_append (output,
|
||||
g_string_new(" INVERT SENSE "));
|
||||
g_string_new(" INVERT SENSE "));
|
||||
output = g_list_append (output, qof_query_printParamPath (path));
|
||||
output = g_list_append (output, qof_query_printPredData (pd));
|
||||
output = g_list_append (output, g_string_new("\n"));
|
||||
@ -1651,8 +1651,8 @@ qof_query_printPredData (QofQueryPredData *pd)
|
||||
if (safe_strcmp (pd->type_name, QOF_TYPE_CHAR) &&
|
||||
safe_strcmp (pd->type_name, QOF_TYPE_GUID))
|
||||
{
|
||||
g_string_sprintfa (gs, "\n how: %s",
|
||||
qof_query_printStringForHow (pd->how));
|
||||
g_string_append_printf (gs, "\n how: %s",
|
||||
qof_query_printStringForHow (pd->how));
|
||||
}
|
||||
|
||||
qof_query_printValueForParam (pd, gs);
|
||||
@ -1696,87 +1696,87 @@ qof_query_printValueForParam (QofQueryPredData *pd, GString * gs)
|
||||
{
|
||||
GList *node;
|
||||
query_guid_t pdata = (query_guid_t) pd;
|
||||
g_string_sprintfa (gs, "\n Match type %s",
|
||||
qof_query_printGuidMatch (pdata->options));
|
||||
g_string_append_printf (gs, "\n Match type %s",
|
||||
qof_query_printGuidMatch (pdata->options));
|
||||
for (node = pdata->guids; node; node = node->next)
|
||||
{
|
||||
/* THREAD-UNSAFE */
|
||||
g_string_sprintfa (gs, ", guids: %s",
|
||||
guid_to_string ((GUID *) node->data));
|
||||
g_string_append_printf (gs, ", guids: %s",
|
||||
guid_to_string ((GUID *) node->data));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_STRING))
|
||||
{
|
||||
query_string_t pdata = (query_string_t) pd;
|
||||
g_string_sprintfa (gs, "\n Match type %s",
|
||||
qof_query_printStringMatch (pdata->options));
|
||||
g_string_sprintfa (gs, " %s string: %s",
|
||||
pdata->is_regex ? "Regex" : "Not regex",
|
||||
pdata->matchstring);
|
||||
g_string_append_printf (gs, "\n Match type %s",
|
||||
qof_query_printStringMatch (pdata->options));
|
||||
g_string_append_printf (gs, " %s string: %s",
|
||||
pdata->is_regex ? "Regex" : "Not regex",
|
||||
pdata->matchstring);
|
||||
return;
|
||||
}
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_NUMERIC))
|
||||
{
|
||||
query_numeric_t pdata = (query_numeric_t) pd;
|
||||
g_string_sprintfa (gs, "\n Match type %s",
|
||||
qof_query_printNumericMatch (pdata->options));
|
||||
g_string_sprintfa (gs, " gnc_numeric: %s",
|
||||
gnc_num_dbg_to_string (pdata->amount));
|
||||
g_string_append_printf (gs, "\n Match type %s",
|
||||
qof_query_printNumericMatch (pdata->options));
|
||||
g_string_append_printf (gs, " gnc_numeric: %s",
|
||||
gnc_num_dbg_to_string (pdata->amount));
|
||||
return;
|
||||
}
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_KVP))
|
||||
{
|
||||
GSList *node;
|
||||
query_kvp_t pdata = (query_kvp_t) pd;
|
||||
g_string_sprintfa (gs, "\n kvp path: ");
|
||||
g_string_append_printf (gs, "\n kvp path: ");
|
||||
for (node = pdata->path; node; node = node->next)
|
||||
{
|
||||
g_string_sprintfa (gs, "/%s", (gchar *) node->data);
|
||||
g_string_append_printf (gs, "/%s", (gchar *) node->data);
|
||||
}
|
||||
g_string_sprintfa (gs, "\n");
|
||||
g_string_sprintfa (gs, " kvp value: %s\n",
|
||||
kvp_value_to_string (pdata->value));
|
||||
g_string_append_printf (gs, "\n");
|
||||
g_string_append_printf (gs, " kvp value: %s\n",
|
||||
kvp_value_to_string (pdata->value));
|
||||
return;
|
||||
}
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_INT64))
|
||||
{
|
||||
query_int64_t pdata = (query_int64_t) pd;
|
||||
g_string_sprintfa (gs, " int64: %" G_GINT64_FORMAT, pdata->val);
|
||||
g_string_append_printf (gs, " int64: %" G_GINT64_FORMAT, pdata->val);
|
||||
return;
|
||||
}
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_INT32))
|
||||
{
|
||||
query_int32_t pdata = (query_int32_t) pd;
|
||||
g_string_sprintfa (gs, " int32: %d", pdata->val);
|
||||
g_string_append_printf (gs, " int32: %d", pdata->val);
|
||||
return;
|
||||
}
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_DOUBLE))
|
||||
{
|
||||
query_double_t pdata = (query_double_t) pd;
|
||||
g_string_sprintfa (gs, " double: %.18g", pdata->val);
|
||||
g_string_append_printf (gs, " double: %.18g", pdata->val);
|
||||
return;
|
||||
}
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_DATE))
|
||||
{
|
||||
query_date_t pdata = (query_date_t) pd;
|
||||
g_string_sprintfa (gs, "\n Match type %s",
|
||||
qof_query_printDateMatch (pdata->options));
|
||||
g_string_sprintfa (gs, " query_date: %s", gnc_print_date (pdata->date));
|
||||
g_string_append_printf (gs, "\n Match type %s",
|
||||
qof_query_printDateMatch (pdata->options));
|
||||
g_string_append_printf (gs, " query_date: %s", gnc_print_date (pdata->date));
|
||||
return;
|
||||
}
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_CHAR))
|
||||
{
|
||||
query_char_t pdata = (query_char_t) pd;
|
||||
g_string_sprintfa (gs, "\n Match type %s",
|
||||
qof_query_printCharMatch (pdata->options));
|
||||
g_string_sprintfa (gs, " char list: %s", pdata->char_list);
|
||||
g_string_append_printf (gs, "\n Match type %s",
|
||||
qof_query_printCharMatch (pdata->options));
|
||||
g_string_append_printf (gs, " char list: %s", pdata->char_list);
|
||||
return;
|
||||
}
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_BOOLEAN))
|
||||
{
|
||||
query_boolean_t pdata = (query_boolean_t) pd;
|
||||
g_string_sprintfa (gs, " boolean: %s", pdata->val?"TRUE":"FALSE");
|
||||
g_string_append_printf (gs, " boolean: %s", pdata->val?"TRUE":"FALSE");
|
||||
return;
|
||||
}
|
||||
/** \todo QOF_TYPE_COLLECT */
|
||||
|
@ -331,7 +331,7 @@ func_op( const char *fname,
|
||||
GString *realFnName;
|
||||
|
||||
realFnName = g_string_sized_new( strlen(fname) + 5 );
|
||||
g_string_sprintf( realFnName, "gnc:%s", fname );
|
||||
g_string_printf( realFnName, "gnc:%s", fname );
|
||||
scmFn = gh_eval_str_with_standard_handler( realFnName->str );
|
||||
g_string_free( realFnName, TRUE );
|
||||
if ( ! SCM_PROCEDUREP( scmFn ) ) {
|
||||
|
@ -93,8 +93,8 @@ db_file_url(DbInfo *dbinfo)
|
||||
|
||||
g_return_val_if_fail(dbinfo->dbname && dbinfo->mode, NULL);
|
||||
|
||||
if ((!g_strncasecmp(dbinfo->port, "7777", 4)) &&
|
||||
(!g_strncasecmp(dbinfo->host, "localhost", 8))) {
|
||||
if ((!g_ascii_strncasecmp(dbinfo->port, "7777", 4)) &&
|
||||
(!g_ascii_strncasecmp(dbinfo->host, "localhost", 8))) {
|
||||
/* TEST_DB_SOCKET_DIR must be an absolute path */
|
||||
db_socket_dir = getenv("TEST_DB_SOCKET_DIR");
|
||||
if (!db_socket_dir)
|
||||
@ -793,7 +793,7 @@ drop_database(DbInfo *dbinfo)
|
||||
gchar *dropdb = NULL;
|
||||
int rc;
|
||||
|
||||
if (!g_strncasecmp(dbinfo->port, "7777", 4)) {
|
||||
if (!g_ascii_strncasecmp(dbinfo->port, "7777", 4)) {
|
||||
dropdb = g_strdup_printf("dropdb -p %s %s",
|
||||
dbinfo->port, dbinfo->dbname);
|
||||
} else {
|
||||
|
@ -46,9 +46,9 @@ g_date_equals( gconstpointer gda, gconstpointer gdb )
|
||||
guint
|
||||
g_date_hash( gconstpointer gd )
|
||||
{
|
||||
gint val = (g_date_year( (GDate*)gd ) * 10000)
|
||||
+ (g_date_month( (GDate*)gd ) * 100)
|
||||
+ g_date_day( (GDate*)gd );
|
||||
gint val = (g_date_get_year( (GDate*)gd ) * 10000)
|
||||
+ (g_date_get_month( (GDate*)gd ) * 100)
|
||||
+ g_date_get_day( (GDate*)gd );
|
||||
return g_int_hash( &val );
|
||||
}
|
||||
|
||||
|
@ -284,7 +284,7 @@ xaccFreqSpecGetNextInstance( FreqSpec *fs,
|
||||
case DAILY: {
|
||||
guint32 julian_in_date, julian_next_repeat, complete_intervals;
|
||||
|
||||
julian_in_date = g_date_julian( in_date );
|
||||
julian_in_date = g_date_get_julian( in_date );
|
||||
complete_intervals =
|
||||
(julian_in_date - fs->s.daily.offset_from_epoch) /
|
||||
fs->s.daily.interval_days;
|
||||
@ -300,7 +300,7 @@ xaccFreqSpecGetNextInstance( FreqSpec *fs,
|
||||
* It is very similar to the daily repeat representation. */
|
||||
guint32 julian_in_date, julian_next_repeat, complete_intervals;
|
||||
|
||||
julian_in_date = g_date_julian( in_date );
|
||||
julian_in_date = g_date_get_julian( in_date );
|
||||
complete_intervals =
|
||||
(julian_in_date - fs->s.weekly.offset_from_epoch) /
|
||||
(fs->s.weekly.interval_weeks * 7);
|
||||
@ -314,18 +314,18 @@ xaccFreqSpecGetNextInstance( FreqSpec *fs,
|
||||
guint32 in_months_from_epoch, after_repeat_in_month_interval,
|
||||
complete_intervals, next_repeat_months_from_epoch, month, year;
|
||||
|
||||
in_months_from_epoch = (g_date_year( in_date )-1) * 12 +
|
||||
g_date_month( in_date ) - 1;
|
||||
in_months_from_epoch = (g_date_get_year( in_date )-1) * 12 +
|
||||
g_date_get_month( in_date ) - 1;
|
||||
complete_intervals =
|
||||
(in_months_from_epoch - fs->s.monthly.offset_from_epoch) /
|
||||
fs->s.monthly.interval_months;
|
||||
after_repeat_in_month_interval =
|
||||
(g_date_day( in_date ) >= fs->s.monthly.day_of_month ||
|
||||
(g_date_get_day( in_date ) >= fs->s.monthly.day_of_month ||
|
||||
(in_months_from_epoch - fs->s.monthly.offset_from_epoch) %
|
||||
fs->s.monthly.interval_months > 0 ||
|
||||
g_date_day( in_date ) >=
|
||||
g_date_days_in_month( g_date_month( in_date ),
|
||||
g_date_year( in_date ) ) ) ? 1 : 0;
|
||||
g_date_get_day( in_date ) >=
|
||||
g_date_get_days_in_month( g_date_get_month( in_date ),
|
||||
g_date_get_year( in_date ) ) ) ? 1 : 0;
|
||||
next_repeat_months_from_epoch =
|
||||
fs->s.monthly.offset_from_epoch +
|
||||
(complete_intervals + after_repeat_in_month_interval) *
|
||||
@ -341,7 +341,7 @@ xaccFreqSpecGetNextInstance( FreqSpec *fs,
|
||||
year = next_repeat_months_from_epoch / 12 + 1;
|
||||
g_date_set_dmy( out_date,
|
||||
min( fs->s.monthly.day_of_month,
|
||||
g_date_days_in_month( month, year ) ),
|
||||
g_date_get_days_in_month( month, year ) ),
|
||||
month,
|
||||
year );
|
||||
} break;
|
||||
@ -352,20 +352,20 @@ xaccFreqSpecGetNextInstance( FreqSpec *fs,
|
||||
wday_of_1st, day_of_repeat;
|
||||
|
||||
GDate date1;
|
||||
in_months_from_epoch = (g_date_year( in_date )-1) * 12 +
|
||||
g_date_month( in_date ) - 1;
|
||||
in_months_from_epoch = (g_date_get_year( in_date )-1) * 12 +
|
||||
g_date_get_month( in_date ) - 1;
|
||||
complete_intervals =
|
||||
(in_months_from_epoch - fs->s.month_relative.offset_from_epoch) /
|
||||
fs->s.month_relative.interval_months;
|
||||
month = g_date_month( in_date );
|
||||
year = g_date_year( in_date );
|
||||
month = g_date_get_month( in_date );
|
||||
year = g_date_get_year( in_date );
|
||||
g_date_set_dmy( &date1, 1, month, year );
|
||||
wday_of_1st = g_date_get_weekday( &date1 );
|
||||
day_of_repeat = (fs->s.month_relative.occurrence-1)*7 +
|
||||
((fs->s.month_relative.weekday + 7 - wday_of_1st)%7 + 1);
|
||||
after_repeat_in_month_interval =
|
||||
(g_date_day( in_date ) >= day_of_repeat ||
|
||||
day_of_repeat > g_date_days_in_month( month, year ) ||
|
||||
(g_date_get_day( in_date ) >= day_of_repeat ||
|
||||
day_of_repeat > g_date_get_days_in_month( month, year ) ||
|
||||
(in_months_from_epoch - fs->s.month_relative.offset_from_epoch) %
|
||||
fs->s.month_relative.interval_months > 0 ) ? 1 : 0;
|
||||
next_repeat_months_from_epoch =
|
||||
@ -382,7 +382,7 @@ xaccFreqSpecGetNextInstance( FreqSpec *fs,
|
||||
* that month... */
|
||||
day_of_repeat = (fs->s.month_relative.occurrence-1)*7 +
|
||||
((fs->s.month_relative.weekday + 7 - wday_of_1st)%7 + 1);
|
||||
while( day_of_repeat > g_date_days_in_month( month, year ) ) {
|
||||
while( day_of_repeat > g_date_get_days_in_month( month, year ) ) {
|
||||
/* If the repeat occurs after the end of the month, then find
|
||||
* the next month containing a day which satisfies the
|
||||
* request. Each candiate month separated by interval_months
|
||||
@ -420,7 +420,7 @@ xaccFreqSpecGetNextInstance( FreqSpec *fs,
|
||||
(FreqSpec*) list->data,
|
||||
in_date,
|
||||
&next_repeat );
|
||||
this_julian = g_date_julian( &next_repeat );
|
||||
this_julian = g_date_get_julian( &next_repeat );
|
||||
|
||||
min_julian = min( min_julian, this_julian );
|
||||
|
||||
@ -474,7 +474,7 @@ xaccFreqSpecSetDaily( FreqSpec *fs,
|
||||
fs->type = DAILY;
|
||||
fs->s.daily.interval_days = interval_days;
|
||||
|
||||
julian_days_since_epoch = g_date_julian( initial_date );
|
||||
julian_days_since_epoch = g_date_get_julian( initial_date );
|
||||
fs->s.daily.offset_from_epoch = julian_days_since_epoch % interval_days;
|
||||
}
|
||||
|
||||
@ -503,7 +503,7 @@ xaccFreqSpecSetWeekly( FreqSpec *fs,
|
||||
fs->type = DAILY;
|
||||
fs->s.daily.interval_days = 7 * interval_weeks;
|
||||
|
||||
julian_days_since_epoch = g_date_julian( initial_date );
|
||||
julian_days_since_epoch = g_date_get_julian( initial_date );
|
||||
fs->s.daily.offset_from_epoch = julian_days_since_epoch % (7*interval_weeks);
|
||||
#endif
|
||||
#if 1
|
||||
@ -517,7 +517,7 @@ xaccFreqSpecSetWeekly( FreqSpec *fs,
|
||||
fs->type = WEEKLY;
|
||||
fs->s.weekly.interval_weeks = interval_weeks;
|
||||
|
||||
julian_days_since_epoch = g_date_julian( initial_date );
|
||||
julian_days_since_epoch = g_date_get_julian( initial_date );
|
||||
fs->s.weekly.offset_from_epoch = julian_days_since_epoch % (7*interval_weeks);
|
||||
#endif
|
||||
#if 0
|
||||
@ -535,7 +535,7 @@ xaccFreqSpecSetWeekly( FreqSpec *fs,
|
||||
fs->type = WEEKLY;
|
||||
fs->s.weekly.interval_weeks = interval_weeks;
|
||||
|
||||
julian_day_initial = g_date_julian( initial_date );
|
||||
julian_day_initial = g_date_get_julian( initial_date );
|
||||
weeks_since_epoch = (julian_day_initial-1) / 7;
|
||||
fs->s.weekly.day_of_week = (julian_day_initial-1) % 7;
|
||||
fs->s.weekly.offset_from_epoch = weeks_since_epoch % interval_weeks;
|
||||
@ -559,10 +559,10 @@ xaccFreqSpecSetMonthly( FreqSpec *fs,
|
||||
fs->type = MONTHLY;
|
||||
fs->s.monthly.interval_months = interval_months;
|
||||
|
||||
months_since_epoch = (g_date_year( initial_date )-1) * 12 +
|
||||
g_date_month( initial_date ) - 1;
|
||||
months_since_epoch = (g_date_get_year( initial_date )-1) * 12 +
|
||||
g_date_get_month( initial_date ) - 1;
|
||||
fs->s.monthly.offset_from_epoch = months_since_epoch % interval_months;
|
||||
fs->s.monthly.day_of_month = g_date_day( initial_date );
|
||||
fs->s.monthly.day_of_month = g_date_get_day( initial_date );
|
||||
|
||||
g_return_if_fail( fs->s.monthly.offset_from_epoch <
|
||||
fs->s.monthly.interval_months );
|
||||
@ -580,12 +580,12 @@ xaccFreqSpecSetMonthRelative( FreqSpec *fs,
|
||||
fs->type = MONTH_RELATIVE;
|
||||
fs->s.month_relative.interval_months = interval_months;
|
||||
|
||||
months_since_epoch = (g_date_year( initial_date )-1) * 12 +
|
||||
g_date_month( initial_date ) - 1;
|
||||
months_since_epoch = (g_date_get_year( initial_date )-1) * 12 +
|
||||
g_date_get_month( initial_date ) - 1;
|
||||
fs->s.month_relative.offset_from_epoch = months_since_epoch % interval_months;
|
||||
|
||||
fs->s.month_relative.weekday = g_date_get_weekday( initial_date );
|
||||
fs->s.month_relative.occurrence = (g_date_day( initial_date )-1) / 7 + 1;
|
||||
fs->s.month_relative.occurrence = (g_date_get_day( initial_date )-1) / 7 + 1;
|
||||
|
||||
g_return_if_fail( fs->s.month_relative.weekday > 0 );
|
||||
g_return_if_fail( fs->s.month_relative.weekday <= 7 );
|
||||
@ -682,11 +682,11 @@ get_dom_string(guint dom)
|
||||
if(dom > 31)
|
||||
{
|
||||
/* This is displayed instead of the number of the day of month. */
|
||||
g_string_sprintf(str, _( "last day"));
|
||||
g_string_printf(str, _( "last day"));
|
||||
}
|
||||
else
|
||||
{
|
||||
g_string_sprintf(str, "%u", dom);
|
||||
g_string_printf(str, "%u", dom);
|
||||
}
|
||||
|
||||
return str;
|
||||
@ -982,7 +982,7 @@ xaccFreqSpecGetFreqStr( FreqSpec *fs, GString *str )
|
||||
snprintf( freqStrBuf, MAX_FREQ_STR_SIZE, _("Unknown") );
|
||||
break;
|
||||
}
|
||||
g_string_sprintf( str, "%s", freqStrBuf );
|
||||
g_string_printf( str, "%s", freqStrBuf );
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -199,7 +199,7 @@ xaccResolveFilePath (const char * filefrag)
|
||||
if (*filefrag == '/')
|
||||
return g_strdup (filefrag);
|
||||
|
||||
if (!g_strncasecmp(filefrag, "file:", 5))
|
||||
if (!g_ascii_strncasecmp(filefrag, "file:", 5))
|
||||
{
|
||||
char *ret = g_new(char, strlen(filefrag) - 5 + 1);
|
||||
strcpy(ret, filefrag + 5);
|
||||
@ -290,15 +290,15 @@ xaccResolveURL (const char * pathfrag)
|
||||
* to make sure the uri is in good form.
|
||||
*/
|
||||
|
||||
if (!g_strncasecmp (pathfrag, "http://", 7) ||
|
||||
!g_strncasecmp (pathfrag, "https://", 8) ||
|
||||
!g_strncasecmp (pathfrag, "postgres://", 11) ||
|
||||
!g_strncasecmp (pathfrag, "rpc://", 6))
|
||||
if (!g_ascii_strncasecmp (pathfrag, "http://", 7) ||
|
||||
!g_ascii_strncasecmp (pathfrag, "https://", 8) ||
|
||||
!g_ascii_strncasecmp (pathfrag, "postgres://", 11) ||
|
||||
!g_ascii_strncasecmp (pathfrag, "rpc://", 6))
|
||||
{
|
||||
return g_strdup(pathfrag);
|
||||
}
|
||||
|
||||
if (!g_strncasecmp (pathfrag, "file:", 5)) {
|
||||
if (!g_ascii_strncasecmp (pathfrag, "file:", 5)) {
|
||||
return (xaccResolveFilePath (pathfrag));
|
||||
}
|
||||
|
||||
|
@ -69,14 +69,14 @@ test_daily (void)
|
||||
|
||||
g_date_set_dmy( &date1, 1, 1, 2000 );
|
||||
|
||||
start_julian = g_date_julian( &date1 );
|
||||
start_julian = g_date_get_julian( &date1 );
|
||||
for( interval = 1; interval < 400; ++interval ) {
|
||||
xaccFreqSpecSetDaily( fs, &date1, interval );
|
||||
for( i = 0; i <= 2 * interval; ++i ) {
|
||||
g_date_set_julian( &date2, start_julian + i );
|
||||
xaccFreqSpecGetNextInstance( fs, &date2, &next_date );
|
||||
do_test_args(
|
||||
g_date_julian( &next_date ) - g_date_julian( &date2 ) ==
|
||||
g_date_get_julian( &next_date ) - g_date_get_julian( &date2 ) ==
|
||||
interval - (i%interval),
|
||||
"daily repeats",
|
||||
__FILE__, __LINE__,
|
||||
@ -96,7 +96,7 @@ test_daily (void)
|
||||
xaccFreqSpecGetNextInstance( fs, &date2, &next_date );
|
||||
date2 = next_date;
|
||||
}
|
||||
do_test_args( g_date_julian( &date2 ) - g_date_julian( &date1 ) == interval*j,
|
||||
do_test_args( g_date_get_julian( &date2 ) - g_date_get_julian( &date1 ) == interval*j,
|
||||
"daily repeats end up in the right place",
|
||||
__FILE__, __LINE__, "interval = %d days, iters = %d",
|
||||
interval, j );
|
||||
@ -121,7 +121,7 @@ test_weekly (void)
|
||||
/*
|
||||
g_date_set_dmy( &date1, 2, 1, 1 );
|
||||
xaccFreqSpecSetWeekly( fs, &date1, 1 );
|
||||
start_julian = g_date_julian( &date1 );
|
||||
start_julian = g_date_get_julian( &date1 );
|
||||
g_date_set_julian( &date2, start_julian + 6 );
|
||||
xaccFreqSpecGetNextInstance( fs, &date2, &next_date );
|
||||
*/
|
||||
@ -129,14 +129,14 @@ test_weekly (void)
|
||||
|
||||
for( weekday = 1; weekday <= 7; ++weekday ) {
|
||||
g_date_set_dmy( &date1, weekday, 1, 1 );
|
||||
start_julian = g_date_julian( &date1 );
|
||||
start_julian = g_date_get_julian( &date1 );
|
||||
for( interval = 1; interval <= 52; ++interval ) {
|
||||
xaccFreqSpecSetWeekly( fs, &date1, interval );
|
||||
for( i = 0; i <= 2 * 7 * interval; ++i ) {
|
||||
g_date_set_julian( &date2, start_julian + i );
|
||||
xaccFreqSpecGetNextInstance( fs, &date2, &next_date );
|
||||
do_test_args(
|
||||
g_date_julian( &next_date ) - g_date_julian( &date2 ) ==
|
||||
g_date_get_julian( &next_date ) - g_date_get_julian( &date2 ) ==
|
||||
interval*7 - (i%(interval*7)),
|
||||
"weekly repeats",
|
||||
__FILE__, __LINE__,
|
||||
@ -157,7 +157,7 @@ test_weekly (void)
|
||||
xaccFreqSpecGetNextInstance( fs, &date2, &next_date );
|
||||
date2 = next_date;
|
||||
}
|
||||
do_test_args( g_date_julian( &date2 ) - g_date_julian( &date1 ) == interval*7*j,
|
||||
do_test_args( g_date_get_julian( &date2 ) - g_date_get_julian( &date1 ) == interval*7*j,
|
||||
"weekly repeats end up in the right place",
|
||||
__FILE__, __LINE__, "interval = %d weeks, iters = %d",
|
||||
interval, j );
|
||||
@ -183,7 +183,7 @@ test_monthly (void)
|
||||
/*
|
||||
g_date_set_dmy( &date1, 1, 1, 1 );
|
||||
xaccFreqSpecSetMonthly( fs, &date1, 2 );
|
||||
start_julian = g_date_julian( &date1 );
|
||||
start_julian = g_date_get_julian( &date1 );
|
||||
g_date_set_julian( &date2, start_julian + 0 );
|
||||
xaccFreqSpecGetNextInstance( fs, &date2, &next_date );
|
||||
*/
|
||||
@ -191,20 +191,20 @@ test_monthly (void)
|
||||
for( monthday = 1; monthday <= 28; ++monthday ) {
|
||||
for( month = 1; month <= 12; ++month ) {
|
||||
g_date_set_dmy( &date1, monthday, month, 1 );
|
||||
start_julian = g_date_julian( &date1 );
|
||||
start_julian = g_date_get_julian( &date1 );
|
||||
for( interval = 1; interval <= 24; ++interval ) {
|
||||
xaccFreqSpecSetMonthly( fs, &date1, interval );
|
||||
for( i = 0; i <= 2 * 31 * interval; ++i ) {
|
||||
g_date_set_julian( &date2, start_julian + i );
|
||||
xaccFreqSpecGetNextInstance( fs, &date2, &next_date );
|
||||
do_test_args(
|
||||
g_date_day( &next_date ) == g_date_day( &date1 ),
|
||||
g_date_get_day( &next_date ) == g_date_get_day( &date1 ),
|
||||
"monthly repeats - check day",
|
||||
__FILE__, __LINE__,
|
||||
"monthday = %d, month = %d, interval = %d months, days from start = %d",
|
||||
monthday, month, interval, i );
|
||||
do_test_args(
|
||||
( g_date_month( &next_date ) + 12 * (g_date_year( &next_date )-1) - 1) %
|
||||
( g_date_get_month( &next_date ) + 12 * (g_date_get_year( &next_date )-1) - 1) %
|
||||
interval == (month-1) % interval,
|
||||
"monthly repeats - check month",
|
||||
__FILE__, __LINE__,
|
||||
@ -219,7 +219,7 @@ test_monthly (void)
|
||||
* and end up in the right place. */
|
||||
g_date_set_dmy( &date0, 1, 1, 2000 );
|
||||
for( day_of_year = 1; day_of_year <= 365*5; ++day_of_year ) {
|
||||
g_date_set_julian( &date1, g_date_julian( &date0 ) + day_of_year-1 );
|
||||
g_date_set_julian( &date1, g_date_get_julian( &date0 ) + day_of_year-1 );
|
||||
for( interval = 1; interval < 20; ++interval ) {
|
||||
xaccFreqSpecSetMonthly( fs, &date1, interval );
|
||||
for( j = 1; j < 20; ++j ) {
|
||||
@ -257,7 +257,7 @@ test_month_relative (void)
|
||||
/*
|
||||
g_date_set_dmy( &date1, 1, 1, 1 );
|
||||
xaccFreqSpecSetMonthRelative( fs, &date1, 2 );
|
||||
start_julian = g_date_julian( &date1 );
|
||||
start_julian = g_date_get_julian( &date1 );
|
||||
g_date_set_julian( &date2, start_julian + 0 );
|
||||
xaccFreqSpecGetNextInstance( fs, &date2, &next_date );
|
||||
*/
|
||||
@ -267,7 +267,7 @@ test_month_relative (void)
|
||||
for( monthday = 1; monthday <= 28; ++monthday ) {
|
||||
for( month = 1; month <= 12; ++month ) {
|
||||
g_date_set_dmy( &date1, monthday, month, 1 );
|
||||
start_julian = g_date_julian( &date1 );
|
||||
start_julian = g_date_get_julian( &date1 );
|
||||
for( interval = 1; interval <= 24; ++interval ) {
|
||||
xaccFreqSpecSetMonthRelative( fs, &date1, interval );
|
||||
for( i = 0; i <= 2 * 31 * interval; ++i ) {
|
||||
@ -280,13 +280,13 @@ test_month_relative (void)
|
||||
"monthday = %d, month = %d, interval = %d months, days from start = %d, weekday = %d",
|
||||
monthday, month, interval, i, g_date_get_weekday( &date1 ) );
|
||||
do_test_args(
|
||||
(g_date_day( &next_date )-1)/7 == (g_date_day( &date1 )-1)/7,
|
||||
(g_date_get_day( &next_date )-1)/7 == (g_date_get_day( &date1 )-1)/7,
|
||||
"month relative repeats - check occurrence",
|
||||
__FILE__, __LINE__,
|
||||
"monthday = %d, month = %d, interval = %d months, days from start = %d, occurrence = %d",
|
||||
monthday, month, interval, i, (g_date_day( &date1 )-1)/7 );
|
||||
monthday, month, interval, i, (g_date_get_day( &date1 )-1)/7 );
|
||||
do_test_args(
|
||||
( g_date_month( &next_date ) + 12 * (g_date_year( &next_date )-1) - 1) %
|
||||
( g_date_get_month( &next_date ) + 12 * (g_date_get_year( &next_date )-1) - 1) %
|
||||
interval == (month-1) % interval,
|
||||
"month relative repeats - check month",
|
||||
__FILE__, __LINE__,
|
||||
@ -314,7 +314,7 @@ test_month_relative (void)
|
||||
}
|
||||
date2 = date1;
|
||||
g_date_add_months( &date2, interval * j );
|
||||
do_test_args( g_date_month( &date2 ) == g_date_month( &next_date ),
|
||||
do_test_args( g_date_get_month( &date2 ) == g_date_get_month( &next_date ),
|
||||
"month_relative repeats end up in the right place - month",
|
||||
__FILE__, __LINE__, "interval = %d months, iters = %d, weekday = %d",
|
||||
interval, j, g_date_get_weekday( &date1 ) );
|
||||
@ -322,7 +322,7 @@ test_month_relative (void)
|
||||
"month_relative repeats end up in the right place - weekday",
|
||||
__FILE__, __LINE__, "interval = %d months, iters = %d, weekday = %d",
|
||||
interval, j, g_date_get_weekday( &date1 ) );
|
||||
do_test_args( (g_date_day( &date2 )-1)/7 == (g_date_day( &next_date )-1)/7,
|
||||
do_test_args( (g_date_get_day( &date2 )-1)/7 == (g_date_get_day( &next_date )-1)/7,
|
||||
"month_relative repeats end up in the right place - occurrence",
|
||||
__FILE__, __LINE__, "interval = %d months, iters = %d, weekday = %d",
|
||||
interval, j, g_date_get_weekday( &date1 ) );
|
||||
@ -392,7 +392,7 @@ test_composite (void)
|
||||
/*
|
||||
g_date_set_dmy( &date1, 1, 1, 1 );
|
||||
xaccFreqSpecSetMonthly( fs, &date1, 2 );
|
||||
start_julian = g_date_julian( &date1 );
|
||||
start_julian = g_date_get_julian( &date1 );
|
||||
g_date_set_julian( &date2, start_julian + 0 );
|
||||
xaccFreqSpecGetNextInstance( fs, &date2, &next_date );
|
||||
*/
|
||||
|
@ -778,10 +778,10 @@ gnc_sxed_check_consistent( SchedXactionEditorDialog *sxed )
|
||||
GString *errStr;
|
||||
|
||||
errStr = g_string_sized_new( 32 );
|
||||
g_string_sprintf( errStr,
|
||||
_( "Couldn't parse credit formula for "
|
||||
"split \"%s\"." ),
|
||||
xaccSplitGetMemo( s ) );
|
||||
g_string_printf( errStr,
|
||||
_( "Couldn't parse credit formula for "
|
||||
"split \"%s\"." ),
|
||||
xaccSplitGetMemo( s ) );
|
||||
gnc_error_dialog( GTK_WIDGET(sxed->dialog),
|
||||
errStr->str );
|
||||
g_string_free( errStr, TRUE );
|
||||
@ -804,10 +804,10 @@ gnc_sxed_check_consistent( SchedXactionEditorDialog *sxed )
|
||||
GString *errStr;
|
||||
|
||||
errStr = g_string_sized_new( 32 );
|
||||
g_string_sprintf( errStr,
|
||||
_( "Couldn't parse debit formula for "
|
||||
"split \"%s\"." ),
|
||||
xaccSplitGetMemo( s ) );
|
||||
g_string_printf( errStr,
|
||||
_( "Couldn't parse debit formula for "
|
||||
"split \"%s\"." ),
|
||||
xaccSplitGetMemo( s ) );
|
||||
gnc_error_dialog( GTK_WIDGET(sxed->dialog),
|
||||
(gchar*)errStr->str );
|
||||
g_string_free( errStr, TRUE );
|
||||
@ -1654,12 +1654,12 @@ schedXact_editor_populate( SchedXactionEditorDialog *sxed )
|
||||
gtk_toggle_button_set_active( sxed->optEndCount, TRUE );
|
||||
|
||||
tmpgStr = g_string_sized_new(5);
|
||||
g_string_sprintf( tmpgStr, "%d", numOccur );
|
||||
g_string_printf( tmpgStr, "%d", numOccur );
|
||||
gtk_entry_set_text( sxed->endCountEntry, tmpgStr->str );
|
||||
g_string_free( tmpgStr, TRUE );
|
||||
|
||||
tmpgStr = g_string_sized_new(5);
|
||||
g_string_sprintf( tmpgStr, "%d", numRemain );
|
||||
g_string_printf( tmpgStr, "%d", numRemain );
|
||||
gtk_entry_set_text( sxed->endRemainEntry, tmpgStr->str );
|
||||
g_string_free( tmpgStr, TRUE );
|
||||
|
||||
@ -1821,14 +1821,14 @@ delete_button_clicked( GtkButton *b, gpointer d )
|
||||
beingEditedList = NULL;
|
||||
for ( ; sel ; sel = sel->next ) {
|
||||
sx = (SchedXaction*)gtk_clist_get_row_data( cl, GPOINTER_TO_INT(sel->data));
|
||||
g_string_sprintfa( realConfDeleteMsg, "\n\"%s\"",
|
||||
xaccSchedXactionGetName( sx ) );
|
||||
g_string_append_printf( realConfDeleteMsg, "\n\"%s\"",
|
||||
xaccSchedXactionGetName( sx ) );
|
||||
if ( (l = gnc_find_gui_components( DIALOG_SCHEDXACTION_EDITOR_CM_CLASS,
|
||||
editor_component_sx_equality,
|
||||
sx )) ) {
|
||||
beingEditedList = g_list_append( beingEditedList, (gpointer)l );
|
||||
g_string_sprintfa( realConfDelOpenMsg, "\n\"%s\"",
|
||||
xaccSchedXactionGetName( sx ) );
|
||||
g_string_append_printf( realConfDelOpenMsg, "\n\"%s\"",
|
||||
xaccSchedXactionGetName( sx ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -2050,14 +2050,14 @@ putSchedXactionInDialog( gpointer data, gpointer user_data )
|
||||
}
|
||||
|
||||
if ( instList == NULL ) {
|
||||
g_string_sprintf( nextDate, _("Not scheduled") );
|
||||
g_string_printf( nextDate, _("Not scheduled") );
|
||||
} else {
|
||||
char tmpBuf[ MAX_DATE_LENGTH+1 ];
|
||||
char dowBuf[ 25 ]; /* <- FIXME: appropriate length? */
|
||||
nextInstDate = (GDate*)instList->data;
|
||||
qof_print_gdate( tmpBuf, MAX_DATE_LENGTH, nextInstDate );
|
||||
g_date_strftime( dowBuf, 25, "%A", nextInstDate );
|
||||
g_string_sprintf( nextDate, "%s (%s)", tmpBuf, dowBuf );
|
||||
g_string_printf( nextDate, "%s (%s)", tmpBuf, dowBuf );
|
||||
}
|
||||
|
||||
/* Add markings to GncDenseCal */
|
||||
@ -2383,8 +2383,8 @@ gnc_sxed_update_cal( SchedXactionEditorDialog *sxed )
|
||||
}
|
||||
|
||||
i = 0;
|
||||
gnc_dense_cal_set_month( sxed->example_cal, g_date_month( &d ) );
|
||||
gnc_dense_cal_set_year( sxed->example_cal, g_date_year( &d ) );
|
||||
gnc_dense_cal_set_month( sxed->example_cal, g_date_get_month( &d ) );
|
||||
gnc_dense_cal_set_year( sxed->example_cal, g_date_get_year( &d ) );
|
||||
while ( (i < EX_CAL_NUM_MONTHS * 31)
|
||||
&& g_date_valid( &d )
|
||||
/* Restrict based on end date */
|
||||
|
@ -748,9 +748,9 @@ sxftd_update_example_cal( SXFromTransInfo *sxfti )
|
||||
if ( i > 0 ) {
|
||||
GtkWidget *w;
|
||||
gnc_dense_cal_set_month( sxfti->example_cal,
|
||||
g_date_month( &startDate ) );
|
||||
g_date_get_month( &startDate ) );
|
||||
gnc_dense_cal_set_year( sxfti->example_cal,
|
||||
g_date_year( &startDate ) );
|
||||
g_date_get_year( &startDate ) );
|
||||
w = glade_xml_get_widget( sxfti->gxml, SXFTD_NAME_ENTRY );
|
||||
name = gtk_editable_get_chars( GTK_EDITABLE(w), 0, -1 );
|
||||
info = g_string_sized_new( 16 );
|
||||
|
@ -1942,8 +1942,8 @@ add_reminders_to_gui( GList *reminderList, sxSinceLastData *sxsld )
|
||||
rowText[1] = "";
|
||||
rowText[2] = g_new0( gchar, 5 ); /* FIXME: appropriate size? */
|
||||
sprintf( rowText[2], "%d",
|
||||
(g_date_julian(rit->occurDate)
|
||||
- g_date_julian(rit->endDate)) );
|
||||
(g_date_get_julian(rit->occurDate)
|
||||
- g_date_get_julian(rit->endDate)) );
|
||||
|
||||
instNode = gtk_ctree_insert_node( ctree, sxNode, NULL,
|
||||
rowText,
|
||||
@ -2460,9 +2460,9 @@ create_each_transaction_helper( Transaction *t, void *d )
|
||||
gnc_copy_trans_onto_trans( t, newT, FALSE, FALSE );
|
||||
|
||||
xaccTransSetDate( newT,
|
||||
g_date_day( tci->date ),
|
||||
g_date_month( tci->date ),
|
||||
g_date_year( tci->date ) );
|
||||
g_date_get_day( tci->date ),
|
||||
g_date_get_month( tci->date ),
|
||||
g_date_get_year( tci->date ) );
|
||||
|
||||
/* the accounts and amounts are in the kvp_frames of the splits. */
|
||||
osList = xaccTransGetSplitList( t );
|
||||
@ -2800,7 +2800,7 @@ tct_table_entry_key_handle( GtkWidget *widget, GdkEventKey *event, gpointer ud )
|
||||
ent = GTK_ENTRY(widget);
|
||||
num = (gnc_numeric*)gtk_object_get_data( GTK_OBJECT(ent), "numeric" );
|
||||
str = g_string_new("");
|
||||
g_string_sprintf( str, "%0.2f", gnc_numeric_to_double( *num ) );
|
||||
g_string_printf( str, "%0.2f", gnc_numeric_to_double( *num ) );
|
||||
gtk_entry_set_text( ent, str->str );
|
||||
g_string_free( str, TRUE );
|
||||
|
||||
@ -2931,7 +2931,7 @@ sxsincelast_tc_row_sel( GtkCTree *ct,
|
||||
}
|
||||
|
||||
gstr = g_string_sized_new(16);
|
||||
g_string_sprintf( gstr, "%s: ", varName );
|
||||
g_string_printf( gstr, "%s: ", varName );
|
||||
label = gtk_label_new( gstr->str );
|
||||
gtk_label_set_justify( GTK_LABEL(label), GTK_JUSTIFY_RIGHT );
|
||||
g_string_free( gstr, TRUE );
|
||||
@ -3493,8 +3493,8 @@ create_bad_reminders_msg( gpointer data, gpointer ud )
|
||||
rit = (reminderInstanceTuple*)data;
|
||||
msg = (GString*)ud;
|
||||
qof_print_gdate( tmpBuf, MAX_DATE_LENGTH, rit->occurDate );
|
||||
g_string_sprintfa( msg, tmpBuf );
|
||||
g_string_sprintfa( msg, "\n" );
|
||||
g_string_append_printf( msg, tmpBuf );
|
||||
g_string_append_printf( msg, "\n" );
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -3523,12 +3523,12 @@ inform_or_add( sxSinceLastData *sxsld, reminderTuple *rt, gboolean okFlag,
|
||||
/* [Add to list for later] dialog issuance to user. */
|
||||
|
||||
userMsg = g_string_sized_new( 128 );
|
||||
g_string_sprintf( userMsg,
|
||||
"You cannot skip instances of "
|
||||
"Scheduled Transactions.\n"
|
||||
"The following instances of \"%s\"\n"
|
||||
"must be selected as well:\n\n",
|
||||
xaccSchedXactionGetName( rt->sx ) );
|
||||
g_string_printf( userMsg,
|
||||
"You cannot skip instances of "
|
||||
"Scheduled Transactions.\n"
|
||||
"The following instances of \"%s\"\n"
|
||||
"must be selected as well:\n\n",
|
||||
xaccSchedXactionGetName( rt->sx ) );
|
||||
g_list_foreach( badList, create_bad_reminders_msg, userMsg );
|
||||
gnc_error_dialog( sxsld->sincelast_window, userMsg->str );
|
||||
g_string_free( userMsg, TRUE );
|
||||
|
@ -237,9 +237,9 @@ prepare_remarks (AcctPeriodInfo *info)
|
||||
{
|
||||
nperiods ++;
|
||||
PINFO ("period=%d end date=%d/%d/%d", nperiods,
|
||||
g_date_month(&period_end),
|
||||
g_date_day(&period_end),
|
||||
g_date_year(&period_end));
|
||||
g_date_get_month(&period_end),
|
||||
g_date_get_day(&period_end),
|
||||
g_date_get_year(&period_end));
|
||||
period_begin = period_end;
|
||||
xaccFreqSpecGetNextInstance (info->period, &period_begin, &period_end);
|
||||
}
|
||||
@ -281,9 +281,9 @@ show_book_details (AcctPeriodInfo *info)
|
||||
"Click on 'Back' to adjust the dates.\n");
|
||||
|
||||
qof_print_date_dmy_buff (close_date_str, MAX_DATE_LENGTH,
|
||||
g_date_day(&info->closing_date),
|
||||
g_date_month(&info->closing_date),
|
||||
g_date_year(&info->closing_date));
|
||||
g_date_get_day(&info->closing_date),
|
||||
g_date_get_month(&info->closing_date),
|
||||
g_date_get_year(&info->closing_date));
|
||||
|
||||
currbook = gnc_get_current_book();
|
||||
ntrans = get_num_xactions_before_date(currbook,
|
||||
@ -301,9 +301,9 @@ show_book_details (AcctPeriodInfo *info)
|
||||
|
||||
/* Create default settings for the title, notes fields */
|
||||
qof_print_date_dmy_buff (prev_close_date_str, MAX_DATE_LENGTH,
|
||||
g_date_day(&info->prev_closing_date),
|
||||
g_date_month(&info->prev_closing_date),
|
||||
g_date_year(&info->prev_closing_date));
|
||||
g_date_get_day(&info->prev_closing_date),
|
||||
g_date_get_month(&info->prev_closing_date),
|
||||
g_date_get_year(&info->prev_closing_date));
|
||||
|
||||
str = g_strdup_printf (_("Period %s - %s"), prev_close_date_str, close_date_str);
|
||||
gtk_entry_set_text (info->book_title, str);
|
||||
|
@ -638,8 +638,8 @@ gnc_ui_sx_loan_druid_create(void)
|
||||
|
||||
/* Translators: %s is "Taxes",
|
||||
* "Insurance", or similar. */
|
||||
g_string_sprintf( str, _("... pay \"%s\"?"),
|
||||
rouid->optData->name );
|
||||
g_string_printf( str, _("... pay \"%s\"?"),
|
||||
rouid->optData->name );
|
||||
rouid->optCb =
|
||||
GTK_CHECK_BUTTON(
|
||||
gtk_check_button_new_with_label(
|
||||
@ -938,11 +938,11 @@ ld_get_pmt_formula( LoanDruidData *ldd, GString *gstr )
|
||||
{
|
||||
g_assert( ldd != NULL );
|
||||
g_assert( gstr != NULL );
|
||||
g_string_sprintfa( gstr, "pmt( %.5f / 12 : %d : %0.2f : 0 : 0 )",
|
||||
(ldd->ld.interestRate / 100),
|
||||
( ldd->ld.numPer
|
||||
* ( ldd->ld.perSize == MONTHS ? 1 : 12 ) ),
|
||||
gnc_numeric_to_double(ldd->ld.principal) );
|
||||
g_string_append_printf( gstr, "pmt( %.5f / 12 : %d : %0.2f : 0 : 0 )",
|
||||
(ldd->ld.interestRate / 100),
|
||||
( ldd->ld.numPer
|
||||
* ( ldd->ld.perSize == MONTHS ? 1 : 12 ) ),
|
||||
gnc_numeric_to_double(ldd->ld.principal) );
|
||||
}
|
||||
|
||||
static
|
||||
@ -951,11 +951,11 @@ ld_get_ppmt_formula( LoanDruidData *ldd, GString *gstr )
|
||||
{
|
||||
g_assert( ldd != NULL );
|
||||
g_assert( gstr != NULL );
|
||||
g_string_sprintf( gstr, "ppmt( %.5f / 12 : i : %d : %0.2f : 0 : 0 )",
|
||||
(ldd->ld.interestRate / 100),
|
||||
( ldd->ld.numPer
|
||||
* ( ldd->ld.perSize == MONTHS ? 1 : 12 ) ),
|
||||
gnc_numeric_to_double(ldd->ld.principal));
|
||||
g_string_printf( gstr, "ppmt( %.5f / 12 : i : %d : %0.2f : 0 : 0 )",
|
||||
(ldd->ld.interestRate / 100),
|
||||
( ldd->ld.numPer
|
||||
* ( ldd->ld.perSize == MONTHS ? 1 : 12 ) ),
|
||||
gnc_numeric_to_double(ldd->ld.principal));
|
||||
}
|
||||
|
||||
static
|
||||
@ -964,11 +964,11 @@ ld_get_ipmt_formula( LoanDruidData *ldd, GString *gstr )
|
||||
{
|
||||
g_assert( ldd != NULL );
|
||||
g_assert( gstr != NULL );
|
||||
g_string_sprintf( gstr, "ipmt( %.5f / 12 : i : %d : %0.2f : 0 : 0 )",
|
||||
(ldd->ld.interestRate / 100),
|
||||
( ldd->ld.numPer
|
||||
* ( ldd->ld.perSize == MONTHS ? 1 : 12 ) ),
|
||||
gnc_numeric_to_double( ldd->ld.principal ) );
|
||||
g_string_printf( gstr, "ipmt( %.5f / 12 : i : %d : %0.2f : 0 : 0 )",
|
||||
(ldd->ld.interestRate / 100),
|
||||
( ldd->ld.numPer
|
||||
* ( ldd->ld.perSize == MONTHS ? 1 : 12 ) ),
|
||||
gnc_numeric_to_double( ldd->ld.principal ) );
|
||||
}
|
||||
|
||||
static
|
||||
@ -1445,13 +1445,13 @@ ld_pay_prep( GnomeDruidPage *gdp, gpointer arg1, gpointer ud )
|
||||
rod = ldd->ld.repayOpts[ldd->currentIdx];
|
||||
str = g_string_sized_new( 32 );
|
||||
/* Translators: %s is "Taxes", or "Insurance", or similar */
|
||||
g_string_sprintf( str, _("Payment: \"%s\""), rod->name );
|
||||
g_string_printf( str, _("Payment: \"%s\""), rod->name );
|
||||
gnome_druid_page_standard_set_title( GNOME_DRUID_PAGE_STANDARD(gdp),
|
||||
str->str );
|
||||
/* copy in the relevant data from the currently-indexed
|
||||
* option. */
|
||||
gtk_entry_set_text( ldd->payTxnName, rod->txnMemo );
|
||||
g_string_sprintf( str, "%0.2f", rod->amount );
|
||||
g_string_printf( str, "%0.2f", rod->amount );
|
||||
gtk_entry_set_text( ldd->payAmtEntry, str->str );
|
||||
|
||||
gtk_widget_set_sensitive( GTK_WIDGET(ldd->payUseEscrow),
|
||||
@ -2108,7 +2108,7 @@ ld_setup_repayment_sx( LoanDruidData *ldd,
|
||||
ttsi = (TTSplitInfo*)elt->data;
|
||||
g_assert( ttsi );
|
||||
gstr = g_string_new( gnc_ttsplitinfo_get_debit_formula( ttsi ) );
|
||||
g_string_sprintfa( gstr, " + %s", amtBuf );
|
||||
g_string_append_printf( gstr, " + %s", amtBuf );
|
||||
gnc_ttsplitinfo_set_debit_formula( ttsi, gstr->str );
|
||||
g_string_free( gstr, TRUE );
|
||||
gstr = NULL;
|
||||
@ -2144,9 +2144,9 @@ ld_setup_repayment_sx( LoanDruidData *ldd,
|
||||
* create a split, then we need to add our
|
||||
* amount in rather than replace. */
|
||||
gstr = g_string_new( str );
|
||||
g_string_sprintfa( gstr, " + " );
|
||||
g_string_append_printf( gstr, " + " );
|
||||
}
|
||||
g_string_sprintfa( gstr, "%s", amtBuf );
|
||||
g_string_append_printf( gstr, "%s", amtBuf );
|
||||
gnc_ttsplitinfo_set_credit_formula( ttsi, gstr->str );
|
||||
g_string_free( gstr, TRUE );
|
||||
gstr = NULL;
|
||||
@ -2191,7 +2191,7 @@ ld_setup_repayment_sx( LoanDruidData *ldd,
|
||||
if ( fromSplit != NULL ) {
|
||||
/* Update the existing from-split. */
|
||||
gstr = g_string_new( gnc_ttsplitinfo_get_credit_formula( fromSplit ) );
|
||||
g_string_sprintfa( gstr, " + %s", amtBuf );
|
||||
g_string_append_printf( gstr, " + %s", amtBuf );
|
||||
gnc_ttsplitinfo_set_credit_formula( fromSplit, gstr->str );
|
||||
g_string_free( gstr, TRUE );
|
||||
gstr = NULL;
|
||||
@ -2277,12 +2277,12 @@ ld_create_sxes( LoanDruidData *ldd )
|
||||
gnc_default_currency() );
|
||||
{
|
||||
GString *payMainTxnDesc = g_string_sized_new( 32 );
|
||||
g_string_sprintf( payMainTxnDesc,
|
||||
"%s - %s%s",
|
||||
ldd->ld.repMemo,
|
||||
( ldd->ld.escrowAcct == NULL
|
||||
? "" : _("Escrow ") ),
|
||||
_("Payment") );
|
||||
g_string_printf( payMainTxnDesc,
|
||||
"%s - %s%s",
|
||||
ldd->ld.repMemo,
|
||||
( ldd->ld.escrowAcct == NULL
|
||||
? "" : _("Escrow ") ),
|
||||
_("Payment") );
|
||||
|
||||
gnc_ttinfo_set_description( paymentSX->mainTxn,
|
||||
payMainTxnDesc->str );
|
||||
@ -2345,7 +2345,7 @@ ld_create_sxes( LoanDruidData *ldd )
|
||||
{
|
||||
GString *escrowTxnDesc;
|
||||
escrowTxnDesc = g_string_new( ldd->ld.repMemo );
|
||||
g_string_sprintfa( escrowTxnDesc, " - %s", _("Payment") );
|
||||
g_string_append_printf( escrowTxnDesc, " - %s", _("Payment") );
|
||||
gnc_ttinfo_set_description( paymentSX->escrowTxn,
|
||||
escrowTxnDesc->str );
|
||||
g_string_free( escrowTxnDesc, TRUE );
|
||||
@ -2358,8 +2358,8 @@ ld_create_sxes( LoanDruidData *ldd )
|
||||
ttsi = gnc_ttsplitinfo_malloc();
|
||||
{
|
||||
gstr = g_string_new( ldd->ld.repMemo );
|
||||
g_string_sprintfa( gstr, " - %s",
|
||||
_("Payment") );
|
||||
g_string_append_printf( gstr, " - %s",
|
||||
_("Payment") );
|
||||
gnc_ttsplitinfo_set_memo( ttsi, gstr->str );
|
||||
g_string_free( gstr, TRUE );
|
||||
gstr = NULL;
|
||||
@ -2379,8 +2379,8 @@ ld_create_sxes( LoanDruidData *ldd )
|
||||
ttsi = gnc_ttsplitinfo_malloc();
|
||||
{
|
||||
gstr = g_string_new( ldd->ld.repMemo );
|
||||
g_string_sprintfa( gstr, " - %s",
|
||||
_("Principal") );
|
||||
g_string_append_printf( gstr, " - %s",
|
||||
_("Principal") );
|
||||
gnc_ttsplitinfo_set_memo( ttsi, gstr->str );
|
||||
g_string_free( gstr, TRUE );
|
||||
gstr = NULL;
|
||||
@ -2400,8 +2400,8 @@ ld_create_sxes( LoanDruidData *ldd )
|
||||
ttsi = gnc_ttsplitinfo_malloc();
|
||||
{
|
||||
gstr = g_string_new( ldd->ld.repMemo );
|
||||
g_string_sprintfa( gstr, " - %s",
|
||||
_("Interest") );
|
||||
g_string_append_printf( gstr, " - %s",
|
||||
_("Interest") );
|
||||
gnc_ttsplitinfo_set_memo( ttsi, gstr->str );
|
||||
g_string_free( gstr, TRUE );
|
||||
gstr = NULL;
|
||||
@ -2426,8 +2426,8 @@ ld_create_sxes( LoanDruidData *ldd )
|
||||
if ( rod->fs != NULL ) {
|
||||
tcSX = g_new0( toCreateSX, 1 );
|
||||
gstr = g_string_new( ldd->ld.repMemo );
|
||||
g_string_sprintfa( gstr, " - %s",
|
||||
rod->name );
|
||||
g_string_append_printf( gstr, " - %s",
|
||||
rod->name );
|
||||
tcSX->name = g_strdup(gstr->str);
|
||||
tcSX->start = *ldd->ld.startDate;
|
||||
tcSX->last = *ldd->ld.repStartDate;
|
||||
@ -2571,8 +2571,8 @@ ld_rev_get_dates( LoanDruidData *ldd, GDate *start, GDate *end )
|
||||
switch ( range ) {
|
||||
case CURRENT_YEAR:
|
||||
g_date_set_time( start, time(NULL) );
|
||||
g_date_set_dmy( start, 1, G_DATE_JANUARY, g_date_year( start ) );
|
||||
g_date_set_dmy( end, 31, G_DATE_DECEMBER, g_date_year( start ) );
|
||||
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( start, time(NULL) );
|
||||
|
@ -287,7 +287,7 @@ static AB_TRANSACTION *trans_list_cb(AB_TRANSACTION *h_trans, void *user_data)
|
||||
/* Number. We use the "customer reference", if there is one. */
|
||||
const char *custref = AB_Transaction_GetCustomerReference (h_trans);
|
||||
if (custref && (strlen (custref) > 0) &&
|
||||
(g_strncasecmp (custref, "NONREF", 6) != 0))
|
||||
(g_ascii_strncasecmp (custref, "NONREF", 6) != 0))
|
||||
xaccTransSetNum (gnc_trans, custref);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user