Move menu extensions scheme code to gnome-utils module.

Add extensions hook and move business extensions to
business-gnome module.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6180 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-12-03 09:57:11 +00:00
parent 5b72f6048b
commit 281cde22af
9 changed files with 119 additions and 87 deletions

View File

@ -213,7 +213,7 @@
(export gnc:reldate-initialize)
;; hooks
(export gnc:hook-export)
(export gnc:hook-define)
(export gnc:hook-danglers-get)
(export gnc:hook-danglers-set!)
(export gnc:hook-danglers->list)

View File

@ -1 +1,83 @@
(define-module (gnucash business-gnome))
(use-modules (g-wrapped gw-business-gnome))
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/gnome-utils" 0)
(gnc:module-load "gnucash/business-core" 0)
(define (add-business-extensions)
(define gnc:extensions-temp-book #f)
(define (gnc:extensions-get-book)
(if gnc:extensions-temp-book
gnc:extensions-temp-book
(begin
(set! gnc:extensions-temp-book (gnc:get-current-book))
(gnc:business-create-book gnc:extensions-temp-book)
gnc:extensions-temp-book)))
(define new-job-item
(gnc:make-menu-item (N_ "Test New Job Dialog")
(N_ "Test New Job Dialog")
(list "Extensions" "")
(lambda ()
(gnc:job-new #f (gnc:extensions-get-book)
#f))))
(define select-job-item
(gnc:make-menu-item (N_ "Test Job Selection Dialog")
(N_ "Test Job Selection Dialog")
(list "Extensions" "")
(lambda ()
(gnc:job-select #f (gnc:extensions-get-book)
#f #f))))
(define new-vendor-item
(gnc:make-menu-item (N_ "Test New Vendor Dialog")
(N_ "Test New Vendor Dialog")
(list "Extensions" "")
(lambda ()
(gnc:vendor-new #f (gnc:extensions-get-book)))))
(define select-vendor-item
(gnc:make-menu-item (N_ "Test Vendor Selection Dialog")
(N_ "Test Vendor Selection Dialog")
(list "Extensions" "")
(lambda ()
(gnc:vendor-select (gnc:extensions-get-book)
#f #f))))
(define new-employee-item
(gnc:make-menu-item (N_ "Test New Employee Dialog")
(N_ "Test New Employee Dialog")
(list "Extensions" "")
(lambda ()
(gnc:employee-new #f (gnc:extensions-get-book)))))
(define select-employee-item
(gnc:make-menu-item (N_ "Test Employee Selection Dialog")
(N_ "Test Employee Selection Dialog")
(list "Extensions" "")
(lambda ()
(gnc:employee-select (gnc:extensions-get-book)
#f #f))))
(define new-order-item
(gnc:make-menu-item (N_ "Test New Order Dialog")
(N_ "Test New Order Dialog")
(list "Extensions" "")
(lambda ()
(gnc:order-new #f (gnc:extensions-get-book)))))
(gnc:add-extension new-order-item)
(gnc:add-extension select-employee-item)
(gnc:add-extension new-employee-item)
(gnc:add-extension select-vendor-item)
(gnc:add-extension new-vendor-item)
(gnc:add-extension select-job-item)
(gnc:add-extension new-job-item))
(gnc:hook-add-dangler gnc:*add-extension-hook* add-business-extensions)

View File

@ -97,6 +97,12 @@ libgw_gnome_utils_la_LDFLAGS = -module
gwmoddir = ${GNC_GWRAP_LIBDIR}
gwmod_DATA = gw-gnome-utils.scm gw-gnome-utils-spec.scm
gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash
gncmod_DATA = gnome-utils.scm
gncscmdir = ${GNC_SHAREDIR}/scm
gncscm_DATA = gnc-menu-extensions.scm
gladedir = $(GNC_GLADE_DIR)
glade_DATA = \
commodity.glade
@ -105,7 +111,8 @@ EXTRA_DIST = \
.cvsignore \
gnc-dir.h.in \
${glade_DATA} \
${gwmod_DATA}
${gwmod_DATA} \
${gncscm_DATA}
dialog-utils.c: gnc-dir.h

View File

@ -54,86 +54,15 @@
(define (gnc:make-separator path)
(gnc:make-extension 'separator #f #f path #f))
(gnc:module-load "gnucash/business-gnome" 0)
(define gnc:extensions-temp-book #f)
(define (gnc:extensions-get-book)
(if gnc:extensions-temp-book
gnc:extensions-temp-book
(begin
(set! gnc:extensions-temp-book (gnc:get-current-book))
(gnc:business-create-book gnc:extensions-temp-book)
gnc:extensions-temp-book)))
(define gnc:*add-extension-hook*
(gnc:hook-define
'add-extension-hook
"Functions to run when the extensions menu is created. Hook args: ()"))
(define (gnc:extensions-menu-setup)
(define menu (gnc:make-menu "Extensions" (list "_Settings")))
(define new-job-item
(gnc:make-menu-item (N_ "Test New Job Dialog")
(N_ "Test New Job Dialog")
(list "Extensions" "")
(lambda ()
(gnc:job-new #f (gnc:extensions-get-book)
#f))))
(define select-job-item
(gnc:make-menu-item (N_ "Test Job Selection Dialog")
(N_ "Test Job Selection Dialog")
(list "Extensions" "")
(lambda ()
(gnc:job-select #f (gnc:extensions-get-book)
#f #f))))
(define new-vendor-item
(gnc:make-menu-item (N_ "Test New Vendor Dialog")
(N_ "Test New Vendor Dialog")
(list "Extensions" "")
(lambda ()
(gnc:vendor-new #f (gnc:extensions-get-book)))))
(define select-vendor-item
(gnc:make-menu-item (N_ "Test Vendor Selection Dialog")
(N_ "Test Vendor Selection Dialog")
(list "Extensions" "")
(lambda ()
(gnc:vendor-select (gnc:extensions-get-book)
#f #f))))
(define new-employee-item
(gnc:make-menu-item (N_ "Test New Employee Dialog")
(N_ "Test New Employee Dialog")
(list "Extensions" "")
(lambda ()
(gnc:employee-new #f (gnc:extensions-get-book)))))
(define select-employee-item
(gnc:make-menu-item (N_ "Test Employee Selection Dialog")
(N_ "Test Employee Selection Dialog")
(list "Extensions" "")
(lambda ()
(gnc:employee-select (gnc:extensions-get-book)
#f #f))))
(define new-order-item
(gnc:make-menu-item (N_ "Test New Order Dialog")
(N_ "Test New Order Dialog")
(list "Extensions" "")
(lambda ()
(gnc:order-new #f (gnc:extensions-get-book)))))
(gnc:add-extension menu)
(gnc:add-extension new-order-item)
(gnc:add-extension select-employee-item)
(gnc:add-extension new-employee-item)
(gnc:add-extension select-vendor-item)
(gnc:add-extension new-vendor-item)
(gnc:add-extension select-job-item)
(gnc:add-extension new-job-item)
)
(gnc:hook-run-danglers gnc:*add-extension-hook*))
(if (gnc:debugging?)
(gnc:hook-add-dangler gnc:*ui-startup-hook*

View File

@ -64,6 +64,7 @@ gnc_module_init(int refcount) {
/* publish g-wrapped bindings */
lmod("(g-wrapped gw-gnome-utils)");
lmod("(gnucash gnome-utils)");
return TRUE;
}

View File

@ -0,0 +1,21 @@
(define-module (gnucash gnome-utils))
(use-modules (g-wrapped gw-gnome-utils))
(use-modules (gnucash bootstrap) (g-wrapped gw-gnc)) ;; FIXME: delete after we finish modularizing.
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/app-utils" 0)
;; from gnc-menu-extensions.scm
(export gnc:extension-type)
(export gnc:extension-name)
(export gnc:extension-documentation)
(export gnc:extension-path)
(export gnc:extension-script)
(export gnc:make-menu-item)
(export gnc:make-menu)
(export gnc:make-separator)
(export gnc:new-menu-namer)
(export gnc:*add-extension-hook*)
(load-from-path "gnc-menu-extensions.scm")

View File

@ -10,7 +10,6 @@ gnc_regular_scm_files = \
command-line.scm \
depend.scm \
doc.scm \
extensions.scm \
help-topics-index.scm \
main.scm \
main-window.scm \

View File

@ -50,13 +50,6 @@
(export gnc:find-doc-file)
(export gnc:load-help-topics)
;; from extensions.scm
(export gnc:extension-type)
(export gnc:extension-name)
(export gnc:extension-documentation)
(export gnc:extension-path)
(export gnc:extension-script)
;; from main-window.scm
(export gnc:find-acct-tree-window-options)
(export gnc:make-new-acct-tree-window)

View File

@ -156,12 +156,12 @@
(gnc:module-load "gnucash/report/standard-reports" 0)
(gnc:module-load "gnucash/report/utility-reports" 0)
(gnc:module-load "gnucash/report/locale-specific/us" 0)
(gnc:module-load "gnucash/business-gnome" 0)
;; Now we can load a bunch of files.
(load-from-path "path.scm")
(load-from-path "command-line.scm")
(load-from-path "doc.scm")
(load-from-path "extensions.scm")
(load-from-path "main-window.scm")
(load-from-path "tip-of-the-day.scm")
(load-from-path "printing/print-check.scm")