static time64
lookup_end_date_option(const gchar *section,
                       const gchar *key_choice,
                       const gchar *key_absolute,
                       const gchar *key_relative,
                       GDate *fy_end)
{
    gchar *choice;
    time64 time;
    int which;

    choice = gnc_gconf_get_string(section, key_choice, NULL);
    if (choice && strcmp(choice, "absolute") == 0)
    {
        time = gnc_gconf_get_int(section, key_absolute, NULL);
        time = gnc_time64_get_day_end(time);
    }
    else
    {
        which = gnc_gconf_get_int(section, key_relative, NULL);
        time = gnc_accounting_period_end_time64(which, fy_end, NULL);
    }
    g_free(choice);
    if (time == 0)
        time = -1;
    return time;
}
Esempio n. 2
0
static time64
lookup_end_date_option(GDate *fy_end)
{
    time64 time;
    int which;

    if (gnc_prefs_get_bool (GNC_PREFS_GROUP_ACCT_SUMMARY, GNC_PREF_END_CHOICE_ABS))
        time = gnc_prefs_get_int64 (GNC_PREFS_GROUP_ACCT_SUMMARY, GNC_PREF_END_DATE);
    else
    {
        which = gnc_prefs_get_int(GNC_PREFS_GROUP_ACCT_SUMMARY, GNC_PREF_END_PERIOD);
        time = gnc_accounting_period_end_time64(which, fy_end, NULL);
    }
    if (time == 0)
        time = -1;
    return time;
}