2002-09-17 Christian Stimming <stimming@tuhh.de>

* src/gnome/window-register.c (regWindowLedger): Uses the
	menu_setup_with_data introduced below.

	* src/gnome-utils/gnc-menu-extensions.[hc]
	(gnc_extensions_menu_setup_with_data): Added, so that windows can
	pass userdata on to the extension menu's callback functions.

	* src/gnome/window-register.[hc]: Add getter functions for RegWindow
	data.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7230 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2002-09-17 22:05:56 +00:00
parent 2ffb9fd9d3
commit 32808a9cf2
5 changed files with 59 additions and 2 deletions

View File

@ -1,3 +1,15 @@
2002-09-17 Christian Stimming <stimming@tuhh.de>
* src/gnome/window-register.c (regWindowLedger): Uses the
menu_setup_with_data introduced below.
* src/gnome-utils/gnc-menu-extensions.[hc]
(gnc_extensions_menu_setup_with_data): Added, so that windows can
pass userdata on to the extension menu's callback functions.
* src/gnome/window-register.[hc]: Add getter functions for RegWindow
data.
2002-09-17 David Hampton <hampton@employees.org>
Add progress bar to main window. Shows progress of read, write

View File

@ -345,6 +345,13 @@ gnc_add_c_extension(GnomeUIInfo *info, gchar *path)
void
gnc_extensions_menu_setup(GnomeApp * app, gchar *window)
{
gnc_extensions_menu_setup_with_data (app, window, NULL);
}
void
gnc_extensions_menu_setup_with_data(GnomeApp * app,
gchar *window, gpointer user_data)
{
GSList * l = NULL;
ExtensionInfo * info;
@ -354,7 +361,7 @@ gnc_extensions_menu_setup(GnomeApp * app, gchar *window)
if ((strcmp(info->window, window) != 0) &&
(strcmp(info->window, WINDOW_NAME_ALL) != 0))
continue;
gnome_app_insert_menus(app, info->path, info->info);
gnome_app_insert_menus_with_data(app, info->path, info->info, user_data);
gnome_app_install_menu_hints(app, info->info);
}
}

View File

@ -33,7 +33,29 @@
void gnc_add_c_extension(GnomeUIInfo *info, gchar *path);
void gnc_add_scm_extension(SCM extension);
/* This is called from the window initializing code, when the actual
* menu items stored by the above functions should now be inserted in
* the menu of the GnomeApp app.
*
* app - The GnomeApp to add the stored menu items
* prefix - The prefix of the window that is currently being set up.
*/
void gnc_extensions_menu_setup(GnomeApp * app, gchar *prefix);
/* This is called from the window initializing code, when the actual
* menu items stored by the above functions should now be inserted in
* the menu of the GnomeApp app.
*
* Use this function when your menu callbacks needs some user_data
* pointer in order to access window-related data.
*
* app - The GnomeApp to add the stored menu items
* prefix - The prefix of the window that is currently being set up.
* user_data - The user data to be passed on to menu item's callback functions.
*/
void gnc_extensions_menu_setup_with_data(GnomeApp * app,
gchar *prefix,
gpointer user_data);
void gnc_extensions_shutdown(void);
#endif

View File

@ -124,6 +124,17 @@ struct _RegWindow
RegDateWindow *date_window;
};
GtkWidget *gnc_RegWindow_window (RegWindow *data)
{
g_assert(data);
return data->window;
}
GNCLedgerDisplay *gnc_RegWindow_ledger (RegWindow *data)
{
g_assert(data);
return data->ledger;
}
/* This static indicates the debugging module that this .o belongs to. */
@ -1486,7 +1497,9 @@ regWindowLedger (GNCLedgerDisplay *ledger)
regData);
/* libglade should do this next line */
GNOME_APP(register_window)->menubar = glade_xml_get_widget (xml, "menubar1");
gnc_extensions_menu_setup(GNOME_APP(register_window), WINDOW_NAME_REGISTER);
gnc_extensions_menu_setup_with_data(GNOME_APP(register_window),
WINDOW_NAME_REGISTER,
regData);
regData->ledger = ledger;

View File

@ -28,6 +28,9 @@
/** STRUCTS *********************************************************/
typedef struct _RegWindow RegWindow;
/* Getters */
GtkWidget *gnc_RegWindow_window (RegWindow *data);
GNCLedgerDisplay *gnc_RegWindow_ledger (RegWindow *data);
/** PROTOTYPES ******************************************************/
RegWindow * regWindowSimple(Account *account);