[evolution] Read entire UI definition in "eplug" files.



commit 69ad05743b4696b4f44661cc29fe27759edca795
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Jun 26 12:21:54 2009 -0400

    Read entire UI definition in "eplug" files.
    
    EPluginUI had a bug were given the following UI definition
    
        <ui-manager id="...">
          <top-level-widget-a>
          <top-level-widget-b>
          <top-level-widget-c>
        </ui-manager>
    
    it would only read <top-level-widget-a>.  The siblings were ignored.
    This doesn't affect any plugins currently using EPluginUI, but does
    affect several on the "kill-bonobo" branch.

 e-util/e-plugin-ui.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/e-util/e-plugin-ui.c b/e-util/e-plugin-ui.c
index 0353fec..6af3290 100644
--- a/e-util/e-plugin-ui.c
+++ b/e-util/e-plugin-ui.c
@@ -261,10 +261,13 @@ plugin_ui_hook_construct (EPluginHook *hook,
 	/* Chain up to parent's construct() method. */
 	E_PLUGIN_HOOK_CLASS (parent_class)->construct (hook, plugin, node);
 
-	for (node = node->children; node != NULL; node = node->next) {
+	for (node = xmlFirstElementChild (node); node != NULL;
+		node = xmlNextElementSibling (node)) {
+
 		xmlNodePtr child;
 		xmlBufferPtr buffer;
-		const gchar *content;
+		GString *content;
+		const gchar *temp;
 		gchar *id;
 
 		if (strcmp ((gchar *) node->name, "ui-manager") != 0)
@@ -276,18 +279,21 @@ plugin_ui_hook_construct (EPluginHook *hook,
 			continue;
 		}
 
+		content = g_string_sized_new (1024);
+
 		/* Extract the XML content below <ui-manager> */
 		buffer = xmlBufferCreate ();
-		child = node->children;
-		while (child != NULL && xmlNodeIsText (child))
-			child = child->next;
-		if (child != NULL)
+		for (child = xmlFirstElementChild (node); child != NULL;
+			child = xmlNextElementSibling (child)) {
+
 			xmlNodeDump (buffer, node->doc, child, 2, 1);
-		content = (const gchar *) xmlBufferContent (buffer);
+			temp = (const gchar *) xmlBufferContent (buffer);
+			g_string_append (content, temp);
+		}
 
 		g_hash_table_insert (
 			priv->ui_definitions,
-			id, g_strdup (content));
+			id, g_string_free (content, FALSE));
 
 		xmlBufferFree (buffer);
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]