mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-12-02 05:29:20 -06:00
stuff from rob browning from a while ago i forgot to check in
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@1808 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
8d9e520567
commit
76c1ac2610
34
src/scm/convenience-wrappers.scm
Normal file
34
src/scm/convenience-wrappers.scm
Normal file
@ -0,0 +1,34 @@
|
||||
|
||||
|
||||
(define (gnc:query-dialog message default-answer
|
||||
yes-button? ok-button? no-button? cancel-button?)
|
||||
;; Show yes/no/cancel dialog box with given message.
|
||||
;;
|
||||
;; display message, and wait for a yes, no, or cancel, depending on
|
||||
;; the arguments. Each of the *-button? arguments indicates whether
|
||||
;; or not the dialog should contain a button of that type.
|
||||
;; default-answer may be set to 'yes, 'ok, 'no or 'cancel. If you
|
||||
;; allow both yes and OK buttons, and set 'yes or 'ok as the default
|
||||
;; answer, which button is the default is undefined, but the result
|
||||
;; is the same either way, and why would be doing that anyhow?
|
||||
;;
|
||||
;; This function returns #t for yes (or OK), #f for no, or 'cancel.
|
||||
;;
|
||||
;; NOTE: This function does not return until the dialog is closed.")
|
||||
|
||||
(let* ((default (case default-answer
|
||||
((yes) 1)
|
||||
((ok) 1)
|
||||
((no) 0)
|
||||
((cancel) -1)))
|
||||
(result
|
||||
(gnc:_query-dialog-lowlev_
|
||||
message default yes-button? ok-button? no-button? cancel-button?)))
|
||||
(case result
|
||||
((1) #t)
|
||||
((0) #f)
|
||||
((-1) 'cancel))))
|
||||
|
||||
(define (gnc:message-dialog message)
|
||||
(let ((result (gnc:query-dialog message 'ok #f #t #f #f)))
|
||||
#t))
|
@ -7,13 +7,41 @@
|
||||
|
||||
(gnc:debug "Setting up extensions menu " win "\n")
|
||||
|
||||
(gnc:extensions-menu-add-item "Export data as text."
|
||||
"Export data as text hint."
|
||||
(gnc:extensions-menu-add-item "Export data as text"
|
||||
"Export data as text hint"
|
||||
(lambda ()
|
||||
(gnc:main-win-export-data-as-text win)))
|
||||
|
||||
(gnc:extensions-menu-add-item "Scheme test2"
|
||||
"Scheme test2 hint"
|
||||
(gnc:extensions-menu-add-item "Test error dialog"
|
||||
"Test error dialog hint"
|
||||
(lambda ()
|
||||
(gnc:error-message-dialog
|
||||
"Some error didn't occur.")))
|
||||
|
||||
(gnc:extensions-menu-add-item
|
||||
"Test verify dialog"
|
||||
"Test verify dialog hint"
|
||||
(lambda ()
|
||||
(let ((result (gnc:verify-dialog "Would you like to play a game?")))
|
||||
(if result
|
||||
(gnc:error-message-dialog "You said yes.")
|
||||
(gnc:error-message-dialog "You said no.")))))
|
||||
|
||||
(gnc:extensions-menu-add-item
|
||||
"Test query dialog"
|
||||
"Test query dialog hint"
|
||||
(lambda ()
|
||||
(let ((result (gnc:query-dialog
|
||||
"Would you like to play a game?"
|
||||
'yes
|
||||
#t #f #t #t)))
|
||||
(case result
|
||||
((#t) (gnc:message-dialog "You said yes."))
|
||||
((#f) (gnc:message-dialog "You said no."))
|
||||
((cancel) (gnc:message-dialog "You said cancel."))))))
|
||||
|
||||
(gnc:extensions-menu-add-item "Simple extension test"
|
||||
"Simple extension test hint"
|
||||
gnc:extensions-menu-test-func))
|
||||
|
||||
(gnc:hook-add-dangler gnc:*main-window-opened-hook* gnc:extensions-menu-setup)
|
||||
|
@ -44,8 +44,7 @@
|
||||
|
||||
(if (pair? gnc:*command-line-files*)
|
||||
;; You can only open single files right now...
|
||||
(gnc:ui-open-file (car gnc:*command-line-files*))
|
||||
(gnc:ui-select-file))
|
||||
(gnc:ui-open-file (car gnc:*command-line-files*)))
|
||||
|
||||
(gnc:lowlev-app-main)
|
||||
|
||||
|
@ -10,4 +10,5 @@
|
||||
(gnc:load "path.scm")
|
||||
(gnc:load "prefs.scm")
|
||||
(gnc:load "command-line.scm")
|
||||
(gnc:load "convenience-wrappers.scm")
|
||||
(gnc:load "main.scm")
|
||||
|
Loading…
Reference in New Issue
Block a user