[Gnucash-changes] r13592 - gnucash/trunk - Walk through the list of plugins installed in a window and uninstall

David Hampton hampton at cvs.gnucash.org
Fri Mar 10 18:11:55 EST 2006


Author: hampton
Date: 2006-03-10 18:11:54 -0500 (Fri, 10 Mar 2006)
New Revision: 13592
Trac: http://svn.gnucash.org/trac/changeset/13592

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/gnome-utils/gnc-main-window.c
Log:
Walk through the list of plugins installed in a window and uninstall
them before the window is destroyed. Fixes 333973.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-03-10 23:06:17 UTC (rev 13591)
+++ gnucash/trunk/ChangeLog	2006-03-10 23:11:54 UTC (rev 13592)
@@ -1,3 +1,13 @@
+2006-03-10  David Hampton  <hampton at employees.org>
+
+	* src/gnome-utils/gnc-main-window.c: Walk through the list of
+	plugins installed in a window and uninstall them before the window
+	is destroyed. Fixes 333973.
+
+	* src/core-utils/gnc-gobject-utils.c: Change the output from this
+	file to use g_message instead of g_warning so the
+	--g-fatal-warnings argument doesn't trip over it.
+
 2006-03-10  Derek Atkins  <derek at ihtfp.com>
 
 	* src/import-export/qif-import/qif-dialog-utils.scm:

Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.c	2006-03-10 23:06:17 UTC (rev 13591)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.c	2006-03-10 23:11:54 UTC (rev 13592)
@@ -928,6 +928,35 @@
 }
 
 
+static void
+gnc_main_window_add_plugin (gpointer plugin,
+			    gpointer window)
+{
+	g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
+	g_return_if_fail (GNC_IS_PLUGIN (plugin));
+
+	ENTER(" ");
+	gnc_plugin_add_to_window (GNC_PLUGIN (plugin),
+				  GNC_MAIN_WINDOW (window),
+				  window_type);
+	LEAVE(" ");
+}
+
+static void
+gnc_main_window_remove_plugin (gpointer plugin,
+			       gpointer window)
+{
+	g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
+	g_return_if_fail (GNC_IS_PLUGIN (plugin));
+
+	ENTER(" ");
+	gnc_plugin_remove_from_window (GNC_PLUGIN (plugin),
+				       GNC_MAIN_WINDOW (window),
+				       window_type);
+	LEAVE(" ");
+}
+
+
 static gboolean
 gnc_main_window_delete_event (GtkWidget *window,
 			      GdkEvent *event,
@@ -1668,6 +1697,8 @@
 {
 	GncMainWindow *window;
 	GncMainWindowPrivate *priv;
+	GncPluginManager *manager;
+	GList *plugins;
 
 	g_return_if_fail (object != NULL);
 	g_return_if_fail (GNC_IS_MAIN_WINDOW (object));
@@ -1698,6 +1729,12 @@
 
 	  g_hash_table_destroy (priv->merged_actions_table);
 	  priv->merged_actions_table = NULL;
+
+	  /* GncPluginManager stuff */
+	  manager = gnc_plugin_manager_get ();
+	  plugins = gnc_plugin_manager_get_plugins (manager);
+	  g_list_foreach (plugins, gnc_main_window_remove_plugin, window);
+	  g_list_free (plugins);
 	}
 	GTK_OBJECT_CLASS (parent_class)->destroy (object);
 }
@@ -2125,6 +2162,8 @@
 	g_return_if_fail (group_name != NULL);
 
 	priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+	if (priv->merged_actions_table == NULL)
+		return;
 	entry = g_hash_table_lookup (priv->merged_actions_table, group_name);
 
 	if (entry == NULL)
@@ -2193,6 +2232,8 @@
 	g_return_val_if_fail (group_name != NULL, NULL);
 
 	priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+	if (priv->merged_actions_table == NULL)
+		return NULL;
 	entry = g_hash_table_lookup (priv->merged_actions_table, group_name);
 
 	if (entry == NULL)
@@ -2203,20 +2244,6 @@
 
 
 static void
-gnc_main_window_add_plugin (gpointer plugin,
-			    gpointer window)
-{
-	g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
-	g_return_if_fail (GNC_IS_PLUGIN (plugin));
-
-	ENTER(" ");
-	gnc_plugin_add_to_window (GNC_PLUGIN (plugin),
-				  GNC_MAIN_WINDOW (window),
-				  window_type);
-	LEAVE(" ");
-}
-
-static void
 gnc_main_window_update_toolbar (GncMainWindow *window)
 {
 	GtkToolbarStyle style;



More information about the gnucash-changes mailing list