[Gnucash-changes] r13662 - gnucash/trunk - Pass a dialog pointer through the scm code and back to the C error

David Hampton hampton at cvs.gnucash.org
Fri Mar 17 19:39:17 EST 2006


Author: hampton
Date: 2006-03-17 19:39:17 -0500 (Fri, 17 Mar 2006)
New Revision: 13662
Trac: http://svn.gnucash.org/trac/changeset/13662

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/gnome/dialog-price-edit-db.c
   gnucash/trunk/src/scm/price-quotes.scm
Log:
Pass a dialog pointer through the scm code and back to the C error
display functions.  This will parent the error dialog properly.  Fixes
334929.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-03-17 23:26:13 UTC (rev 13661)
+++ gnucash/trunk/ChangeLog	2006-03-18 00:39:17 UTC (rev 13662)
@@ -1,5 +1,10 @@
 2006-03-17  David Hampton  <hampton at employees.org>
 
+	* src/scm/price-quotes.scm:
+	* src/gnome/dialog-price-edit-db.c: Pass a dialog pointer through
+	the scm code and back to the C error display functions.  This will
+	parent the error dialog properly.  Fixes 334929.
+
 	* src/gnome-utils/account-quickfill.c: Enhance the quickfill event
 	handler to detect changes in whether an account should appear in
 	the quickfill.  Fixes 334787.

Modified: gnucash/trunk/src/gnome/dialog-price-edit-db.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-price-edit-db.c	2006-03-17 23:26:13 UTC (rev 13661)
+++ gnucash/trunk/src/gnome/dialog-price-edit-db.c	2006-03-18 00:39:17 UTC (rev 13662)
@@ -45,6 +45,7 @@
 #include "gnc-ui-util.h"
 #include "guile-util.h"
 #include "engine-helpers.h"
+#include <g-wrap-wct.h>
 
 
 #define DIALOG_PRICE_DB_CM_CLASS "dialog-price-edit-db"
@@ -261,6 +262,7 @@
   PricesDialog *pdb_dialog = data;
   SCM quotes_func;
   SCM book_scm;
+  SCM scm_window, window_type;
 
   ENTER(" ");
   quotes_func = scm_c_eval_string ("gnc:book-add-quotes");
@@ -275,8 +277,11 @@
     return;
   }
 
+  window_type = scm_c_eval_string("<gtk:Widget*>");
+  scm_window = gw_wcp_assimilate_ptr(pdb_dialog->dialog, window_type);
+
   gnc_set_busy_cursor (NULL, TRUE);
-  scm_call_1 (quotes_func, book_scm);
+  scm_call_2 (quotes_func, scm_window, book_scm);
   gnc_unset_busy_cursor (NULL);
   LEAVE(" ");
 }

Modified: gnucash/trunk/src/scm/price-quotes.scm
===================================================================
--- gnucash/trunk/src/scm/price-quotes.scm	2006-03-17 23:26:13 UTC (rev 13661)
+++ gnucash/trunk/src/scm/price-quotes.scm	2006-03-18 00:39:17 UTC (rev 13662)
@@ -377,7 +377,7 @@
         get-quotes
         kill-quoter)))
 
-(define (gnc:book-add-quotes book)
+(define (gnc:book-add-quotes window book)
 
   (define (book->commodity->fq-call-data book)
     ;; Call helper that walks all of the defined commodities to see if
@@ -634,17 +634,17 @@
      ((eq? fq-call-data #f)
       (set! keep-going? #f)
       (if (gnc:ui-is-running?)
-          (gnc:error-dialog #f (_ "No commodities marked for quote retrieval."))
+          (gnc:error-dialog window (_ "No commodities marked for quote retrieval."))
 	  (gnc:warn (_ "No commodities marked for quote retrieval."))))
      ((eq? fq-results #f)
       (set! keep-going? #f)
       (if (gnc:ui-is-running?)
-          (gnc:error-dialog #f (_ "Unable to get quotes or diagnose the problem."))
+          (gnc:error-dialog window (_ "Unable to get quotes or diagnose the problem."))
 	  (gnc:warn (_ "Unable to get quotes or diagnose the problem."))))
      ((member 'missing-lib fq-results)
       (set! keep-going? #f)
       (if (gnc:ui-is-running?)
-          (gnc:error-dialog #f
+          (gnc:error-dialog window
            (_ "You are missing some needed Perl libraries.
 Run 'gnc-fq-update' as root to install them."))
           (gnc:warn (_ "You are missing some needed Perl libraries.
@@ -652,17 +652,17 @@
      ((member 'system-error fq-results)
       (set! keep-going? #f)
       (if (gnc:ui-is-running?)
-          (gnc:error-dialog #f
+          (gnc:error-dialog window
            (_ "There was a system error while retrieving the price quotes."))
           (gnc:warn (_ "There was a system error while retrieving the price quotes.") "\n")))
      ((not (list? (car fq-results)))
       (set! keep-going? #f)
       (if (gnc:ui-is-running?)
-          (gnc:error-dialog #f
+          (gnc:error-dialog window
            (_ "There was an unknown error while retrieving the price quotes."))
           (gnc:warn (_ "There was an unknown error while retrieving the price quotes.") "\n")))
      ((and (not commod-tz-quote-triples) (gnc:ui-is-running?))
-      (gnc:error-dialog #f
+      (gnc:error-dialog window
        (_ "Unable to get quotes or diagnose the problem."))
        (set! keep-going? #f))
      ((not commod-tz-quote-triples)
@@ -673,7 +673,7 @@
           (if (and ok-syms (not (null? ok-syms)))
               (set!
                keep-going?
-               (gnc:verify-dialog #f #t
+               (gnc:verify-dialog window #t
                 (call-with-output-string
                  (lambda (p)
                    (display (_ "Unable to retrieve quotes for these items:") p)
@@ -683,7 +683,7 @@
                    (newline p)
                    (display (_ "Continue using only the good quotes?") p)))))
               (begin
-                (gnc:error-dialog #f
+                (gnc:error-dialog window
                  (call-with-output-string
                   (lambda (p)
                     (display
@@ -712,7 +712,7 @@
            (if (gnc:ui-is-running?)
                (set!
                 keep-going?
-                (gnc:verify-dialog #f #t
+                (gnc:verify-dialog window #t
                  (call-with-output-string
                   (lambda (p)
                     (display (_ "Unable to create prices for these items:") p)
@@ -744,7 +744,7 @@
     (if session
 	(begin
           (gnc:debug "about to call gnc:book-add-quotes")
-	  (set! quote-ok? (and (gnc:book-add-quotes
+	  (set! quote-ok? (and (gnc:book-add-quotes #f
 				(gnc:session-get-book session))))
 
           (gnc:debug "done gnc:book-add-quotes:" quote-ok?)



More information about the gnucash-changes mailing list