[patch 11/15] [comments.diff] A collection of miscellaneous comments

c.shoemaker at cox.net c.shoemaker at cox.net
Mon Oct 10 10:34:33 EDT 2005


         - spelling corrections, line wrap fixes, whitespace changes
         - inline documentation
         - silence a texinfo warning
         - various _deeply_ insightful one-liners


 GNOME2_STATUS                                    |   49 +++++++++++++++++------
 HACKING                                          |    6 ++
 src/app-utils/config-var.scm                     |    2 
 src/app-utils/gnc-component-manager.h            |    3 -
 src/backend/file/gnc-schedxaction-xml-v2.c       |    1 
 src/backend/postgres/gncquery.c                  |    1 
 src/business/business-utils/business-options.scm |    2 
 src/doc/design/engine.texinfo                    |    6 +-
 src/doc/multicurrency-discussion.txt             |    6 --
 src/engine/Query.h                               |    2 
 src/engine/SX-book.c                             |    3 -
 src/engine/SchedXaction.c                        |    4 +
 src/engine/TransactionP.h                        |    4 -
 src/engine/gnc-numeric.h                         |    4 -
 src/engine/guid.c                                |    1 
 src/engine/qofbook.h                             |    3 -
 src/engine/qofclass.c                            |    2 
 src/engine/qofclass.h                            |    4 -
 src/engine/qofquery.c                            |    1 
 src/engine/qofquery.h                            |    8 ++-
 src/engine/qofsession.c                          |    5 +-
 src/experimental/cgi-bin/gnc-server.c            |    2 
 src/gnome-utils/dialog-utils.c                   |   13 +++++-
 src/gnome-utils/gnc-amount-edit.c                |    6 +-
 src/gnome-utils/gnc-amount-edit.h                |    8 +--
 src/gnome-utils/gnc-date-format.c                |    1 
 src/gnome-utils/gnc-plugin-manager.h             |    6 +-
 src/gnome-utils/gnc-plugin.h                     |    9 ++--
 src/gnome-utils/gnc-tree-model-account.c         |    7 +--
 src/gnome-utils/gnc-tree-model.c                 |    2 
 src/gnome/dialog-scheduledxaction.c              |    4 +
 src/gnome/dialog-sxsincelast.c                   |    3 +
 src/report/report-gnome/gw-report-gnome-spec.scm |    3 +
 src/report/report-gnome/report-gnome.scm         |    6 ++
 src/report/report-system/html-document.scm       |    2 
 src/report/report-system/html-table.scm          |    5 ++
 src/report/report-system/report-utilities.scm    |   25 +++++++----
 src/report/report-system/report.scm              |   49 +++++++++++++++--------
 38 files changed, 183 insertions(+), 85 deletions(-)

Index: gnucash/GNOME2_STATUS
===================================================================
--- gnucash.orig/GNOME2_STATUS
+++ gnucash/GNOME2_STATUS
@@ -3,7 +3,7 @@
 Intro
 -----
 
-This is a ad-hoc list of list of what works and doesn't work in the g2
+This is a ad-hoc list of what works and doesn't work in the g2
 port of gnucash.  The plan is to finish porting those parts of gnucash
 that have already been started (i.e. new windowing system, account
 tree, commodities tree, etc.), but not to port any additional features
@@ -80,6 +80,8 @@ Resources
     - The main windows do not yet support saving position/size
       information.  (On my list - DRH)
 
+  - Open pages are no longer open after reopening file.
+
   - Weird pango_layout_set_text "string not UTF-8" issues reported by Neil Williams:
     
     - http://lists.gnucash.org/pipermail/gnucash-devel/2005-March/012797.html
@@ -165,24 +167,47 @@ Resources
   - HBCI - Transaction templates eventually need to be converted from a GTK_CLIST
     to a GTK_TREE_VIEW.  Currently working as a GtkClist. 
 
+
+- Notebook tabs
+
+  - When opening multiple report tabs, all reports get tab title of
+    first report. [FIXED]
+
+  - Account Tree tab title is unaffected by "Name of Account View" option.
+
+  - Also, changing that option doesn't affect dirty status of options
+    dialog. [ FIXED ]
+
+
 - Budgeting
 
-  - Can create/modify budgets via the Budgeting workbench. (Actions->Budgeting Workbench)
+  - Budget Report
+
+    - the default account selection isn't very reasonable, Inc & Exp
+      would be better
+
+    - sometimes negative numbers render on two lines in their table-cell
+
+  - Budget GUI
+
+    - default account filter doesn't take effect until options are
+      opened, should take effect as soon as view is opened
+
+    - it might be nice to disallow some of the more unusual recurrences
+
+    - better if budget list dialog allowed double click to open
+
+    - need help text
 
-  - Track budget tab still needs to be completed.  Should allow you to look
-    at predicted vs. actual information.
+    - should displaying zero values be optional?
 
-  - No save to file functionality.  Therefore budgets must currently be
-    created fresh each time gnucash is started.  First thing what I want to fix.
+    - it'd be nice if there was a summary column at the far right
 
-  - Should the budgeting workbench fit into the new windowing scheme better?
-    Currently it is its own window but maybe each workbench should be a tab
-    in the new layout.  How would this work with the sub-tabs?  Have to think
-    about this some more.
+  - Budget Engine
 
-    - The druid for 'New' is created underneath the Budget-list window.
+    - Do budgets play nice with QSF?
 
-  - Probably more TODO but these are the main points.
+    - Still a lot of dead legacy code hanging around
 
 - Hierarchy Merge - BROKEN
 
Index: gnucash/HACKING
===================================================================
--- gnucash.orig/HACKING
+++ gnucash/HACKING
@@ -76,7 +76,7 @@ Starting Gnucash from the build tree:
 
 To run gnucash from your build tree:
 -- edit ./src/bin/overrides/gnucash and replace gnucash-env with
-   gnucash-build-env
+   ./src/bin/overrides/gnucash-build-env
 -- then start gnucash by saying ./src/bin/overrides/gnucash
 -- Make sure you undo this change before installing gnucash
 
@@ -113,6 +113,10 @@ To run gdb on an opt-style-install from 
    [gdb output]
    gdb> run -e main -s ../libexec/overrides/gnucash --g-fatal-warning
 
+You'll also probably want to know about these:
+
+    % gdb> catch fork
+    % gdb> set follow-fork-mode child
 
 -----
 It may be the case that running GDB from within emacs doesn't work for you,
Index: gnucash/src/app-utils/config-var.scm
===================================================================
--- gnucash.orig/src/app-utils/config-var.scm
+++ gnucash/src/app-utils/config-var.scm
@@ -15,7 +15,7 @@
 ;; 59 Temple Place - Suite 330        Fax:    +1-617-542-2652
 ;; Boston, MA  02111-1307,  USA       gnu at gnu.org
 
-;;; config-var: You can create them, set values, find out of the value
+;;; config-var: You can create them, set values, find out if the value
 ;;; is different from the default, and you can get a description.  You
 ;;; can also specify an action function which will be called whenever
 ;;; the value is changed.  The action function receives the special
Index: gnucash/src/app-utils/gnc-component-manager.h
===================================================================
--- gnucash.orig/src/app-utils/gnc-component-manager.h
+++ gnucash/src/app-utils/gnc-component-manager.h
@@ -178,8 +178,7 @@ gint gnc_register_gui_component_scm (con
  * component_id: id of component which is watching the entity
  * session:      the session this component is associated with
  */
-void
-gnc_gui_component_set_session (gint component_id, gpointer session);
+void gnc_gui_component_set_session (gint component_id, gpointer session);
 
 /* gnc_gui_component_watch_entity
  *   Add an entity to the list of those being watched by the component.
Index: gnucash/src/backend/file/gnc-schedxaction-xml-v2.c
===================================================================
--- gnucash.orig/src/backend/file/gnc-schedxaction-xml-v2.c
+++ gnucash/src/backend/file/gnc-schedxaction-xml-v2.c
@@ -645,6 +645,7 @@ gnc_schedXaction_end_handler(gpointer da
                change re: storing template accounts. */
             /* Fix: get account with name of our GUID from the template
                accounts group.  Make that our template_acct pointer. */
+            /* THREAD-UNSAFE */
             id = guid_to_string( xaccSchedXactionGetGUID( sx ) );
             ag = gnc_book_get_template_group(book);
             if ( ag == NULL )
Index: gnucash/src/backend/postgres/gncquery.c
===================================================================
--- gnucash.orig/src/backend/postgres/gncquery.c
+++ gnucash/src/backend/postgres/gncquery.c
@@ -549,6 +549,7 @@ kvp_right_operand(sqlQuery * sq, KvpValu
             return g_strdup_printf(SQL_DBL_FMT, kvp_value_get_double(value));
 
         case KVP_TYPE_GUID:{
+            /* THREAD-UNSAFE */
             const char *guid = guid_to_string(kvp_value_get_guid(value));
             char *s = g_strdup_printf("'%s'", guid);
             return s;
Index: gnucash/src/business/business-utils/business-options.scm
===================================================================
--- gnucash.orig/src/business/business-utils/business-options.scm
+++ gnucash/src/business/business-utils/business-options.scm
@@ -58,7 +58,7 @@
                 (value-validator (convert-to-invoice invoice))))))
     (gnc:make-option
      section name sort-tag 'invoice documentation-string getter
-     (lambda (invoice)
+     (lambda (invoice) ;; setter
        (if (not invoice) (set! invoice (default-getter)))
        (set! invoice (convert-to-invoice invoice))
        (let* ((result (validator invoice))
Index: gnucash/src/doc/design/engine.texinfo
===================================================================
--- gnucash.orig/src/doc/design/engine.texinfo
+++ gnucash/src/doc/design/engine.texinfo
@@ -246,7 +246,7 @@ Return a GUID which is guaranteed to alw
 @subsection How to use GUIDs
 
 The Engine API functions which access the GUID for a specific entity
-return a pointer to the GUID. @strong{Note:} Do not store the pointer
+return a pointer to the GUID.  NOTE: Do not store the pointer
 itself! Instead, store a copy of the GUID. Storing the pointer itself
 would present some of the same problems as using the account pointer
 directly. Example:
@@ -282,12 +282,12 @@ Return the @code{memcmp} of the two GUID
 You can encode and decode GUIDs and their string representations using the
 next two functions.
 
- at deftypefun {char *} guid_to_string (const GUID * @var{guid})
+ at deftypefun {const char *} guid_to_string (const GUID * @var{guid})
 Return a null-terminated string encoding of @var{guid}. String encodings
 of identifiers are hex numbers printed only with the characters @code{0}
 through @code{9} and @code{a} through @code{f}.  The encoding will
 always be @code{GUID_ENCODING_LENGTH} characters long. The returned
-string should be freed when no longer needed.
+string must NOT be freed when no longer needed.
 @end deftypefun
 
 @deftypefun {char *} guid_to_string_buff (const GUID * @var{guid}, char * @var{buff})
Index: gnucash/src/doc/multicurrency-discussion.txt
===================================================================
--- gnucash.orig/src/doc/multicurrency-discussion.txt
+++ gnucash/src/doc/multicurrency-discussion.txt
@@ -35,10 +35,6 @@ Definition of \a gnc-monetary is in src/
 
 <goonie> OK, cool, I think I can figure it out.
 
-<cstim> goonie: You will need to use a commodity-collector from report-utilities.scm
-
-<goonie> OK, cool, I think I can figure it out.
-
 <cstim> If you want the total of only one commodity, you can use the 'getpair action of commodity-collector...
  but if you want to show (correctly) all of the currencies, you will have a lot of trouble.
  Basically, I have the "reference implementation" in html-utilities.scm .
@@ -194,8 +190,6 @@ the amount of the account-commodity invo
  We could \a gnc:split-get-share-amount => \a gnc:split-get-damount
  whatever. My point for the Beer is let's have some.
 
-<dres> beer doesn't need a point.  it just is.
-
 <cstim> oops. 
  I would expect that the transaction report uses \a gnc:split-get-share-amount
  which in this case gives you already the amounts exchanged into AUD and everything's fine.
Index: gnucash/src/engine/Query.h
===================================================================
--- gnucash.orig/src/engine/Query.h
+++ gnucash/src/engine/Query.h
@@ -70,7 +70,7 @@ typedef enum {
 
 /* After the query has been set up, call one of these to run the query. 
  *    XXX The routines below should be replaced by a query
- *    that explicitly asks for a list of the desied item.
+ *    that explicitly asks for a list of the desired item.
  *
  * The xaccQueryGetSplits() routine returns all splits matching the 
  *    query.  Any given split will appear at most once in the result;
Index: gnucash/src/engine/SX-book.c
===================================================================
--- gnucash.orig/src/engine/SX-book.c
+++ gnucash/src/engine/SX-book.c
@@ -68,7 +68,8 @@ gnc_book_get_template_group( QofBook *bo
 }
 
 void
-gnc_collection_set_template_group (QofCollection *col, AccountGroup *templateGroup)
+gnc_collection_set_template_group (QofCollection *col,
+                                   AccountGroup *templateGroup)
 {
   AccountGroup *old_grp;
   if (!col) return;
Index: gnucash/src/engine/SchedXaction.c
===================================================================
--- gnucash.orig/src/engine/SchedXaction.c
+++ gnucash/src/engine/SchedXaction.c
@@ -65,7 +65,9 @@ xaccSchedXactionInit( SchedXaction *sx, 
 
    /* create a new template account for our splits */
    sx->template_acct = xaccMallocAccount(book);
-   xaccAccountSetName( sx->template_acct, guid_to_string( &sx->inst.entity.guid ));
+   /* THREAD-UNSAFE */
+   xaccAccountSetName( sx->template_acct,
+                       guid_to_string( &sx->inst.entity.guid ));
    xaccAccountSetCommodity
      (sx->template_acct,
       gnc_commodity_new( book,
Index: gnucash/src/engine/TransactionP.h
===================================================================
--- gnucash.orig/src/engine/TransactionP.h
+++ gnucash/src/engine/TransactionP.h
@@ -76,7 +76,7 @@
  * accounts.  Thus, a single credit-card transaction might be split
  * between "dining", "tips" and "taxes" categories.
  *
- * A "split" is more commonly refered to as a "entry" in a "transaction".
+ * A "split" is more commonly referred to as an "entry" in a "transaction".
  */
 
 /* Flags for handling cap-gains status */
@@ -110,7 +110,7 @@ struct split_s
   char  * memo;
 
   /* The action field is an arbitrary user-assigned value.
-   * It is meant to be a very short (one to ten cahracter) string that
+   * It is meant to be a very short (one to ten character) string that
    * signifies the "type" of this split, such as e.g. Buy, Sell, Div,
    * Withdraw, Deposit, ATM, Check, etc. The idea is that this field
    * can be used to create custom reports or graphs of data.
Index: gnucash/src/engine/gnc-numeric.h
===================================================================
--- gnucash.orig/src/engine/gnc-numeric.h
+++ gnucash/src/engine/gnc-numeric.h
@@ -118,7 +118,7 @@ typedef struct _gnc_numeric gnc_numeric;
 
     Valid values for denom are:
     GNC_DENOM_AUTO  -- compute denominator exactly
-    integer n       -- Force the denominator of teh result to be this integer
+    integer n       -- Force the denominator of the result to be this integer
     GNC_DENOM_RECIPROCAL -- Use 1/n as the denominator (???huh???)
 
     Valid values for 'how' are bitwise combinations of zero or one
@@ -264,7 +264,7 @@ typedef enum {
 
 /** Values that can be passed as the 'denom' argument.  
  *  The include a positive number n to be used as the 
- *  denominator of teh output value.  Other possibilities 
+ *  denominator of the output value.  Other possibilities
  *  include the list below:
  */
 
Index: gnucash/src/engine/guid.c
===================================================================
--- gnucash.orig/src/engine/guid.c
+++ gnucash/src/engine/guid.c
@@ -108,6 +108,7 @@ guid_null(void)
     int i;
     char *tmp = "NULLGUID.EMPTY.";
 
+    /* 16th space for '\O' */
     for (i = 0; i < 16; i++)
       null_guid.data[i] = tmp[i];
 
Index: gnucash/src/engine/qofbook.h
===================================================================
--- gnucash.orig/src/engine/qofbook.h
+++ gnucash/src/engine/qofbook.h
@@ -130,7 +130,8 @@ void qof_book_set_data (QofBook *book, c
  *  when the book is destroyed.  The argument to the callback will be 
  *  the book followed by the data pointer.
  */
-void qof_book_set_data_fin (QofBook *book, const char *key, gpointer data, QofBookFinalCB);
+void qof_book_set_data_fin (QofBook *book, const char *key, gpointer data,
+                            QofBookFinalCB);
 
 /** Retrieves arbitrary pointers to structs stored by qof_book_set_data. */
 gpointer qof_book_get_data (QofBook *book, const char *key);
Index: gnucash/src/engine/qofclass.c
===================================================================
--- gnucash.orig/src/engine/qofclass.c
+++ gnucash/src/engine/qofclass.c
@@ -70,7 +70,7 @@ qof_class_register (QofIdTypeConst obj_n
     g_hash_table_insert (classTable, (char *)obj_name, ht);
   }
 
-  /* At least right now, we allow dummy, paramterless objects, 
+  /* At least right now, we allow dummy, parameterless objects,
    * for testing purposes.  Although I suppose that should be 
    * an error..  */
   /* Now insert all the parameters */
Index: gnucash/src/engine/qofclass.h
===================================================================
--- gnucash.orig/src/engine/qofclass.h
+++ gnucash/src/engine/qofclass.h
@@ -185,8 +185,8 @@ typedef int (*QofSortFunc)(gpointer, gpo
  *  controlling the object.   The getters are typically used by the
  *  query subsystem to query type specific data.   Note that there
  *  is no particular requirement for there to be a setter for every
- *  getter or even vice-versa, nor is there any requeirement for these
- *  to map 'cleanly' or orthogonaly to the underlying object.  The
+ *  getter or even vice-versa, nor is there any requirement for these
+ *  to map 'cleanly' or orthogonally to the underlying object.  The
  *  parameters are really just a set of value setting and getting 
  *  routines.
  *
Index: gnucash/src/engine/qofquery.c
===================================================================
--- gnucash.orig/src/engine/qofquery.c
+++ gnucash/src/engine/qofquery.c
@@ -1700,6 +1700,7 @@ qof_query_printValueForParam (QofQueryPr
                        qof_query_printGuidMatch (pdata->options));
     for (node = pdata->guids; node; node = node->next)
     {
+        /* THREAD-UNSAFE */
       g_string_sprintfa (gs, ", guids: %s",
 			 guid_to_string ((GUID *) node->data));
     }
Index: gnucash/src/engine/qofquery.h
===================================================================
--- gnucash.orig/src/engine/qofquery.h
+++ gnucash/src/engine/qofquery.h
@@ -155,10 +155,12 @@ void qof_query_destroy (QofQuery *q);
  */
 void qof_query_search_for (QofQuery *query, QofIdTypeConst obj_type);
 
-/** Set the book to be searched.  Books contain/identify collections 
+/** Set the book to be searched.  Books contain/identify collections
  *  of objects; the search will be performed over those books
- *  specified with this function.  If no books are set, no results 
- *  will be returned (since there is nothing to search over).
+ *  specified with this function.  If no books are set, no results
+ *  will be returned (since there is nothing to search over). (CAS:
+ *  Apparently, if no books are set, you'll actually get a critical
+ *  assertion failure.)
  *
  *  You can search multiple books.  To specify multiple books, call 
  *  this function multiple times with different arguments.  
Index: gnucash/src/engine/qofsession.c
===================================================================
--- gnucash.orig/src/engine/qofsession.c
+++ gnucash/src/engine/qofsession.c
@@ -82,7 +82,7 @@ qof_session_add_close_hook (GFunc fn, gp
   GHook *hook;
 
   if (session_closed_hooks == NULL) {
-    session_closed_hooks = malloc(sizeof(GHookList));
+      session_closed_hooks = malloc(sizeof(GHookList)); /* LEAKED */
     g_hook_list_init (session_closed_hooks, sizeof(GHook));
   }
 
@@ -1167,6 +1167,7 @@ qof_session_load (QofSession *session,
 		qof_book_set_backend (ob, NULL);
 		qof_book_destroy (ob);
 	}
+        /* Um, I think we're leaking the oldbooks list. */
 	
 	LEAVE ("sess = %p, book_id=%s", session, session->book_id
          ? session->book_id : "(null)");
@@ -1422,7 +1423,7 @@ qof_session_destroy (QofSession *session
   /* destroy the backend */
   qof_session_destroy_backend(session);
 
-  for (node=session->books; node; node=node->next)
+  for (node = session->books; node; node = node->next)
   {
     QofBook *book = node->data;
     qof_book_set_backend (book, NULL);
Index: gnucash/src/experimental/cgi-bin/gnc-server.c
===================================================================
--- gnucash.orig/src/experimental/cgi-bin/gnc-server.c
+++ gnucash/src/experimental/cgi-bin/gnc-server.c
@@ -120,7 +120,7 @@ auth_user (const char * name, const char
   guid = g_new (GUID, 1);
   guid_new (guid);
   logged_in_users = g_list_prepend (logged_in_users, guid);
-  session_auth_string = guid_to_string (guid);
+  session_auth_string = guid_to_string (guid); /* THREAD UNSAFE */
   return session_auth_string;
 }
 
Index: gnucash/src/gnome-utils/dialog-utils.c
===================================================================
--- gnucash.orig/src/gnome-utils/dialog-utils.c
+++ gnucash/src/gnome-utils/dialog-utils.c
@@ -77,7 +77,7 @@ option_menu_destroy_cb (GtkObject *obj, 
 }
 
 /********************************************************************\
- * gnc_ui_create_option_button                                      *
+ * gnc_build_option_menu: WARNING: this comment clearly wrong       *
  *   create an option button given the option structure             *
  *                                                                  *
  * Args: option_info - the option structure to use                  *
@@ -869,9 +869,17 @@ gnc_clist_columns_autosize (GtkCList *li
   gtk_clist_columns_autosize (list);
 }
 
+/*   Glade Stuff
+ *
+ *
+ */
 
 static gboolean glade_inited = FALSE;
 
+/* gnc_glade_xml_new: a convenience wrapper for glade_xml_new
+ *   - takes care of glade initialization, if needed
+ *   - takes care of finding the directory for glade files
+ */
 GladeXML *
 gnc_glade_xml_new (const char *filename, const char *root)
 {
@@ -896,6 +904,9 @@ gnc_glade_xml_new (const char *filename,
   return xml;
 }
 
+/* gnc_glade_lookup_widget:  Given a root (or at least ancestor) widget,
+ *   find the child widget with the given name.
+ */
 GtkWidget *
 gnc_glade_lookup_widget (GtkWidget *widget, const char *name)
 {
Index: gnucash/src/gnome-utils/gnc-amount-edit.c
===================================================================
--- gnucash.orig/src/gnome-utils/gnc-amount-edit.c
+++ gnucash/src/gnome-utils/gnc-amount-edit.c
@@ -4,9 +4,9 @@
  * Copyright (C) 2000 Dave Peticolas <dave at krondo.com>
  * All rights reserved.
  *
- * Gnucash is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of the
+ * Gnucash is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
  * License, or (at your option) any later version.
  *
  * Gnucash is distributed in the hope that it will be useful,
Index: gnucash/src/gnome-utils/gnc-amount-edit.h
===================================================================
--- gnucash.orig/src/gnome-utils/gnc-amount-edit.h
+++ gnucash/src/gnome-utils/gnc-amount-edit.h
@@ -4,10 +4,10 @@
  * Copyright (C) 2000 Dave Peticolas <dave at krondo.com>
  * All rights reserved.
  *
- * GnuCash is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
+ * GnuCash is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
  *
  * Gnucash is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
Index: gnucash/src/gnome-utils/gnc-date-format.c
===================================================================
--- gnucash.orig/src/gnome-utils/gnc-date-format.c
+++ gnucash/src/gnome-utils/gnc-date-format.c
@@ -40,6 +40,7 @@
 #include "gnc-date-format.h"
 #include "dialog-utils.h"
 
+/* Perhaps it's better just to use MAX_DATE_LENGTH defined in gnc-date.h */
 #define MAX_DATE_LEN 80
 
 enum {
Index: gnucash/src/gnome-utils/gnc-plugin-manager.h
===================================================================
--- gnucash.orig/src/gnome-utils/gnc-plugin-manager.h
+++ gnucash/src/gnome-utils/gnc-plugin-manager.h
@@ -78,8 +78,10 @@ typedef struct {
 	GObjectClass object;
 
 	/* Signals */
-	void (* plugin_added) (GncPluginManager *plugin_manager, GncPlugin *plugin);
-	void (* plugin_removed) (GncPluginManager *plugin_manager, GncPlugin *plugin);
+	void (* plugin_added)
+         (GncPluginManager *plugin_manager, GncPlugin *plugin);
+	void (* plugin_removed)
+         (GncPluginManager *plugin_manager, GncPlugin *plugin);
 } GncPluginManagerClass;
 
 /** Retrieve the GType value for the gnucash plugin manager.
Index: gnucash/src/gnome-utils/gnc-plugin.h
===================================================================
--- gnucash.orig/src/gnome-utils/gnc-plugin.h
+++ gnucash/src/gnome-utils/gnc-plugin.h
@@ -102,10 +102,13 @@ typedef struct {
 	void (* gconf_notifications) (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data);
 
 	/* Virtual Table */
-	void (* add_to_window) (GncPlugin *plugin, GncMainWindow *window, GQuark type);
-	void (* remove_from_window) (GncPlugin *plugin, GncMainWindow *window, GQuark type);
+	void (* add_to_window)
+         (GncPlugin *plugin, GncMainWindow *window, GQuark type);
+	void (* remove_from_window)
+         (GncPlugin *plugin, GncMainWindow *window, GQuark type);
 
-	GncPluginPage *(* create_page) (GncPlugin *plugin, const gchar *uri);
+	GncPluginPage *(* create_page)
+         (GncPlugin *plugin, const gchar *uri);
 } GncPluginClass;
 
 /* function prototypes */
Index: gnucash/src/gnome-utils/gnc-tree-model-account.c
===================================================================
--- gnucash.orig/src/gnome-utils/gnc-tree-model-account.c
+++ gnucash/src/gnome-utils/gnc-tree-model-account.c
@@ -1409,7 +1409,7 @@ gnc_tree_model_account_delete_event_help
  *  has been deleted from the real model (which is the engine's
  *  account tree for us), but once the account has been deleted from
  *  the engine we have no way to determine the path to pass to
- *  row_deleted().  This is a PITA, but the only ither choice is to
+ *  row_deleted().  This is a PITA, but the only other choice is to
  *  have this model mirror the engine's accounts instead of
  *  referencing them directly.
  *
@@ -1419,7 +1419,7 @@ gnc_tree_model_account_delete_event_help
  *  cares about items of type "account".
  *
  *  @param event type The type of the event. This function only cares
- *  about items of type ADD, REMOVE, and DESTROY.
+ *  about items of type ADD, REMOVE, MODIFY, and DESTROY.
  *
  *  @param user_data A pointer to the account tree model.
  */
@@ -1458,7 +1458,8 @@ gnc_tree_model_account_event_handler (GU
 	 case GNC_EVENT_ADD:
 	  /* Tell the filters/views where the new account was added. */
 	  DEBUG("add account %p (%s)", account, account_name);
-	  if (gnc_tree_model_account_get_iter_from_account (model, account, &iter)) {
+	  if (gnc_tree_model_account_get_iter_from_account (
+                  model, account, &iter)) {
 	    path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &iter);
 	    gtk_tree_model_row_inserted (GTK_TREE_MODEL(model), path, &iter);
 	    gnc_tree_model_account_path_changed (model, path);
Index: gnucash/src/gnome-utils/gnc-tree-model.c
===================================================================
--- gnucash.orig/src/gnome-utils/gnc-tree-model.c
+++ gnucash/src/gnome-utils/gnc-tree-model.c
@@ -78,6 +78,8 @@ gnc_tree_model_get_type (void)
     //  NULL
     //};
 
+    /* CAS: I think this should subclass GObject, not GtkObject. */
+
     gnc_tree_model_type = g_type_register_static (GTK_TYPE_OBJECT,
 						  GNC_TREE_MODEL_NAME,
 						  &our_info, 0);
Index: gnucash/src/gnome/dialog-scheduledxaction.c
===================================================================
--- gnucash.orig/src/gnome/dialog-scheduledxaction.c
+++ gnucash/src/gnome/dialog-scheduledxaction.c
@@ -1567,7 +1567,9 @@ schedXact_editor_create_ledger( SchedXac
                                                  "tempxaction_frame" ) );
 
 	/* Create the ledger */
-        sxed->sxGUIDstr = g_strdup( guid_to_string( xaccSchedXactionGetGUID(sxed->sx) ) );
+        /* THREAD-UNSAFE */
+        sxed->sxGUIDstr = g_strdup( guid_to_string(
+                                        xaccSchedXactionGetGUID(sxed->sx) ) );
         sxed->ledger = gnc_ledger_display_template_gl( sxed->sxGUIDstr );
         splitreg = gnc_ledger_display_get_split_register( sxed->ledger );
 
Index: gnucash/src/gnome/dialog-sxsincelast.c
===================================================================
--- gnucash.orig/src/gnome/dialog-sxsincelast.c
+++ gnucash/src/gnome/dialog-sxsincelast.c
@@ -2691,6 +2691,8 @@ create_transactions_on( SchedXaction *sx
         ag = gnc_book_get_template_group( gnc_get_current_book () );
         id = guid_to_string( xaccSchedXactionGetGUID(sx) );
         if ( ag && id ) {
+            /* This looks strange but it's right.  The account is
+               named after the guid string. */
                 acct = xaccGetAccountFromName( ag, id );
                 if ( acct ) {
                         createUD.tci = tci;
@@ -2738,6 +2740,7 @@ sxsl_get_sx_vars( SchedXaction *sx, GHas
 
                 ag = gnc_book_get_template_group( gnc_get_current_book () );
                 id = guid_to_string( xaccSchedXactionGetGUID(sx) );
+                /* Get account named after guid string. */
                 acct = xaccGetAccountFromName( ag, id );
                 splitList = xaccAccountGetSplitList( acct );
         }
Index: gnucash/src/report/report-gnome/gw-report-gnome-spec.scm
===================================================================
--- gnucash.orig/src/report/report-gnome/gw-report-gnome-spec.scm
+++ gnucash/src/report/report-gnome/gw-report-gnome-spec.scm
@@ -64,6 +64,9 @@
    '((<gw:int> report-id) (<gnc:MainWindow*> window))
    "Show report window")
 
+
+;; This is the function that's responsible for creating and returning
+;; the editor widget for a report's options.
   (gw:wrap-function
    ws
    'gnc:default-options-editor
Index: gnucash/src/report/report-gnome/report-gnome.scm
===================================================================
--- gnucash.orig/src/report/report-gnome/report-gnome.scm
+++ gnucash/src/report/report-gnome/report-gnome.scm
@@ -22,11 +22,15 @@
 (export gnc:report-menu-setup)
 (export gnc:add-report-template-menu-items)
 
+;; returns a function that takes a list: (options, report),
+;; and returns a widget
 (define (gnc:report-options-editor report) 
   (if (equal? (gnc:report-type report) "Multicolumn View")
       gnc:column-view-edit-options
       gnc:default-options-editor))
 
+;; do not rely on the return value of this function - it has none.
+;; instead, this function's side-effect is to set the report's editor widget.
 (define (gnc:report-edit-options report) 
   (let* ((editor-widg (gnc:report-editor-widget report)))
     (if editor-widg
@@ -104,7 +108,7 @@
   (define tax-menu 
     (gnc:make-menu gnc:menuname-taxes (list gnc:menuname-reports)))
 
-  (gnc:warn "report-menu-setup")
+  (gnc:warn "report-menu-setup") ;; why do we do this?
 
   ;; (gnc:add-extension tax-menu)
   (gnc:add-extension income-expense-menu)
Index: gnucash/src/report/report-system/html-document.scm
===================================================================
--- gnucash.orig/src/report/report-system/html-document.scm
+++ gnucash/src/report/report-system/html-document.scm
@@ -106,6 +106,8 @@
     (do-list tree)
     retval))
 
+;; first optional argument is "headers?"
+;; returns the html document as a string, I think.
 (define (gnc:html-document-render doc . rest) 
   (let ((stylesheet (gnc:html-document-style-sheet doc))
         (headers? (if (null? rest) #f (if (car rest) #t #f))))
Index: gnucash/src/report/report-system/html-table.scm
===================================================================
--- gnucash.orig/src/report/report-system/html-table.scm
+++ gnucash/src/report/report-system/html-table.scm
@@ -418,6 +418,8 @@
 	 )
     ))
 
+;; if the 4th arg is a cell, overwrite the existing cell,
+;; otherwise, append all remaining objects to the existing cell
 (define (gnc:html-table-set-cell! table row col . objects)
   (let ((rowdata #f)
 	(row-loc #f)
@@ -562,12 +564,15 @@
 ;; It would be nice to have table row/col/cell accessor functions in here.
 ;; It would also be nice to have table juxtaposition functions, too.
 ;; i.e., (gnc:html-table-nth-row table n)
+;;  [ CAS: how is that different from gnc:html-table-get-row ? ]
+
 ;;       (gnc:html-table-append-table-horizontal table add-table)
 ;; (An old merge-table used to exist inside balance-sheet.scm/GnuCash 1.8.9.)
 ;; Feel free to contribute! :-)
 ;; 
 
 ;; This function was moved here from balance-sheet.scm.
+;; This function "stacks" the two tables vertically.
 (define (gnc:html-table-merge t1 t2)
   (begin 
     (gnc:html-table-set-data! t1
Index: gnucash/src/report/report-system/report-utilities.scm
===================================================================
--- gnucash.orig/src/report/report-system/report-utilities.scm
+++ gnucash/src/report/report-system/report-utilities.scm
@@ -336,15 +336,16 @@
 
 ;; A commodity collector. This is intended to handle multiple
 ;; currencies' amounts. The amounts are accumulated via 'add, the
-;; result can be fetched via 'format.  Used to work with strings as
-;; currencies and doubles as values, but now it uses <gnc:commodity*>
-;; as commodity and <gnc:numeric> as value. 
-;; Old Example: (define a (make-commodity-collector)) ... 
-;; (a 'add 'USD 12) ...  (a 'format (lambda(x y)(list x y)) #f) 
-;; used to give you something like 
-;; ((USD 123.4) (DEM 12.21) (FRF -23.32))
-;; But now USD is a <gnc:commodity*> and 123.4 a <gnc:numeric>, so
-;; there is no simple example anymore.
+;; result can be fetched via 'format.  This used to work with strings
+;; as currencies and doubles as values, but now it uses
+;; <gnc:commodity*> as commodity and <gnc:numeric> as value.
+;;
+;; Old Example: (define a (make-commodity-collector)) ...  (a 'add 'USD
+;; 12) ...  (a 'format (lambda(x y)(list x y)) #f) used to give you
+;; something like ((USD 123.4) (DEM 12.21) (FRF -23.32))
+;;
+;; New Example: But now USD is a <gnc:commodity*> and 123.4 a
+;; <gnc:numeric>, so there is no simple example anymore.
 ;;
 ;; The functions:
 ;;   'add <commodity> <amount>: Add the given amount to the 
@@ -456,9 +457,15 @@
 	('getmonetary (getmonetary commodity amount))
 	('list commoditylist) ; this one is only for internal use
 	(else (gnc:warn "bad commodity-collector action: " action))))))
+
+
 ;; Bah. Let's get back to normal data types -- this procedure thingy
 ;; from above makes every code almost unreadable. First step: replace
 ;; all 'action function calls by the normal functions below.
+
+;; CAS: ugh.  Having two usages is even *more* confusing, so let's
+;; please settle on one or the other.  What's Step 2?  How 'bout
+;; documenting the new functions?
 (define (gnc:commodity-collector-add collector commodity amount)
   (collector 'add commodity amount))
 (define (gnc:commodity-collector-merge collector other-collector)
Index: gnucash/src/report/report-system/report.scm
===================================================================
--- gnucash.orig/src/report/report-system/report.scm
+++ gnucash/src/report/report-system/report.scm
@@ -26,8 +26,8 @@
 ;; to generate the reports menu whenever a new window opens and to
 ;; figure out what to do when a report needs to be generated.
 ;;
-;; The key is the string naming the report and the value is the 
-;; report definition structure.
+;; The key is the string naming the report (the report "type") and the
+;; value is the report definition structure.
 (define *gnc:_report-templates_* (make-hash-table 23))
 
 ;; this is a hash of 'report ID' to instantiated report.  the 
@@ -47,6 +47,7 @@
 (define gnc:pagename-display (N_ "Display"))
 (define gnc:optname-reportname (N_ "Report name"))
 
+;; A <report-template> represents one of the available report types.
 (define <report-template>
   (make-record-type "<report-template>"
                     ;; The data items in a report record
@@ -55,6 +56,7 @@
                               renderer in-menu? menu-path menu-name
                               menu-tip export-types export-thunk)))
 
+;; if args is supplied, it is a list of field names and values
 (define (gnc:define-report . args)
   ;; For now the version is ignored, but in the future it'll let us
   ;; change behaviors without breaking older reports.
@@ -173,6 +175,7 @@
           (gnc:register-option options names)
           options))))
 
+;; A <report> represents an instantiation of a particular report type.
 (define <report>
   (make-record-type "<report>"
                     '(type id options dirty? needs-save? editor-widget ctext)))
@@ -221,12 +224,15 @@
 (define gnc:report-set-editor-widget!
   (record-modifier <report> 'editor-widget))
 
+;; ctext is for caching the rendered html
 (define gnc:report-ctext 
   (record-accessor <report> 'ctext))
 
 (define gnc:report-set-ctext!
   (record-modifier <report> 'ctext))
 
+;; gnc:make-report instantiates a report from a report-template.
+;; The actual report is stored away in a hash-table -- only the id is returned.
 (define (gnc:make-report template-name . rest)
   (let ((r ((record-constructor <report>) 
             template-name ;; type
@@ -272,6 +278,8 @@
         (gnc:report-template-new-options template)
         #f)))
 
+;; A convenience wrapper to get the report-template's export types from
+;; an instantiated report.
 (define (gnc:report-export-types report)
   (let ((template (hash-ref *gnc:_report-templates_* 
                             (gnc:report-type report))))
@@ -279,6 +287,8 @@
         (gnc:report-template-export-types template)
         #f)))
 
+;; A convenience wrapper to get the report-template's export thunk from
+;; an instantiated report.
 (define (gnc:report-export-thunk report)
   (let ((template (hash-ref *gnc:_report-templates_* 
                             (gnc:report-type report))))
@@ -393,30 +403,37 @@
 	     (open-file conf-file-name "a"))
     (force-output)))
 
+;; gets the renderer from the report template;
+;; gets the stylesheet from the report;
+;; renders the html doc and caches the resulting string;
+;; returns the html string.
 (define (gnc:report-render-html report headers?)
   (if (and (not (gnc:report-dirty? report))
            (gnc:report-ctext report))
       ;; if there's clean cached text, return it 
-      (begin 
-        (gnc:report-ctext report))
+      ;;(begin
+      (gnc:report-ctext report)
+      ;;  )
       
       ;; otherwise, rerun the report 
       (let ((template (hash-ref *gnc:_report-templates_* 
                                 (gnc:report-type report)))
 	    (doc #f))
         (set! doc (if template
-            (let* ((renderer (gnc:report-template-renderer template))
-                   (stylesheet (gnc:report-stylesheet report))
-                   (doc (renderer report))
-                   (html #f))
-              (gnc:html-document-set-style-sheet! doc stylesheet)
-              (set! html (gnc:html-document-render doc headers?))
-              (gnc:report-set-ctext! report html)
-              (gnc:report-set-dirty?! report #f)              
-              html)
-            #f))
-	doc)))
+                      (let* ((renderer (gnc:report-template-renderer template))
+                             (stylesheet (gnc:report-stylesheet report))
+                             (doc (renderer report))
+                             (html #f))
+                        (gnc:html-document-set-style-sheet! doc stylesheet)
+                        (set! html (gnc:html-document-render doc headers?))
+                        (gnc:report-set-ctext! report html) ;; cache the html
+                        (gnc:report-set-dirty?! report #f)  ;; mark it clean
+                        html)
+                      #f))
+	doc))) ;; YUK! inner doc is html-doc object; outer doc is a string.
 
+;; looks up the report by id and renders it with gnc:report-render-html
+;; marks the cursor busy during rendering; returns the html
 (define (gnc:report-run id)
   (let ((report (gnc:find-report id))
 	(start-time (gettimeofday))
@@ -435,6 +452,8 @@
     (gnc:unset-busy-cursor #f)
     html))
 
+
+;; "thunk" should take the report-type and the report template record
 (define (gnc:report-templates-for-each thunk)
   (hash-for-each (lambda (name template) (thunk name template))
                  *gnc:_report-templates_*))

--


More information about the gnucash-devel mailing list