mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Optional module loading. Latest OFX changes.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6998 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
a9df3df3f9
commit
23926cd141
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
|||||||
|
2002-06-22 David Hampton <hampton@employees.org>
|
||||||
|
|
||||||
|
* src/gnc-module/gnc-module.{c,h,scm} :
|
||||||
|
* src/gnc-module/gw-gnc-module-spec.scm : Add support for loading
|
||||||
|
an optional module. I.E. Don't complain if you can't find it.
|
||||||
|
|
||||||
|
* src/gnome/window-main.c : Add a File/Import submenu that will
|
||||||
|
contain entries for QIF, OFX, etc.
|
||||||
|
|
||||||
|
* src/import-export/Makefile.am :
|
||||||
|
* src/import-export/gncmod-generic-import.c :
|
||||||
|
* src/import-export/ofx/gnc-ofx-import.c :
|
||||||
|
* src/import-export/ofx/gncmod-ofx-import.c :
|
||||||
|
* src/scm/main.scm : OFX module loading tweaks.
|
||||||
|
|
||||||
2002-06-21 Derek Atkins <derek@ihtfp.com>
|
2002-06-21 Derek Atkins <derek@ihtfp.com>
|
||||||
|
|
||||||
* integrate the Billing Terms into the Core, GUI, and XML Backend
|
* integrate the Billing Terms into the Core, GUI, and XML Backend
|
||||||
|
@ -415,8 +415,8 @@ gnc_module_check_loaded(const char * module_name, gint interface)
|
|||||||
* Ensure that the module named by "module_name" is loaded.
|
* Ensure that the module named by "module_name" is loaded.
|
||||||
*************************************************************/
|
*************************************************************/
|
||||||
|
|
||||||
GNCModule
|
static GNCModule
|
||||||
gnc_module_load(char * module_name, gint interface)
|
gnc_module_load_common(char * module_name, gint interface, gboolean optional)
|
||||||
{
|
{
|
||||||
|
|
||||||
GNCLoadedModule * info;
|
GNCLoadedModule * info;
|
||||||
@ -499,7 +499,7 @@ gnc_module_load(char * module_name, gint interface)
|
|||||||
}
|
}
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
else
|
else if (!optional)
|
||||||
{
|
{
|
||||||
g_warning ("Failed to open module %s", module_name);
|
g_warning ("Failed to open module %s", module_name);
|
||||||
if(modinfo) printf(": %s\n", lt_dlerror());
|
if(modinfo) printf(": %s\n", lt_dlerror());
|
||||||
@ -507,10 +507,23 @@ gnc_module_load(char * module_name, gint interface)
|
|||||||
module_name, interface);
|
module_name, interface);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GNCModule
|
||||||
|
gnc_module_load(char * module_name, gint interface)
|
||||||
|
{
|
||||||
|
return gnc_module_load_common(module_name, interface, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
GNCModule
|
||||||
|
gnc_module_load_optional(char * module_name, gint interface)
|
||||||
|
{
|
||||||
|
return gnc_module_load_common(module_name, interface, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
* gnc_module_unload
|
* gnc_module_unload
|
||||||
* unload a module (only actually unload it if the use count goes to 0)
|
* unload a module (only actually unload it if the use count goes to 0)
|
||||||
|
@ -35,6 +35,7 @@ GList * gnc_module_system_modinfo(void);
|
|||||||
/* load and unload a module. gnc_module_system_init() must be called
|
/* load and unload a module. gnc_module_system_init() must be called
|
||||||
* before loading and unloading. */
|
* before loading and unloading. */
|
||||||
GNCModule gnc_module_load(gchar * module_name, gint interface);
|
GNCModule gnc_module_load(gchar * module_name, gint interface);
|
||||||
|
GNCModule gnc_module_load_optional(gchar * module_name, gint interface);
|
||||||
int gnc_module_unload(GNCModule mod);
|
int gnc_module_unload(GNCModule mod);
|
||||||
GNCModuleInfo * gnc_module_get_info(const char * lib_path);
|
GNCModuleInfo * gnc_module_get_info(const char * lib_path);
|
||||||
int gnc_module_use_scm_module(gchar * module_path);
|
int gnc_module_use_scm_module(gchar * module_path);
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
;; symbols from gw-gnc-module
|
;; symbols from gw-gnc-module
|
||||||
(export gnc:module-system-refresh)
|
(export gnc:module-system-refresh)
|
||||||
(export gnc:module-load)
|
(export gnc:module-load)
|
||||||
|
(export gnc:module-load-optional)
|
||||||
(export gnc:module-unload)
|
(export gnc:module-unload)
|
||||||
(export gnc:module-lookup)
|
(export gnc:module-lookup)
|
||||||
|
|
||||||
|
@ -32,6 +32,12 @@
|
|||||||
'(((<gw:mchars> caller-owned) module-name) (<gw:int> interface))
|
'(((<gw:mchars> caller-owned) module-name) (<gw:int> interface))
|
||||||
"Load and initialize a gnc-module")
|
"Load and initialize a gnc-module")
|
||||||
|
|
||||||
|
(gw:wrap-function
|
||||||
|
ws 'gnc:module-load-optional
|
||||||
|
'<gnc:module> "gnc_module_load_optional"
|
||||||
|
'(((<gw:mchars> caller-owned) module-name) (<gw:int> interface))
|
||||||
|
"Load and initialize a gnc-module if present")
|
||||||
|
|
||||||
(gw:wrap-function
|
(gw:wrap-function
|
||||||
ws 'gnc:module-unload
|
ws 'gnc:module-unload
|
||||||
'<gw:bool> "gnc_module_unload"
|
'<gw:bool> "gnc_module_unload"
|
||||||
|
@ -797,6 +797,19 @@ gnc_main_window_create_menus(GNCMDIInfo * maininfo)
|
|||||||
GNOMEUIINFO_END
|
GNOMEUIINFO_END
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static GnomeUIInfo gnc_file_import_submenu_template[] =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
GNOME_APP_UI_ITEM,
|
||||||
|
N_("Import _QIF..."),
|
||||||
|
N_("Import a Quicken QIF file"),
|
||||||
|
gnc_main_window_file_import_cb, NULL, NULL,
|
||||||
|
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_CONVERT,
|
||||||
|
'i', GDK_CONTROL_MASK, NULL
|
||||||
|
},
|
||||||
|
GNOMEUIINFO_END
|
||||||
|
};
|
||||||
|
|
||||||
static GnomeUIInfo gnc_file_export_submenu_template[] =
|
static GnomeUIInfo gnc_file_export_submenu_template[] =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@ -837,14 +850,8 @@ gnc_main_window_create_menus(GNCMDIInfo * maininfo)
|
|||||||
GNOMEUIINFO_MENU_SAVE_ITEM(gnc_main_window_file_save_cb, NULL),
|
GNOMEUIINFO_MENU_SAVE_ITEM(gnc_main_window_file_save_cb, NULL),
|
||||||
GNOMEUIINFO_MENU_SAVE_AS_ITEM(gnc_main_window_file_save_as_cb, NULL),
|
GNOMEUIINFO_MENU_SAVE_AS_ITEM(gnc_main_window_file_save_as_cb, NULL),
|
||||||
GNOMEUIINFO_SEPARATOR,
|
GNOMEUIINFO_SEPARATOR,
|
||||||
{
|
GNOMEUIINFO_SUBTREE( N_("_Import"),
|
||||||
GNOME_APP_UI_ITEM,
|
gnc_file_import_submenu_template ),
|
||||||
N_("_Import QIF..."),
|
|
||||||
N_("Import a Quicken QIF file"),
|
|
||||||
gnc_main_window_file_import_cb, NULL, NULL,
|
|
||||||
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_CONVERT,
|
|
||||||
'i', GDK_CONTROL_MASK, NULL
|
|
||||||
},
|
|
||||||
GNOMEUIINFO_SUBTREE( N_("_Export"),
|
GNOMEUIINFO_SUBTREE( N_("_Export"),
|
||||||
gnc_file_export_submenu_template ),
|
gnc_file_export_submenu_template ),
|
||||||
GNOMEUIINFO_SEPARATOR,
|
GNOMEUIINFO_SEPARATOR,
|
||||||
|
@ -3,7 +3,8 @@ SUBDIRS = . binary-import qif-import ${OFX_DIR} test
|
|||||||
pkglib_LTLIBRARIES=libgncmod-generic-import.la
|
pkglib_LTLIBRARIES=libgncmod-generic-import.la
|
||||||
|
|
||||||
libgncmod_generic_import_la_SOURCES = \
|
libgncmod_generic_import_la_SOURCES = \
|
||||||
gnc-generic-import.c
|
gnc-generic-import.c \
|
||||||
|
gncmod-generic-import.c
|
||||||
|
|
||||||
noinst_HEADERS = \
|
noinst_HEADERS = \
|
||||||
gnc-generic-import.h
|
gnc-generic-import.h
|
||||||
|
@ -43,12 +43,6 @@ gnc_module_init(int refcount)
|
|||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if(!gnc_module_load("gnucash/import-export", 0))
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
gh_eval_str("(use-modules (gnucash import-export))");
|
|
||||||
printf("Generic import module loaded\n");
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,13 +224,14 @@ int ofx_proc_transaction(struct OfxTransactionData data)
|
|||||||
}
|
}
|
||||||
xaccTransSetNotes(transaction, notes);
|
xaccTransSetNotes(transaction, notes);
|
||||||
g_free(notes);
|
g_free(notes);
|
||||||
|
xaccTransSetCurrency(transaction,xaccAccountGetCommodity(account));
|
||||||
if(data.amount_valid==true){
|
if(data.amount_valid==true){
|
||||||
split=xaccMallocSplit(book);
|
split=xaccMallocSplit(book);
|
||||||
xaccTransAppendSplit(transaction,split);
|
xaccTransAppendSplit(transaction,split);
|
||||||
xaccAccountInsertSplit(account,split);
|
xaccAccountInsertSplit(account,split);
|
||||||
gnc_amount = double_to_gnc_numeric(data.amount,xaccAccountGetCommoditySCU(account),GNC_RND_ROUND);
|
gnc_amount = double_to_gnc_numeric(data.amount,xaccAccountGetCommoditySCU(account),GNC_RND_ROUND);
|
||||||
xaccSplitSetValue(split, gnc_amount);
|
xaccSplitSetBaseValue(split, gnc_amount,xaccAccountGetCommodity(account));
|
||||||
|
|
||||||
}
|
}
|
||||||
xaccTransCommitEdit(transaction);
|
xaccTransCommitEdit(transaction);
|
||||||
//printf("Now calling gnc_import_add_trans()\n");
|
//printf("Now calling gnc_import_add_trans()\n");
|
||||||
|
@ -46,8 +46,6 @@ gnc_module_init(int refcount)
|
|||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
gh_eval_str("(use-modules (gnucash import-export ofx))");
|
|
||||||
printf("OFX module loaded\n");
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,6 +374,7 @@ string and 'directories' must be a list of strings."
|
|||||||
(gnc:module-load "gnucash/register/register-gnome" 0)
|
(gnc:module-load "gnucash/register/register-gnome" 0)
|
||||||
(gnc:module-load "gnucash/import-export/binary-import" 0)
|
(gnc:module-load "gnucash/import-export/binary-import" 0)
|
||||||
(gnc:module-load "gnucash/import-export/qif-import" 0)
|
(gnc:module-load "gnucash/import-export/qif-import" 0)
|
||||||
|
(gnc:module-load-optional "gnucash/import-export/ofx" 0)
|
||||||
(gnc:module-load "gnucash/report/report-system" 0)
|
(gnc:module-load "gnucash/report/report-system" 0)
|
||||||
(gnc:module-load "gnucash/report/stylesheets" 0)
|
(gnc:module-load "gnucash/report/stylesheets" 0)
|
||||||
(gnc:module-load "gnucash/report/standard-reports" 0)
|
(gnc:module-load "gnucash/report/standard-reports" 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user