From c6fd77460f5baf88528f5da2ffb99e86a2885ff0 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 5 Mar 2011 12:33:49 -0500 Subject: Coding style and whitespace cleanup. --- e-util/e-plugin.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'e-util/e-plugin.c') diff --git a/e-util/e-plugin.c b/e-util/e-plugin.c index db717e8dcd..d3579b7d89 100644 --- a/e-util/e-plugin.c +++ b/e-util/e-plugin.c @@ -154,8 +154,6 @@ ep_construct (EPlugin *ep, xmlNodePtr root) ep->name = e_plugin_xml_prop_domain(root, "name", ep->domain); - pd(printf("creating plugin '%s' '%s'\n", ep->name?ep->name:"un-named", ep->id)); - node = root->children; while (node) { if (strcmp((gchar *)node->name, "hook") == 0) { @@ -173,12 +171,15 @@ ep_construct (EPlugin *ep, xmlNodePtr root) if (ep->enabled && eph_types != NULL - && (type = g_hash_table_lookup (eph_types, class)) != NULL) { + && (type = g_hash_table_lookup ( + eph_types, class)) != NULL) { g_free (class); hook = g_object_new (G_OBJECT_CLASS_TYPE (type), NULL); res = type->construct (hook, ep, node); if (res == -1) { - g_warning("Plugin '%s' failed to load hook", ep->name); + g_warning ( + "Plugin '%s' failed to " + "load hook", ep->name); g_object_unref (hook); goto fail; } else { @@ -188,7 +189,8 @@ ep_construct (EPlugin *ep, xmlNodePtr root) g_free (class); } } else if (strcmp((gchar *)node->name, "description") == 0) { - ep->description = e_plugin_xml_content_domain (node, ep->domain); + ep->description = + e_plugin_xml_content_domain (node, ep->domain); } else if (strcmp((gchar *)node->name, "author") == 0) { gchar *name = e_plugin_xml_prop(node, "name"); gchar *email = e_plugin_xml_prop(node, "email"); @@ -353,7 +355,6 @@ ep_load_plugin (xmlNodePtr root, struct _plugin_doc *pdoc) * which is checked when a new type is registered. */ class = g_hash_table_lookup (ep_types, prop); if (class == NULL) { - pd(printf("Delaying loading of plugin '%s' unknown type '%s'\n", id, prop)); g_free (id); xmlFree (prop); return NULL; @@ -404,22 +405,20 @@ ep_load (const gchar *filename, gint load_level) if ((atoi (plugin_load_level) == load_level) ) { ep = ep_load_plugin (root, pdoc); - if (ep) { - if (load_level == 1) - e_plugin_invoke (ep, "load_plugin_type_register_function", NULL); - } + if (ep && load_level == 1) + e_plugin_invoke (ep, "load_plugin_type_register_function", NULL); } } else if (load_level == 2) { ep = ep_load_plugin (root, pdoc); } if (ep) { - pd(printf ("\nloading plugin [%s] at load_level [%d]\n", ep->name, load_level)); - - /* README: May be we can use load_levels to achieve the same thing. - But it may be confusing for a plugin writer */ - is_system_plugin = e_plugin_xml_prop (root, "system_plugin"); - if (is_system_plugin && !strcmp (is_system_plugin, "true")) { + /* README: Maybe we can use load_levels to + * achieve the same thing. But it may be + * confusing for a plugin writer. */ + is_system_plugin = + e_plugin_xml_prop (root, "system_plugin"); + if (g_strcmp0 (is_system_plugin, "true") == 0) { e_plugin_enable (ep, TRUE); ep->flags |= E_PLUGIN_FLAGS_SYSTEM_PLUGIN; } else @@ -559,8 +558,9 @@ e_plugin_load_plugins (void) while ((d = g_dir_read_name (dir))) { if (g_str_has_suffix (d, ".eplug")) { - gchar * name = g_build_filename (path, d, NULL); + gchar *name; + name = g_build_filename (path, d, NULL); ep_load (name, i); g_free (name); } -- cgit v1.2.3 From 37b3d691ca6f1cc8e305d89cd14aa35856423e8c Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 18 Apr 2011 19:16:32 -0400 Subject: Bug 647708 - e_plugin_xml_prop() can return libxml2 allocated memory Always copy the xmlChar property into GLib-allocated memory. g_mem_is_system_malloc() has nothing to do with libxml2. --- e-util/e-plugin.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'e-util/e-plugin.c') diff --git a/e-util/e-plugin.c b/e-util/e-plugin.c index d3579b7d89..fa7f0d9d88 100644 --- a/e-util/e-plugin.c +++ b/e-util/e-plugin.c @@ -732,8 +732,7 @@ e_plugin_get_configure_widget (EPlugin *ep) * @id: The name of the property to retrieve. * * A static helper function to look up a property on an XML node, and - * ensure it is allocated in GLib system memory. If GLib isn't using - * the system malloc then it must copy the property value. + * ensure it is allocated in GLib system memory. * * Return value: The property, allocated in GLib memory, or NULL if no * such property exists. @@ -741,17 +740,17 @@ e_plugin_get_configure_widget (EPlugin *ep) gchar * e_plugin_xml_prop (xmlNodePtr node, const gchar *id) { - gchar *p = (gchar *)xmlGetProp (node, (const guchar *)id); + xmlChar *xml_prop; + gchar *glib_prop = NULL; - if (g_mem_is_system_malloc ()) { - return p; - } else { - gchar * out = g_strdup (p); + xml_prop = xmlGetProp (node, (xmlChar *) id); - if (p) - xmlFree (p); - return out; + if (xml_prop != NULL) { + glib_prop = g_strdup ((gchar *) xml_prop); + xmlFree (xml_prop); } + + return glib_prop; } /** -- cgit v1.2.3 From 8a186c3588d3598857c36e2122fa68d01eba30fd Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 8 May 2011 13:24:42 -0400 Subject: Coding style cleanups. --- e-util/e-plugin.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'e-util/e-plugin.c') diff --git a/e-util/e-plugin.c b/e-util/e-plugin.c index fa7f0d9d88..17e4b50102 100644 --- a/e-util/e-plugin.c +++ b/e-util/e-plugin.c @@ -576,7 +576,7 @@ e_plugin_load_plugins (void) static void ep_list_plugin (gpointer key, gpointer val, gpointer dat) { - GSList **l = (GSList **)dat; + GSList **l = (GSList **) dat; *l = g_slist_prepend(*l, g_object_ref(val)); } @@ -770,7 +770,7 @@ e_plugin_xml_prop_domain (xmlNodePtr node, const gchar *id, const gchar *domain) { gchar *p, *out; - p = (gchar *)xmlGetProp (node, (const guchar *)id); + p = (gchar *) xmlGetProp (node, (const guchar *) id); if (p == NULL) return NULL; @@ -796,7 +796,7 @@ e_plugin_xml_prop_domain (xmlNodePtr node, const gchar *id, const gchar *domain) gint e_plugin_xml_int (xmlNodePtr node, const gchar *id, gint def) { - gchar *p = (gchar *)xmlGetProp (node, (const guchar *)id); + gchar *p = (gchar *) xmlGetProp (node, (const guchar *) id); if (p) return atoi (p); @@ -817,7 +817,7 @@ e_plugin_xml_int (xmlNodePtr node, const gchar *id, gint def) gchar * e_plugin_xml_content (xmlNodePtr node) { - gchar *p = (gchar *)xmlNodeGetContent (node); + gchar *p = (gchar *) xmlNodeGetContent (node); if (g_mem_is_system_malloc ()) { return p; @@ -846,7 +846,7 @@ e_plugin_xml_content_domain (xmlNodePtr node, const gchar *domain) { gchar *p, *out; - p = (gchar *)xmlNodeGetContent (node); + p = (gchar *) xmlNodeGetContent (node); if (p == NULL) return NULL; @@ -935,7 +935,7 @@ e_plugin_hook_mask (xmlNodePtr root, gchar *val, *p, *start, c; guint32 mask = 0; - val = (gchar *)xmlGetProp (root, (const guchar *)prop); + val = (gchar *) xmlGetProp (root, (const guchar *) prop); if (val == NULL) return 0; @@ -988,7 +988,7 @@ e_plugin_hook_id (xmlNodePtr root, gchar *val; gint i; - val = (gchar *)xmlGetProp (root, (const guchar *)prop); + val = (gchar *) xmlGetProp (root, (const guchar *) prop); if (val == NULL) return ~0; -- cgit v1.2.3 From 756c8abcb840b8da588031f4a0d7e1fc979fab70 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 27 May 2011 15:23:07 +0200 Subject: Bug #646109 - Fix use of include to make sure translations work --- e-util/e-plugin.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'e-util/e-plugin.c') diff --git a/e-util/e-plugin.c b/e-util/e-plugin.c index 17e4b50102..e0f1aecd22 100644 --- a/e-util/e-plugin.c +++ b/e-util/e-plugin.c @@ -16,7 +16,9 @@ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) */ +#ifdef HAVE_CONFIG_H #include +#endif #include #include -- cgit v1.2.3 From f014ab82c81078d60cb1df8c986305c2cc9948c2 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 4 Jun 2011 15:53:10 -0500 Subject: Coding style and whitespace cleanups. --- e-util/e-plugin.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'e-util/e-plugin.c') diff --git a/e-util/e-plugin.c b/e-util/e-plugin.c index e0f1aecd22..52bbe101cb 100644 --- a/e-util/e-plugin.c +++ b/e-util/e-plugin.c @@ -408,7 +408,8 @@ ep_load (const gchar *filename, gint load_level) ep = ep_load_plugin (root, pdoc); if (ep && load_level == 1) - e_plugin_invoke (ep, "load_plugin_type_register_function", NULL); + e_plugin_invoke ( + ep, "load_plugin_type_register_function", NULL); } } else if (load_level == 2) { ep = ep_load_plugin (root, pdoc); -- cgit v1.2.3 From fcbbdfbd18e15b4ee8322a0217cf03a689a5e033 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 16 Aug 2011 11:25:56 -0400 Subject: Coding style and whitespace cleanup. --- e-util/e-plugin.c | 116 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 69 insertions(+), 47 deletions(-) (limited to 'e-util/e-plugin.c') diff --git a/e-util/e-plugin.c b/e-util/e-plugin.c index 52bbe101cb..17650f045a 100644 --- a/e-util/e-plugin.c +++ b/e-util/e-plugin.c @@ -40,29 +40,29 @@ #define phd(x) /* - - imap - IMAP4 and IMAP4v1 mail store - - - - - PLAIN - SASL PLAIN authentication mechanism - + * + * imap + * IMAP4 and IMAP4v1 mail store + * + * + * + * + * PLAIN + * SASL PLAIN authentication mechanism + * */ /* EPlugin stuff */ @@ -105,7 +105,8 @@ ep_check_enabled (const gchar *id) } static void -ep_set_enabled (const gchar *id, gint state) +ep_set_enabled (const gchar *id, + gint state) { GConfClient *client; @@ -133,7 +134,8 @@ ep_set_enabled (const gchar *id, gint state) } static gint -ep_construct (EPlugin *ep, xmlNodePtr root) +ep_construct (EPlugin *ep, + xmlNodePtr root) { xmlNodePtr node; gint res = -1; @@ -159,7 +161,7 @@ ep_construct (EPlugin *ep, xmlNodePtr root) node = root->children; while (node) { if (strcmp((gchar *)node->name, "hook") == 0) { - struct _EPluginHook *hook; + EPluginHook *hook; EPluginHookClass *type; gchar *class = e_plugin_xml_prop(node, "class"); @@ -213,7 +215,8 @@ fail: } static void -ep_enable (EPlugin *ep, gint state) +ep_enable (EPlugin *ep, + gint state) { GSList *iter; @@ -328,7 +331,8 @@ e_plugin_init (EPlugin *ep) } static EPlugin * -ep_load_plugin (xmlNodePtr root, struct _plugin_doc *pdoc) +ep_load_plugin (xmlNodePtr root, + struct _plugin_doc *pdoc) { gchar *prop, *id; EPluginClass *class; @@ -375,7 +379,8 @@ ep_load_plugin (xmlNodePtr root, struct _plugin_doc *pdoc) } static gint -ep_load (const gchar *filename, gint load_level) +ep_load (const gchar *filename, + gint load_level) { xmlDocPtr doc; xmlNodePtr root; @@ -545,8 +550,8 @@ e_plugin_load_plugins (void) GCONF_VALUE_STRING, NULL); g_object_unref (client); - for (i=0; i < 3; i++) { - for (l = ep_path;l;l = g_slist_next (l)) { + for (i = 0; i < 3; i++) { + for (l = ep_path; l; l = g_slist_next (l)) { GDir *dir; const gchar *d; gchar *path = l->data; @@ -577,7 +582,9 @@ e_plugin_load_plugins (void) } static void -ep_list_plugin (gpointer key, gpointer val, gpointer dat) +ep_list_plugin (gpointer key, + gpointer val, + gpointer dat) { GSList **l = (GSList **) dat; @@ -615,7 +622,8 @@ e_plugin_list_plugins (void) * Return value: The return from the construct virtual method. **/ gint -e_plugin_construct (EPlugin *ep, xmlNodePtr root) +e_plugin_construct (EPlugin *ep, + xmlNodePtr root) { EPluginClass *class; @@ -641,7 +649,9 @@ e_plugin_construct (EPlugin *ep, xmlNodePtr root) * Return value: The return of the plugin invocation. **/ gpointer -e_plugin_invoke (EPlugin *ep, const gchar *name, gpointer data) +e_plugin_invoke (EPlugin *ep, + const gchar *name, + gpointer data) { EPluginClass *class; @@ -668,7 +678,8 @@ e_plugin_invoke (EPlugin *ep, const gchar *name, gpointer data) * Return value: the symbol value, or %NULL if not found **/ gpointer -e_plugin_get_symbol (EPlugin *ep, const gchar *name) +e_plugin_get_symbol (EPlugin *ep, + const gchar *name) { EPluginClass *class; @@ -690,7 +701,8 @@ e_plugin_get_symbol (EPlugin *ep, const gchar *name) * THIS IS NOT FULLY IMPLEMENTED YET **/ void -e_plugin_enable (EPlugin *ep, gint state) +e_plugin_enable (EPlugin *ep, + gint state) { EPluginClass *class; @@ -741,7 +753,8 @@ e_plugin_get_configure_widget (EPlugin *ep) * such property exists. **/ gchar * -e_plugin_xml_prop (xmlNodePtr node, const gchar *id) +e_plugin_xml_prop (xmlNodePtr node, + const gchar *id) { xmlChar *xml_prop; gchar *glib_prop = NULL; @@ -769,7 +782,9 @@ e_plugin_xml_prop (xmlNodePtr node, const gchar *id) * such property exists. **/ gchar * -e_plugin_xml_prop_domain (xmlNodePtr node, const gchar *id, const gchar *domain) +e_plugin_xml_prop_domain (xmlNodePtr node, + const gchar *id, + const gchar *domain) { gchar *p, *out; @@ -797,7 +812,9 @@ e_plugin_xml_prop_domain (xmlNodePtr node, const gchar *id, const gchar *domain) * Return value: The value if set, or @def if not. **/ gint -e_plugin_xml_int (xmlNodePtr node, const gchar *id, gint def) +e_plugin_xml_int (xmlNodePtr node, + const gchar *id, + gint def) { gchar *p = (gchar *) xmlGetProp (node, (const guchar *) id); @@ -845,7 +862,8 @@ e_plugin_xml_content (xmlNodePtr node) * Return value: The node content, allocated in GLib memory. **/ gchar * -e_plugin_xml_content_domain (xmlNodePtr node, const gchar *domain) +e_plugin_xml_content_domain (xmlNodePtr node, + const gchar *domain) { gchar *p, *out; @@ -867,7 +885,9 @@ G_DEFINE_TYPE ( G_TYPE_OBJECT) static gint -eph_construct (EPluginHook *eph, EPlugin *ep, xmlNodePtr root) +eph_construct (EPluginHook *eph, + EPlugin *ep, + xmlNodePtr root) { eph->plugin = ep; @@ -875,7 +895,8 @@ eph_construct (EPluginHook *eph, EPlugin *ep, xmlNodePtr root) } static void -eph_enable (EPluginHook *eph, gint state) +eph_enable (EPluginHook *eph, + gint state) { /* NOOP */ } @@ -903,7 +924,8 @@ e_plugin_hook_init (EPluginHook *hook) * THIS IS NOT FULY IMEPLEMENTED YET **/ void -e_plugin_hook_enable (EPluginHook *eph, gint state) +e_plugin_hook_enable (EPluginHook *eph, + gint state) { EPluginHookClass *class; @@ -932,7 +954,7 @@ e_plugin_hook_enable (EPluginHook *eph, gint state) **/ guint32 e_plugin_hook_mask (xmlNodePtr root, - const struct _EPluginHookTargetKey *map, + const EPluginHookTargetKey *map, const gchar *prop) { gchar *val, *p, *start, c; @@ -952,7 +974,7 @@ e_plugin_hook_mask (xmlNodePtr root, if (start != p) { gint i; - for (i=0;map[i].key;i++) { + for (i = 0; map[i].key; i++) { if (!strcmp (map[i].key, start)) { mask |= map[i].value; break; @@ -985,7 +1007,7 @@ e_plugin_hook_mask (xmlNodePtr root, **/ guint32 e_plugin_hook_id (xmlNodePtr root, - const struct _EPluginHookTargetKey *map, + const EPluginHookTargetKey *map, const gchar *prop) { gchar *val; @@ -995,7 +1017,7 @@ e_plugin_hook_id (xmlNodePtr root, if (val == NULL) return ~0; - for (i=0;map[i].key;i++) { + for (i = 0; map[i].key; i++) { if (!strcmp (map[i].key, val)) { xmlFree (val); return map[i].value; -- cgit v1.2.3 From 53bc6ffc531d7a7188e15be245a31f301090ee15 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 10 Sep 2011 11:47:15 -0400 Subject: The EExtension framework is now in libebackend. The EModule, EExtensible and EExtension classes as well as the e_type_traverse() function have been moved to Evolution-Data-Server's libebackend library to replace e-data-server-module.c. Now Evolution-Data-Server modules use the same framework as Evolution. --- e-util/e-plugin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'e-util/e-plugin.c') diff --git a/e-util/e-plugin.c b/e-util/e-plugin.c index 17650f045a..a19dc879b3 100644 --- a/e-util/e-plugin.c +++ b/e-util/e-plugin.c @@ -27,12 +27,12 @@ #include +#include #include #include #include "e-plugin.h" #include "e-util-private.h" -#include "e-util.h" /* plugin debug */ #define pd(x) -- cgit v1.2.3