/* Used several places in a transaction edit where many other * parameters are also being set, so individual commits wouldn't be * appropriate. */ void gnc_import_set_split_online_id(Split * split, const gchar * string_value) { kvp_frame * frame; xaccTransBeginEdit (xaccSplitGetParent (split)); frame = xaccSplitGetSlots(split); kvp_frame_set_str (frame, "online_id", string_value); qof_instance_set_dirty (QOF_INSTANCE (split)); }
/* Not actually used */ void gnc_import_set_trans_online_id(Transaction * transaction, const gchar * string_value) { kvp_frame * frame; xaccTransBeginEdit (transaction); frame = xaccTransGetSlots(transaction); kvp_frame_set_str (frame, "online_id", string_value); qof_instance_set_dirty (QOF_INSTANCE (transaction)); xaccTransCommitEdit (transaction); }
/* Used in the midst of editing a transaction; make it save the * account data. */ void gnc_import_set_acc_online_id(Account * account, const gchar * string_value) { kvp_frame * frame; g_return_if_fail (account != NULL); frame = xaccAccountGetSlots(account); xaccAccountBeginEdit (account); kvp_frame_set_str(frame, "online_id", string_value); qof_instance_set_dirty (QOF_INSTANCE (account)); xaccAccountCommitEdit (account); }
static gboolean ap_close_period (GnomeDruidPage *druidpage, GtkWidget *druid, gpointer user_data) { AcctPeriodInfo *info = user_data; QofBook *closed_book = NULL, *current_book; const char *btitle; char *bnotes; Timespec closing_date; KvpFrame *book_frame; gboolean really_do_close_books = FALSE; ENTER("info=%p", info); current_book = gnc_get_current_book (); btitle = gtk_entry_get_text (info->book_title); bnotes = xxxgtk_textview_get_text (info->book_notes); PINFO("book title=%s\n", btitle); timespecFromTime_t (&closing_date, gnc_timet_get_day_end_gdate (&info->closing_date)); #define REALLY_DO_CLOSE_BOOKS #ifdef REALLY_DO_CLOSE_BOOKS really_do_close_books = TRUE; #endif /* REALLY_DO_CLOSE_BOOKS */ if (really_do_close_books) { /* Close the books ! */ qof_event_suspend (); gnc_suspend_gui_refresh (); scrub_all(); closed_book = gnc_book_close_period (current_book, closing_date, NULL, btitle); book_frame = qof_book_get_slots(closed_book); kvp_frame_set_str (book_frame, "/book/title", btitle); kvp_frame_set_str (book_frame, "/book/notes", bnotes); qof_session_add_book (gnc_get_current_session(), closed_book); /* We must save now; if we don't, and the user bails without saving, * then opening account balances will be incorrect, and this can only * lead to unhappiness. */ gnc_file_save (); gnc_resume_gui_refresh (); qof_event_resume (); gnc_gui_refresh_all (); /* resume above should have been enough ??? */ } g_free(bnotes); /* Report the status back to the user. */ info->close_status = 0; /* XXX fixme success or failure? */ /* Find the next closing date ... */ info->prev_closing_date = info->closing_date; recurrenceListNextInstance(info->period, &info->prev_closing_date, &info->closing_date); /* 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)) { return FALSE; } /* Load up the GUI for the next closing period. */ gnc_frequency_setup_recurrence(info->period_menu, NULL, &info->closing_date); show_book_details (info); return TRUE; }