r19337 - gnucash/trunk/src - Bug #447339 - custom reports with similar names misbehaving

Geert Janssens gjanssens at code.gnucash.org
Tue Jul 6 11:46:11 EDT 2010


Author: gjanssens
Date: 2010-07-06 11:46:11 -0400 (Tue, 06 Jul 2010)
New Revision: 19337
Trac: http://svn.gnucash.org/trac/changeset/19337

Modified:
   gnucash/trunk/src/gnome-utils/gnc-menu-extensions.c
   gnucash/trunk/src/gnome-utils/gnc-menu-extensions.scm
   gnucash/trunk/src/gnome-utils/gnome-utils.scm
   gnucash/trunk/src/report/report-gnome/report-gnome.scm
Log:
Bug #447339 - custom reports with similar names misbehaving

Modified: gnucash/trunk/src/gnome-utils/gnc-menu-extensions.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-menu-extensions.c	2010-07-06 06:11:40 UTC (rev 19336)
+++ gnucash/trunk/src/gnome-utils/gnc-menu-extensions.c	2010-07-06 15:46:11 UTC (rev 19337)
@@ -36,6 +36,7 @@
 {
     SCM type;
     SCM name;
+    SCM guid;
     SCM documentation;
     SCM path;
     SCM script;
@@ -45,7 +46,7 @@
 static QofLogModule log_module = GNC_MOD_GUI;
 
 static GSList *extension_list = NULL;
-static Getters getters = {0, 0, 0, 0, 0};
+static Getters getters = {0, 0, 0, 0, 0, 0};
 
 GSList *
 gnc_extensions_get_menu_list (void)
@@ -63,6 +64,7 @@
 
     getters.type = scm_c_eval_string("gnc:extension-type");
     getters.name = scm_c_eval_string("gnc:extension-name");
+    getters.guid = scm_c_eval_string("gnc:extension-guid");
     getters.documentation = scm_c_eval_string("gnc:extension-documentation");
     getters.path = scm_c_eval_string("gnc:extension-path");
     getters.script = scm_c_eval_string("gnc:extension-script");
@@ -118,6 +120,16 @@
 }
 
 
+/* returns malloc'd guid */
+static char *
+gnc_extension_guid (SCM extension)
+{
+    initialize_getters();
+
+    return gnc_guile_call1_to_string(getters.guid, extension);
+}
+
+
 /* returns malloc'd docs */
 static char *
 gnc_extension_documentation (SCM extension)
@@ -201,11 +213,11 @@
 
     actionName = g_string_sized_new( strlen( name ) + 7 );
 
-    // 'Mum & ble' => 'Mumble'
+    // 'Mum & ble12' => 'Mumble___ble12'
     for ( extChar = name; *extChar != '\0'; extChar++ )
     {
         if ( ! isalnum( *extChar ) )
-            continue;
+            g_string_append_c( actionName, '_' );
         g_string_append_c( actionName, *extChar );
     }
 
@@ -241,7 +253,7 @@
 {
     ExtensionInfo *ext_info;
     gchar *typeStr, *tmp;
-    const gchar *name;
+    const gchar *name, *guid;
 
     ext_info = g_new0(ExtensionInfo, 1);
     ext_info->extension = extension;
@@ -255,8 +267,9 @@
 
     /* Get all the pieces */
     name = gnc_extension_name(extension);
+    guid = gnc_extension_guid(extension);
     ext_info->ae.label = g_strdup(gettext(name));
-    ext_info->ae.name = gnc_ext_gen_action_name(name);
+    ext_info->ae.name = gnc_ext_gen_action_name(guid);
     ext_info->ae.tooltip = gnc_extension_documentation(extension);
     ext_info->ae.stock_id = NULL;
     ext_info->ae.accelerator = NULL;

Modified: gnucash/trunk/src/gnome-utils/gnc-menu-extensions.scm
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-menu-extensions.scm	2010-07-06 06:11:40 UTC (rev 19336)
+++ gnucash/trunk/src/gnome-utils/gnc-menu-extensions.scm	2010-07-06 15:46:11 UTC (rev 19337)
@@ -20,6 +20,8 @@
          type
          ;; The name of the extension in the menu
          name
+         ;; The guid of object the menu will refer to
+         guid
          ;; The tooltip
          documentation-string
          ;; A list of names indicating the menus under which this item is
@@ -30,6 +32,7 @@
          script)
   (vector type
           name
+          guid
           documentation-string
           path
           script))
@@ -38,18 +41,20 @@
   (vector-ref extension 0))
 (define (gnc:extension-name extension)
   (vector-ref extension 1))
+(define (gnc:extension-guid extension)
+  (vector-ref extension 2))
 (define (gnc:extension-documentation extension)
-  (vector-ref extension 2))
+  (vector-ref extension 3))
 (define (gnc:extension-path extension)
-  (vector-ref extension 3))
+  (vector-ref extension 4))
 (define (gnc:extension-script extension)
-  (vector-ref extension 4))
+  (vector-ref extension 5))
 
-(define (gnc:make-menu-item name documentation-string path script)
-  (gnc:make-extension 'menu-item name documentation-string path script))
+(define (gnc:make-menu-item name guid documentation-string path script)
+  (gnc:make-extension 'menu-item name guid documentation-string path script))
 
 (define (gnc:make-menu name path)
-  (gnc:make-extension 'menu name "" path #f))
+  (gnc:make-extension 'menu name name "" path #f))
 
 (define (gnc:make-separator path)
-  (gnc:make-extension 'separator "" "" path #f))
+  (gnc:make-extension 'separator "" "" "" path #f))

Modified: gnucash/trunk/src/gnome-utils/gnome-utils.scm
===================================================================
--- gnucash/trunk/src/gnome-utils/gnome-utils.scm	2010-07-06 06:11:40 UTC (rev 19336)
+++ gnucash/trunk/src/gnome-utils/gnome-utils.scm	2010-07-06 15:46:11 UTC (rev 19337)
@@ -9,6 +9,7 @@
 ;; from gnc-menu-extensions.scm
 (export gnc:extension-type)
 (export gnc:extension-name)
+(export gnc:extension-guid)
 (export gnc:extension-documentation)
 (export gnc:extension-path)
 (export gnc:extension-script)

Modified: gnucash/trunk/src/report/report-gnome/report-gnome.scm
===================================================================
--- gnucash/trunk/src/report/report-gnome/report-gnome.scm	2010-07-06 06:11:40 UTC (rev 19336)
+++ gnucash/trunk/src/report/report-gnome/report-gnome.scm	2010-07-06 15:46:11 UTC (rev 19337)
@@ -72,6 +72,7 @@
           (set! item
                 (gnc:make-menu-item
                  name
+                 (gnc:report-template-report-guid template)
                  menu-tip
                  menu-path
                  (lambda (window)
@@ -111,6 +112,7 @@
   (gnc-add-scm-extension 
    (gnc:make-menu-item
    (N_ "Custom Reports")
+   "4d3dcdc8890b11df99dd94cddfd72085"
    (N_ "Manage and run custom reports")
    (list gnc:menuname-reports)
    (lambda (window)
@@ -132,6 +134,7 @@
   (gnc-add-scm-extension
    (gnc:make-menu-item 
     (N_ "Welcome Sample Report")
+    "ad80271c890b11dfa79f2dcedfd72085"
     (N_ "Welcome-to-GnuCash report screen")
     (list gnc:menuname-reports gnc:menuname-utility "")
     (lambda (window)



More information about the gnucash-changes mailing list