mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Remove plugin preferences
Make sure when a GncMainWindow closes that the preference callbacks that were setup for the plugins are removed. At this point the actions are not touched as it causes errors to be logged to the terminal.
This commit is contained in:
parent
93dd58c214
commit
f043a820f3
@ -2747,6 +2747,7 @@ gnc_main_window_new (void)
|
||||
active_windows = g_list_append (active_windows, window);
|
||||
gnc_main_window_update_title(window);
|
||||
window->window_quitting = FALSE;
|
||||
window->just_plugin_prefs = FALSE;
|
||||
#ifdef MAC_INTEGRATION
|
||||
gnc_quartz_set_menu(window);
|
||||
#else
|
||||
@ -3115,6 +3116,15 @@ gnc_main_window_close_page (GncPluginPage *page)
|
||||
priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
|
||||
if (priv->installed_pages == NULL)
|
||||
{
|
||||
GncPluginManager *manager = gnc_plugin_manager_get ();
|
||||
GList *plugins = gnc_plugin_manager_get_plugins (manager);
|
||||
|
||||
/* remove only the preference callbacks from the window plugins */
|
||||
window->just_plugin_prefs = TRUE;
|
||||
g_list_foreach (plugins, gnc_main_window_remove_plugin, window);
|
||||
window->just_plugin_prefs = FALSE;
|
||||
g_list_free (plugins);
|
||||
|
||||
/* remove the preference callbacks from the main window */
|
||||
gnc_main_window_remove_prefs (window);
|
||||
|
||||
|
@ -58,6 +58,7 @@ typedef struct GncMainWindow
|
||||
GtkUIManager *ui_merge; /**< A pointer to the UI Manager data
|
||||
structure for the whole window. */
|
||||
gboolean window_quitting; /**< Set to TRUE when quitting from this window. */
|
||||
gboolean just_plugin_prefs; /**< Just remove preferences only from plugins */
|
||||
} GncMainWindow;
|
||||
|
||||
/** The class data structure for a main window object. */
|
||||
|
@ -474,7 +474,8 @@ gnc_plugin_menu_additions_remove_from_window (GncPlugin *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);
|
||||
if (group)
|
||||
|
||||
if (group && !window->just_plugin_prefs)
|
||||
gtk_ui_manager_remove_action_group(window->ui_merge, group);
|
||||
|
||||
/* Note: This code does not clean up the per-callback data structures
|
||||
|
@ -201,7 +201,7 @@ gnc_plugin_remove_from_window (GncPlugin *plugin,
|
||||
/*
|
||||
* Update window to remove UI items
|
||||
*/
|
||||
if (klass->actions_name)
|
||||
if (klass->actions_name && !window->just_plugin_prefs)
|
||||
{
|
||||
DEBUG ("%s: %d actions to unmerge",
|
||||
klass->actions_name, (klass->n_actions + klass->n_toggle_actions));
|
||||
|
Loading…
Reference in New Issue
Block a user