diff --git a/ChangeLog b/ChangeLog index a01e37bc79..59781abb75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2001-04-22 Dave Peticolas + + * 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 * src/scm/report/transaction-report.scm: Added new options for diff --git a/src/gnome/dialog-account.c b/src/gnome/dialog-account.c index 1cca86fbb4..53b34c165d 100644 --- a/src/gnome/dialog-account.c +++ b/src/gnome/dialog-account.c @@ -1332,7 +1332,7 @@ gnc_type_list_unselect_cb(GtkCList * type_list, gint row, gint column, aw->type = BAD_TYPE; gtk_widget_set_sensitive(aw->security_edit, FALSE); - gtk_widget_set_sensitive(aw->source_menu, FALSE); + gtk_widget_set_sensitive(aw->quote_frame, FALSE); } diff --git a/src/gnome/dialog-options.c b/src/gnome/dialog-options.c index 871c9dabec..a4ead066d9 100644 --- a/src/gnome/dialog-options.c +++ b/src/gnome/dialog-options.c @@ -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 * * GUI option. * * * - * Args: section - section of option * - * name - name of option * + * Args: option - option to change widget state for * * selectable - if false, update the widget so that it * * cannot be selected by the user. If true, * * update the widget so that it can be selected.* * Return: nothing * \********************************************************************/ void -gnc_set_option_selectable_by_name( const char *section, - const char *name, - gboolean selectable) +gnc_set_option_selectable (GNCOption *option, gboolean selectable) { - GNCOption *option = gnc_get_option_by_name( section, name ); - if ((option == NULL) || (option->widget == NULL)) return; - gtk_widget_set_sensitive( GTK_WIDGET(option->widget), - selectable ); - - return; -} /* gnc_set_option_selectable_by_name */ + gtk_widget_set_sensitive (GTK_WIDGET(option->widget), selectable); +} static void diff --git a/src/gnome/glade-gnc-dialogs.c b/src/gnome/glade-gnc-dialogs.c index c05f680336..d354089afa 100644 --- a/src/gnome/glade-gnc-dialogs.c +++ b/src/gnome/glade-gnc-dialogs.c @@ -774,7 +774,7 @@ create_Find_Transactions (void) GtkWidget *balance_balanced_toggle; GtkWidget *balance_not_balanced_toggle; GtkWidget *label843; - GtkWidget *frame34; + GtkWidget *tags_frame; GtkWidget *vbox82; GtkWidget *label844; GtkWidget *tag_entry; @@ -1531,19 +1531,19 @@ create_Find_Transactions (void) gtk_widget_show (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)")); - gtk_widget_ref (frame34); - gtk_object_set_data_full (GTK_OBJECT (Find_Transactions), "frame34", frame34, + tags_frame = gtk_frame_new (_("Match transaction tags (CURRENTLY INOPERABLE)")); + gtk_widget_ref (tags_frame); + gtk_object_set_data_full (GTK_OBJECT (Find_Transactions), "tags_frame", tags_frame, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (frame34); - gtk_container_add (GTK_CONTAINER (notebook2), frame34); + gtk_widget_show (tags_frame); + gtk_container_add (GTK_CONTAINER (notebook2), tags_frame); vbox82 = gtk_vbox_new (FALSE, 0); gtk_widget_ref (vbox82); gtk_object_set_data_full (GTK_OBJECT (Find_Transactions), "vbox82", vbox82, (GtkDestroyNotify) gtk_widget_unref); 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); label844 = gtk_label_new (_("Find transactions with the tag:")); diff --git a/src/gnome/gnc-dialogs.glade b/src/gnome/gnc-dialogs.glade index ff599147d0..97f4658819 100644 --- a/src/gnome/gnc-dialogs.glade +++ b/src/gnome/gnc-dialogs.glade @@ -2349,7 +2349,7 @@ Exactly GtkFrame - frame34 + tags_frame 0 GTK_SHADOW_ETCHED_IN diff --git a/src/gnome/window-register.c b/src/gnome/window-register.c index f9e8ab1daf..ab13ddf478 100644 --- a/src/gnome/window-register.c +++ b/src/gnome/window-register.c @@ -3084,17 +3084,12 @@ report_helper (RegWindow *regData, SCM func, Query *query) { query = xaccLedgerDisplayGetQuery (regData->ledger); g_return_if_fail (query != NULL); - - query = xaccQueryCopy (query); } arg = gw_wcp_assimilate_ptr (query, qtype); args = gh_cons (arg, args); if (arg == SCM_UNDEFINED) - { - xaccFreeQuery (query); return; - } gh_apply (func, args); } diff --git a/src/scm/options.scm b/src/scm/options.scm index f9f4981faa..d154773ff2 100644 --- a/src/scm/options.scm +++ b/src/scm/options.scm @@ -714,8 +714,7 @@ (gnc:make-option section name "" 'query #f (lambda () value) - (lambda (x) (set! value (if (list? x) x (gnc:query->scm x))) - (display value) (newline)) + (lambda (x) (set! value (if (list? x) x (gnc:query->scm x)))) (lambda () (if (list? default-value) default-value (gnc:query->scm default-value))) diff --git a/src/scm/report/register.scm b/src/scm/report/register.scm index e07cdda3c5..6ae0dd1b3d 100644 --- a/src/scm/report/register.scm +++ b/src/scm/report/register.scm @@ -234,10 +234,7 @@ (gnc:register-option gnc:*report-options* new-option)) (gnc:register-reg-option - (gnc:make-query-option "__reg" "query-new" #f)) - - (gnc:register-reg-option - (gnc:make-internal-option "__reg" "query" #f)) + (gnc:make-query-option "__reg" "query" #f)) (gnc:register-reg-option (gnc:make-internal-option "__reg" "journal" #f)) (gnc:register-reg-option @@ -576,7 +573,8 @@ (let ((document (gnc:make-html-document)) (splits '()) (table '()) - (query (opt-val "__reg" "query")) + (query-scm (opt-val "__reg" "query")) + (query #f) (journal? (opt-val "__reg" "journal")) (debit-string (opt-val "__reg" "debit-string")) (credit-string (opt-val "__reg" "credit-string")) @@ -586,6 +584,8 @@ (if invoice? (set! title (_ "Invoice"))) + (set! query (gnc:scm->query query-scm)) + (gnc:query-set-group query (gnc:get-current-group)) (set! splits (gnc:glist->list @@ -630,6 +630,8 @@ (gnc:html-document-set-title! document title) (gnc:html-document-add-object! document table) + (gnc:free-query query) + document)) (gnc:define-report @@ -652,7 +654,6 @@ (let* ((options (gnc:make-report-options "Register")) (invoice-op (gnc:lookup-option options "Invoice" "Make an invoice")) (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")) (double-op (gnc:lookup-option options "__reg" "double")) (title-op (gnc:lookup-option options "General" "Title")) @@ -667,7 +668,6 @@ (gnc:option-set-value invoice-op invoice?) (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 double-op double?) (gnc:option-set-value title-op title) @@ -675,7 +675,6 @@ (gnc:option-set-value credit-op credit-string) (func (gnc:make-report "Register" options)))) - (define (gnc:show-register-report . rest) (apply gnc:apply-register-report (cons gnc:report-window (cons #f rest)))) diff --git a/src/scm/report/transaction-report.scm b/src/scm/report/transaction-report.scm index 3b94f0cc1c..28690c7775 100644 --- a/src/scm/report/transaction-report.scm +++ b/src/scm/report/transaction-report.scm @@ -41,7 +41,7 @@ (define-syntax addto! (syntax-rules () ((_ alist element) (set! alist (cons element alist))))) - + (define (split-account-full-name-same-p a b) (= (gnc:split-compare-account-full-names a b) 0)) @@ -479,11 +479,12 @@ "a" (N_ "Sort by this criterion first") 'account-name key-choice-list #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 (and (member x subtotal-enabled) #t))))) - + (gnc:register-trep-option (gnc:make-multichoice-option pagename-sorting (N_ "Primary Sort Order") @@ -497,7 +498,8 @@ "c" (N_ "Subtotal according to the primary key?") #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 (and x (equal? @@ -523,10 +525,11 @@ 'date key-choice-list #f (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 (and (member x subtotal-enabled) #t))))) - + (gnc:register-trep-option (gnc:make-multichoice-option pagename-sorting (N_ "Secondary Sort Order") @@ -539,9 +542,10 @@ pagename-sorting optname-sec-subtotal "g" (N_ "Subtotal according to the secondary key?") - #t #f - (lambda (x) (gnc:set-option-selectable-by-name - pagename-sorting optname-sec-subtotal-by x)))) + #t #f + (lambda (x) (gnc:option-db-set-option-selectable-by-name + gnc:*transaction-report-options* + pagename-sorting optname-sec-subtotal-by x)))) (gnc:register-trep-option (gnc:make-multichoice-option