Esempio n. 1
0
static void
sxftd_ok_clicked(SXFromTransInfo *sxfti)
{
    QofBook *book;
    SchedXactions *sxes;
    guint sx_error = sxftd_compute_sx(sxfti);

    if (sx_error != 0
            && sx_error != SXFTD_ERRNO_UNBALANCED_XACTION)
    {
        g_critical("sxftd_compute_sx after ok_clicked [%d]", sx_error);
    }
    else
    {
        if ( sx_error == SXFTD_ERRNO_UNBALANCED_XACTION )
        {
            gnc_error_dialog( gnc_ui_get_toplevel(), "%s",
                              _( "The Scheduled Transaction is unbalanced. "
                                 "You are strongly encouraged to correct this situation." ) );
        }
        book = gnc_get_current_book ();
        sxes = gnc_book_get_schedxactions(book);
        gnc_sxes_add_sx(sxes, sxfti->sx);
    }

    sxftd_close(sxfti, FALSE);
    return;
}
static void
sxftd_advanced_clicked(SXFromTransInfo *sxfti)
{
    guint sx_error = sxftd_compute_sx(sxfti);
    GncSxEditorDialog *adv_edit_dlg;
    GMainContext *context;

    if ( sx_error != 0
            && sx_error != SXFTD_ERRNO_UNBALANCED_XACTION )
    {
        // unbalanced-xaction is "okay", since this is also checked for by
        // the advanced editor.
        g_warning("something bad happened in sxftd_compute_sx [%d]", sx_error);
        return;
    }
    gtk_widget_hide( sxfti->dialog );
    /* force a gui update. */
    context = g_main_context_default();
    while (g_main_context_iteration(context, FALSE));

    adv_edit_dlg =
        gnc_ui_scheduled_xaction_editor_dialog_create(sxfti->sx,
                TRUE /* newSX */);
    /* close ourself, since advanced editing entails us, and there are sync
     * issues otherwise. */
    sxftd_close(sxfti, FALSE);
}