Esempio n. 1
0
/* gnc_configure_date_format
 *    sets dateFormat to the current value on the scheme side
 *
 * Args: Nothing
 * Returns: Nothing
 */
static void
gnc_configure_date_format (void)
{
    char *format_code = gnc_gconf_get_string(GCONF_GENERAL,
                        KEY_DATE_FORMAT, NULL);

    QofDateFormat df;

    if (format_code == NULL)
        format_code = g_strdup("locale");
    if (*format_code == '\0')
    {
        g_free(format_code);
        format_code = g_strdup("locale");
    }

    if (gnc_date_string_to_dateformat(format_code, &df))
    {
        PERR("Incorrect date format code");
        if (format_code != NULL)
            free(format_code);
        return;
    }

    qof_date_format_set(df);

    if (format_code != NULL)
        free(format_code);
}
Esempio n. 2
0
/* gnc_configure_date_format
 *    sets dateFormat to the current value on the scheme side
 *
 * Args: Nothing
 * Returns: Nothing
 */
static void
gnc_configure_date_format (void)
{
    QofDateFormat df = gnc_prefs_get_int(GNC_PREFS_GROUP_GENERAL,
                                         GNC_PREF_DATE_FORMAT);

    /* Only a subset of the qof date formats is currently
     * supported for date entry.
     */
    if ((df > QOF_DATE_FORMAT_LOCALE)
            || (df > QOF_DATE_FORMAT_LOCALE))
    {
        PERR("Incorrect date format");
        return;
    }

    qof_date_format_set(df);
}