[Gnucash-changes] r12977 - gnucash/trunk/src - Re-enable report
menu setup.
Chris Shoemaker
chris at cvs.gnucash.org
Tue Jan 24 23:32:57 EST 2006
Author: chris
Date: 2006-01-24 23:32:56 -0500 (Tue, 24 Jan 2006)
New Revision: 12977
Trac: http://svn.gnucash.org/trac/changeset/12977
Modified:
gnucash/trunk/src/bin/gnucash-bin.c
gnucash/trunk/src/report/report-gnome/report-gnome.scm
gnucash/trunk/src/scm/command-line.scm
gnucash/trunk/src/scm/doc.scm
gnucash/trunk/src/scm/main.scm
Log:
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.
Modified: gnucash/trunk/src/bin/gnucash-bin.c
===================================================================
--- gnucash/trunk/src/bin/gnucash-bin.c 2006-01-25 02:06:08 UTC (rev 12976)
+++ gnucash/trunk/src/bin/gnucash-bin.c 2006-01-25 04:32:56 UTC (rev 12977)
@@ -343,11 +343,16 @@
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);
Modified: gnucash/trunk/src/report/report-gnome/report-gnome.scm
===================================================================
--- gnucash/trunk/src/report/report-gnome/report-gnome.scm 2006-01-25 02:06:08 UTC (rev 12976)
+++ gnucash/trunk/src/report/report-gnome/report-gnome.scm 2006-01-25 04:32:56 UTC (rev 12977)
@@ -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))))
+)
Modified: gnucash/trunk/src/scm/command-line.scm
===================================================================
--- gnucash/trunk/src/scm/command-line.scm 2006-01-25 02:06:08 UTC (rev 12976)
+++ gnucash/trunk/src/scm/command-line.scm 2006-01-25 04:32:56 UTC (rev 12977)
@@ -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
Modified: gnucash/trunk/src/scm/doc.scm
===================================================================
--- gnucash/trunk/src/scm/doc.scm 2006-01-25 02:06:08 UTC (rev 12976)
+++ gnucash/trunk/src/scm/doc.scm 2006-01-25 04:32:56 UTC (rev 12977)
@@ -15,6 +15,55 @@
;; 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
;; Boston, MA 02110-1301, USA gnu at 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*)))
Modified: gnucash/trunk/src/scm/main.scm
===================================================================
--- gnucash/trunk/src/scm/main.scm 2006-01-25 02:06:08 UTC (rev 12976)
+++ gnucash/trunk/src/scm/main.scm 2006-01-25 04:32:56 UTC (rev 12977)
@@ -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 @@
(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
)
More information about the gnucash-changes
mailing list