[Gnucash-changes] Patch from Chris Shoemaker to avoid trying to double-add plugins to

David Hampton hampton at cvs.gnucash.org
Thu Oct 13 17:49:34 EDT 2005


Log Message:
-----------
Patch from Chris Shoemaker to avoid trying to double-add plugins to
plugin manager by delaying signal connection until the plugins are
already managed by the plugin manager.

Tags:
----
gnucash-gnome2-dev

Modified Files:
--------------
    gnucash:
        ChangeLog
    gnucash/src/gnome-utils:
        gnc-main-window.c

Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1487.2.332
retrieving revision 1.1487.2.333
diff -LChangeLog -LChangeLog -u -r1.1487.2.332 -r1.1487.2.333
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,15 @@
+2005-10-13  David Hampton  <hampton at employees.org>
+
+	* src/gnome-utils/gnc-main-window.c: Patch from Chris Shoemaker to
+	avoid trying to double-add plugins to plugin manager by delaying
+	signal connection until the plugins are already managed by the
+	plugin manager.
+
+	* src/gnome-utils/gnc-tree-view-account.c: Patch from Chris
+	Shoemaker to convert gnc-tree-view-account to a GObject base
+	instead of a GtkObject base. Also contains some line wrapping
+	fixes.
+
 2005-10-13  Derek Atkins  <derek at ihtfp.com>
 
 	* src/lib/glib26/Makefile.am:
Index: gnc-main-window.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/Attic/gnc-main-window.c,v
retrieving revision 1.1.2.25
retrieving revision 1.1.2.26
diff -Lsrc/gnome-utils/gnc-main-window.c -Lsrc/gnome-utils/gnc-main-window.c -u -r1.1.2.25 -r1.1.2.26
--- src/gnome-utils/gnc-main-window.c
+++ src/gnome-utils/gnc-main-window.c
@@ -301,8 +301,9 @@
 }
 
 
-/** Look through the list of pages installed in this window and see if
- *  the specified page is there.
+/** See if the page already exists.  For each open window, look
+ *  through the list of pages installed in that window and see if the
+ *  specified page is there.
  *
  *  @internal
  *
@@ -507,12 +508,14 @@
 	      entity, type, event_type, user_data);
 	window = GNC_MAIN_WINDOW(user_data);
 
+        /* This is not a typical list iteration.  We're removing while
+         * we iterate, so we have to cache the 'next' pointer before
+         * executing any code in the loop. */
 	for (item = window->priv->installed_pages; item; item = next) {
 	  next = g_list_next(item);
 	  page = GNC_PLUGIN_PAGE(item->data);
-	  if (!gnc_plugin_page_has_book (page, entity))
-	    continue;
-	  gnc_main_window_close_page (page);
+	  if (gnc_plugin_page_has_book (page, entity))
+              gnc_main_window_close_page (page);
 	}
 	LEAVE(" ");
 }
@@ -1662,12 +1665,13 @@
 	/* GncPluginManager stuff */
 	manager = gnc_plugin_manager_get ();
 	plugins = gnc_plugin_manager_get_plugins (manager);
+        g_list_foreach (plugins, gnc_main_window_add_plugin, window);
+        g_list_free (plugins);
+
 	g_signal_connect (G_OBJECT (manager), "plugin-added",
 			  G_CALLBACK (gnc_main_window_plugin_added), window);
 	g_signal_connect (G_OBJECT (manager), "plugin-removed",
 			  G_CALLBACK (gnc_main_window_plugin_removed), window);
-	g_list_foreach (plugins, gnc_main_window_add_plugin, window);
-	g_list_free (plugins);
 
 }
 


More information about the gnucash-changes mailing list