aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-06-27 00:21:54 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-06-27 00:35:09 +0800
commit69ad05743b4696b4f44661cc29fe27759edca795 (patch)
tree336677dea2d61b2f17a333cf6fc7df21049a610b
parent1a77e6dedd7632636732c3321bbc1ec016ea1eb7 (diff)
downloadgsoc2013-evolution-69ad05743b4696b4f44661cc29fe27759edca795.tar.gz
gsoc2013-evolution-69ad05743b4696b4f44661cc29fe27759edca795.tar.zst
gsoc2013-evolution-69ad05743b4696b4f44661cc29fe27759edca795.zip
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.
-rw-r--r--e-util/e-plugin-ui.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/e-util/e-plugin-ui.c b/e-util/e-plugin-ui.c
index 0353fecea0..6af3290bb6 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);
}