* report-gnome/report-gnome.scm -- Create sorted menu items

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7279 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2002-10-06 16:53:20 +00:00
parent 2b6beb7b0a
commit 8ea1237010
2 changed files with 17 additions and 4 deletions

View File

@ -1,5 +1,7 @@
2002-10-06 Derek Atkins <derek@ihtfp.com>
* Rename a bunch of reports as per Chris Lyttle's suggestions
* report-gnome/report-gnome.scm -- Create sorted menu items
2002-10-06 David Hampton <hampton@employees.org>

View File

@ -42,12 +42,12 @@
(define (gnc:add-report-template-menu-items)
(define menu-namer (gnc:new-menu-namer))
(define *template-items* '())
(define (add-template-menu-item name template)
(if (gnc:report-template-in-menu? template)
(let ((title (string-append (_ "Report") ": " (_ name)))
(menu-path (gnc:report-template-menu-path template))
(menu-name (gnc:report-template-menu-name template))
(menu-tip (gnc:report-template-menu-tip template))
(item #f))
@ -58,8 +58,6 @@
(set! menu-path (append (list gnc:window-name-main gnc:menuname-reports) menu-path))
(if menu-name (set! name menu-name))
(if (not menu-tip)
(set! menu-tip
(sprintf #f (_ "Display the %s report") (_ name))))
@ -75,7 +73,20 @@
(gnc:main-window-open-report report #f)))))
(gnc:add-extension item))))
(gnc:report-templates-for-each add-template-menu-item))
(define (add-template name template)
(let ((menu-name (gnc:report-template-menu-name template)))
(if menu-name (set! name menu-name))
(set! *template-items* (cons (cons name template) *template-items*))))
(define (sort-templates a b)
(string>? (car a) (car b)))
(gnc:report-templates-for-each add-template)
(for-each
(lambda (item)
(add-template-menu-item (car item) (cdr item)))
(sort *template-items* sort-templates)))
(define (gnc:report-menu-setup)
;; since this menu gets added to every child window, we say it