* gnome/dialog-new-user: don't call the qif-import-druid directly.

Add a callback API for the qif-import druid.  Use that callback
	  when the qif-import button is pressed.  Make the qif-import button
	  sensitive only when the qif-import module is loaded (i.e. only when
	  the callback function is non-NULL).
	* import-export/qif-import -- set the make_druid callback for the new-user
	  dialog.
	* gnome/Makefile.am -- remove dependency on qif-import library.
	* src/makefile.am -- re-order import-export after gnome

	* engine/Transaction.c -- allow deletion of a non-connected Splits
	  (fixes a SEGV problem)

	* engine/Account.c -- send an event whenever an account balance is updated.
	  Fixes bug # 97689


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7456 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2002-11-10 04:42:09 +00:00
parent b66a65968e
commit f20f01857b
9 changed files with 63 additions and 11 deletions

View File

@ -1,3 +1,20 @@
2002-11-09 Derek Atkins <derek@ihtfp.com>
* gnome/dialog-new-user: don't call the qif-import-druid directly.
Add a callback API for the qif-import druid. Use that callback
when the qif-import button is pressed. Make the qif-import button
sensitive only when the qif-import module is loaded (i.e. only when
the callback function is non-NULL).
* import-export/qif-import -- set the make_druid callback for the new-user
dialog.
* gnome/Makefile.am -- remove dependency on qif-import library.
* src/makefile.am -- re-order import-export after gnome
* engine/Transaction.c -- allow deletion of a non-connected Splits
(fixes a SEGV problem)
* engine/Account.c -- send an event whenever an account balance is updated.
Fixes bug # 97689
2002-11-08 Christian Stimming <stimming@tuhh.de>
* src/gnome/window-register.c (regWindowLedger): Fix menu

View File

@ -21,8 +21,8 @@ GUI_SUBDIRS_1 = \
GUI_SUBDIRS_2 = \
register \
import-export \
gnome \
import-export \
experimental \
business \
optional

View File

@ -62,6 +62,14 @@ static void xaccAccountBringUpToDate (Account *);
/********************************************************************\
\********************************************************************/
G_INLINE_FUNC void account_event (Account *account);
G_INLINE_FUNC void
account_event (Account *account)
{
gnc_engine_generate_event (&account->guid, GNC_EVENT_MODIFY);
}
G_INLINE_FUNC void mark_account (Account *account);
G_INLINE_FUNC void
mark_account (Account *account)
@ -69,7 +77,7 @@ mark_account (Account *account)
if (account->parent)
account->parent->saved = FALSE;
gnc_engine_generate_event (&account->guid, GNC_EVENT_MODIFY);
account_event (account);
}
/********************************************************************\
@ -1169,6 +1177,7 @@ xaccAccountRecomputeBalance (Account * acc)
acc->reconciled_balance = reconciled_balance;
acc->balance_dirty = FALSE;
account_event (acc);
}
/********************************************************************\

View File

@ -2052,7 +2052,7 @@ xaccSplitDestroy (Split *split)
acc = split->acc;
trans = split->parent;
if (!acc->do_free && xaccTransWarnReadOnly (trans))
if (acc && !acc->do_free && xaccTransWarnReadOnly (trans))
return FALSE;
check_open (trans);

View File

@ -11,7 +11,6 @@ libgncgnome_la_LIBADD = \
${top_builddir}/src/engine/libgncmod-engine.la \
${top_builddir}/src/app-file/libgncmod-app-file.la \
${top_builddir}/src/backend/file/libgncmod-backend-file.la \
${top_builddir}/src/import-export/qif-import/libgncmod-qif-import.la \
${top_builddir}/src/report/report-system/libgncmod-report-system.la \
${top_builddir}/src/report/report-gnome/libgncmod-report-gnome.la \
${top_builddir}/src/register/ledger-core/libgncmod-ledger-core.la \
@ -120,8 +119,6 @@ AM_CFLAGS = \
-I${top_srcdir}/src/register/register-gnome \
-I${top_srcdir}/src/report/report-system \
-I${top_srcdir}/src/report/report-gnome \
-I${top_srcdir}/src/import-export/binary-import \
-I${top_srcdir}/src/import-export/qif-import \
${GUILE_INCS} \
${G_WRAP_COMPILE_ARGS} \
${GNOME_INCLUDEDIR} \

View File

@ -28,15 +28,25 @@
#include "dialog-new-user.h"
#include "dialog-utils.h"
#include "druid-hierarchy.h"
#include "druid-qif-import.h"
#include "global-options.h"
#include "gnc-ui.h"
#include "window-help.h"
/* function to open a qif import druid */
static void (*qifImportDruidFcn)(void) = NULL;
static void gnc_ui_new_user_cancel_dialog (void);
void
gnc_new_user_dialog_register_qif_druid (void (*cb_fcn)(void))
{
g_return_if_fail (qifImportDruidFcn == NULL);
qifImportDruidFcn = cb_fcn;
}
void
gnc_set_first_startup (gboolean first_startup)
{
@ -63,6 +73,11 @@ gnc_ui_new_user_dialog (void)
import_qif_button = glade_xml_get_widget (xml, "import_qif_button");
tutorial_button = glade_xml_get_widget (xml, "tutorial_button");
/* Set the sensitivity of the qif-import button based on the availability
* of the qif-import druid.
*/
gtk_widget_set_sensitive (import_qif_button, (qifImportDruidFcn != NULL));
result = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
if (result != 0)
{
@ -79,10 +94,10 @@ gnc_ui_new_user_dialog (void)
return;
}
if (gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (import_qif_button)))
if ((qifImportDruidFcn != NULL) &&
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (import_qif_button)))
{
gnc_ui_qif_import_druid_make ();
qifImportDruidFcn();
}
else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tutorial_button)))
{

View File

@ -26,6 +26,9 @@
void gnc_ui_new_user_dialog (void);
void gnc_set_first_startup (gboolean first_startup);
/* Register the qif-import druid */
void gnc_new_user_dialog_register_qif_druid (void (*cb_fcn)(void));
/* private */
void gncp_new_user_finish (void);

View File

@ -11,6 +11,7 @@
#include "gnc-module.h"
#include "gnc-module-api.h"
#include "druid-qif-import.h"
#include "dialog-new-user.h"
/* version of the gnc module system interface we require */
int libgncmod_qif_import_LTX_gnc_module_system_interface = 0;
@ -57,6 +58,15 @@ libgncmod_qif_import_LTX_gnc_module_init(int refcount)
return FALSE;
}
/* If the recount == 0 then register the qif-import-druid for the new-user
* dialog.
*/
if (refcount == 0)
{
gnc_new_user_dialog_register_qif_druid
((void (*)())gnc_ui_qif_import_druid_make);
}
gh_eval_str("(use-modules (gnucash import-export qif-import))");
gnc_ui_qif_import_create_menus();

View File

@ -3,4 +3,5 @@ TESTS=test-link
noinst_PROGRAMS=test-link
test_link_SOURCES=test-link.c
test_link_LDADD=../libgncmod-qif-import.la
test_link_LDADD=../libgncmod-qif-import.la \
${top_builddir}/src/gnome/libgncgnome.la