/* Constructor */ GNCImportSettings * gnc_import_Settings_new (void) { GNCImportSettings * settings; settings = g_new0 ( GNCImportSettings, 1); settings->action_skip_enabled = gnc_gconf_get_bool(GCONF_IMPORT_SECTION, "enable_skip", NULL); settings->action_update_enabled = gnc_gconf_get_bool(GCONF_IMPORT_SECTION, "enable_update", NULL); settings->action_add_enabled = DEFAULT_ACTION_ADD_ENABLED; settings->action_clear_enabled = DEFAULT_ACTION_CLEAR_ENABLED; settings->clear_threshold = (int)gnc_gconf_get_float(GCONF_IMPORT_SECTION, "auto_clear_threshold", NULL); settings->add_threshold = (int)gnc_gconf_get_float(GCONF_IMPORT_SECTION, "auto_add_threshold", NULL); settings->display_threshold = (int)gnc_gconf_get_float(GCONF_IMPORT_SECTION, "match_threshold", NULL); settings->fuzzy_amount = gnc_gconf_get_float(GCONF_IMPORT_SECTION, "atm_fee_threshold", NULL); settings->match_date_hardlimit = 42; /* 6 weeks */ return settings; }
/* gnc_configure_date_completion * sets dateCompletion to the current value on the scheme side. * QOF_DATE_COMPLETION_THISYEAR: use current year * QOF_DATE_COMPLETION_SLIDING: use a sliding 12-month window * backmonths 0-11: windows starts this many months before current month * * Args: Nothing * Returns: Nothing */ static void gnc_configure_date_completion (void) { char *date_completion = gnc_gconf_get_string(GCONF_GENERAL, KEY_DATE_COMPLETION, NULL); int backmonths = gnc_gconf_get_float(GCONF_GENERAL, KEY_DATE_BACKMONTHS, NULL); QofDateCompletion dc; if (backmonths < 0) { backmonths = 0; } else if (backmonths > 11) { backmonths = 11; } if (date_completion && strcmp(date_completion, "sliding") == 0) { dc = QOF_DATE_COMPLETION_SLIDING; } else if (date_completion && strcmp(date_completion, "thisyear") == 0) { dc = QOF_DATE_COMPLETION_THISYEAR; } else { /* No preference has been set yet */ PINFO("Incorrect date completion code, using defaults"); dc = QOF_DATE_COMPLETION_THISYEAR; backmonths = 6; gnc_gconf_set_string (GCONF_GENERAL, KEY_DATE_COMPLETION, "thisyear", NULL); gnc_gconf_set_float (GCONF_GENERAL, KEY_DATE_BACKMONTHS, 6.0, NULL); } qof_date_completion_set(dc, backmonths); if (date_completion != NULL) { free(date_completion); } }
static guint sxftd_compute_sx(SXFromTransInfo *sxfti) { GtkWidget *w; gchar *name; GDate date; GList *schedule = NULL; getEndTuple end_info; guint sxftd_errno = 0; /* 0 == OK, > 0 means dialog needs to be run again */ SchedXaction *sx = sxfti->sx; /* get the name */ w = glade_xml_get_widget(sxfti->gxml, SXFTD_NAME_ENTRY); name = gtk_editable_get_chars(GTK_EDITABLE(w), 0, -1); xaccSchedXactionSetName(sx, name); g_free(name); g_date_set_time_t( &date, gnc_date_edit_get_date( sxfti->startDateGDE ) ); sxftd_update_schedule(sxfti, &date, &schedule); if (sxftd_errno == 0) { gnc_sx_set_schedule(sx, schedule); xaccSchedXactionSetStartDate( sx, &date ); } end_info = sxftd_get_end_info(sxfti); switch (end_info.type) { case NEVER_END: break; case END_ON_DATE: xaccSchedXactionSetEndDate(sx, &(end_info.end_date)); break; case END_AFTER_N_OCCS: xaccSchedXactionSetNumOccur(sx, end_info.n_occurrences); break; default: sxftd_errno = 2; break; } gnc_sx_set_instance_count( sx, 1 ); /* Set the autocreate, days-in-advance and remind-in-advance values from * options. */ { gboolean autoCreateState, notifyState; gint daysInAdvance; autoCreateState = gnc_gconf_get_bool( SXED_GCONF_SECTION, KEY_CREATE_AUTO, NULL ); notifyState = gnc_gconf_get_bool( SXED_GCONF_SECTION, KEY_NOTIFY, NULL ); xaccSchedXactionSetAutoCreate( sx, autoCreateState, (autoCreateState & notifyState) ); daysInAdvance = gnc_gconf_get_float( SXED_GCONF_SECTION, KEY_CREATE_DAYS, NULL ); xaccSchedXactionSetAdvanceCreation( sx, daysInAdvance ); daysInAdvance = gnc_gconf_get_float( SXED_GCONF_SECTION, KEY_REMIND_DAYS, NULL ); xaccSchedXactionSetAdvanceReminder( sx, daysInAdvance ); } if ( sxftd_add_template_trans( sxfti ) != 0 ) { sxftd_errno = SXFTD_ERRNO_UNBALANCED_XACTION; } return sxftd_errno; }