diff --git a/src/gnome/dialog-options.c b/src/gnome/dialog-options.c index 20ad79fbb8..c89165f56d 100644 --- a/src/gnome/dialog-options.c +++ b/src/gnome/dialog-options.c @@ -81,7 +81,7 @@ gnc_date_option_set_select_method(GNCOption *option, gboolean use_absolute, { GList* widget_list; GtkWidget *ab_button, *rel_button, *rel_widget, *ab_widget; - + widget_list = gtk_container_children(GTK_CONTAINER(option->widget)); ab_button = g_list_nth_data(widget_list, GNC_RD_WID_AB_BUTTON_POS); ab_widget = g_list_nth_data(widget_list, GNC_RD_WID_AB_WIDGET_POS); @@ -206,9 +206,9 @@ gnc_option_set_ui_value(GNCOption *option, gboolean use_default) int index; char *date_option_type; char *symbol_str; - + date_option_type = gnc_option_date_option_get_subtype(option); - + if (gh_vector_p(value)) { symbol = gh_vector_ref(value, gh_int2scm(0)); @@ -253,7 +253,7 @@ gnc_option_set_ui_value(GNCOption *option, gboolean use_default) if (gnc_timepair_p(tp)) { ts = gnc_timepair2timespec(tp); - + if (safe_strcmp(date_option_type, "absolute") == 0) { gnc_date_edit_set_time(GNC_DATE_EDIT(option->widget), ts.tv_sec); @@ -284,7 +284,6 @@ gnc_option_set_ui_value(GNCOption *option, gboolean use_default) } free(symbol_str); } - } else { @@ -456,7 +455,8 @@ gnc_option_get_ui_value(GNCOption *option) { int index; SCM type, val; - char *subtype = gnc_option_date_option_get_subtype(option); + char *subtype = gnc_option_date_option_get_subtype(option); + if(safe_strcmp(subtype, "relative") == 0) { index = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(option->widget), @@ -468,10 +468,10 @@ gnc_option_get_ui_value(GNCOption *option) else if (safe_strcmp(subtype, "absolute") == 0) { Timespec ts; - + ts.tv_sec = gnc_date_edit_get_date(GNC_DATE_EDIT(option->widget)); ts.tv_nsec = 0; - + result = gh_cons(gh_symbol2scm("absolute"), gnc_timespec2timepair(ts)); } else if (safe_strcmp(subtype, "both") == 0) @@ -503,8 +503,7 @@ gnc_option_get_ui_value(GNCOption *option) } g_free(subtype); } - -else if (safe_strcmp(type, "account-list") == 0) + else if (safe_strcmp(type, "account-list") == 0) { GNCAccountTree *tree; GList *list; diff --git a/src/scm/date-utilities.scm b/src/scm/date-utilities.scm index bb8a0f0b92..2052ff2e30 100644 --- a/src/scm/date-utilities.scm +++ b/src/scm/date-utilities.scm @@ -216,6 +216,7 @@ (set-tm:year zd 0) (set-tm:yday zd 0) (set-tm:wday zd 0) + (set-tm:isdst zd 0) zd)) (define SecDelta @@ -288,6 +289,7 @@ (set-tm:hour bdt 23) (let ((newtime (car (mktime bdt)))) (cons newtime 0)))) + (define (gnc:reldate-get-symbol x) (vector-ref x 0)) (define (gnc:reldate-get-string x) (vector-ref x 1)) (define (gnc:reldate-get-desc x) (vector-ref x 2)) @@ -311,7 +313,6 @@ (if rel-date-data ((gnc:reldate-get-fn rel-date-data)) (gnc:error "Tried to look up an undefined date symbol")))) - (define (gnc:get-relative-date-strings date-symbol) (let ((rel-date-info (hash-ref gnc:relative-date-hash date-symbol))) @@ -334,6 +335,7 @@ (set-tm:hour now 0) (set-tm:mday now 1) (set-tm:mon now 0) + (set-tm:isdst now 0) (gnc:secs->timepair (car (mktime now))))) (define (gnc:get-start-prev-year) @@ -344,7 +346,8 @@ (set-tm:mday now 1) (set-tm:mon now 0) (set-tm:year now (- (tm:year now) 1)) - (gnc:secs->timepair (car (mktime now))))) + (set-tm:isdst now 0) + (gnc:secs->timepair (car (mktime now))))) (define (gnc:get-end-prev-year) (let ((now (localtime (current-time)))) @@ -354,8 +357,8 @@ (set-tm:mday now 31) (set-tm:mon now 11) (set-tm:year now (- (tm:year now) 1)) - (gnc:secs->timepair (car (mktime now))))) - + (set-tm:isdst now 0) + (gnc:secs->timepair (car (mktime now))))) ;; FIXME:: Replace with option when it becomes available (define (gnc:get-start-cur-fin-year) @@ -388,7 +391,6 @@ (set-tm:mon now 6) (set-tm:year now (- (tm:year now) 2)) (cons (car (mktime now)) 0)) - (begin (set-tm:sec now 0) (set-tm:min now 0) @@ -408,7 +410,6 @@ (set-tm:mday now 30) (set-tm:mon now 5) (cons (car (mktime now)) 0)) - (begin (set-tm:sec now 59) (set-tm:min now 59) @@ -452,7 +453,6 @@ (set-tm:mday (gnc:days-in-month (+ (tm:month now) 1)) (+ (tm:year) 1900)) (cons (car (mktime now)) 0))) - (define (gnc:get-start-current-quarter) (let ((now (localtime (current-time)))) (set-tm:sec now 0) diff --git a/src/scm/options.scm b/src/scm/options.scm index a7b94f3631..a62078097a 100644 --- a/src/scm/options.scm +++ b/src/scm/options.scm @@ -314,9 +314,9 @@ (or (and (eq? 'relative (car date)) (symbol? (cdr date))) (and (eq? 'absolute (car date)) - (pair? (cdr date)) - (exact? (cadr date)) - (exact? (cddr date)))))) + (pair? (cdr date)) + (exact? (cadr date)) + (exact? (cddr date)))))) (define (list-lookup list item) (cond ((null? list) #f) @@ -327,30 +327,29 @@ (string-append "'" (gnc:value->string value))))) (gnc:make-option section name sort-tag 'date documentation-string - (lambda () + (lambda () (if (eq? (car value) 'relative) - (vector 'relative (gnc:get-absolute-from-relative-date (cdr value)) (cdr value)) (vector 'absolute (cdr value)))) (lambda (date) (if (date-legal date) (set! value date) - (gnc:error "Illegal date value set"))) + (gnc:error "Illegal date value set"))) default-getter (gnc:restore-form-generator value->string) (lambda (date) (if (date-legal date) (list #t date) - (list #f "date-option: illegal date"))) + (list #f "date-option: illegal date"))) (vector subtype show-time relative-date-list) (vector (lambda () (length relative-date-list)) - (lambda (x) (list-ref relative-date-list x)) - (lambda (x) (gnc:get-relative-date-string - (list-ref relative-date-list x))) - (lambda (x) (gnc:get-relative-date-desc - (list-ref relative-date-list x))) - (lambda (x) (list-lookup relative-date-list x))) + (lambda (x) (list-ref relative-date-list x)) + (lambda (x) (gnc:get-relative-date-string + (list-ref relative-date-list x))) + (lambda (x) (gnc:get-relative-date-desc + (list-ref relative-date-list x))) + (lambda (x) (list-lookup relative-date-list x))) #f #f))) diff --git a/src/scm/report.scm b/src/scm/report.scm index 5cac6f4270..c64722f09f 100644 --- a/src/scm/report.scm +++ b/src/scm/report.scm @@ -75,7 +75,7 @@ (display ")") (newline) (newline port)))) - + (define (report-output->string tree) (call-with-output-string (lambda (port) diff --git a/src/scm/report/hello-world.scm b/src/scm/report/hello-world.scm index aac6b3a57f..6893f4bd3a 100644 --- a/src/scm/report/hello-world.scm +++ b/src/scm/report/hello-world.scm @@ -81,18 +81,20 @@ (lambda () (cons 'absolute (cons (current-time) 0))) #t 'absolute #f )) - (gnc:register-hello-world-option + (gnc:register-hello-world-option (gnc:make-date-option "Hello, World!" "Combo Date Option" "y" "This is a combination date option" (lambda () (cons 'relative 'start-cal-year)) #f 'both '(start-cal-year start-prev-year end-prev-year) )) - (gnc:register-hello-world-option + + (gnc:register-hello-world-option (gnc:make-date-option "Hello, World!" "Relative Date Option" "x" "This is a relative date option" (lambda () (cons 'relative 'start-cal-year)) #f 'relative '(start-cal-year start-prev-year end-prev-year) )) + ;; This is a number range option. The user can enter a number ;; between a lower and upper bound given below. There are also ;; arrows the user can click to go up or down, the amount changed @@ -235,8 +237,7 @@ ;; The first thing we do is make local variables for all the specific ;; options in the set of options given to the function. This set will ;; be generated by the options generator above. - (let ((dummy (display options)) - (bool-val (op-value "Hello, World!" "Boolean Option")) + (let ((bool-val (op-value "Hello, World!" "Boolean Option")) (mult-val (op-value "Hello, World!" "Multi Choice Option")) (string-val (op-value "Hello, World!" "String Option")) (date-val (gnc:date-option-absolute-time (op-value "Hello, World!" "Just a Date Option"))) @@ -251,7 +252,7 @@ ;; Crash if asked to. (if crash-val (string-length #f));; string-length needs a string - + (let ((time-string (strftime "%X" (localtime (current-time)))) (date-string (strftime "%x" (localtime (car date-val)))) (date-string2 (strftime "%x %X" (localtime (car date2-val)))) @@ -267,7 +268,7 @@ (html-start-document-color (gnc:color-option->html color-op)) ;; Here we get the title using the string database and 'lookup. - "