mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Move preferences and configuration variables into app-utils modules.
Much module refactoring & cleanup. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5391 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
a5eab3a8e9
commit
0a8c78bcc1
@ -63,6 +63,9 @@ void
|
|||||||
gnc_file_init (void)
|
gnc_file_init (void)
|
||||||
{
|
{
|
||||||
gnc_set_current_book_handler (gnc_get_current_book_internal);
|
gnc_set_current_book_handler (gnc_get_current_book_internal);
|
||||||
|
|
||||||
|
/* Make sure we have a curent book. */
|
||||||
|
gnc_get_current_book_internal ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -43,18 +43,18 @@ lmod(char * mn)
|
|||||||
|
|
||||||
int
|
int
|
||||||
gnc_module_init(int refcount) {
|
gnc_module_init(int refcount) {
|
||||||
|
/* load the engine (we depend on it) */
|
||||||
|
if(!gnc_module_load("gnucash/engine", 0)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* load the calculation module (we depend on it) */
|
||||||
|
if(!gnc_module_load("gnucash/app-utils", 0)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (refcount == 0)
|
if (refcount == 0)
|
||||||
{
|
{
|
||||||
/* load the engine (we depend on it) */
|
|
||||||
if(!gnc_module_load("gnucash/engine", 0)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* load the calculation module (we depend on it) */
|
|
||||||
if(!gnc_module_load("gnucash/app-utils", 0)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gnc_file_init ();
|
gnc_file_init ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,9 +55,11 @@ gncmod_DATA = app-utils.scm
|
|||||||
gncscmdir = ${GNC_SHAREDIR}/scm
|
gncscmdir = ${GNC_SHAREDIR}/scm
|
||||||
gncscm_DATA = \
|
gncscm_DATA = \
|
||||||
c-interface.scm \
|
c-interface.scm \
|
||||||
|
config-var.scm \
|
||||||
date-utilities.scm \
|
date-utilities.scm \
|
||||||
hooks.scm \
|
hooks.scm \
|
||||||
options.scm \
|
options.scm \
|
||||||
|
prefs.scm \
|
||||||
utilities.scm
|
utilities.scm
|
||||||
|
|
||||||
gwmoddir = ${GNC_GWRAP_LIBDIR}
|
gwmoddir = ${GNC_GWRAP_LIBDIR}
|
||||||
|
@ -88,6 +88,30 @@
|
|||||||
(export gnc:send-options)
|
(export gnc:send-options)
|
||||||
(export gnc:save-options)
|
(export gnc:save-options)
|
||||||
|
|
||||||
|
;; config-var.scm
|
||||||
|
(export gnc:make-config-var)
|
||||||
|
(export gnc:config-var-description-get)
|
||||||
|
(export gnc:config-var-action-func-get)
|
||||||
|
(export gnc:config-var-equality-func-get)
|
||||||
|
(export gnc:config-var-modified?)
|
||||||
|
(export gnc:config-var-modified?-set!)
|
||||||
|
(export gnc:config-var-default-value-get)
|
||||||
|
(export gnc:config-var-default-value-set!)
|
||||||
|
(export gnc:config-var-value-get)
|
||||||
|
(export gnc:config-var-value-set!)
|
||||||
|
(export gnc:config-var-value-is-default?)
|
||||||
|
|
||||||
|
;; prefs.scm
|
||||||
|
(export gnc:register-configuration-option)
|
||||||
|
(export gnc:lookup-global-option)
|
||||||
|
(export gnc:send-global-options)
|
||||||
|
(export gnc:global-options-clear-changes)
|
||||||
|
(export gnc:save-all-options)
|
||||||
|
(export gnc:get-debit-string)
|
||||||
|
(export gnc:get-credit-string)
|
||||||
|
(export gnc:*options-entries*)
|
||||||
|
(export gnc:config-file-format-version)
|
||||||
|
|
||||||
;; date-utilities.scm
|
;; date-utilities.scm
|
||||||
|
|
||||||
(export gnc:reldate-list)
|
(export gnc:reldate-list)
|
||||||
@ -210,7 +234,38 @@
|
|||||||
(export gnc:backtrace-if-exception)
|
(export gnc:backtrace-if-exception)
|
||||||
|
|
||||||
(load-from-path "c-interface.scm")
|
(load-from-path "c-interface.scm")
|
||||||
|
(load-from-path "config-var.scm")
|
||||||
(load-from-path "options.scm")
|
(load-from-path "options.scm")
|
||||||
|
(load-from-path "prefs.scm")
|
||||||
(load-from-path "hooks.scm")
|
(load-from-path "hooks.scm")
|
||||||
(load-from-path "date-utilities.scm")
|
(load-from-path "date-utilities.scm")
|
||||||
(load-from-path "utilities.scm")
|
(load-from-path "utilities.scm")
|
||||||
|
|
||||||
|
(gnc:hook-add-dangler gnc:*startup-hook*
|
||||||
|
(lambda ()
|
||||||
|
(begin
|
||||||
|
;; Initialize the C side options code.
|
||||||
|
;; Must come after the scheme options are loaded.
|
||||||
|
(gnc:c-options-init)
|
||||||
|
|
||||||
|
;; Initialize the expresion parser.
|
||||||
|
;; Must come after the C side options initialization.
|
||||||
|
(gnc:exp-parser-init))))
|
||||||
|
|
||||||
|
;; add a hook to shut down the expression parser
|
||||||
|
(gnc:hook-add-dangler gnc:*shutdown-hook*
|
||||||
|
(lambda ()
|
||||||
|
(begin
|
||||||
|
;; Shutdown the expression parser
|
||||||
|
(gnc:exp-parser-shutdown)
|
||||||
|
|
||||||
|
;; This saves global options plus (for the
|
||||||
|
;; moment) saved report and account tree
|
||||||
|
;; window parameters. Reports and parameters
|
||||||
|
;; should probably be in a separate file,
|
||||||
|
;; with the main data file, or something
|
||||||
|
;; else.
|
||||||
|
(gnc:save-all-options)
|
||||||
|
|
||||||
|
;; Shut down the C side options code
|
||||||
|
(gnc:c-options-shutdown))))
|
||||||
|
@ -33,14 +33,12 @@
|
|||||||
;;; permanent, and if they leave the variable value different from the
|
;;; permanent, and if they leave the variable value different from the
|
||||||
;;; default, should be saved to the auto configuration file.
|
;;; default, should be saved to the auto configuration file.
|
||||||
|
|
||||||
(gnc:support "config-var.scm")
|
|
||||||
|
|
||||||
(define (gnc:make-config-var description
|
(define (gnc:make-config-var description
|
||||||
set-action-func
|
set-action-func
|
||||||
equality-func
|
equality-func
|
||||||
default)
|
default)
|
||||||
(let ((var
|
(let ((var (vector description set-action-func
|
||||||
(vector description set-action-func equality-func #f default default)))
|
equality-func #f default default)))
|
||||||
(gnc:config-var-value-set! var #f default)
|
(gnc:config-var-value-set! var #f default)
|
||||||
var))
|
var))
|
||||||
|
|
||||||
@ -54,7 +52,8 @@
|
|||||||
(define (gnc:config-var-modified?-set! var value) (vector-set! var 3 value))
|
(define (gnc:config-var-modified?-set! var value) (vector-set! var 3 value))
|
||||||
|
|
||||||
(define (gnc:config-var-default-value-get var) (vector-ref var 4))
|
(define (gnc:config-var-default-value-get var) (vector-ref var 4))
|
||||||
(define (gnc:config-var-default-value-set! var value) (vector-set! var 4 value))
|
(define (gnc:config-var-default-value-set! var value)
|
||||||
|
(vector-set! var 4 value))
|
||||||
|
|
||||||
(define (gnc:config-var-value-get var) (vector-ref var 5))
|
(define (gnc:config-var-value-get var) (vector-ref var 5))
|
||||||
(define (gnc:config-var-value-set! var is-config-mod? value)
|
(define (gnc:config-var-value-set! var is-config-mod? value)
|
@ -44,9 +44,6 @@ char gnc_get_account_separator (void);
|
|||||||
gboolean gnc_reverse_balance(Account *account);
|
gboolean gnc_reverse_balance(Account *account);
|
||||||
gboolean gnc_reverse_balance_type(GNCAccountType type);
|
gboolean gnc_reverse_balance_type(GNCAccountType type);
|
||||||
|
|
||||||
const char * gnc_register_default_font(void);
|
|
||||||
const char * gnc_register_default_hint_font(void);
|
|
||||||
|
|
||||||
|
|
||||||
/* Engine enhancements & i18n ***************************************/
|
/* Engine enhancements & i18n ***************************************/
|
||||||
void gnc_set_current_book_handler (GNCBookCB cb);
|
void gnc_set_current_book_handler (GNCBookCB cb);
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
"#include <global-options.h>\n"
|
"#include <global-options.h>\n"
|
||||||
"#include <option-util.h>\n"
|
"#include <option-util.h>\n"
|
||||||
"#include <gnc-euro.h>\n"
|
"#include <gnc-euro.h>\n"
|
||||||
|
"#include <gnc-exp-parser.h>\n"
|
||||||
"#include <gnc-ui-util.h>\n"
|
"#include <gnc-ui-util.h>\n"
|
||||||
"#include <gnc-gettext-util.h>\n"
|
"#include <gnc-gettext-util.h>\n"
|
||||||
"#include <gnc-helpers.h>\n"
|
"#include <gnc-helpers.h>\n"
|
||||||
@ -84,6 +85,23 @@
|
|||||||
mod '<gnc:OptionChangeCallback>
|
mod '<gnc:OptionChangeCallback>
|
||||||
"GNCOptionChangeCallback" "const GNCOptionChangeCallback")
|
"GNCOptionChangeCallback" "const GNCOptionChangeCallback")
|
||||||
|
|
||||||
|
|
||||||
|
(gw:wrap-function
|
||||||
|
mod
|
||||||
|
'gnc:exp-parser-init
|
||||||
|
'<gw:void>
|
||||||
|
"gnc_exp_parser_init"
|
||||||
|
'()
|
||||||
|
"Initialize the expression parser.")
|
||||||
|
|
||||||
|
(gw:wrap-function
|
||||||
|
mod
|
||||||
|
'gnc:exp-parser-shutdown
|
||||||
|
'<gw:void>
|
||||||
|
"gnc_exp_parser_shutdown"
|
||||||
|
'()
|
||||||
|
"Shutdown the expression parser and free any associated memory.")
|
||||||
|
|
||||||
(gw:wrap-function
|
(gw:wrap-function
|
||||||
mod
|
mod
|
||||||
'gnc:gettext-helper
|
'gnc:gettext-helper
|
||||||
@ -139,7 +157,7 @@
|
|||||||
|
|
||||||
(gw:wrap-function
|
(gw:wrap-function
|
||||||
mod
|
mod
|
||||||
'gnc:amount->string-helper
|
'gnc:amount->string
|
||||||
'(<gw:m-chars-callee-owned> gw:const)
|
'(<gw:m-chars-callee-owned> gw:const)
|
||||||
"xaccPrintAmount"
|
"xaccPrintAmount"
|
||||||
'((<gnc:numeric> amount)
|
'((<gnc:numeric> amount)
|
||||||
|
@ -158,7 +158,9 @@ gnc_option_set_ui_value (GNCOption *option, gboolean use_default)
|
|||||||
{
|
{
|
||||||
g_return_if_fail (option != NULL);
|
g_return_if_fail (option != NULL);
|
||||||
g_return_if_fail (option->odb != NULL);
|
g_return_if_fail (option->odb != NULL);
|
||||||
g_return_if_fail (option->odb->set_ui_value != NULL);
|
|
||||||
|
if (!option->odb->set_ui_value)
|
||||||
|
return;
|
||||||
|
|
||||||
option->odb->set_ui_value (option, use_default);
|
option->odb->set_ui_value (option, use_default);
|
||||||
}
|
}
|
||||||
|
@ -888,12 +888,7 @@
|
|||||||
(lambda (option)
|
(lambda (option)
|
||||||
(let ((value (gnc:option-value option))
|
(let ((value (gnc:option-value option))
|
||||||
(default-value (gnc:option-default-value option)))
|
(default-value (gnc:option-default-value option)))
|
||||||
; (if (and (pair? default-value)); (eqv? 'commodity-scm (car value)))
|
(if (not (equal? value default-value))
|
||||||
; (begin
|
|
||||||
; (write value) (newline)
|
|
||||||
; (write default-value) (newline)))
|
|
||||||
(if
|
|
||||||
(not (equal? value default-value))
|
|
||||||
(let* ((generator (gnc:option-generate-restore-form option))
|
(let* ((generator (gnc:option-generate-restore-form option))
|
||||||
(restore-code (false-if-exception (generator))))
|
(restore-code (false-if-exception (generator))))
|
||||||
(if restore-code
|
(if restore-code
|
||||||
|
@ -56,8 +56,6 @@
|
|||||||
;; eq?
|
;; eq?
|
||||||
;; #f))
|
;; #f))
|
||||||
|
|
||||||
(gnc:support "prefs.scm")
|
|
||||||
|
|
||||||
(define gnc:*options-entries* (gnc:new-options))
|
(define gnc:*options-entries* (gnc:new-options))
|
||||||
|
|
||||||
(define (gnc:register-configuration-option new-option)
|
(define (gnc:register-configuration-option new-option)
|
||||||
@ -76,9 +74,8 @@
|
|||||||
;; it's important to make sure it happens in this order. later the
|
;; it's important to make sure it happens in this order. later the
|
||||||
;; hook should probably revert back to just save-global-options.
|
;; hook should probably revert back to just save-global-options.
|
||||||
(define (gnc:save-all-options)
|
(define (gnc:save-all-options)
|
||||||
(gnc:save-global-options)
|
(gnc:save-global-options))
|
||||||
; (gnc:save-report-options); (gnc:save-acct-tree-options)
|
; (gnc:save-style-sheet-options))
|
||||||
(gnc:save-style-sheet-options))
|
|
||||||
|
|
||||||
(define (gnc:save-global-options)
|
(define (gnc:save-global-options)
|
||||||
(gnc:make-home-dir)
|
(gnc:make-home-dir)
|
||||||
@ -240,16 +237,20 @@ and expand the current transaction")))
|
|||||||
"h" (N_ "If selected, use a dialog to confirm a change to a reconciled \
|
"h" (N_ "If selected, use a dialog to confirm a change to a reconciled \
|
||||||
transaction.") #t))
|
transaction.") #t))
|
||||||
|
|
||||||
|
(define (string-take-n string n)
|
||||||
|
(substring string n (string-length string)))
|
||||||
|
|
||||||
(gnc:register-configuration-option
|
(gnc:register-configuration-option
|
||||||
(gnc:make-font-option
|
(gnc:make-font-option
|
||||||
(N_ "Register") (N_ "Register font")
|
(N_ "Register") (N_ "Register font")
|
||||||
"i" (N_ "The font to use in the register") (gnc:register-default-font)))
|
"i" (N_ "The font to use in the register")
|
||||||
|
(string-take-n (_ "register-default-font:-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*") 22)))
|
||||||
|
|
||||||
(gnc:register-configuration-option
|
(gnc:register-configuration-option
|
||||||
(gnc:make-font-option
|
(gnc:make-font-option
|
||||||
(N_ "Register") (N_ "Register hint font")
|
(N_ "Register") (N_ "Register hint font")
|
||||||
"j" (N_ "The font used to show hints in the register")
|
"j" (N_ "The font used to show hints in the register")
|
||||||
(gnc:register-default-hint-font)))
|
(string-take-n (_ "register-hint-font:-adobe-helvetica-medium-o-normal--*-120-*-*-*-*-*-*") 19)))
|
||||||
|
|
||||||
|
|
||||||
;; Register Color options
|
;; Register Color options
|
||||||
@ -557,8 +558,8 @@ without one.")
|
|||||||
(gnc:register-configuration-option
|
(gnc:register-configuration-option
|
||||||
(gnc:make-number-range-option
|
(gnc:make-number-range-option
|
||||||
(N_ "Scheduled Transactions")
|
(N_ "Scheduled Transactions")
|
||||||
(N_ "Default create-in-advance days")
|
(N_ "Default create in advance days")
|
||||||
"d" (N_ "Default number of days-in-advance to create new SXes")
|
"d" (N_ "Default number of days in advance to create new SXes")
|
||||||
0 ; default
|
0 ; default
|
||||||
0 ; min
|
0 ; min
|
||||||
99999999 ; max
|
99999999 ; max
|
||||||
@ -570,14 +571,14 @@ without one.")
|
|||||||
(gnc:make-number-range-option
|
(gnc:make-number-range-option
|
||||||
(N_ "Scheduled Transactions")
|
(N_ "Scheduled Transactions")
|
||||||
(N_ "Default remind-in-advance days")
|
(N_ "Default remind-in-advance days")
|
||||||
"e" (N_ "Default number of days-in-advance to remind on new SXes")
|
"e" (N_ "Default number of days in advance to remind on new SXes")
|
||||||
0 ; default
|
0 ; default
|
||||||
0 ; min
|
0 ; min
|
||||||
99999 ; max
|
99999 ; max
|
||||||
0 ; num-decimals
|
0 ; num-decimals
|
||||||
1 ; step size
|
1 ; step size
|
||||||
))
|
))
|
||||||
|
|
||||||
(gnc:register-configuration-option
|
(gnc:register-configuration-option
|
||||||
(gnc:make-number-range-option
|
(gnc:make-number-range-option
|
||||||
(N_ "Scheduled Transactions")
|
(N_ "Scheduled Transactions")
|
||||||
@ -590,111 +591,6 @@ without one.")
|
|||||||
1 ; step size
|
1 ; step size
|
||||||
))
|
))
|
||||||
|
|
||||||
;;; Configuation variables
|
|
||||||
|
|
||||||
(define gnc:*arg-show-version*
|
|
||||||
(gnc:make-config-var
|
|
||||||
(N_ "Show version.")
|
|
||||||
(lambda (var value) (if (boolean? value) (list value) #f))
|
|
||||||
eq?
|
|
||||||
#f))
|
|
||||||
|
|
||||||
(define gnc:*arg-show-usage*
|
|
||||||
(gnc:make-config-var
|
|
||||||
(N_ "Generate an argument summary.")
|
|
||||||
(lambda (var value) (if (boolean? value) (list value) #f))
|
|
||||||
eq?
|
|
||||||
#f))
|
|
||||||
|
|
||||||
(define gnc:*arg-show-help*
|
|
||||||
(gnc:make-config-var
|
|
||||||
(N_ "Generate an argument summary.")
|
|
||||||
(lambda (var value) (if (boolean? value) (list value) #f))
|
|
||||||
eq?
|
|
||||||
#f))
|
|
||||||
|
|
||||||
(define gnc:*arg-no-file*
|
|
||||||
(gnc:make-config-var
|
|
||||||
(N_ "Don't load any file, including autoloading the last file.")
|
|
||||||
(lambda (var value) (if (boolean? value) (list value) #f))
|
|
||||||
eq?
|
|
||||||
#f))
|
|
||||||
|
|
||||||
(define gnc:*config-dir*
|
|
||||||
(gnc:make-config-var
|
|
||||||
(N_ "Configuration directory.")
|
|
||||||
(lambda (var value) (if (string? value) (list value) #f))
|
|
||||||
string=?
|
|
||||||
gnc:_config-dir-default_))
|
|
||||||
|
|
||||||
(define gnc:*share-dir*
|
|
||||||
(gnc:make-config-var
|
|
||||||
(N_ "Shared files directory.")
|
|
||||||
(lambda (var value) (if (string? value) (list value) #f))
|
|
||||||
string=?
|
|
||||||
gnc:_share-dir-default_))
|
|
||||||
|
|
||||||
;; Convert the temporary startup value into a config var.
|
|
||||||
(let ((current-value gnc:*debugging?*))
|
|
||||||
(set!
|
|
||||||
gnc:*debugging?*
|
|
||||||
(gnc:make-config-var
|
|
||||||
(N_ "Enable debugging code.")
|
|
||||||
(lambda (var value) (if (boolean? value) (list value) #f))
|
|
||||||
eq?
|
|
||||||
#f))
|
|
||||||
(gnc:config-var-value-set! gnc:*debugging?* #f current-value))
|
|
||||||
|
|
||||||
(let ((current-value gnc:*debugging?*))
|
|
||||||
(set!
|
|
||||||
gnc:*develmode*
|
|
||||||
(gnc:make-config-var
|
|
||||||
(N_ "Enable developers mode.")
|
|
||||||
(lambda (var value) (if (boolean? value) (list value) #f))
|
|
||||||
eq?
|
|
||||||
#f))
|
|
||||||
(gnc:config-var-value-set! gnc:*develmode* #f current-value))
|
|
||||||
|
|
||||||
(define gnc:*loglevel*
|
|
||||||
(gnc:make-config-var
|
|
||||||
(N_ "Logging level from 0 (least logging) to 5 (most logging).")
|
|
||||||
(lambda (var value) (if (exact? value) (list value) #f))
|
|
||||||
eq?
|
|
||||||
#f))
|
|
||||||
|
|
||||||
;; Convert the temporary startup value into a config var.
|
|
||||||
(let ((current-load-path gnc:*load-path*))
|
|
||||||
(set!
|
|
||||||
gnc:*load-path*
|
|
||||||
(gnc:make-config-var
|
|
||||||
(N_ "A list of strings indicating the load path for (gnc:load name).
|
|
||||||
Each element must be a string representing a directory or a symbol
|
|
||||||
where 'default expands to the default path, and 'current expands to
|
|
||||||
the current value of the path.")
|
|
||||||
(lambda (var value)
|
|
||||||
(let ((result (gnc:expand-load-path value)))
|
|
||||||
(if (list? result)
|
|
||||||
(list result)
|
|
||||||
#f)))
|
|
||||||
equal?
|
|
||||||
'(default)))
|
|
||||||
(gnc:config-var-value-set! gnc:*load-path* #f current-load-path))
|
|
||||||
|
|
||||||
(define gnc:*doc-path*
|
|
||||||
|
|
||||||
(gnc:make-config-var
|
|
||||||
(N_ "A list of strings indicating where to look for html and parsed-html files. \
|
|
||||||
Each element must be a string representing a directory or a symbol \
|
|
||||||
where 'default expands to the default path, and 'current expands to \
|
|
||||||
the current value of the path.")
|
|
||||||
(lambda (var value)
|
|
||||||
(let ((result (gnc:_expand-doc-path_ value)))
|
|
||||||
(if (list? result)
|
|
||||||
(list result)
|
|
||||||
#f)))
|
|
||||||
equal?
|
|
||||||
'(default)))
|
|
||||||
|
|
||||||
|
|
||||||
;;; Internal options -- Section names that start with "__" are not
|
;;; Internal options -- Section names that start with "__" are not
|
||||||
;;; displayed in option dialogs.
|
;;; displayed in option dialogs.
|
@ -36,24 +36,22 @@ gnc_module_description(void)
|
|||||||
int
|
int
|
||||||
gnc_module_init(int refcount)
|
gnc_module_init(int refcount)
|
||||||
{
|
{
|
||||||
if(refcount == 0)
|
engine = gnc_module_load("gnucash/engine", 0);
|
||||||
{
|
if(!engine) return FALSE;
|
||||||
engine = gnc_module_load("gnucash/engine", 0);
|
|
||||||
|
|
||||||
if(!engine) return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
gnc_module_end(int refcount)
|
gnc_module_end(int refcount)
|
||||||
{
|
{
|
||||||
if((refcount == 0) && engine)
|
int unload = TRUE;
|
||||||
{
|
|
||||||
int unload = gnc_module_unload(engine);
|
|
||||||
engine = NULL;
|
|
||||||
return unload;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (engine)
|
||||||
|
unload = gnc_module_unload(engine);
|
||||||
|
|
||||||
|
if (refcount == 0)
|
||||||
|
engine = NULL;
|
||||||
|
|
||||||
|
return unload;
|
||||||
|
}
|
||||||
|
@ -40,24 +40,24 @@ gnc_module_description(void)
|
|||||||
int
|
int
|
||||||
gnc_module_init(int refcount)
|
gnc_module_init(int refcount)
|
||||||
{
|
{
|
||||||
if(refcount == 0) {
|
engine = gnc_module_load("gnucash/engine", 0);
|
||||||
engine = gnc_module_load("gnucash/engine", 0);
|
if(!engine) return FALSE;
|
||||||
|
|
||||||
if(!engine) return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
gnc_module_end(int refcount)
|
gnc_module_end(int refcount)
|
||||||
{
|
{
|
||||||
if((refcount == 0) && engine)
|
int unload = TRUE;
|
||||||
{
|
|
||||||
int unload = gnc_module_unload(engine);
|
if (engine)
|
||||||
|
unload = gnc_module_unload(engine);
|
||||||
|
|
||||||
|
if (refcount == 0)
|
||||||
engine = NULL;
|
engine = NULL;
|
||||||
return unload;
|
|
||||||
}
|
return unload;
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,24 +40,24 @@ gnc_module_description(void)
|
|||||||
int
|
int
|
||||||
gnc_module_init(int refcount)
|
gnc_module_init(int refcount)
|
||||||
{
|
{
|
||||||
if(refcount == 0) {
|
engine = gnc_module_load("gnucash/engine", 0);
|
||||||
engine = gnc_module_load("gnucash/engine", 0);
|
if(!engine) return FALSE;
|
||||||
|
|
||||||
if(!engine) return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
gnc_module_end(int refcount)
|
gnc_module_end(int refcount)
|
||||||
{
|
{
|
||||||
if((refcount == 0) && engine)
|
int unload = TRUE;
|
||||||
{
|
|
||||||
int unload = gnc_module_unload(engine);
|
if (engine)
|
||||||
|
unload = gnc_module_unload(engine);
|
||||||
|
|
||||||
|
if (refcount == 0)
|
||||||
engine = NULL;
|
engine = NULL;
|
||||||
return unload;
|
|
||||||
}
|
return unload;
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,17 +3,9 @@
|
|||||||
;;; load and save commodity tables
|
;;; load and save commodity tables
|
||||||
;;;
|
;;;
|
||||||
;;; Bill Gribble <grib@billgribble.com> 3 Aug 2000
|
;;; Bill Gribble <grib@billgribble.com> 3 Aug 2000
|
||||||
;;; $Id$
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|
||||||
;;(define gnc:*iso-4217-currency-file*
|
|
||||||
;; (gnc:make-config-var
|
|
||||||
;; "Database of ISO-4217 currency definitions"
|
|
||||||
;; (lambda (var value) (if (string? value) (list value) #f))
|
|
||||||
;; string=?
|
|
||||||
;; "iso-4217-currencies.scm"))
|
|
||||||
|
|
||||||
(define gnc:*iso-4217-currency-file* "iso-4217-currencies.scm")
|
(define gnc:*iso-4217-currency-file* "iso-4217-currencies.scm")
|
||||||
|
|
||||||
(define GNC_COMMODITY_NS_ISO "ISO4217")
|
(define GNC_COMMODITY_NS_ISO "ISO4217")
|
||||||
|
@ -277,8 +277,7 @@ gnc_module_get_info(const char * fullpath)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("\n** WARNING ** : module '%s' does not match module signature\n",
|
g_warning ("module '%s' does not match module signature\n", fullpath);
|
||||||
fullpath);
|
|
||||||
lt_dlclose(handle);
|
lt_dlclose(handle);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -294,8 +293,7 @@ gnc_module_get_info(const char * fullpath)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("\n** WARNING ** : Failed to dlopen() '%s': %s\n",
|
g_warning ("Failed to dlopen() '%s': %s\n", fullpath, lt_dlerror());
|
||||||
fullpath, lt_dlerror());
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -424,10 +422,12 @@ gnc_module_load(char * module_name, gint interface)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
g_warning ("module init failed: %s", module_name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
g_warning ("module has no init func: %s", module_name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -455,7 +455,7 @@ gnc_module_load(char * module_name, gint interface)
|
|||||||
if(!info->init_func(0))
|
if(!info->init_func(0))
|
||||||
{
|
{
|
||||||
/* init failed. unload the module. */
|
/* init failed. unload the module. */
|
||||||
printf("Initialization failed for module %s\n", module_name);
|
g_warning ("Initialization failed for module %s\n", module_name);
|
||||||
g_hash_table_remove(loaded_modules, info);
|
g_hash_table_remove(loaded_modules, info);
|
||||||
g_free(info->filename);
|
g_free(info->filename);
|
||||||
g_free(info);
|
g_free(info);
|
||||||
@ -467,18 +467,18 @@ gnc_module_load(char * module_name, gint interface)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Module %s (%s) is not a gnc-module.\n", module_name,
|
g_warning ("Module %s (%s) is not a gnc-module.\n", module_name,
|
||||||
modinfo->module_filepath);
|
modinfo->module_filepath);
|
||||||
lt_dlclose(handle);
|
lt_dlclose(handle);
|
||||||
}
|
}
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("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());
|
||||||
else printf(": could not locate %s interface v.%d\n",
|
else g_warning (": could not locate %s interface v.%d\n",
|
||||||
module_name, interface);
|
module_name, interface);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -524,7 +524,7 @@ gnc_module_unload(GNCModule module)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Failed to unload module %p (it is not loaded)\n", module);
|
g_warning ("Failed to unload module %p (it is not loaded)\n", module);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ TESTS_ENVIRONMENT= \
|
|||||||
GNC_MODULE_PATH=../../engine:../../gnc-module:../../calculation:.. \
|
GNC_MODULE_PATH=../../engine:../../gnc-module:../../calculation:.. \
|
||||||
GUILE_LOAD_PATH=${G_WRAP_MODULE_DIR}:../../engine:..:../../gnc-module:${top_srcdir}/lib \
|
GUILE_LOAD_PATH=${G_WRAP_MODULE_DIR}:../../engine:..:../../gnc-module:${top_srcdir}/lib \
|
||||||
LTDL_LIBRARY_PATH=.. \
|
LTDL_LIBRARY_PATH=.. \
|
||||||
LD_LIBRARY_PATH=${top_srcdir}/src/gnc-module:${top_srcdir}/src/gnc-module/.libs:${top_srcdir}/src/engine:${top_srcdir}/src/engine/.libs:${top_srcdir}/src/calculation:${top_srcdir}/src/calculation/.libs
|
LD_LIBRARY_PATH=${top_srcdir}/src/gnc-module:${top_srcdir}/src/gnc-module/.libs:${top_srcdir}/src/engine:${top_srcdir}/src/engine/.libs:${top_srcdir}/src/calculation:${top_srcdir}/src/calculation/.libs:${top_srcdir}/src/network-utils:${top_srcdir}/src/network-utils/.libs
|
||||||
|
|
||||||
LDADD = \
|
LDADD = \
|
||||||
-L${top_srcdir}/src/gnc-module -L${top_srcdir}/src/gnc-module/.libs \
|
-L${top_srcdir}/src/gnc-module -L${top_srcdir}/src/gnc-module/.libs \
|
||||||
|
@ -526,7 +526,6 @@ gnucash_ui_init(void)
|
|||||||
|
|
||||||
gnc_recn_cell_set_string_getter (gnc_get_reconcile_str);
|
gnc_recn_cell_set_string_getter (gnc_get_reconcile_str);
|
||||||
|
|
||||||
/* gnc_default_ui_start */
|
|
||||||
gnucash_style_init();
|
gnucash_style_init();
|
||||||
gnucash_color_init();
|
gnucash_color_init();
|
||||||
|
|
||||||
@ -558,17 +557,6 @@ gnucash_ui_init(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean hasstarted = FALSE;
|
|
||||||
void
|
|
||||||
gnc_default_ui_start(void)
|
|
||||||
{
|
|
||||||
if (!hasstarted)
|
|
||||||
{
|
|
||||||
hasstarted = TRUE;
|
|
||||||
gnc_get_current_book ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ============================================================== */
|
/* ============================================================== */
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -618,11 +606,10 @@ gnc_ui_destroy (void)
|
|||||||
/* ============================================================== */
|
/* ============================================================== */
|
||||||
|
|
||||||
int
|
int
|
||||||
gnc_ui_show_main_window(void)
|
gnc_ui_show_main_window (void)
|
||||||
{
|
{
|
||||||
/* Initialize gnome */
|
/* Initialize gnome */
|
||||||
gnucash_ui_init();
|
gnucash_ui_init();
|
||||||
gnc_default_ui_start();
|
|
||||||
|
|
||||||
/* Get the main window on screen. */
|
/* Get the main window on screen. */
|
||||||
while (gtk_events_pending())
|
while (gtk_events_pending())
|
||||||
@ -707,15 +694,6 @@ gnc_ui_start_event_loop (void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
gnc_ui_main(void)
|
|
||||||
{
|
|
||||||
gnc_ui_show_main_window();
|
|
||||||
|
|
||||||
return gnc_ui_start_event_loop();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ============================================================== */
|
/* ============================================================== */
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@ -726,31 +704,6 @@ gnucash_ui_open_file(const char name[])
|
|||||||
|
|
||||||
/* ============================================================== */
|
/* ============================================================== */
|
||||||
|
|
||||||
int
|
|
||||||
gnucash_ui_select_file(void)
|
|
||||||
{
|
|
||||||
gnc_file_open ();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ============================================================== */
|
|
||||||
|
|
||||||
const char *
|
|
||||||
gnc_register_default_font(void)
|
|
||||||
{
|
|
||||||
return gnucash_style_get_default_register_font_name();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ============================================================== */
|
|
||||||
|
|
||||||
const char *
|
|
||||||
gnc_register_default_hint_font(void)
|
|
||||||
{
|
|
||||||
return gnucash_style_get_default_register_hint_font_name();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ============================================================== */
|
|
||||||
|
|
||||||
/* gnc_configure_date_format_cb
|
/* gnc_configure_date_format_cb
|
||||||
* Callback called when options change - sets dateFormat to the current
|
* Callback called when options change - sets dateFormat to the current
|
||||||
* value on the scheme side and refreshes register windows
|
* value on the scheme side and refreshes register windows
|
||||||
|
@ -31,17 +31,13 @@ gboolean gnucash_ui_is_running(void);
|
|||||||
gboolean gnucash_ui_is_terminating(void);
|
gboolean gnucash_ui_is_terminating(void);
|
||||||
int gnucash_ui_init(void);
|
int gnucash_ui_init(void);
|
||||||
gboolean gnucash_ui_open_file(const char * name);
|
gboolean gnucash_ui_open_file(const char * name);
|
||||||
int gnucash_ui_select_file(void);
|
|
||||||
|
|
||||||
GNCMainInfo * gnc_ui_get_data(void);
|
GNCMainInfo * gnc_ui_get_data(void);
|
||||||
void gnc_default_ui_start(void);
|
|
||||||
void gnc_ui_shutdown(void);
|
void gnc_ui_shutdown(void);
|
||||||
void gnc_ui_destroy(void);
|
void gnc_ui_destroy(void);
|
||||||
int gnc_ui_show_main_window(void);
|
int gnc_ui_show_main_window(void);
|
||||||
int gnc_ui_start_event_loop(void);
|
int gnc_ui_start_event_loop(void);
|
||||||
int gnc_ui_main(void);
|
|
||||||
const char * gnc_register_default_font(void);
|
|
||||||
const char * gnc_register_default_hint_font(void);
|
|
||||||
gboolean gnc_reverse_balance_type(GNCAccountType type);
|
gboolean gnc_reverse_balance_type(GNCAccountType type);
|
||||||
gboolean gnc_reverse_balance(Account *account);
|
gboolean gnc_reverse_balance(Account *account);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -42,34 +42,31 @@ lmod(char * mn)
|
|||||||
|
|
||||||
int
|
int
|
||||||
gnc_module_init(int refcount) {
|
gnc_module_init(int refcount) {
|
||||||
if (refcount == 0)
|
/* load the engine (we depend on it) */
|
||||||
{
|
if(!gnc_module_load("gnucash/engine", 0)) {
|
||||||
/* load the engine (we depend on it) */
|
return FALSE;
|
||||||
if(!gnc_module_load("gnucash/engine", 0)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* load the calculation module (we depend on it) */
|
|
||||||
if(!gnc_module_load("gnucash/app-utils", 0)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* load the calculation module (we depend on it) */
|
|
||||||
if(!gnc_module_load("gnucash/app-file", 0)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* load the calculation module (we depend on it) */
|
|
||||||
if(!gnc_module_load("gnucash/gnome-utils", 0)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* publish g-wrapped bindings */
|
|
||||||
/* load the scheme code */
|
|
||||||
lmod("(g-wrapped gw-binary-import)");
|
|
||||||
lmod("(gnucash import-export binary-import)");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* load the calculation module (we depend on it) */
|
||||||
|
if(!gnc_module_load("gnucash/app-utils", 0)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* load the calculation module (we depend on it) */
|
||||||
|
if(!gnc_module_load("gnucash/app-file", 0)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* load the calculation module (we depend on it) */
|
||||||
|
if(!gnc_module_load("gnucash/gnome-utils", 0)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* publish g-wrapped bindings */
|
||||||
|
/* load the scheme code */
|
||||||
|
lmod("(g-wrapped gw-binary-import)");
|
||||||
|
lmod("(gnucash import-export binary-import)");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,22 +30,20 @@ gnc_module_description(void) {
|
|||||||
|
|
||||||
int
|
int
|
||||||
gnc_module_init(int refcount) {
|
gnc_module_init(int refcount) {
|
||||||
if(refcount == 0)
|
if(!gnc_module_load("gnucash/engine", 0))
|
||||||
{
|
{
|
||||||
if(!gnc_module_load("gnucash/engine", 0))
|
return FALSE;
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!gnc_module_load("gnucash/register/register-core", 0))
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!gnc_module_load("gnucash/app-utils", 0))
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!gnc_module_load("gnucash/register/register-core", 0))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!gnc_module_load("gnucash/app-utils", 0))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -30,20 +30,18 @@ gnc_module_description(void) {
|
|||||||
|
|
||||||
int
|
int
|
||||||
gnc_module_init(int refcount) {
|
gnc_module_init(int refcount) {
|
||||||
if(refcount == 0)
|
if(!gnc_module_load("gnucash/engine", 0))
|
||||||
{
|
{
|
||||||
if(!gnc_module_load("gnucash/engine", 0))
|
return FALSE;
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME. We need this for the wide-character functions.
|
|
||||||
* When fixing, get rid of gnome-utils includes, too. */
|
|
||||||
if(!gnc_module_load("gnucash/gnome-utils", 0))
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME. We need this for the wide-character functions.
|
||||||
|
* When fixing, get rid of gnome-utils includes, too. */
|
||||||
|
if(!gnc_module_load("gnucash/gnome-utils", 0))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ TESTS_ENVIRONMENT= \
|
|||||||
GNC_MODULE_PATH=../../engine:../../gnc-module:../../calculation:.. \
|
GNC_MODULE_PATH=../../engine:../../gnc-module:../../calculation:.. \
|
||||||
GUILE_LOAD_PATH=${G_WRAP_MODULE_DIR}:../../engine:..:../../gnc-module:${top_srcdir}/lib \
|
GUILE_LOAD_PATH=${G_WRAP_MODULE_DIR}:../../engine:..:../../gnc-module:${top_srcdir}/lib \
|
||||||
LTDL_LIBRARY_PATH=.. \
|
LTDL_LIBRARY_PATH=.. \
|
||||||
LD_LIBRARY_PATH=${top_srcdir}/src/gnc-module:${top_srcdir}/src/gnc-module/.libs:${top_srcdir}/src/engine:${top_srcdir}/src/engine/.libs:${top_srcdir}/src/calculation:${top_srcdir}/src/calculation/.libs
|
LD_LIBRARY_PATH=${top_srcdir}/src/gnc-module:${top_srcdir}/src/gnc-module/.libs:${top_srcdir}/src/engine:${top_srcdir}/src/engine/.libs:${top_srcdir}/src/calculation:${top_srcdir}/src/calculation/.libs:${top_srcdir}/src/network-utils:${top_srcdir}/src/network-utils/.libs
|
||||||
|
|
||||||
LDADD = \
|
LDADD = \
|
||||||
-L${top_srcdir}/src/gnc-module -L${top_srcdir}/src/gnc-module/.libs \
|
-L${top_srcdir}/src/gnc-module -L${top_srcdir}/src/gnc-module/.libs \
|
||||||
|
@ -36,16 +36,16 @@ gnc_module_description(void) {
|
|||||||
|
|
||||||
int
|
int
|
||||||
gnc_module_init(int refcount) {
|
gnc_module_init(int refcount) {
|
||||||
|
if(!gnc_module_load("gnucash/register/register-core", 0)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!gnc_module_load("gnucash/gnome-utils", 0)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (refcount == 0)
|
if (refcount == 0)
|
||||||
{
|
{
|
||||||
if(!gnc_module_load("gnucash/register/register-core", 0)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!gnc_module_load("gnucash/gnome-utils", 0)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gnc_register_add_cell_type (COMBO_CELL_TYPE_NAME, gnc_combo_cell_new);
|
gnc_register_add_cell_type (COMBO_CELL_TYPE_NAME, gnc_combo_cell_new);
|
||||||
|
|
||||||
gnc_register_add_cell_type (DATE_CELL_TYPE_NAME, gnc_date_cell_new);
|
gnc_register_add_cell_type (DATE_CELL_TYPE_NAME, gnc_date_cell_new);
|
||||||
|
@ -796,6 +796,18 @@ gnucash_font_load (const char *name)
|
|||||||
return gdk_font_load (name);
|
return gdk_font_load (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
gnucash_style_get_default_register_font_name (void)
|
||||||
|
{
|
||||||
|
return _("register-default-font:-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*") + 22;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
gnucash_style_get_default_register_hint_font_name (void)
|
||||||
|
{
|
||||||
|
return _("register-hint-font:-adobe-helvetica-medium-o-normal--*-120-*-*-*-*-*-*") + 19;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gnucash_style_set_register_font_name (const char *name)
|
gnucash_style_set_register_font_name (const char *name)
|
||||||
{
|
{
|
||||||
@ -1001,18 +1013,6 @@ gnucash_sheet_set_header_widths (GnucashSheet *sheet,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
|
||||||
gnucash_style_get_default_register_font_name (void)
|
|
||||||
{
|
|
||||||
return _("register-default-font:-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*") + 22;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
|
||||||
gnucash_style_get_default_register_hint_font_name (void)
|
|
||||||
{
|
|
||||||
return _("register-hint-font:-adobe-helvetica-medium-o-normal--*-120-*-*-*-*-*-*") + 19;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gnucash_style_init (void)
|
gnucash_style_init (void)
|
||||||
{
|
{
|
||||||
|
@ -71,9 +71,6 @@ void gnucash_sheet_style_init(void);
|
|||||||
void gnucash_style_set_register_font_name(const char *name);
|
void gnucash_style_set_register_font_name(const char *name);
|
||||||
void gnucash_style_set_register_hint_font_name(const char *name);
|
void gnucash_style_set_register_hint_font_name(const char *name);
|
||||||
|
|
||||||
const char * gnucash_style_get_default_register_font_name(void);
|
|
||||||
const char * gnucash_style_get_default_register_hint_font_name(void);
|
|
||||||
|
|
||||||
gint gnucash_style_col_is_resizable (SheetBlockStyle *style, int col);
|
gint gnucash_style_col_is_resizable (SheetBlockStyle *style, int col);
|
||||||
|
|
||||||
CellDimensions * gnucash_style_get_cell_dimensions (SheetBlockStyle *style,
|
CellDimensions * gnucash_style_get_cell_dimensions (SheetBlockStyle *style,
|
||||||
|
@ -6,7 +6,7 @@ TESTS_ENVIRONMENT= \
|
|||||||
GNC_MODULE_PATH=../../engine:../../gnc-module:../../calculation:.. \
|
GNC_MODULE_PATH=../../engine:../../gnc-module:../../calculation:.. \
|
||||||
GUILE_LOAD_PATH=${G_WRAP_MODULE_DIR}:../../engine:..:../../gnc-module:${top_srcdir}/lib \
|
GUILE_LOAD_PATH=${G_WRAP_MODULE_DIR}:../../engine:..:../../gnc-module:${top_srcdir}/lib \
|
||||||
LTDL_LIBRARY_PATH=.. \
|
LTDL_LIBRARY_PATH=.. \
|
||||||
LD_LIBRARY_PATH=${top_srcdir}/src/gnc-module:${top_srcdir}/src/gnc-module/.libs:${top_srcdir}/src/engine:${top_srcdir}/src/engine/.libs:${top_srcdir}/src/calculation:${top_srcdir}/src/calculation/.libs
|
LD_LIBRARY_PATH=${top_srcdir}/src/gnc-module:${top_srcdir}/src/gnc-module/.libs:${top_srcdir}/src/engine:${top_srcdir}/src/engine/.libs:${top_srcdir}/src/calculation:${top_srcdir}/src/calculation/.libs:${top_srcdir}/src/network-utils:${top_srcdir}/src/network-utils/.libs
|
||||||
|
|
||||||
LDADD = \
|
LDADD = \
|
||||||
-L${top_srcdir}/src/gnc-module -L${top_srcdir}/src/gnc-module/.libs \
|
-L${top_srcdir}/src/gnc-module -L${top_srcdir}/src/gnc-module/.libs \
|
||||||
|
@ -278,15 +278,15 @@
|
|||||||
datum)
|
datum)
|
||||||
|
|
||||||
(define (gnc:default-html-gnc-numeric-renderer datum params)
|
(define (gnc:default-html-gnc-numeric-renderer datum params)
|
||||||
(gnc:amount->string-helper datum (gnc:default-print-info #f)))
|
(gnc:amount->string datum (gnc:default-print-info #f)))
|
||||||
|
|
||||||
(define (gnc:default-html-gnc-monetary-renderer datum params)
|
(define (gnc:default-html-gnc-monetary-renderer datum params)
|
||||||
(gnc:amount->string-helper
|
(gnc:amount->string
|
||||||
(gnc:gnc-monetary-amount datum)
|
(gnc:gnc-monetary-amount datum)
|
||||||
(gnc:commodity-print-info (gnc:gnc-monetary-commodity datum) #t)))
|
(gnc:commodity-print-info (gnc:gnc-monetary-commodity datum) #t)))
|
||||||
|
|
||||||
(define (gnc:default-html-number-renderer datum params)
|
(define (gnc:default-html-number-renderer datum params)
|
||||||
(gnc:amount->string-helper
|
(gnc:amount->string
|
||||||
(gnc:double-to-gnc-numeric datum 100 GNC-RND-ROUND)
|
(gnc:double-to-gnc-numeric datum 100 GNC-RND-ROUND)
|
||||||
(gnc:default-print-info #f)))
|
(gnc:default-print-info #f)))
|
||||||
|
|
||||||
|
@ -36,8 +36,6 @@
|
|||||||
(set! l (append! l filler))))
|
(set! l (append! l filler))))
|
||||||
l)
|
l)
|
||||||
|
|
||||||
(define gnc:amount->string gnc:amount->string-helper)
|
|
||||||
|
|
||||||
;; pair is a list of one gnc:commodity and one gnc:numeric
|
;; pair is a list of one gnc:commodity and one gnc:numeric
|
||||||
;; value. Deprecated -- use <gnc-monetary> instead.
|
;; value. Deprecated -- use <gnc-monetary> instead.
|
||||||
(define (gnc:commodity-value->string pair)
|
(define (gnc:commodity-value->string pair)
|
||||||
@ -48,7 +46,7 @@
|
|||||||
;; style-info mechanism and simple plug the <gnc-monetary> into the
|
;; style-info mechanism and simple plug the <gnc-monetary> into the
|
||||||
;; html-renderer.
|
;; html-renderer.
|
||||||
(define (gnc:monetary->string value)
|
(define (gnc:monetary->string value)
|
||||||
(gnc:amount->string-helper
|
(gnc:amount->string
|
||||||
(gnc:gnc-monetary-amount value)
|
(gnc:gnc-monetary-amount value)
|
||||||
(gnc:commodity-print-info (gnc:gnc-monetary-commodity value) #t)))
|
(gnc:commodity-print-info (gnc:gnc-monetary-commodity value) #t)))
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ gnc_autogen_scm_files = \
|
|||||||
|
|
||||||
gnc_regular_scm_files = \
|
gnc_regular_scm_files = \
|
||||||
command-line.scm \
|
command-line.scm \
|
||||||
config-var.scm \
|
|
||||||
depend.scm \
|
depend.scm \
|
||||||
doc.scm \
|
doc.scm \
|
||||||
extensions.scm \
|
extensions.scm \
|
||||||
@ -19,7 +18,6 @@ gnc_regular_scm_files = \
|
|||||||
main.scm \
|
main.scm \
|
||||||
main-window.scm \
|
main-window.scm \
|
||||||
path.scm \
|
path.scm \
|
||||||
prefs.scm \
|
|
||||||
price-quotes.scm \
|
price-quotes.scm \
|
||||||
slib-backup.scm \
|
slib-backup.scm \
|
||||||
startup.scm \
|
startup.scm \
|
||||||
|
@ -80,7 +80,7 @@
|
|||||||
|
|
||||||
;(simple-format #t "load-path == ~S\n" %load-path)
|
;(simple-format #t "load-path == ~S\n" %load-path)
|
||||||
|
|
||||||
;; These will be converted to config vars later (see prefs.scm)
|
;; These will be converted to config vars later (see command-line.scm)
|
||||||
(define gnc:*load-path* #f)
|
(define gnc:*load-path* #f)
|
||||||
(define gnc:*debugging?* (if (getenv "GNC_DEBUG") #t #f))
|
(define gnc:*debugging?* (if (getenv "GNC_DEBUG") #t #f))
|
||||||
(define gnc:*develmode* (if (getenv "GNC_DEVEL_MODE") #t #f))
|
(define gnc:*develmode* (if (getenv "GNC_DEVEL_MODE") #t #f))
|
||||||
|
@ -15,75 +15,114 @@
|
|||||||
;; 59 Temple Place - Suite 330 Fax: +1-617-542-2652
|
;; 59 Temple Place - Suite 330 Fax: +1-617-542-2652
|
||||||
;; Boston, MA 02111-1307, USA gnu@gnu.org
|
;; Boston, MA 02111-1307, USA gnu@gnu.org
|
||||||
|
|
||||||
;; also "-c"
|
|
||||||
|
|
||||||
(define gnc:*command-line-remaining* #f)
|
(define gnc:*command-line-remaining* #f)
|
||||||
|
|
||||||
(gnc:depend "price-quotes.scm")
|
;;; Configuration variables
|
||||||
|
|
||||||
;;(use-modules (ice-9 getopt-long))
|
(define gnc:*arg-show-version*
|
||||||
|
(gnc:make-config-var
|
||||||
|
(N_ "Show version.")
|
||||||
|
(lambda (var value) (if (boolean? value) (list value) #f))
|
||||||
|
eq?
|
||||||
|
#f))
|
||||||
|
|
||||||
;;(define (gnc:is-boolean-arg? arg)
|
(define gnc:*arg-show-usage*
|
||||||
;; (if (or (string=? arg "true") (string=? arg "false")) #t #f))
|
(gnc:make-config-var
|
||||||
|
(N_ "Generate an argument summary.")
|
||||||
|
(lambda (var value) (if (boolean? value) (list value) #f))
|
||||||
|
eq?
|
||||||
|
#f))
|
||||||
|
|
||||||
;;(define (gnc:is-integer-arg? arg)
|
(define gnc:*arg-show-help*
|
||||||
;; (if (string->number arg) #t #f))
|
(gnc:make-config-var
|
||||||
|
(N_ "Generate an argument summary.")
|
||||||
|
(lambda (var value) (if (boolean? value) (list value) #f))
|
||||||
|
eq?
|
||||||
|
#f))
|
||||||
|
|
||||||
;;(define (gnc:convert-arg-to-boolean arg)
|
(define gnc:*arg-no-file*
|
||||||
;; (if (string=? arg "true")
|
(gnc:make-config-var
|
||||||
;; #t
|
(N_ "Don't load any file, including autoloading the last file.")
|
||||||
;; (if (string=? arg "false")
|
(lambda (var value) (if (boolean? value) (list value) #f))
|
||||||
;; #f
|
eq?
|
||||||
;; 'abort)))
|
#f))
|
||||||
|
|
||||||
|
(define gnc:*config-dir*
|
||||||
|
(gnc:make-config-var
|
||||||
|
(N_ "Configuration directory.")
|
||||||
|
(lambda (var value) (if (string? value) (list value) #f))
|
||||||
|
string=?
|
||||||
|
gnc:_config-dir-default_))
|
||||||
|
|
||||||
|
(define gnc:*share-dir*
|
||||||
|
(gnc:make-config-var
|
||||||
|
(N_ "Shared files directory.")
|
||||||
|
(lambda (var value) (if (string? value) (list value) #f))
|
||||||
|
string=?
|
||||||
|
gnc:_share-dir-default_))
|
||||||
|
|
||||||
|
;; Convert the temporary startup value into a config var.
|
||||||
|
(let ((current-value gnc:*debugging?*))
|
||||||
|
(set!
|
||||||
|
gnc:*debugging?*
|
||||||
|
(gnc:make-config-var
|
||||||
|
(N_ "Enable debugging code.")
|
||||||
|
(lambda (var value) (if (boolean? value) (list value) #f))
|
||||||
|
eq?
|
||||||
|
#f))
|
||||||
|
(gnc:config-var-value-set! gnc:*debugging?* #f current-value))
|
||||||
|
|
||||||
|
(let ((current-value gnc:*debugging?*))
|
||||||
|
(set!
|
||||||
|
gnc:*develmode*
|
||||||
|
(gnc:make-config-var
|
||||||
|
(N_ "Enable developers mode.")
|
||||||
|
(lambda (var value) (if (boolean? value) (list value) #f))
|
||||||
|
eq?
|
||||||
|
#f))
|
||||||
|
(gnc:config-var-value-set! gnc:*develmode* #f current-value))
|
||||||
|
|
||||||
|
(define gnc:*loglevel*
|
||||||
|
(gnc:make-config-var
|
||||||
|
(N_ "Logging level from 0 (least logging) to 5 (most logging).")
|
||||||
|
(lambda (var value) (if (exact? value) (list value) #f))
|
||||||
|
eq?
|
||||||
|
#f))
|
||||||
|
|
||||||
|
;; Convert the temporary startup value into a config var.
|
||||||
|
(let ((current-load-path gnc:*load-path*))
|
||||||
|
(set!
|
||||||
|
gnc:*load-path*
|
||||||
|
(gnc:make-config-var
|
||||||
|
(N_ "A list of strings indicating the load path for (gnc:load name).
|
||||||
|
Each element must be a string representing a directory or a symbol
|
||||||
|
where 'default expands to the default path, and 'current expands to
|
||||||
|
the current value of the path.")
|
||||||
|
(lambda (var value)
|
||||||
|
(let ((result (gnc:expand-load-path value)))
|
||||||
|
(if (list? result)
|
||||||
|
(list result)
|
||||||
|
#f)))
|
||||||
|
equal?
|
||||||
|
'(default)))
|
||||||
|
(gnc:config-var-value-set! gnc:*load-path* #f current-load-path))
|
||||||
|
|
||||||
|
(define gnc:*doc-path*
|
||||||
|
|
||||||
|
(gnc:make-config-var
|
||||||
|
(N_ "A list of strings indicating where to look for html and parsed-html files. \
|
||||||
|
Each element must be a string representing a directory or a symbol \
|
||||||
|
where 'default expands to the default path, and 'current expands to \
|
||||||
|
the current value of the path.")
|
||||||
|
(lambda (var value)
|
||||||
|
(let ((result (gnc:_expand-doc-path_ value)))
|
||||||
|
(if (list? result)
|
||||||
|
(list result)
|
||||||
|
#f)))
|
||||||
|
equal?
|
||||||
|
'(default)))
|
||||||
|
|
||||||
;;(define (gnc:convert-arg-to-integer arg)
|
|
||||||
;; (let ((value (string->number arg)))
|
|
||||||
;; (if (and (not value) (not (exact? value)))
|
|
||||||
;; 'abort
|
|
||||||
;; value)))
|
|
||||||
|
|
||||||
;;(define (gnc:convert-arg-defs-to-opt-args arg-defs)
|
|
||||||
;; (letrec ((return '())
|
|
||||||
;; (decide-single-char
|
|
||||||
;; (let ((single-char-cache '()))
|
|
||||||
;; (lambda (name)
|
|
||||||
;; (let ((possible (string-ref name 0)))
|
|
||||||
;; (if (eq? (assv possible single-char-cache) #f)
|
|
||||||
;; (begin
|
|
||||||
;; (set! single-char-cache (acons possible #t
|
|
||||||
;; single-char-cache))
|
|
||||||
;; possible)
|
|
||||||
;; #f)))))
|
|
||||||
;; (create-arg-list
|
|
||||||
;; (lambda (name-sym value pred sc)
|
|
||||||
;; (let ((ret `(,name-sym (value ,value))))
|
|
||||||
;; (if (not (eq? pred #f))
|
|
||||||
;; (set! ret (append ret (cons 'predicate pred))))
|
|
||||||
;; (if (not (eq? sc #f))
|
|
||||||
;; (set! ret (append ret (cons 'single-char sc))))
|
|
||||||
;; ret)))
|
|
||||||
;; (helper
|
|
||||||
;; (lambda (arg-defs ret)
|
|
||||||
;; (if (not (pair? arg-defs))
|
|
||||||
;; ret
|
|
||||||
;; (helper
|
|
||||||
;; (cdr arg-defs)
|
|
||||||
;; (cons
|
|
||||||
;; (let* ((one-arg (car arg-defs))
|
|
||||||
;; (arg-name (car one-arg))
|
|
||||||
;; (arg-sym (string->symbol arg-name))
|
|
||||||
;; (arg-oc (decide-single-char arg-name)))
|
|
||||||
;; (case (cadr one-arg)
|
|
||||||
;; ((boolean) (create-arg-list arg-sym 'optional
|
|
||||||
;; gnc:is-boolean-arg?
|
|
||||||
;; arg-oc))
|
|
||||||
;; ((integer) (create-arg-list arg-sym #t
|
|
||||||
;; gnc:is-integer-arg?
|
|
||||||
;; arg-oc))
|
|
||||||
;; ((string) (create-arg-list arg-sym #t #f arg-oc))))
|
|
||||||
;; ret))))))
|
|
||||||
;; (helper arg-defs return)))
|
|
||||||
|
|
||||||
(define gnc:*arg-defs*
|
(define gnc:*arg-defs*
|
||||||
(list
|
(list
|
||||||
(list "version"
|
(list "version"
|
||||||
@ -200,6 +239,7 @@
|
|||||||
(set! gnc:*batch-mode-things-to-do*
|
(set! gnc:*batch-mode-things-to-do*
|
||||||
(cons
|
(cons
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
(gnc:depend "price-quotes.scm")
|
||||||
(if (not (gnc:add-quotes-to-book-at-url val))
|
(if (not (gnc:add-quotes-to-book-at-url val))
|
||||||
(begin
|
(begin
|
||||||
(gnc:error "Failed to add quotes to " val)
|
(gnc:error "Failed to add quotes to " val)
|
||||||
|
@ -159,10 +159,7 @@
|
|||||||
(gnc:module-load "gnucash/report/locale-specific/us" 0)
|
(gnc:module-load "gnucash/report/locale-specific/us" 0)
|
||||||
|
|
||||||
;; Now we can load a bunch of files.
|
;; Now we can load a bunch of files.
|
||||||
(gnc:depend "config-var.scm")
|
|
||||||
(gnc:depend "utilities.scm")
|
|
||||||
(gnc:depend "path.scm")
|
(gnc:depend "path.scm")
|
||||||
(gnc:depend "prefs.scm")
|
|
||||||
(gnc:depend "command-line.scm")
|
(gnc:depend "command-line.scm")
|
||||||
(gnc:depend "doc.scm")
|
(gnc:depend "doc.scm")
|
||||||
(gnc:depend "extensions.scm")
|
(gnc:depend "extensions.scm")
|
||||||
@ -188,14 +185,6 @@
|
|||||||
|
|
||||||
(gnc:hook-run-danglers gnc:*startup-hook*)
|
(gnc:hook-run-danglers gnc:*startup-hook*)
|
||||||
|
|
||||||
;; Initialize the C side options code. Must come after the scheme
|
|
||||||
;; options are loaded.
|
|
||||||
(gnc:c-options-init)
|
|
||||||
|
|
||||||
;; Initialize the expresion parser. Must come after the C side
|
|
||||||
;; options initialization.
|
|
||||||
(gnc:exp-parser-init)
|
|
||||||
|
|
||||||
(if (gnc:config-var-value-get gnc:*arg-show-version*)
|
(if (gnc:config-var-value-get gnc:*arg-show-version*)
|
||||||
(begin
|
(begin
|
||||||
(gnc:prefs-show-version)
|
(gnc:prefs-show-version)
|
||||||
@ -267,19 +256,6 @@
|
|||||||
|
|
||||||
(gnc:print-unstable-message)
|
(gnc:print-unstable-message)
|
||||||
|
|
||||||
;; add a hook to shut down the expression parser
|
|
||||||
(gnc:hook-add-dangler gnc:*shutdown-hook* gnc:exp-parser-shutdown)
|
|
||||||
|
|
||||||
;; add a hook to save the user configs on shutdown. this saves
|
|
||||||
;; global options plus (for the moment) saved report and account
|
|
||||||
;; tree window parameters. reports and parameters should probably
|
|
||||||
;; be in a separate file, with the main data file, or something
|
|
||||||
;; else.
|
|
||||||
(gnc:hook-add-dangler gnc:*shutdown-hook* gnc:save-all-options)
|
|
||||||
|
|
||||||
;; add a hook to shut down the C side options code
|
|
||||||
(gnc:hook-add-dangler gnc:*shutdown-hook* gnc:c-options-shutdown)
|
|
||||||
|
|
||||||
(if (null? gnc:*batch-mode-things-to-do*)
|
(if (null? gnc:*batch-mode-things-to-do*)
|
||||||
;; We're not in batch mode; we can go ahead and do the normal thing.
|
;; We're not in batch mode; we can go ahead and do the normal thing.
|
||||||
(begin
|
(begin
|
||||||
@ -296,7 +272,6 @@
|
|||||||
(gnc:start-ui-event-loop))
|
(gnc:start-ui-event-loop))
|
||||||
(begin
|
(begin
|
||||||
(gnc:load-account-file)
|
(gnc:load-account-file)
|
||||||
(gnc:default-ui-start)
|
|
||||||
(gnc:show-main-window)
|
(gnc:show-main-window)
|
||||||
(gnc:start-ui-event-loop)))
|
(gnc:start-ui-event-loop)))
|
||||||
(gnc:hook-remove-dangler gnc:*ui-shutdown-hook* gnc:ui-finish))
|
(gnc:hook-remove-dangler gnc:*ui-shutdown-hook* gnc:ui-finish))
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
(use-modules (gnucash process))
|
(use-modules (gnucash process))
|
||||||
|
|
||||||
(gnc:support "price-quotes.scm")
|
(gnc:support "price-quotes.scm")
|
||||||
(gnc:depend "utilities.scm")
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;
|
;;
|
||||||
|
@ -23,9 +23,6 @@
|
|||||||
;; Tips should be written as a list of lists of string. Each list of strings
|
;; Tips should be written as a list of lists of string. Each list of strings
|
||||||
;; represents one tip
|
;; represents one tip
|
||||||
|
|
||||||
(gnc:depend "config-var.scm")
|
|
||||||
(gnc:depend "prefs.scm")
|
|
||||||
|
|
||||||
(define (non-negative-integer? value)
|
(define (non-negative-integer? value)
|
||||||
(and (integer? value) (>= value 0)))
|
(and (integer? value) (>= value 0)))
|
||||||
|
|
||||||
@ -105,6 +102,3 @@
|
|||||||
"Display \"Tip of the Day\"")))
|
"Display \"Tip of the Day\"")))
|
||||||
(if (gnc:option-value tip-opt)
|
(if (gnc:option-value tip-opt)
|
||||||
(gnc:ui-totd-dialog-create-and-run)))))
|
(gnc:ui-totd-dialog-create-and-run)))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user