mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Re-enable report menu setup.
The report menu setup is pretty fragile - it has to be done in a pretty specific order, so I pulled it out of (gnc:main) and call it independently. Also, move more bits of gnc:main into the modules where the bits are used. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@12977 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -343,11 +343,16 @@ inner_main (void *closure, int argc, char **argv)
|
||||
main_mod = scm_c_resolve_module("gnucash main");
|
||||
scm_set_current_module(main_mod);
|
||||
|
||||
load_gnucash_modules();
|
||||
|
||||
/* Setting-up the report menu must come after the module
|
||||
loading but before the gui initialization. */
|
||||
scm_c_use_module("gnucash report report-gnome");
|
||||
scm_c_eval_string("(gnc:report-menu-setup)");
|
||||
|
||||
/* TODO: After some more guile-extraction, this should happen even
|
||||
before booting guile. */
|
||||
gnc_main_gui_init();
|
||||
|
||||
load_gnucash_modules();
|
||||
|
||||
qof_log_set_level_global(loglevel);
|
||||
|
||||
|
@@ -8,6 +8,7 @@
|
||||
(define-module (gnucash report report-gnome))
|
||||
(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
|
||||
(use-modules (gnucash gnc-module))
|
||||
(use-modules (gnucash gnome-utils))
|
||||
|
||||
(use-modules (ice-9 slib))
|
||||
(require 'printf)
|
||||
@@ -118,4 +119,14 @@
|
||||
(gnc:hook-run-danglers gnc:*report-hook*)
|
||||
|
||||
;; push reports (new items added on top of menu)
|
||||
(gnc:add-report-template-menu-items))
|
||||
(gnc:add-report-template-menu-items)
|
||||
|
||||
;; the Welcome to GnuCash "extravaganza" report
|
||||
(gnc:add-extension
|
||||
(gnc:make-menu-item
|
||||
(N_ "Welcome Sample Report")
|
||||
(N_ "Welcome-to-GnuCash report screen")
|
||||
(list gnc:menuname-reports gnc:menuname-utility "")
|
||||
(lambda (window)
|
||||
(gnc:main-window-open-report (gnc:make-welcome-report) window))))
|
||||
)
|
||||
|
@@ -19,6 +19,18 @@
|
||||
|
||||
(define gnc:*command-line-remaining* #f)
|
||||
|
||||
(define (gnc:flatten tree)
|
||||
(let ((result '()))
|
||||
(let loop ((remaining-items tree))
|
||||
(cond
|
||||
((null? remaining-items) #t)
|
||||
((list? remaining-items)
|
||||
(loop (car remaining-items))
|
||||
(loop (cdr remaining-items)))
|
||||
(else
|
||||
(set! result (cons remaining-items result)))))
|
||||
(reverse! result)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; Configuration variables
|
||||
|
||||
|
@@ -15,6 +15,55 @@
|
||||
;; 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
|
||||
;; Boston, MA 02110-1301, USA gnu@gnu.org
|
||||
|
||||
(define (build-path . elements)
|
||||
(string-join elements "/"))
|
||||
|
||||
(define (gnc:find-file file directories)
|
||||
"Find file named 'file' anywhere in 'directories'. 'file' must be a
|
||||
string and 'directories' must be a list of strings."
|
||||
|
||||
(gnc:debug "gnc:find-file looking for " file " in " directories)
|
||||
|
||||
(do ((rest directories (cdr rest))
|
||||
(finished? #f)
|
||||
(result #f))
|
||||
((or (null? rest) finished?) result)
|
||||
|
||||
(let ((file-name (build-path (car rest) file)))
|
||||
(gnc:debug " checking for " file-name)
|
||||
(if (access? file-name F_OK)
|
||||
(begin
|
||||
(gnc:debug "found file " file-name)
|
||||
(set! finished? #t)
|
||||
(set! result file-name))))))
|
||||
|
||||
(define (gnc:find-localized-file file base-directories)
|
||||
;; Find file in path in base directories, or in any localized subdir
|
||||
;; thereof.
|
||||
|
||||
(define (locale-prefixes)
|
||||
;; Mac OS X. 10.1 and earlier don't have LC_MESSAGES. Fall back to
|
||||
;; LC_ALL for those systems.
|
||||
(let* ((locale (or (false-if-exception (setlocale LC_MESSAGES))
|
||||
(setlocale LC_ALL)))
|
||||
(strings (cond ((not (string? locale)) '())
|
||||
((equal? locale "C") '())
|
||||
((<= (string-length locale) 4) (list locale))
|
||||
(else (list (substring locale 0 2)
|
||||
(substring locale 0 5)
|
||||
locale)))))
|
||||
(reverse (cons "C" strings))))
|
||||
|
||||
(let loop ((prefixes (locale-prefixes))
|
||||
(dirs base-directories))
|
||||
(if (null? dirs)
|
||||
#f
|
||||
(or (gnc:find-file file (map (lambda (prefix)
|
||||
(build-path (car dirs) prefix))
|
||||
prefixes))
|
||||
(gnc:find-file file (list (car dirs)))
|
||||
(loop prefixes (cdr dirs))))))
|
||||
|
||||
(define (gnc:find-doc-file file)
|
||||
(gnc:find-localized-file file (gnc:config-var-value-get gnc:*doc-path*)))
|
||||
|
||||
|
@@ -51,8 +51,6 @@
|
||||
(export gnc:debug)
|
||||
(export string-join)
|
||||
(export gnc:backtrace-if-exception)
|
||||
(export gnc:find-file)
|
||||
(export gnc:find-localized-file)
|
||||
(export gnc:main)
|
||||
(export gnc:safe-strcmp) ;; only used by aging.scm atm...
|
||||
|
||||
@@ -149,18 +147,6 @@
|
||||
(set! parts (cons (substring str 0 last-char) parts))))
|
||||
parts))
|
||||
|
||||
;; only used by doc-path
|
||||
(define (gnc:flatten tree)
|
||||
(let ((result '()))
|
||||
(let loop ((remaining-items tree))
|
||||
(cond
|
||||
((null? remaining-items) #t)
|
||||
((list? remaining-items)
|
||||
(loop (car remaining-items))
|
||||
(loop (cdr remaining-items)))
|
||||
(else
|
||||
(set! result (cons remaining-items result)))))
|
||||
(reverse! result)))
|
||||
|
||||
(define (gnc:backtrace-if-exception proc . args)
|
||||
(define (dumper key . args)
|
||||
@@ -214,55 +200,6 @@
|
||||
(gnc:msg stuff "-- Elapsed time: " delta "seconds.")
|
||||
(set! gnc:*last-time* now)))
|
||||
|
||||
(define (build-path . elements)
|
||||
(string-join elements "/"))
|
||||
|
||||
(define (gnc:find-file file directories)
|
||||
"Find file named 'file' anywhere in 'directories'. 'file' must be a
|
||||
string and 'directories' must be a list of strings."
|
||||
|
||||
(gnc:debug "gnc:find-file looking for " file " in " directories)
|
||||
|
||||
(do ((rest directories (cdr rest))
|
||||
(finished? #f)
|
||||
(result #f))
|
||||
((or (null? rest) finished?) result)
|
||||
|
||||
(let ((file-name (build-path (car rest) file)))
|
||||
(gnc:debug " checking for " file-name)
|
||||
(if (access? file-name F_OK)
|
||||
(begin
|
||||
(gnc:debug "found file " file-name)
|
||||
(set! finished? #t)
|
||||
(set! result file-name))))))
|
||||
|
||||
(define (gnc:find-localized-file file base-directories)
|
||||
;; Find file in path in base directories, or in any localized subdir
|
||||
;; thereof.
|
||||
|
||||
(define (locale-prefixes)
|
||||
;; Mac OS X. 10.1 and earlier don't have LC_MESSAGES. Fall back to
|
||||
;; LC_ALL for those systems.
|
||||
(let* ((locale (or (false-if-exception (setlocale LC_MESSAGES))
|
||||
(setlocale LC_ALL)))
|
||||
(strings (cond ((not (string? locale)) '())
|
||||
((equal? locale "C") '())
|
||||
((<= (string-length locale) 4) (list locale))
|
||||
(else (list (substring locale 0 2)
|
||||
(substring locale 0 5)
|
||||
locale)))))
|
||||
(reverse (cons "C" strings))))
|
||||
|
||||
(let loop ((prefixes (locale-prefixes))
|
||||
(dirs base-directories))
|
||||
(if (null? dirs)
|
||||
#f
|
||||
(or (gnc:find-file file (map (lambda (prefix)
|
||||
(build-path (car dirs) prefix))
|
||||
prefixes))
|
||||
(gnc:find-file file (list (car dirs)))
|
||||
(loop prefixes (cdr dirs))))))
|
||||
|
||||
(define (gnc:shutdown exit-status)
|
||||
(gnc:debug "Shutdown -- exit-status: " exit-status)
|
||||
(exit exit-status)) ;; Temporary Stub until command-line.scm dies
|
||||
@@ -311,16 +248,5 @@ string and 'directories' must be a list of strings."
|
||||
(gnc:update-splash-screen (_ "Checking Finance::Quote..."))
|
||||
(gnc:price-quotes-install-sources)
|
||||
|
||||
(gnc:report-menu-setup)
|
||||
|
||||
;; the Welcome to GnuCash "extravaganza" report
|
||||
(gnc:add-extension
|
||||
(gnc:make-menu-item
|
||||
(N_ "Welcome Sample Report")
|
||||
(N_ "Welcome-to-GnuCash report screen")
|
||||
(list gnc:menuname-reports gnc:menuname-utility "")
|
||||
(lambda (window)
|
||||
(gnc:main-window-open-report (gnc:make-welcome-report) window))))
|
||||
|
||||
;;return to C
|
||||
)
|
||||
|
Reference in New Issue
Block a user