aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-plugin.c
diff options
context:
space:
mode:
authorSankar P <psankar@novell.com>2008-03-19 17:06:21 +0800
committerSankarasivasubramanian Pasupathilingam <psankar@src.gnome.org>2008-03-19 17:06:21 +0800
commit04000625d6e5afa85be7c8426adf1df68aa4aa5c (patch)
tree0b6dd106a2f47dca2be55f59f14fdd3756cd7df2 /e-util/e-plugin.c
parent96b7bd344fb4809679584037727f70cde7158300 (diff)
downloadgsoc2013-evolution-04000625d6e5afa85be7c8426adf1df68aa4aa5c.tar
gsoc2013-evolution-04000625d6e5afa85be7c8426adf1df68aa4aa5c.tar.gz
gsoc2013-evolution-04000625d6e5afa85be7c8426adf1df68aa4aa5c.tar.bz2
gsoc2013-evolution-04000625d6e5afa85be7c8426adf1df68aa4aa5c.tar.lz
gsoc2013-evolution-04000625d6e5afa85be7c8426adf1df68aa4aa5c.tar.xz
gsoc2013-evolution-04000625d6e5afa85be7c8426adf1df68aa4aa5c.tar.zst
gsoc2013-evolution-04000625d6e5afa85be7c8426adf1df68aa4aa5c.zip
** Fix for bug #496839
2008-03-19 Sankar P <psankar@novell.com> ** Fix for bug #496839 * e-plugin.c: (ep_load), (e_plugin_load_plugins), (e_plugin_get_configure_widget): * e-plugin.h: - Implement Plugin Load Levels. You can decide on which load-level you want your plugin to be loaded. - Load Levels are mandatory if you need other language loaders like Mono-Loader or Python-Loader. - Introduce FLAGS as part of EPlugin. Futuristic. svn path=/trunk/; revision=35216
Diffstat (limited to 'e-util/e-plugin.c')
-rw-r--r--e-util/e-plugin.c77
1 files changed, 55 insertions, 22 deletions
diff --git a/e-util/e-plugin.c b/e-util/e-plugin.c
index 0a87513adf..4f07f1b022 100644
--- a/e-util/e-plugin.c
+++ b/e-util/e-plugin.c
@@ -363,12 +363,12 @@ ep_load_plugin(xmlNodePtr root, struct _plugin_doc *pdoc)
}
static int
-ep_load(const char *filename)
+ep_load(const char *filename, int load_level)
{
xmlDocPtr doc;
xmlNodePtr root;
int res = -1;
- EPlugin *ep;
+ EPlugin *ep = NULL;
int cache = FALSE;
struct _plugin_doc *pdoc;
@@ -389,10 +389,37 @@ ep_load(const char *filename)
for (root = root->children; root ; root = root->next) {
if (strcmp((char *)root->name, "e-plugin") == 0) {
- ep = ep_load_plugin(root, pdoc);
+ char *plugin_load_level, *is_system_plugin;
+
+ plugin_load_level = NULL;
+ plugin_load_level = e_plugin_xml_prop (root, "load_level");
+ if (plugin_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);
+ }
+ }
+ } 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"))
+ ep->flags |= E_PLUGIN_FLAGS_SYSTEM_PLUGIN;
+ else
+ ep->flags &= ~E_PLUGIN_FLAGS_SYSTEM_PLUGIN;
+
pdoc->plugin_hooks = g_slist_prepend(pdoc->plugin_hooks, ep);
cache |= (ep->hooks_pending != NULL);
+ ep = NULL;
}
cache |= pdoc->plugins != NULL;
}
@@ -499,36 +526,39 @@ int
e_plugin_load_plugins(void)
{
GSList *l;
+ int i;
if (ep_types == NULL) {
g_warning("no plugin types defined");
return 0;
}
- for (l = ep_path;l;l = g_slist_next(l)) {
- GDir *dir;
- const char *d;
- char *path = l->data;
+ for (i=0; i < 3; i++) {
+ for (l = ep_path;l;l = g_slist_next(l)) {
+ GDir *dir;
+ const char *d;
+ char *path = l->data;
- pd(printf("scanning plugin dir '%s'\n", path));
+ pd(printf("scanning plugin dir '%s'\n", path));
- dir = g_dir_open(path, 0, NULL);
- if (dir == NULL) {
- /*g_warning("Could not find plugin path: %s", path);*/
- continue;
- }
+ dir = g_dir_open(path, 0, NULL);
+ if (dir == NULL) {
+ /*g_warning("Could not find plugin path: %s", path);*/
+ continue;
+ }
- while ( (d = g_dir_read_name(dir)) ) {
- if (strlen(d) > 6
- && !strcmp(d + strlen(d) - 6, ".eplug")) {
- char * name = g_build_filename(path, d, NULL);
+ while ( (d = g_dir_read_name(dir)) ) {
+ if (strlen(d) > 6
+ && !strcmp(d + strlen(d) - 6, ".eplug")) {
+ char * name = g_build_filename(path, d, NULL);
- ep_load(name);
- g_free(name);
+ ep_load(name, i);
+ g_free(name);
+ }
}
- }
- g_dir_close(dir);
+ g_dir_close(dir);
+ }
}
return 0;
@@ -698,7 +728,10 @@ e_plugin_get_configure_widget (EPlugin *ep)
{
EPluginClass *ptr;
ptr = ((EPluginClass *)G_OBJECT_GET_CLASS(ep));
- return ptr->get_configure_widget (ep);
+ if (ptr->get_configure_widget)
+ return ptr->get_configure_widget (ep);
+
+ return NULL;
}
/**