* src/scm/report/transaction-report.scm: use new api for

changing sensitivity

	* src/guile/gnc.gwp: wrap new function

	* src/guile/global-options.c (gnc_set_option_selectable_by_name):
	new func

	* src/guile/option-util.c
	(gnc_option_db_set_option_selectable_by_name): new func

	* src/gnome/dialog-options.c (gnc_set_option_selectable): new func

	* src/gnome/dialog-account.c (gnc_type_list_unselect_cb): fix bug

	* src/scm/report/register.scm: use query option to store query

	* src/gnome/window-register.c (report_helper): don't copy
	the query -- it's converted to scm now

	* src/guile/gnc-helpers.c: more work on scm<->query


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4009 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-04-22 11:43:03 +00:00
parent df26729bf1
commit 085a167be9
9 changed files with 60 additions and 47 deletions

View File

@ -1,3 +1,27 @@
2001-04-22 Dave Peticolas <dave@krondo.com>
* src/scm/report/transaction-report.scm: use new api for
changing sensitivity
* src/guile/gnc.gwp: wrap new function
* src/guile/global-options.c (gnc_set_option_selectable_by_name):
new func
* src/guile/option-util.c
(gnc_option_db_set_option_selectable_by_name): new func
* src/gnome/dialog-options.c (gnc_set_option_selectable): new func
* src/gnome/dialog-account.c (gnc_type_list_unselect_cb): fix bug
* src/scm/report/register.scm: use query option to store query
* src/gnome/window-register.c (report_helper): don't copy
the query -- it's converted to scm now
* src/guile/gnc-helpers.c: more work on scm<->query
2001-04-22 Christian Stimming <stimming@tuhh.de> 2001-04-22 Christian Stimming <stimming@tuhh.de>
* src/scm/report/transaction-report.scm: Added new options for * src/scm/report/transaction-report.scm: Added new options for

View File

@ -1332,7 +1332,7 @@ gnc_type_list_unselect_cb(GtkCList * type_list, gint row, gint column,
aw->type = BAD_TYPE; aw->type = BAD_TYPE;
gtk_widget_set_sensitive(aw->security_edit, FALSE); gtk_widget_set_sensitive(aw->security_edit, FALSE);
gtk_widget_set_sensitive(aw->source_menu, FALSE); gtk_widget_set_sensitive(aw->quote_frame, FALSE);
} }

View File

@ -693,32 +693,24 @@ gnc_option_get_ui_value(GNCOption *option)
/********************************************************************\ /********************************************************************\
* gnc_set_option_selectable_by_name * * gnc_set_option_selectable *
* Change the selectable state of the widget that represents a * * Change the selectable state of the widget that represents a *
* GUI option. * * GUI option. *
* * * *
* Args: section - section of option * * Args: option - option to change widget state for *
* name - name of option *
* selectable - if false, update the widget so that it * * selectable - if false, update the widget so that it *
* cannot be selected by the user. If true, * * cannot be selected by the user. If true, *
* update the widget so that it can be selected.* * update the widget so that it can be selected.*
* Return: nothing * * Return: nothing *
\********************************************************************/ \********************************************************************/
void void
gnc_set_option_selectable_by_name( const char *section, gnc_set_option_selectable (GNCOption *option, gboolean selectable)
const char *name,
gboolean selectable)
{ {
GNCOption *option = gnc_get_option_by_name( section, name );
if ((option == NULL) || (option->widget == NULL)) if ((option == NULL) || (option->widget == NULL))
return; return;
gtk_widget_set_sensitive( GTK_WIDGET(option->widget), gtk_widget_set_sensitive (GTK_WIDGET(option->widget), selectable);
selectable ); }
return;
} /* gnc_set_option_selectable_by_name */
static void static void

View File

@ -774,7 +774,7 @@ create_Find_Transactions (void)
GtkWidget *balance_balanced_toggle; GtkWidget *balance_balanced_toggle;
GtkWidget *balance_not_balanced_toggle; GtkWidget *balance_not_balanced_toggle;
GtkWidget *label843; GtkWidget *label843;
GtkWidget *frame34; GtkWidget *tags_frame;
GtkWidget *vbox82; GtkWidget *vbox82;
GtkWidget *label844; GtkWidget *label844;
GtkWidget *tag_entry; GtkWidget *tag_entry;
@ -1531,19 +1531,19 @@ create_Find_Transactions (void)
gtk_widget_show (label843); gtk_widget_show (label843);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 10), label843); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 10), label843);
frame34 = gtk_frame_new (_("Match transaction tags (CURRENTLY INOPERABLE)")); tags_frame = gtk_frame_new (_("Match transaction tags (CURRENTLY INOPERABLE)"));
gtk_widget_ref (frame34); gtk_widget_ref (tags_frame);
gtk_object_set_data_full (GTK_OBJECT (Find_Transactions), "frame34", frame34, gtk_object_set_data_full (GTK_OBJECT (Find_Transactions), "tags_frame", tags_frame,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (frame34); gtk_widget_show (tags_frame);
gtk_container_add (GTK_CONTAINER (notebook2), frame34); gtk_container_add (GTK_CONTAINER (notebook2), tags_frame);
vbox82 = gtk_vbox_new (FALSE, 0); vbox82 = gtk_vbox_new (FALSE, 0);
gtk_widget_ref (vbox82); gtk_widget_ref (vbox82);
gtk_object_set_data_full (GTK_OBJECT (Find_Transactions), "vbox82", vbox82, gtk_object_set_data_full (GTK_OBJECT (Find_Transactions), "vbox82", vbox82,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox82); gtk_widget_show (vbox82);
gtk_container_add (GTK_CONTAINER (frame34), vbox82); gtk_container_add (GTK_CONTAINER (tags_frame), vbox82);
gtk_container_set_border_width (GTK_CONTAINER (vbox82), 5); gtk_container_set_border_width (GTK_CONTAINER (vbox82), 5);
label844 = gtk_label_new (_("Find transactions with the tag:")); label844 = gtk_label_new (_("Find transactions with the tag:"));

View File

@ -2349,7 +2349,7 @@ Exactly
<widget> <widget>
<class>GtkFrame</class> <class>GtkFrame</class>
<name>frame34</name> <name>tags_frame</name>
<label>Match transaction tags (CURRENTLY INOPERABLE)</label> <label>Match transaction tags (CURRENTLY INOPERABLE)</label>
<label_xalign>0</label_xalign> <label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>

View File

@ -3084,17 +3084,12 @@ report_helper (RegWindow *regData, SCM func, Query *query)
{ {
query = xaccLedgerDisplayGetQuery (regData->ledger); query = xaccLedgerDisplayGetQuery (regData->ledger);
g_return_if_fail (query != NULL); g_return_if_fail (query != NULL);
query = xaccQueryCopy (query);
} }
arg = gw_wcp_assimilate_ptr (query, qtype); arg = gw_wcp_assimilate_ptr (query, qtype);
args = gh_cons (arg, args); args = gh_cons (arg, args);
if (arg == SCM_UNDEFINED) if (arg == SCM_UNDEFINED)
{
xaccFreeQuery (query);
return; return;
}
gh_apply (func, args); gh_apply (func, args);
} }

View File

@ -714,8 +714,7 @@
(gnc:make-option (gnc:make-option
section name "" 'query #f section name "" 'query #f
(lambda () value) (lambda () value)
(lambda (x) (set! value (if (list? x) x (gnc:query->scm x))) (lambda (x) (set! value (if (list? x) x (gnc:query->scm x))))
(display value) (newline))
(lambda () (if (list? default-value) (lambda () (if (list? default-value)
default-value default-value
(gnc:query->scm default-value))) (gnc:query->scm default-value)))

View File

@ -234,10 +234,7 @@
(gnc:register-option gnc:*report-options* new-option)) (gnc:register-option gnc:*report-options* new-option))
(gnc:register-reg-option (gnc:register-reg-option
(gnc:make-query-option "__reg" "query-new" #f)) (gnc:make-query-option "__reg" "query" #f))
(gnc:register-reg-option
(gnc:make-internal-option "__reg" "query" #f))
(gnc:register-reg-option (gnc:register-reg-option
(gnc:make-internal-option "__reg" "journal" #f)) (gnc:make-internal-option "__reg" "journal" #f))
(gnc:register-reg-option (gnc:register-reg-option
@ -576,7 +573,8 @@
(let ((document (gnc:make-html-document)) (let ((document (gnc:make-html-document))
(splits '()) (splits '())
(table '()) (table '())
(query (opt-val "__reg" "query")) (query-scm (opt-val "__reg" "query"))
(query #f)
(journal? (opt-val "__reg" "journal")) (journal? (opt-val "__reg" "journal"))
(debit-string (opt-val "__reg" "debit-string")) (debit-string (opt-val "__reg" "debit-string"))
(credit-string (opt-val "__reg" "credit-string")) (credit-string (opt-val "__reg" "credit-string"))
@ -586,6 +584,8 @@
(if invoice? (if invoice?
(set! title (_ "Invoice"))) (set! title (_ "Invoice")))
(set! query (gnc:scm->query query-scm))
(gnc:query-set-group query (gnc:get-current-group)) (gnc:query-set-group query (gnc:get-current-group))
(set! splits (gnc:glist->list (set! splits (gnc:glist->list
@ -630,6 +630,8 @@
(gnc:html-document-set-title! document title) (gnc:html-document-set-title! document title)
(gnc:html-document-add-object! document table) (gnc:html-document-add-object! document table)
(gnc:free-query query)
document)) document))
(gnc:define-report (gnc:define-report
@ -652,7 +654,6 @@
(let* ((options (gnc:make-report-options "Register")) (let* ((options (gnc:make-report-options "Register"))
(invoice-op (gnc:lookup-option options "Invoice" "Make an invoice")) (invoice-op (gnc:lookup-option options "Invoice" "Make an invoice"))
(query-op (gnc:lookup-option options "__reg" "query")) (query-op (gnc:lookup-option options "__reg" "query"))
(query-new-op (gnc:lookup-option options "__reg" "query-new"))
(journal-op (gnc:lookup-option options "__reg" "journal")) (journal-op (gnc:lookup-option options "__reg" "journal"))
(double-op (gnc:lookup-option options "__reg" "double")) (double-op (gnc:lookup-option options "__reg" "double"))
(title-op (gnc:lookup-option options "General" "Title")) (title-op (gnc:lookup-option options "General" "Title"))
@ -667,7 +668,6 @@
(gnc:option-set-value invoice-op invoice?) (gnc:option-set-value invoice-op invoice?)
(gnc:option-set-value query-op query) (gnc:option-set-value query-op query)
(gnc:option-set-value query-new-op query)
(gnc:option-set-value journal-op journal?) (gnc:option-set-value journal-op journal?)
(gnc:option-set-value double-op double?) (gnc:option-set-value double-op double?)
(gnc:option-set-value title-op title) (gnc:option-set-value title-op title)
@ -675,7 +675,6 @@
(gnc:option-set-value credit-op credit-string) (gnc:option-set-value credit-op credit-string)
(func (gnc:make-report "Register" options)))) (func (gnc:make-report "Register" options))))
(define (gnc:show-register-report . rest) (define (gnc:show-register-report . rest)
(apply gnc:apply-register-report (apply gnc:apply-register-report
(cons gnc:report-window (cons #f rest)))) (cons gnc:report-window (cons #f rest))))

View File

@ -41,7 +41,7 @@
(define-syntax addto! (define-syntax addto!
(syntax-rules () (syntax-rules ()
((_ alist element) (set! alist (cons element alist))))) ((_ alist element) (set! alist (cons element alist)))))
(define (split-account-full-name-same-p a b) (define (split-account-full-name-same-p a b)
(= (gnc:split-compare-account-full-names a b) 0)) (= (gnc:split-compare-account-full-names a b) 0))
@ -479,11 +479,12 @@
"a" (N_ "Sort by this criterion first") "a" (N_ "Sort by this criterion first")
'account-name 'account-name
key-choice-list #f key-choice-list #f
(lambda (x) (lambda (x)
(gnc:set-option-selectable-by-name (gnc:option-db-set-option-selectable-by-name
gnc:*transaction-report-options*
pagename-sorting optname-prime-subtotal pagename-sorting optname-prime-subtotal
(and (member x subtotal-enabled) #t))))) (and (member x subtotal-enabled) #t)))))
(gnc:register-trep-option (gnc:register-trep-option
(gnc:make-multichoice-option (gnc:make-multichoice-option
pagename-sorting (N_ "Primary Sort Order") pagename-sorting (N_ "Primary Sort Order")
@ -497,7 +498,8 @@
"c" "c"
(N_ "Subtotal according to the primary key?") (N_ "Subtotal according to the primary key?")
#t #f #t #f
(lambda (x) (gnc:set-option-selectable-by-name (lambda (x) (gnc:option-db-set-option-selectable-by-name
gnc:*transaction-report-options*
pagename-sorting optname-prime-subtotal-by pagename-sorting optname-prime-subtotal-by
(and x (and x
(equal? (equal?
@ -523,10 +525,11 @@
'date 'date
key-choice-list #f key-choice-list #f
(lambda (x) (lambda (x)
(gnc:set-option-selectable-by-name (gnc:option-db-set-option-selectable-by-name
gnc:*transaction-report-options*
pagename-sorting optname-sec-subtotal pagename-sorting optname-sec-subtotal
(and (member x subtotal-enabled) #t))))) (and (member x subtotal-enabled) #t)))))
(gnc:register-trep-option (gnc:register-trep-option
(gnc:make-multichoice-option (gnc:make-multichoice-option
pagename-sorting (N_ "Secondary Sort Order") pagename-sorting (N_ "Secondary Sort Order")
@ -539,9 +542,10 @@
pagename-sorting optname-sec-subtotal pagename-sorting optname-sec-subtotal
"g" "g"
(N_ "Subtotal according to the secondary key?") (N_ "Subtotal according to the secondary key?")
#t #f #t #f
(lambda (x) (gnc:set-option-selectable-by-name (lambda (x) (gnc:option-db-set-option-selectable-by-name
pagename-sorting optname-sec-subtotal-by x)))) gnc:*transaction-report-options*
pagename-sorting optname-sec-subtotal-by x))))
(gnc:register-trep-option (gnc:register-trep-option
(gnc:make-multichoice-option (gnc:make-multichoice-option