mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
In reports menu, first list submenus, then menu items, both sorted lexicographically.
Should ease finding specific reports when reports and placeholders are not mixed together anymore. Previously all elements were sorted lexicographically, where the submenus already contained accelerators. As LANG=C and LANG=en_US.utf8 handle underscores differently, even those results were not the same. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17024 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
b6373ae509
commit
1c6f9acd32
@ -219,10 +219,10 @@ gnc_plugin_menu_additions_action_cb (GtkAction *action,
|
||||
}
|
||||
|
||||
|
||||
/** Compare two extension menu item and indicate which should appear
|
||||
* first in the menu listings. The strings being compared are
|
||||
* collation keys produced by g_utf8_collate_key(), so this function
|
||||
* doesn't have to be anything more than a wrapper around strcmp,
|
||||
/** Compare two extension menu items and indicate which should appear
|
||||
* first in the menu listings. If only one of them is a submenu,
|
||||
* choose that one. Otherwise, the sort_keys are collation keys
|
||||
* produced by g_utf8_collate_key(), so compare them with strcmp.
|
||||
*
|
||||
* @param a A menu extension.
|
||||
*
|
||||
@ -231,9 +231,16 @@ gnc_plugin_menu_additions_action_cb (GtkAction *action,
|
||||
* @return -1 if extension 'a' should appear first. 1 if extension
|
||||
* 'b' should appear first. */
|
||||
static gint
|
||||
gnc_menu_additions_alpha_sort (ExtensionInfo *a, ExtensionInfo *b)
|
||||
gnc_menu_additions_sort (ExtensionInfo *a, ExtensionInfo *b)
|
||||
{
|
||||
if (a->type == b->type)
|
||||
return strcmp(a->sort_key, b->sort_key);
|
||||
else if (a->type == GTK_UI_MANAGER_MENU)
|
||||
return -1;
|
||||
else if (b->type == GTK_UI_MANAGER_MENU)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -437,7 +444,7 @@ gnc_plugin_menu_additions_add_to_window (GncPlugin *plugin,
|
||||
gtk_ui_manager_insert_action_group(window->ui_merge, per_window.group, 0);
|
||||
|
||||
menu_list = g_slist_sort(gnc_extensions_get_menu_list(),
|
||||
(GCompareFunc)gnc_menu_additions_alpha_sort);
|
||||
(GCompareFunc)gnc_menu_additions_sort);
|
||||
|
||||
/* Assign accelerators */
|
||||
table = g_once(&accel_table_init, gnc_menu_additions_init_accel_table, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user