mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug #447339 - custom reports with similar names misbehaving
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19337 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
3c8257c4c7
commit
4da2b4ab25
@ -36,6 +36,7 @@ struct _Getters
|
|||||||
{
|
{
|
||||||
SCM type;
|
SCM type;
|
||||||
SCM name;
|
SCM name;
|
||||||
|
SCM guid;
|
||||||
SCM documentation;
|
SCM documentation;
|
||||||
SCM path;
|
SCM path;
|
||||||
SCM script;
|
SCM script;
|
||||||
@ -45,7 +46,7 @@ struct _Getters
|
|||||||
static QofLogModule log_module = GNC_MOD_GUI;
|
static QofLogModule log_module = GNC_MOD_GUI;
|
||||||
|
|
||||||
static GSList *extension_list = NULL;
|
static GSList *extension_list = NULL;
|
||||||
static Getters getters = {0, 0, 0, 0, 0};
|
static Getters getters = {0, 0, 0, 0, 0, 0};
|
||||||
|
|
||||||
GSList *
|
GSList *
|
||||||
gnc_extensions_get_menu_list (void)
|
gnc_extensions_get_menu_list (void)
|
||||||
@ -63,6 +64,7 @@ initialize_getters()
|
|||||||
|
|
||||||
getters.type = scm_c_eval_string("gnc:extension-type");
|
getters.type = scm_c_eval_string("gnc:extension-type");
|
||||||
getters.name = scm_c_eval_string("gnc:extension-name");
|
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.documentation = scm_c_eval_string("gnc:extension-documentation");
|
||||||
getters.path = scm_c_eval_string("gnc:extension-path");
|
getters.path = scm_c_eval_string("gnc:extension-path");
|
||||||
getters.script = scm_c_eval_string("gnc:extension-script");
|
getters.script = scm_c_eval_string("gnc:extension-script");
|
||||||
@ -118,6 +120,16 @@ gnc_extension_name (SCM extension)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* 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 */
|
/* returns malloc'd docs */
|
||||||
static char *
|
static char *
|
||||||
gnc_extension_documentation (SCM extension)
|
gnc_extension_documentation (SCM extension)
|
||||||
@ -201,11 +213,11 @@ gnc_ext_gen_action_name (const gchar *name)
|
|||||||
|
|
||||||
actionName = g_string_sized_new( strlen( name ) + 7 );
|
actionName = g_string_sized_new( strlen( name ) + 7 );
|
||||||
|
|
||||||
// 'Mum & ble' => 'Mumble'
|
// 'Mum & ble12' => 'Mumble___ble12'
|
||||||
for ( extChar = name; *extChar != '\0'; extChar++ )
|
for ( extChar = name; *extChar != '\0'; extChar++ )
|
||||||
{
|
{
|
||||||
if ( ! isalnum( *extChar ) )
|
if ( ! isalnum( *extChar ) )
|
||||||
continue;
|
g_string_append_c( actionName, '_' );
|
||||||
g_string_append_c( actionName, *extChar );
|
g_string_append_c( actionName, *extChar );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +253,7 @@ gnc_create_extension_info (SCM extension)
|
|||||||
{
|
{
|
||||||
ExtensionInfo *ext_info;
|
ExtensionInfo *ext_info;
|
||||||
gchar *typeStr, *tmp;
|
gchar *typeStr, *tmp;
|
||||||
const gchar *name;
|
const gchar *name, *guid;
|
||||||
|
|
||||||
ext_info = g_new0(ExtensionInfo, 1);
|
ext_info = g_new0(ExtensionInfo, 1);
|
||||||
ext_info->extension = extension;
|
ext_info->extension = extension;
|
||||||
@ -255,8 +267,9 @@ gnc_create_extension_info (SCM extension)
|
|||||||
|
|
||||||
/* Get all the pieces */
|
/* Get all the pieces */
|
||||||
name = gnc_extension_name(extension);
|
name = gnc_extension_name(extension);
|
||||||
|
guid = gnc_extension_guid(extension);
|
||||||
ext_info->ae.label = g_strdup(gettext(name));
|
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.tooltip = gnc_extension_documentation(extension);
|
||||||
ext_info->ae.stock_id = NULL;
|
ext_info->ae.stock_id = NULL;
|
||||||
ext_info->ae.accelerator = NULL;
|
ext_info->ae.accelerator = NULL;
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
type
|
type
|
||||||
;; The name of the extension in the menu
|
;; The name of the extension in the menu
|
||||||
name
|
name
|
||||||
|
;; The guid of object the menu will refer to
|
||||||
|
guid
|
||||||
;; The tooltip
|
;; The tooltip
|
||||||
documentation-string
|
documentation-string
|
||||||
;; A list of names indicating the menus under which this item is
|
;; A list of names indicating the menus under which this item is
|
||||||
@ -30,6 +32,7 @@
|
|||||||
script)
|
script)
|
||||||
(vector type
|
(vector type
|
||||||
name
|
name
|
||||||
|
guid
|
||||||
documentation-string
|
documentation-string
|
||||||
path
|
path
|
||||||
script))
|
script))
|
||||||
@ -38,18 +41,20 @@
|
|||||||
(vector-ref extension 0))
|
(vector-ref extension 0))
|
||||||
(define (gnc:extension-name extension)
|
(define (gnc:extension-name extension)
|
||||||
(vector-ref extension 1))
|
(vector-ref extension 1))
|
||||||
(define (gnc:extension-documentation extension)
|
(define (gnc:extension-guid extension)
|
||||||
(vector-ref extension 2))
|
(vector-ref extension 2))
|
||||||
(define (gnc:extension-path extension)
|
(define (gnc:extension-documentation extension)
|
||||||
(vector-ref extension 3))
|
(vector-ref extension 3))
|
||||||
(define (gnc:extension-script extension)
|
(define (gnc:extension-path extension)
|
||||||
(vector-ref extension 4))
|
(vector-ref extension 4))
|
||||||
|
(define (gnc:extension-script extension)
|
||||||
|
(vector-ref extension 5))
|
||||||
|
|
||||||
(define (gnc:make-menu-item name documentation-string path script)
|
(define (gnc:make-menu-item name guid documentation-string path script)
|
||||||
(gnc:make-extension 'menu-item name documentation-string path script))
|
(gnc:make-extension 'menu-item name guid documentation-string path script))
|
||||||
|
|
||||||
(define (gnc:make-menu name path)
|
(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)
|
(define (gnc:make-separator path)
|
||||||
(gnc:make-extension 'separator "" "" path #f))
|
(gnc:make-extension 'separator "" "" "" path #f))
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
;; from gnc-menu-extensions.scm
|
;; from gnc-menu-extensions.scm
|
||||||
(export gnc:extension-type)
|
(export gnc:extension-type)
|
||||||
(export gnc:extension-name)
|
(export gnc:extension-name)
|
||||||
|
(export gnc:extension-guid)
|
||||||
(export gnc:extension-documentation)
|
(export gnc:extension-documentation)
|
||||||
(export gnc:extension-path)
|
(export gnc:extension-path)
|
||||||
(export gnc:extension-script)
|
(export gnc:extension-script)
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
(set! item
|
(set! item
|
||||||
(gnc:make-menu-item
|
(gnc:make-menu-item
|
||||||
name
|
name
|
||||||
|
(gnc:report-template-report-guid template)
|
||||||
menu-tip
|
menu-tip
|
||||||
menu-path
|
menu-path
|
||||||
(lambda (window)
|
(lambda (window)
|
||||||
@ -111,6 +112,7 @@
|
|||||||
(gnc-add-scm-extension
|
(gnc-add-scm-extension
|
||||||
(gnc:make-menu-item
|
(gnc:make-menu-item
|
||||||
(N_ "Custom Reports")
|
(N_ "Custom Reports")
|
||||||
|
"4d3dcdc8890b11df99dd94cddfd72085"
|
||||||
(N_ "Manage and run custom reports")
|
(N_ "Manage and run custom reports")
|
||||||
(list gnc:menuname-reports)
|
(list gnc:menuname-reports)
|
||||||
(lambda (window)
|
(lambda (window)
|
||||||
@ -132,6 +134,7 @@
|
|||||||
(gnc-add-scm-extension
|
(gnc-add-scm-extension
|
||||||
(gnc:make-menu-item
|
(gnc:make-menu-item
|
||||||
(N_ "Welcome Sample Report")
|
(N_ "Welcome Sample Report")
|
||||||
|
"ad80271c890b11dfa79f2dcedfd72085"
|
||||||
(N_ "Welcome-to-GnuCash report screen")
|
(N_ "Welcome-to-GnuCash report screen")
|
||||||
(list gnc:menuname-reports gnc:menuname-utility "")
|
(list gnc:menuname-reports gnc:menuname-utility "")
|
||||||
(lambda (window)
|
(lambda (window)
|
||||||
|
Loading…
Reference in New Issue
Block a user