[Gnucash-changes] r11898 - gnucash/trunk - The register page should
add to the existing list of items in the
David Hampton
hampton at cvs.gnucash.org
Wed Nov 9 22:27:53 EST 2005
Author: hampton
Date: 2005-11-09 22:27:52 -0500 (Wed, 09 Nov 2005)
New Revision: 11898
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/src/business/business-reports/business-reports.scm
gnucash/trunk/src/gnome-utils/gnc-menu-extensions.c
gnucash/trunk/src/gnome-utils/gnc-menu-extensions.h
gnucash/trunk/src/gnome-utils/gnc-plugin-menu-additions.c
gnucash/trunk/src/gnome-utils/gnc-plugin-menu-additions.h
gnucash/trunk/src/gnome-utils/ui/gnc-main-window-ui.xml
gnucash/trunk/src/gnome/gnc-plugin-page-register.c
gnucash/trunk/src/gnome/ui/gnc-plugin-page-register-ui.xml
gnucash/trunk/src/report/report-system/report.scm
Log:
The register page should add to the existing list of items in the
Report menu, not replace it. Sort the items in the Reports menu, and
add a couple of accelerators.
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2005-11-10 03:26:49 UTC (rev 11897)
+++ gnucash/trunk/ChangeLog 2005-11-10 03:27:52 UTC (rev 11898)
@@ -1,5 +1,19 @@
2005-11-09 David Hampton <hampton at employees.org>
+ * src/report/report-system/report.scm:
+ * src/business/business-reports/business-reports.scm:
+ * src/gnome-utils/ui/gnc-main-window-ui.xml:
+ * src/gnome-utils/gnc-menu-extensions.[ch]:
+ * src/gnome-utils/gnc-plugin-menu-additions.[ch]:
+ * src/gnome/gnc-plugin-page-register.c:
+ * src/gnome/ui/gnc-plugin-page-register-ui.xml: The register page
+ should add to the existing list of items in the Report menu, not
+ replace it. Sort the items in the Reports menu, and add a couple
+ of accelerators.
+
+ * src/report/stylesheets/gnc-plugin-stylesheets.c: The "Edit
+ Stylesheets" menu item should always be visible.
+
* doc/README.dependencies: Document the devel packages needed to
compile gnucash on FC4.
Modified: gnucash/trunk/src/business/business-reports/business-reports.scm
===================================================================
--- gnucash/trunk/src/business/business-reports/business-reports.scm 2005-11-10 03:26:49 UTC (rev 11897)
+++ gnucash/trunk/src/business/business-reports/business-reports.scm 2005-11-10 03:27:52 UTC (rev 11898)
@@ -32,7 +32,7 @@
;; to define gnc:html-build-url
(gnc:module-load "gnucash/business-gnome" 0)
-(define gnc:menuname-business-reports (N_ "Business Reports"))
+(define gnc:menuname-business-reports (N_ "_Business"))
(define (guid-ref idstr type guid)
(gnc:html-build-url type (string-append idstr guid) #f))
Modified: gnucash/trunk/src/gnome/gnc-plugin-page-register.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-register.c 2005-11-10 03:26:49 UTC (rev 11897)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-register.c 2005-11-10 03:27:52 UTC (rev 11898)
@@ -225,9 +225,9 @@
/* Reports menu */
- { "ReportsAccountReportAction", NULL, N_("_Account Report"), NULL, NULL,
+ { "ReportsAccountReportAction", NULL, N_("Account Report"), NULL, NULL,
G_CALLBACK (gnc_plugin_page_register_cmd_account_report) },
- { "ReportsTransactionReportAction", NULL, N_("_Transaction Report"), NULL, NULL,
+ { "ReportsAcctTransReportAction", NULL, N_("Account Transaction Report"), NULL, NULL,
G_CALLBACK (gnc_plugin_page_register_cmd_transaction_report) },
};
static guint gnc_plugin_page_register_n_actions = G_N_ELEMENTS (gnc_plugin_page_register_actions);
@@ -398,10 +398,6 @@
gnc_plugin_page_add_book (plugin_page, (QofBook *)item->data);
// Do not free the list. It is owned by the query.
- g_object_set_data(G_OBJECT(plugin_page),
- GNC_PLUGIN_HIDE_MENU_ADDITIONS_NAME,
- GINT_TO_POINTER(1));
-
priv->component_manager_id = 0;
return plugin_page;
}
Modified: gnucash/trunk/src/gnome/ui/gnc-plugin-page-register-ui.xml
===================================================================
--- gnucash/trunk/src/gnome/ui/gnc-plugin-page-register-ui.xml 2005-11-10 03:26:49 UTC (rev 11897)
+++ gnucash/trunk/src/gnome/ui/gnc-plugin-page-register-ui.xml 2005-11-10 03:27:52 UTC (rev 11898)
@@ -58,8 +58,10 @@
</menu>
<menu name="Reports" action="ReportsAction">
- <menuitem name="ReportsAccountReport" action="ReportsAccountReportAction"/>
- <menuitem name="ReportsTransactionReport" action="ReportsTransactionReportAction"/>
+ <placeholder name="AccountReports">
+ <menuitem name="ReportsAccountReport" action="ReportsAccountReportAction"/>
+ <menuitem name="ReportsAcctTransReport" action="ReportsAcctTransReportAction"/>
+ </placeholder>
</menu>
</menubar>
Modified: gnucash/trunk/src/gnome-utils/gnc-menu-extensions.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-menu-extensions.c 2005-11-10 03:26:49 UTC (rev 11897)
+++ gnucash/trunk/src/gnome-utils/gnc-menu-extensions.c 2005-11-10 03:27:52 UTC (rev 11898)
@@ -49,7 +49,7 @@
GSList *
gnc_extensions_get_menu_list (void)
{
- return extension_list;
+ return g_slist_copy(extension_list);
}
static void
@@ -217,7 +217,7 @@
gnc_create_extension_info (SCM extension)
{
ExtensionInfo *ext_info;
- gchar *typeStr;
+ gchar *typeStr, *tmp;
ext_info = g_new0(ExtensionInfo, 1);
ext_info->extension = extension;
@@ -236,6 +236,10 @@
ext_info->ae.accelerator = NULL;
ext_info->ae.callback = NULL;
+ tmp = g_strdup_printf("%s/%s", ext_info->path, ext_info->ae.label);
+ ext_info->sort_key = g_utf8_collate_key(tmp, -1);
+ g_free(tmp);
+
switch (ext_info->type) {
case GTK_UI_MANAGER_MENU: typeStr = "menu"; break;
case GTK_UI_MANAGER_MENUITEM: typeStr = "menuitem"; break;
Modified: gnucash/trunk/src/gnome-utils/gnc-menu-extensions.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-menu-extensions.h 2005-11-10 03:26:49 UTC (rev 11897)
+++ gnucash/trunk/src/gnome-utils/gnc-menu-extensions.h 2005-11-10 03:27:52 UTC (rev 11898)
@@ -32,6 +32,7 @@
GtkActionEntry ae;
gchar *path;
+ gchar *sort_key;
const gchar *typeStr;
GtkUIManagerItemType type;
} ExtensionInfo;
Modified: gnucash/trunk/src/gnome-utils/gnc-plugin-menu-additions.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-plugin-menu-additions.c 2005-11-10 03:26:49 UTC (rev 11897)
+++ gnucash/trunk/src/gnome-utils/gnc-plugin-menu-additions.c 2005-11-10 03:27:52 UTC (rev 11898)
@@ -61,10 +61,6 @@
static void gnc_plugin_menu_additions_add_to_window (GncPlugin *plugin, GncMainWindow *window, GQuark type);
static void gnc_plugin_menu_additions_remove_from_window (GncPlugin *plugin, GncMainWindow *window, GQuark type);
-/* Callbacks on other objects */
-static void gnc_plugin_menu_additions_main_window_page_changed (GncMainWindow *window,
- GncPluginPage *page);
-
/* Command callbacks */
/* This static indicates the debugging module that this .o belongs to. */
@@ -220,13 +216,19 @@
gnc_extension_invoke_cb(data->data, gnc_main_window_to_scm(data->window));
}
+static gint
+gnc_menu_additions_alpha_sort (ExtensionInfo *a, ExtensionInfo *b)
+{
+ return strcmp(a->sort_key, b->sort_key);
+}
+
static void
gnc_menu_additions_menu_setup_one (ExtensionInfo *ext_info,
GncPluginMenuAdditionsPerWindow *per_window)
{
GncMainWindowActionData *cb_data;
- DEBUG( "Adding %s/%s [%s] as [%s]\n", ext_info->path, ext_info->ae.label,
+ DEBUG( "Adding %s/%s [%s] as [%s]", ext_info->path, ext_info->ae.label,
ext_info->ae.name, ext_info->typeStr );
cb_data = g_new0 (GncMainWindowActionData, 1);
@@ -244,14 +246,10 @@
gtk_ui_manager_ensure_update(per_window->ui_manager);
}
-/** Initialize the file history menu for a window. This function is
- * called as part of the initialization of a window, after all the
- * plugin menu items have been added to the menu structure. Its job
- * is to correctly initialize the file history menu. It does this by
- * first calling a function that initializes the menu to the current
- * as maintained in gconf. It then creates a gconf client that will
- * listens for any changes to the file history menu, and will update
- * the meny when they are signalled.
+/** Initialize the report menu and other additional menus. This
+ * function is called as part of the initialization of a window,
+ * after all the plugin menu items have been added to the menu
+ * structure.
*
* @param plugin A pointer to the gnc-plugin object responsible for
* adding/removing the file history menu.
@@ -270,10 +268,6 @@
ENTER(" ");
- g_signal_connect (G_OBJECT(window), "page_changed",
- G_CALLBACK (gnc_plugin_menu_additions_main_window_page_changed),
- plugin);
-
per_window.window = window;
per_window.ui_manager = window->ui_merge;
per_window.group = gtk_action_group_new ("MenuAdditions" );
@@ -281,7 +275,8 @@
per_window.merge_id = gtk_ui_manager_new_merge_id(window->ui_merge);
gtk_ui_manager_insert_action_group(window->ui_merge, per_window.group, 0);
- menu_list = gnc_extensions_get_menu_list();
+ menu_list = g_slist_sort(gnc_extensions_get_menu_list(),
+ (GCompareFunc)gnc_menu_additions_alpha_sort);
g_slist_foreach(menu_list, (GFunc)gnc_menu_additions_menu_setup_one,
&per_window);
@@ -315,10 +310,6 @@
ENTER(" ");
- g_signal_handlers_disconnect_by_func(G_OBJECT(window),
- G_CALLBACK (gnc_plugin_menu_additions_main_window_page_changed),
- plugin);
-
/* Have to remove our actions manually. Its only automatic if the
* actions name is installed into the plugin class. */
group = gnc_main_window_get_action_group(window, PLUGIN_ACTIONS_NAME);
@@ -328,52 +319,5 @@
LEAVE(" ");
}
-/************************************************************
- * Object Callbacks *
- ************************************************************/
-
-static void
-our_gtk_action_set_visible(GtkAction *action, gboolean visible)
-{
- g_object_set(G_OBJECT(action), "visible", visible, NULL);
-}
-
-
-/** Whenever the current page has changed, update the reports menus based
- * upon the page that is currently selected. */
-static void
-gnc_plugin_menu_additions_main_window_page_changed (GncMainWindow *window,
- GncPluginPage *page)
-{
- GtkActionGroup *action_group;
- GList *action_list;
- gboolean visible;
- gpointer tmp;
-
- ENTER("main window %p, page %p", window, page);
- action_group = gnc_main_window_get_action_group(window,PLUGIN_ACTIONS_NAME);
- if (action_group == NULL) {
- LEAVE("Can't find action group");
- return;
- }
-
- /* Does the now-visible page want menu-extensions to be visible? */
- if (page) {
- tmp = g_object_get_data(G_OBJECT(page),GNC_PLUGIN_HIDE_MENU_ADDITIONS_NAME);
- visible = !GPOINTER_TO_INT(tmp);
- } else {
- visible = TRUE;
- }
-
- action_list = gtk_action_group_list_actions(action_group);
- // Use the following line for gtk2.6
- // g_list_foreach(action_list, (GFunc)gtk_action_set_visible, (gpointer)visible);
- g_list_foreach(action_list, (GFunc)our_gtk_action_set_visible,
- GINT_TO_POINTER(visible));
- g_list_free(action_list);
-
- LEAVE(" ");
-}
-
/** @} */
/** @} */
Modified: gnucash/trunk/src/gnome-utils/gnc-plugin-menu-additions.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-plugin-menu-additions.h 2005-11-10 03:26:49 UTC (rev 11897)
+++ gnucash/trunk/src/gnome-utils/gnc-plugin-menu-additions.h 2005-11-10 03:27:52 UTC (rev 11898)
@@ -46,7 +46,6 @@
#define GNC_PLUGIN_MENU_ADDITIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_MENU_ADDITIONS, GncPluginMenuAdditionsClass))
#define GNC_PLUGIN_MENU_ADDITIONS_NAME "gnc-plugin-menu-additions"
-#define GNC_PLUGIN_HIDE_MENU_ADDITIONS_NAME "gnc-plugin-hide-menu-additions"
/* typedefs & structures */
typedef struct {
Modified: gnucash/trunk/src/gnome-utils/ui/gnc-main-window-ui.xml
===================================================================
--- gnucash/trunk/src/gnome-utils/ui/gnc-main-window-ui.xml 2005-11-10 03:26:49 UTC (rev 11897)
+++ gnucash/trunk/src/gnome-utils/ui/gnc-main-window-ui.xml 2005-11-10 03:27:52 UTC (rev 11898)
@@ -87,7 +87,16 @@
<placeholder name="AdditionalMenusPlaceholder"/>
<menu name="Reports" action="ReportsAction">
- <placeholder name="ReportsPlaceholder"/>
+ <placeholder name="StandardReports"/>
+ <separator name="ReportSep1"/>
+ <placeholder name="CustomReports"/>
+ <separator name="ReportSep2"/>
+ <placeholder name="CustomReports"/>
+ <separator name="ReportSep3"/>
+ <placeholder name="AccountReports"/>
+ <separator name="ReportSep4"/>
+ <placeholder name="OtherReports"/>
+ <separator name="ReportSep5"/>
</menu>
<menu name="Tools" action="ToolsAction">
Modified: gnucash/trunk/src/report/report-system/report.scm
===================================================================
--- gnucash/trunk/src/report/report-system/report.scm 2005-11-10 03:26:49 UTC (rev 11897)
+++ gnucash/trunk/src/report/report-system/report.scm 2005-11-10 03:27:52 UTC (rev 11898)
@@ -36,7 +36,7 @@
(define *gnc:_report-next-serial_* 0)
;; Define those strings here to make changes easier and avoid typos.
-(define gnc:menuname-reports "Reports")
+(define gnc:menuname-reports "Reports/StandardReports")
(define gnc:menuname-asset-liability (N_ "_Assets & Liabilities"))
(define gnc:menuname-income-expense (N_ "_Income & Expense"))
(define gnc:menuname-taxes (N_ "_Taxes"))
@@ -269,7 +269,8 @@
template-name id options #t #t #f #f)))
(if (>= id *gnc:_report-next-serial_*)
(set! *gnc:_report-next-serial_* (+ id 1)))
- (hash-set! *gnc:_reports_* id r)))
+ (hash-set! *gnc:_reports_* id r)
+ id))
(define (gnc:make-report-options template-name)
More information about the gnucash-changes
mailing list