From 32f545cdf031ebe3718791f18e8fb6b6141fd081 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 28 Aug 2009 20:21:54 -0400 Subject: Simplify EPlugin loading at startup. - Require all EPlugin and EPluginHook subtypes be registered before loading plugins. This drastically simplifies the EPlugin/EPluginHook negotiation. - Turn most EPluginHook subtypes into GTypeModules and register their types from an e_module_load() function (does not include shell hooks). - Convert EPluginLib and the Mono and Python bindings to GTypeModules and register their types from an e_module_load() function, and kill EPluginTypeHook. --- plugins/Makefile.am | 2 +- plugins/attachment-reminder/attachment-reminder.c | 4 +- plugins/bbdb/bbdb.c | 4 +- plugins/bogo-junk-plugin/bf-junk-filter.c | 26 +- .../org-gnome-bogo-junk-plugin.eplug.xml | 13 +- plugins/caldav/caldav-source.c | 4 +- plugins/calendar-weather/calendar-weather.c | 4 +- plugins/email-custom-header/email-custom-header.c | 4 +- plugins/exchange-operations/exchange-operations.c | 2 +- plugins/google-account-setup/google-source.c | 4 +- .../groupwise-account-setup.c | 4 +- plugins/hula-account-setup/hula-account-setup.c | 4 +- plugins/mail-notification/mail-notification.c | 4 +- plugins/mono/Camel.cs | 1278 -------------------- plugins/mono/ChangeLog | 84 -- plugins/mono/Evolution.cs | 158 --- plugins/mono/Makefile.am | 22 - plugins/mono/mono-plugin.c | 240 ---- plugins/mono/mono-plugin.h | 51 - plugins/mono/org-gnome-evolution-mono.eplug.xml | 11 - plugins/prefer-plain/prefer-plain.c | 4 +- plugins/pst-import/pst-importer.c | 4 +- plugins/python/ChangeLog | 38 - plugins/python/Makefile.am | 30 - plugins/python/example/Makefile.am | 29 - plugins/python/example/hello_python.py | 5 - .../python/example/org-gnome-hello-python-ui.xml | 16 - .../example/org-gnome-hello-python.eplug.xml | 20 - .../python/org-gnome-evolution-python.eplug.xml | 10 - plugins/python/python-plugin-loader.c | 192 --- plugins/python/python-plugin-loader.h | 47 - plugins/sa-junk-plugin/em-junk-filter.c | 18 +- .../org-gnome-sa-junk-plugin.eplug.xml | 16 +- plugins/tnef-attachments/tnef-plugin.c | 4 +- .../webdav-account-setup/webdav-contacts-source.c | 4 +- 35 files changed, 63 insertions(+), 2297 deletions(-) delete mode 100644 plugins/mono/Camel.cs delete mode 100644 plugins/mono/ChangeLog delete mode 100644 plugins/mono/Evolution.cs delete mode 100644 plugins/mono/Makefile.am delete mode 100644 plugins/mono/mono-plugin.c delete mode 100644 plugins/mono/mono-plugin.h delete mode 100644 plugins/mono/org-gnome-evolution-mono.eplug.xml delete mode 100644 plugins/python/ChangeLog delete mode 100644 plugins/python/Makefile.am delete mode 100644 plugins/python/example/Makefile.am delete mode 100644 plugins/python/example/hello_python.py delete mode 100644 plugins/python/example/org-gnome-hello-python-ui.xml delete mode 100644 plugins/python/example/org-gnome-hello-python.eplug.xml delete mode 100644 plugins/python/org-gnome-evolution-python.eplug.xml delete mode 100644 plugins/python/python-plugin-loader.c delete mode 100644 plugins/python/python-plugin-loader.h (limited to 'plugins') diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 88edda37f0..c20e1dde91 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -1,4 +1,4 @@ SUBDIRS = $(plugins_enabled) -DIST_SUBDIRS = $(all_plugins_base) $(all_plugins_standard) $(all_plugins_experimental) profiler python +DIST_SUBDIRS = $(all_plugins_base) $(all_plugins_standard) $(all_plugins_experimental) profiler -include $(top_srcdir)/git.mk diff --git a/plugins/attachment-reminder/attachment-reminder.c b/plugins/attachment-reminder/attachment-reminder.c index 87acc1662d..330fd5df8f 100644 --- a/plugins/attachment-reminder/attachment-reminder.c +++ b/plugins/attachment-reminder/attachment-reminder.c @@ -67,7 +67,7 @@ enum { CLUE_N_COLUMNS }; -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); GtkWidget *e_plugin_lib_get_configure_widget (EPlugin *epl); void org_gnome_evolution_attachment_reminder (EPlugin *ep, EMEventTargetComposer *t); @@ -85,7 +85,7 @@ static gboolean clue_foreach_check_isempty (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, UIData *ui); gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { return 0; } diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c index c7d7cdfdcb..d5104dcf0c 100644 --- a/plugins/bbdb/bbdb.c +++ b/plugins/bbdb/bbdb.c @@ -42,7 +42,7 @@ #define d(x) /* Plugin hooks */ -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); void bbdb_handle_send (EPlugin *ep, EMEventTargetComposer *target); GtkWidget *bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data); @@ -106,7 +106,7 @@ find_esource_by_uri (ESourceList *source_list, const gchar *target_uri) } gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { /* Start up the plugin. */ if (enable) { diff --git a/plugins/bogo-junk-plugin/bf-junk-filter.c b/plugins/bogo-junk-plugin/bf-junk-filter.c index 3de8c30955..da384225c8 100644 --- a/plugins/bogo-junk-plugin/bf-junk-filter.c +++ b/plugins/bogo-junk-plugin/bf-junk-filter.c @@ -44,7 +44,7 @@ #include #include #include "mail/em-config.h" -#include +#include #include #include #include @@ -70,15 +70,15 @@ static const gchar em_junk_bf_gconf_dir[] = EM_JUNK_BF_GCONF_DIR; GtkWidget * org_gnome_bogo_convert_unicode (struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data); /* plugin fonction prototypes */ -gboolean em_junk_bf_check_junk (EPlugin *ep, EMJunkHookTarget *target); -gpointer em_junk_bf_validate_binary (EPlugin *ep, EMJunkHookTarget *target); -void em_junk_bf_report_junk (EPlugin *ep, EMJunkHookTarget *target); -void em_junk_bf_report_non_junk (EPlugin *ep, EMJunkHookTarget *target); -void em_junk_bf_commit_reports (EPlugin *ep, EMJunkHookTarget *target); +gboolean em_junk_bf_check_junk (EPlugin *ep, EMJunkTarget *target); +gpointer em_junk_bf_validate_binary (EPlugin *ep, EMJunkTarget *target); +void em_junk_bf_report_junk (EPlugin *ep, EMJunkTarget *target); +void em_junk_bf_report_non_junk (EPlugin *ep, EMJunkTarget *target); +void em_junk_bf_commit_reports (EPlugin *ep, EMJunkTarget *target); static gint pipe_to_bogofilter (CamelMimeMessage *msg, const gchar **argv, GError **error); /* eplugin stuff */ -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); #define EM_JUNK_BF_GCONF_DIR_LENGTH (G_N_ELEMENTS (em_junk_bf_gconf_dir) - 1) @@ -241,7 +241,7 @@ em_junk_bf_setting_notify (GConfClient *gconf, } gboolean -em_junk_bf_check_junk (EPlugin *ep, EMJunkHookTarget *target) +em_junk_bf_check_junk (EPlugin *ep, EMJunkTarget *target) { CamelMimeMessage *msg = target->m; gint rv; @@ -266,7 +266,7 @@ em_junk_bf_check_junk (EPlugin *ep, EMJunkHookTarget *target) } void -em_junk_bf_report_junk (EPlugin *ep, EMJunkHookTarget *target) +em_junk_bf_report_junk (EPlugin *ep, EMJunkTarget *target) { CamelMimeMessage *msg = target->m; @@ -287,7 +287,7 @@ em_junk_bf_report_junk (EPlugin *ep, EMJunkHookTarget *target) } void -em_junk_bf_report_non_junk (EPlugin *ep, EMJunkHookTarget *target) +em_junk_bf_report_non_junk (EPlugin *ep, EMJunkTarget *target) { CamelMimeMessage *msg = target->m; @@ -308,18 +308,18 @@ em_junk_bf_report_non_junk (EPlugin *ep, EMJunkHookTarget *target) } void -em_junk_bf_commit_reports (EPlugin *ep, EMJunkHookTarget *target) +em_junk_bf_commit_reports (EPlugin *ep, EMJunkTarget *target) { } gpointer -em_junk_bf_validate_binary (EPlugin *ep, EMJunkHookTarget *target) +em_junk_bf_validate_binary (EPlugin *ep, EMJunkTarget *target) { return g_file_test (em_junk_bf_binary, G_FILE_TEST_EXISTS) ? (gpointer) "1" : NULL; } gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { GConfClient *gconf; diff --git a/plugins/bogo-junk-plugin/org-gnome-bogo-junk-plugin.eplug.xml b/plugins/bogo-junk-plugin/org-gnome-bogo-junk-plugin.eplug.xml index e1d8cc83a0..1317b988d9 100644 --- a/plugins/bogo-junk-plugin/org-gnome-bogo-junk-plugin.eplug.xml +++ b/plugins/bogo-junk-plugin/org-gnome-bogo-junk-plugin.eplug.xml @@ -7,13 +7,12 @@ <_description>Filter junk messages using Bogofilter. - - - + diff --git a/plugins/caldav/caldav-source.c b/plugins/caldav/caldav-source.c index 3407353574..f5d8f59d12 100644 --- a/plugins/caldav/caldav-source.c +++ b/plugins/caldav/caldav-source.c @@ -42,7 +42,7 @@ /*****************************************************************************/ /* prototypes */ -gint e_plugin_lib_enable (EPluginLib *ep, +gint e_plugin_lib_enable (EPlugin *ep, gint enable); GtkWidget * oge_caldav (EPlugin *epl, @@ -66,7 +66,7 @@ ensure_caldav_source_group (ECalSourceType source_type) } gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { if (enable) { diff --git a/plugins/calendar-weather/calendar-weather.c b/plugins/calendar-weather/calendar-weather.c index b49726a57a..b558f7e3d2 100644 --- a/plugins/calendar-weather/calendar-weather.c +++ b/plugins/calendar-weather/calendar-weather.c @@ -42,12 +42,12 @@ GtkWidget *e_calendar_weather_refresh (EPlugin *epl, EConfigHookItemFactoryData GtkWidget *e_calendar_weather_units (EPlugin *epl, EConfigHookItemFactoryData *data); gboolean e_calendar_weather_check (EPlugin *epl, EConfigHookPageCheckData *data); void e_calendar_weather_migrate (EPlugin *epl, ECalEventTargetBackend *data); -gint e_plugin_lib_enable (EPluginLib *epl, gint enable); +gint e_plugin_lib_enable (EPlugin *epl, gint enable); #define WEATHER_BASE_URI "weather://" gint -e_plugin_lib_enable (EPluginLib *epl, gint enable) +e_plugin_lib_enable (EPlugin *epl, gint enable) { GList *l; const gchar *tmp; diff --git a/plugins/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c index 4e76f971c8..127cbdc815 100644 --- a/plugins/email-custom-header/email-custom-header.c +++ b/plugins/email-custom-header/email-custom-header.c @@ -79,13 +79,13 @@ static void epech_dialog_dispose (GObject *object); static void epech_setup_widgets (CustomHeaderOptionsDialog *mch); static gint epech_check_existing_composer_window(gconstpointer a, gconstpointer b); static void commit_changes (ConfigData *cd); -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); GtkWidget *e_plugin_lib_get_configure_widget (EPlugin *epl); gboolean e_plugin_ui_init(GtkUIManager *ui_manager, EMsgComposer *composer); GtkWidget *org_gnome_email_custom_header_config_option (struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data); gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { return 0; } diff --git a/plugins/exchange-operations/exchange-operations.c b/plugins/exchange-operations/exchange-operations.c index d79948ccc4..35ed781fad 100644 --- a/plugins/exchange-operations/exchange-operations.c +++ b/plugins/exchange-operations/exchange-operations.c @@ -58,7 +58,7 @@ free_exchange_listener (void) } gint -e_plugin_lib_enable (EPluginLib *eplib, gint enable) +e_plugin_lib_enable (EPlugin *eplib, gint enable) { if (!exchange_global_config_listener) { exchange_global_config_listener = exchange_config_listener_new (); diff --git a/plugins/google-account-setup/google-source.c b/plugins/google-account-setup/google-source.c index aea49fa722..1dc76a0431 100644 --- a/plugins/google-account-setup/google-source.c +++ b/plugins/google-account-setup/google-source.c @@ -60,7 +60,7 @@ /*****************************************************************************/ /* prototypes */ -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); GtkWidget *plugin_google (EPlugin *epl, EConfigHookItemFactoryData *data); void e_calendar_google_migrate (EPlugin *epl, ECalEventTargetBackend *data); @@ -82,7 +82,7 @@ ensure_google_source_group (void) } gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { if (enable) { diff --git a/plugins/groupwise-account-setup/groupwise-account-setup.c b/plugins/groupwise-account-setup/groupwise-account-setup.c index 6375446d7e..0872a9c2a7 100644 --- a/plugins/groupwise-account-setup/groupwise-account-setup.c +++ b/plugins/groupwise-account-setup/groupwise-account-setup.c @@ -32,7 +32,7 @@ static CamelGwListener *config_listener = NULL; -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); GtkWidget* org_gnome_gw_account_setup(struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data); void ensure_mandatory_esource_properties (EPlugin *ep, ESEventTargetUpgrade *target); @@ -114,7 +114,7 @@ free_groupwise_listener ( void ) } gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { if (!config_listener) { config_listener = camel_gw_listener_new (); diff --git a/plugins/hula-account-setup/hula-account-setup.c b/plugins/hula-account-setup/hula-account-setup.c index 3f5898b724..34427f3b71 100644 --- a/plugins/hula-account-setup/hula-account-setup.c +++ b/plugins/hula-account-setup/hula-account-setup.c @@ -27,7 +27,7 @@ static CamelHulaListener *config_listener = NULL; -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); GtkWidget* org_gnome_evolution_hula_account_setup (struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data); static void @@ -37,7 +37,7 @@ free_hula_listener ( void ) } gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { if (!config_listener) { config_listener = camel_hula_listener_new (); diff --git a/plugins/mail-notification/mail-notification.c b/plugins/mail-notification/mail-notification.c index 8a2e7c238e..07483e7e06 100644 --- a/plugins/mail-notification/mail-notification.c +++ b/plugins/mail-notification/mail-notification.c @@ -885,7 +885,7 @@ get_cfg_widget (void) void org_gnome_mail_new_notify (EPlugin *ep, EMEventTargetFolder *t); void org_gnome_mail_read_notify (EPlugin *ep, EMEventTargetMessage *t); -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); GtkWidget *e_plugin_lib_get_configure_widget (EPlugin *epl); void @@ -935,7 +935,7 @@ org_gnome_mail_read_notify (EPlugin *ep, EMEventTargetMessage *t) } gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { if (enable) { #ifdef HAVE_DBUS diff --git a/plugins/mono/Camel.cs b/plugins/mono/Camel.cs deleted file mode 100644 index 4ad80e7012..0000000000 --- a/plugins/mono/Camel.cs +++ /dev/null @@ -1,1278 +0,0 @@ - -using System; -using System.Collections; -using System.ComponentModel; -using System.Runtime.InteropServices; - -namespace Camel { - [StructLayout (LayoutKind.Sequential)] - public struct CamelException { - public int id; - public string desc; - } - - public class Arg { - public enum Tag : uint { - END = 0, - IGNORE = 1, - FIRST = 1024, - - TYPE = 0xf0000000, /* type field for tags */ - TAG = 0x0fffffff, /* tag field for args */ - - OBJ = 0x00000000, /* object */ - INT = 0x10000000, /* int */ - DBL = 0x20000000, /* double */ - STR = 0x30000000, /* c string */ - PTR = 0x40000000, /* ptr */ - BOO = 0x50000000 /* bool */ - } - } - - public class Exception : System.ApplicationException { - public enum Type { - NONE = 0, - SYSTEM = 1 - } - - public Type id; - public string desc; - - public Exception(CamelException ex) { - id = (Type)ex.id; - desc = ex.desc; - } - - public Exception(Type _id, string _desc) { - id = _id; - desc = _desc; - } - } - - public class Util { - [DllImport("camel-1.2")] static extern int camel_init(string certdir, bool nss); - - public static void Init(string certdir, bool nss) { - if (camel_init(certdir, nss) != 0) - throw new Exception(Exception.Type.SYSTEM, "Init failure"); - } - - public static string [] getUIDArray(IntPtr o) { - GPtrArray pa = (GPtrArray)Marshal.PtrToStructure(o, typeof(GPtrArray)); - string [] uids = new string[pa.len]; - - for (int i=0;i use StringBuilder - [DllImport("camel-1.2")] static extern IntPtr camel_url_decode(ref string url); - - public URL(string uri) { - CamelException ex = new CamelException(); - - cobject = camel_url_new(uri, ref ex); - if (ex.id != 0) - throw new Exception(ex); - } - - public URL(URL bbase, string uri) { - cobject = camel_url_new_with_base(bbase.cobject, uri); - } - - ~URL() { - camel_url_free(cobject); - } - - /* its ugly but it works */ - private string field(string name) { - return Marshal.PtrToStringAuto(Marshal.ReadIntPtr(cobject, (int)Marshal.OffsetOf(typeof(CamelURL), name))); - } - - public string protocol { - set { camel_url_set_protocol(cobject, value); } - get { return field("protocol"); } - } - - public string user { - set { camel_url_set_user(cobject, value); } - get { return field("user"); } - } - - public string authmech { - set { camel_url_set_authmech(cobject, value); } - get { return field("authmech"); } - } - - public string passwd { - set { camel_url_set_passwd(cobject, value); } - get { return field("passwd"); } - } - - public string host { - set { camel_url_set_host(cobject, value); } - get { return field("host"); } - } - - public int port { - set { camel_url_set_port(cobject, value); } - get { return (int)Marshal.ReadIntPtr(cobject, (int)Marshal.OffsetOf(typeof(CamelURL), "port")); } - } - - public string path { - set { camel_url_set_path(cobject, value); } - get { return field("path"); } - } - - public string query { - set { camel_url_set_query(cobject, value); } - get { return field("query"); } - } - - public string fragment { - set { camel_url_set_fragment(cobject, value); } - get { return field("fragment"); } - } - - public Params paramlist { - get { - if (param_list == null) - param_list = new Params(this); - return param_list; - } - } - - public override string ToString() { - return camel_url_to_string(cobject, 0); - } - - public static string encode(string val) { - return camel_url_encode(val, null); - } - - public static string encode(string val, string escape) { - return camel_url_encode(val, escape); - } - } -} - -namespace Camel.Hash { - public class Stream : System.IO.Stream { - protected Camel.Stream substream; - - public Stream(Camel.Stream sub) { - substream = sub; - } - - public override bool CanSeek { get { return false; } } - public override bool CanRead { get { return true; } } - public override bool CanWrite { get { return true; } } - public override long Length { - get { - throw new System.IO.IOException("Cannot get stream length"); - } - } - public override long Position { - get { - throw new System.IO.IOException("Cannot get stream position"); - } - set { - if (value == 0) { - substream.reset(); - } else { - throw new System.IO.IOException("Cannot set stream position"); - } - } - } - - public override int Read(byte[] buffer, int offset, int count) { - // FIXME: how to add the offset to the buffer? - return substream.read(buffer, count); - } - - public override void Write(byte[] buffer, int offset, int count) { - // FIXME: how to add the offset to the buffer? - substream.write(buffer, count); - } - - public override void Flush() { - substream.flush(); - } - - public override long Seek(long offset, System.IO.SeekOrigin seek) { - throw new System.IO.IOException("Seeking not supported"); - } - - public override void SetLength(long len) { - throw new System.IO.IOException("Cannot set stream length"); - } - } -} - -/* -namespace Evolution.Mail { - class Component : GLib.Object { - public Component(IntPtr raw) : base(raw) {} - public Component() : base() {} - - ~Component() { - Dispose(); - } - - [DllImport("libevolution-mail.so")] static extern IntPtr mail_component_peek(); - [DllImport("libevolution-mail.so")] static extern IntPtr mail_component_peek_base_directory(IntPtr component); - [DllImport("libevolution-mail.so")] static extern IntPtr mail_component_peek(); - - public static Component peek() { - return new Component(mail_component_peek()); - } - - public String baseDirectory { - get {} - } -} -*/ diff --git a/plugins/mono/ChangeLog b/plugins/mono/ChangeLog deleted file mode 100644 index d994cc06f5..0000000000 --- a/plugins/mono/ChangeLog +++ /dev/null @@ -1,84 +0,0 @@ -2009-02-05 Suman Manjunath - - * mono-plugin.c: Include to fix an implicit- - function-declaration compiler warning. - -2009-01-28 Suman Manjunath - - * mono-plugin.c: Include to fix an implicit- - function-declaration compiler warning. - -2008-10-22 Matthew Barnes - - ** Fixes part of bug #549025 - - * Makefile.am: - Add $(MONO_CFLAGS) and $(MONO_LIBS) explicitly. The mono plugin - is the only module that should be linking against libmono. - -2008-09-02 Sankar P - -License Changes - - * mono-plugin.c: - -2008-08-27 Sankar P - -License Changes - - * mono-plugin.h: - -2008-04-01 Johnny Jacob - - * Camel.cs: Type cast. Fixes compile error. - -2008-03-19 Sankar P - - * mono-plugin.c: (epm_invoke), - (load_plugin_type_register_function): - * org-gnome-evolution-mono.eplug.xml: - - Use Plugin load levels. Mono loader should load - and register the type "mono", before a plugin - of type "mono" is loaded. - -2007-10-02 Matthew Barnes - - ** Fixes part of bug #469657 - - * mono-plugin.c: - Use destroy functions in GHashTables to simplify memory management. - -2007-04-02 Sankar P - - * Committed on behalf of Gilles Dartiguelongue - - * org-gnome-evolution-mono.eplug.xml: - Cleanup. - Fixes part of #301149 - -2005-12-17 Tor Lillqvist - - * mono-plugin.c: Drop unused inclusion of . - -2005-08-19 Not Zed - - ** See #308117. - - * Makefile.am: link to proper libraries. - -2005-06-15 Harish Krishnaswamy - - * Makefile.am : mono-plugin.h should be included - in the sources too. - -2005-05-25 Not Zed - - * mono-plugin.c: implement the mono loader as a plugin itself. - -2005-05-17 Not Zed - - * Evolution.cs: added initial e_error wrapper. - - * Camel.cs: added multipart & contenttype wrappers. - - diff --git a/plugins/mono/Evolution.cs b/plugins/mono/Evolution.cs deleted file mode 100644 index 0db54405b3..0000000000 --- a/plugins/mono/Evolution.cs +++ /dev/null @@ -1,158 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Reflection; - -using Camel; - -namespace Evolution { - [StructLayout (LayoutKind.Sequential)] - public class PopupTarget { - public IntPtr popup; - public IntPtr widget; - public int type; - public int mask; - }; - - [StructLayout (LayoutKind.Sequential)] - public class MenuTarget { - public IntPtr menu; - public IntPtr widget; - public int type; - public int mask; - }; - - [StructLayout (LayoutKind.Sequential)] - public class EventTarget { - public IntPtr aevent; - public int type; - public int mask; - }; -}; - -namespace Evolution { - public class Error { - // can we marshal varags from c#? - [DllImport("eutil")] static extern int e_error_run(IntPtr parent, string tag, IntPtr end); - [DllImport("eutil")] static extern int e_error_run(IntPtr parent, string tag, string arg0, IntPtr end); - [DllImport("eutil")] static extern int e_error_run(IntPtr parent, string tag, string arg0, string arg1, IntPtr end); - [DllImport("eutil")] static extern int e_error_run(IntPtr parent, string tag, string arg0, string arg1, string arg2, IntPtr end); - - public static int run(IntPtr parent, string tag) { - return e_error_run(parent, tag, (IntPtr)0); - } - public static int run(IntPtr parent, string tag, string arg0) { - return e_error_run(parent, tag, arg0, (IntPtr)0); - } - public static int run(IntPtr parent, string tag, string arg0, string arg1) { - return e_error_run(parent, tag, arg0, arg1, (IntPtr)0); - } - public static int run(IntPtr parent, string tag, string arg0, string arg1, string arg2) { - return e_error_run(parent, tag, arg0, arg1, arg2, (IntPtr)0); - } - } -} - -namespace Evolution.Mail { - /* ********************************************************************** */ - [StructLayout (LayoutKind.Sequential)] - public class PopupTargetSelect : PopupTarget { - public IntPtr _folder; - public string uri; - public IntPtr _uids; - - public static PopupTargetSelect get(IntPtr o) { - return (PopupTargetSelect)Marshal.PtrToStructure(o, typeof(PopupTargetSelect)); - } - - public Camel.Folder folder { - get { return (Camel.Folder)Camel.Object.fromCamel(_folder); } - } - - public string [] uids { - get { return Camel.Util.getUIDArray(_uids); } - } - } - - [StructLayout (LayoutKind.Sequential)] - public class PopupTargetURI : Evolution.PopupTarget { - public string uri; - - public static PopupTargetURI get(IntPtr o) { - return (PopupTargetURI)Marshal.PtrToStructure(o, typeof(PopupTargetURI)); - } - } - - [StructLayout (LayoutKind.Sequential)] - public class PopupTargetPart : PopupTarget { - public string mimeType; - public IntPtr _part; - - public static PopupTargetPart get(IntPtr o) { - return (PopupTargetPart)Marshal.PtrToStructure(o, typeof(PopupTargetPart)); - } - - public Camel.Object part { - get { return (Camel.Object)Camel.Object.fromCamel(_part); } - } - } - - [StructLayout (LayoutKind.Sequential)] - public struct PopupTargetFolder { - public Evolution.PopupTarget target; - public string uri; - - public static PopupTargetFolder get(IntPtr o) { - return (PopupTargetFolder)Marshal.PtrToStructure(o, typeof(PopupTargetFolder)); - } - } - - /* ********************************************************************** */ - [StructLayout (LayoutKind.Sequential)] - public class MenuTargetSelect : MenuTarget { - public IntPtr _folder; - public string uri; - public IntPtr _uids; - - public static MenuTargetSelect get(IntPtr o) { - return (MenuTargetSelect)Marshal.PtrToStructure(o, typeof(MenuTargetSelect)); - } - - public Camel.Folder folder { - get { return (Camel.Folder)Camel.Object.fromCamel(_folder); } - } - - public string [] uids { - get { return Camel.Util.getUIDArray(_uids); } - } - } - - /* ********************************************************************** */ - [StructLayout (LayoutKind.Sequential)] - public class EventTargetFolder : EventTarget { - public string uri; - - public static EventTargetFolder get(IntPtr o) { - return (EventTargetFolder)Marshal.PtrToStructure(o, typeof(EventTargetFolder)); - } - } - - [StructLayout (LayoutKind.Sequential)] - public class EventTargetMessage : EventTarget { - public IntPtr _folder; - public string uid; - public IntPtr _message; - - public static EventTargetMessage get(IntPtr o) { - return (EventTargetMessage)Marshal.PtrToStructure(o, typeof(EventTargetMessage)); - } - - public Camel.Folder folder { - get { return (Camel.Folder)Camel.Object.fromCamel(_folder); } - } - - public Camel.MimeMessage message { - get { return (Camel.MimeMessage)Camel.Object.fromCamel(_message); } - } - - } -}; diff --git a/plugins/mono/Makefile.am b/plugins/mono/Makefile.am deleted file mode 100644 index 4f7a935179..0000000000 --- a/plugins/mono/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - $(E_UTIL_CFLAGS) \ - $(MONO_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-evolution-mono.eplug -plugin_LTLIBRARIES = liborg-gnome-evolution-mono.la - -liborg_gnome_evolution_mono_la_SOURCES = mono-plugin.c mono-plugin.h -liborg_gnome_evolution_mono_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) -liborg_gnome_evolution_mono_la_LIBADD = \ - $(E_UTIL_LIBS) \ - $(MONO_LIBS) - -EXTRA_DIST = org-gnome-evolution-mono.eplug.xml - -BUILT_SOURCES = $(plugin_DATA) -CLEANFILES = $(BUILT_SOURCES) - --include $(top_srcdir)/git.mk diff --git a/plugins/mono/mono-plugin.c b/plugins/mono/mono-plugin.c deleted file mode 100644 index ae5f199c46..0000000000 --- a/plugins/mono/mono-plugin.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see - * - * - * Authors: - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#include -#include - -#include "mono-plugin.h" - -#include -#include -#include -#include -#include -#include -#include - -#define d(x) (x) - -static MonoDomain *domain; - -/* ********************************************************************** */ -static gpointer epm_parent_class; - -typedef struct _EPluginMonoPrivate { - MonoAssembly *assembly; - MonoClass *klass; - MonoObject *plugin; - GHashTable *methods; -} EPluginMonoPrivate; - -#define epm ((EPluginMono *)ep) - -gpointer load_plugin_type_register_function (gpointer a, gpointer b); - -static gchar * -get_xml_prop(xmlNodePtr node, const gchar *id) -{ - gchar *p = xmlGetProp(node, id); - gchar *out = NULL; - - if (p) { - out = g_strdup(p); - xmlFree(p); - } - - return out; -} - -/* - Two approaches: - You can have a Evolution.Plugin implementation which has every callback as methods on it. - Or you can just use static methods for everything. - - All methods take a single (structured) argument. -*/ - -static gpointer -epm_invoke(EPlugin *ep, const gchar *name, gpointer data) -{ - EPluginMonoPrivate *p = epm->priv; - MonoMethodDesc *d; - MonoMethod *m; - MonoObject *x = NULL, *res; - gpointer *params; - - g_print ("\n\a epm_invoke in mono-plugin.c in mono plugin loader is called \n\a"); - - /* we need to do this every time since we may be called from any thread for some uses */ - mono_thread_attach(domain); - - if (p->assembly == NULL) { - p->assembly = mono_domain_assembly_open(domain, epm->location); - if (p->assembly == NULL) { - g_warning("can't load assembly '%s'", epm->location); - return NULL; - } - - if (epm->handler == NULL - || (p->klass = mono_class_from_name(mono_assembly_get_image(p->assembly), "", epm->handler)) == NULL) { - d(printf("Using static callbacks only")); - } else { - p->plugin = mono_object_new(domain, p->klass); - /* could conceivably init with some context too */ - mono_runtime_object_init(p->plugin); - } - } - - m = g_hash_table_lookup(p->methods, name); - if (m == NULL) { - if (p->klass) { - d(printf("looking up method '%s' in class\n", name)); - /* class method */ - - d = mono_method_desc_new(name, FALSE); - /*if (d == NULL) { - g_warning("Can't create method descriptor for '%s'", name); - return NULL; - }*/ - - gpointer iter = NULL; - MonoMethod* mono_method; - - d(printf ("\n\a About to get methods in klass\n\a")); - - while ((mono_method = mono_class_get_methods (p->klass, &iter))) { - g_print ("\n\a Method name is : <%s>\n\a", mono_method_get_name(mono_method)); - } - d(printf ("\n\a Got methods in klass \n\a")); -//mono_class_get_method_from_name - m = mono_class_get_method_from_name (p->klass, name, -1); - if (m == NULL) { - g_warning("Can't find method callback '%s'", name); - return NULL; - } - } else { - d(printf("looking up static method '%s'\n", name)); - /* static method */ - d = mono_method_desc_new(name, FALSE); - if (d == NULL) { - g_warning("Can't create method descriptor for '%s'", name); - return NULL; - } - - m = mono_method_desc_search_in_image(d, mono_assembly_get_image(p->assembly)); - if (m == NULL) { - g_warning("Can't find method callback '%s'", name); - return NULL; - } - } - - g_hash_table_insert(p->methods, g_strdup(name), m); - } - - params = g_malloc0(sizeof(*params)*1); - params[0] = &data; - res = mono_runtime_invoke(m, p->plugin, params, &x); - /* do i need to free params?? */ - - if (x) - mono_print_unhandled_exception(x); - - if (res) { - gpointer *p = mono_object_unbox(res); - d(printf("mono method returned '%p' %ld\n", *p, (glong)*p)); - return *p; - } else - return NULL; -} - -static gint -epm_construct(EPlugin *ep, xmlNodePtr root) -{ - if (((EPluginClass *)epm_parent_class)->construct(ep, root) == -1) - return -1; - - epm->location = get_xml_prop(root, "location"); - epm->handler = get_xml_prop(root, "handler"); - - if (epm->location == NULL) - return -1; - - return 0; -} - -static void -epm_finalise(GObject *o) -{ - EPlugin *ep = (EPlugin *)o; - EPluginMonoPrivate *p = epm->priv; - - g_free(epm->location); - g_free(epm->handler); - - g_hash_table_destroy(p->methods); - - g_free(epm->priv); - - ((GObjectClass *)epm_parent_class)->finalize(o); -} - -static void -epm_class_init(EPluginClass *klass) -{ - ((GObjectClass *)klass)->finalize = epm_finalise; - klass->construct = epm_construct; - klass->invoke = epm_invoke; - klass->type = "mono"; -} - -static void -epm_init(GObject *o) -{ - EPlugin *ep = (EPlugin *)o; - - epm->priv = g_malloc0(sizeof(*epm->priv)); - epm->priv->methods = g_hash_table_new_full( - g_str_hash, g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) NULL); -} - -gpointer -load_plugin_type_register_function (gpointer a, gpointer b) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof(EPluginMonoClass), NULL, NULL, (GClassInitFunc) epm_class_init, NULL, NULL, - sizeof(EPluginMono), 0, (GInstanceInitFunc) epm_init, - }; - - epm_parent_class = g_type_class_ref(e_plugin_get_type()); - type = g_type_register_static(e_plugin_get_type(), "EPluginMono", &info, 0); - e_plugin_register_type (type); - d(printf("\nType EPluginMono registered from the mono-plugin-loader\n")); - domain = mono_jit_init("Evolution"); - mono_thread_attach(domain); - } - - return GUINT_TO_POINTER(type); -} diff --git a/plugins/mono/mono-plugin.h b/plugins/mono/mono-plugin.h deleted file mode 100644 index 8ea867e806..0000000000 --- a/plugins/mono/mono-plugin.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see - * - * - * Authors: - * Sankar P - * Michael Zucchi - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef _ORG_GNOME_EVOLUTION_MONO_H -#define _ORG_GNOME_EVOLUTION_MONO_H - -#include "e-util/e-plugin.h" - -/* ********************************************************************** */ -/* This is ALL private */ - -typedef struct _EPluginMono EPluginMono; -typedef struct _EPluginMonoClass EPluginMonoClass; - -struct _EPluginMono { - EPlugin plugin; - - struct _EPluginMonoPrivate *priv; - - gchar *location; /* location */ - gchar *handler; /* handler class */ -}; - -struct _EPluginMonoClass { - EPluginClass plugin_class; -}; - -gpointer org_gnome_evolution_mono_get_type(gpointer a, gpointer b); - -#endif /* ! _ORG_GNOME_EVOLUTION_MONO_H */ diff --git a/plugins/mono/org-gnome-evolution-mono.eplug.xml b/plugins/mono/org-gnome-evolution-mono.eplug.xml deleted file mode 100644 index 8b7ea0d043..0000000000 --- a/plugins/mono/org-gnome-evolution-mono.eplug.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - <_description>Support plugins written in Mono. - - - - - diff --git a/plugins/prefer-plain/prefer-plain.c b/plugins/prefer-plain/prefer-plain.c index 0a1da1f63c..b896f19299 100644 --- a/plugins/prefer-plain/prefer-plain.c +++ b/plugins/prefer-plain/prefer-plain.c @@ -243,10 +243,10 @@ org_gnome_prefer_plain_config_mode(struct _EPlugin *epl, struct _EConfigHookItem return (GtkWidget *)dropdown; } -gint e_plugin_lib_enable(EPluginLib *ep, gint enable); +gint e_plugin_lib_enable(EPlugin *ep, gint enable); gint -e_plugin_lib_enable(EPluginLib *ep, gint enable) +e_plugin_lib_enable(EPlugin *ep, gint enable) { gchar *key; gint i; diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c index 976eaa408d..8009d563f7 100644 --- a/plugins/pst-import/pst-importer.c +++ b/plugins/pst-import/pst-importer.c @@ -94,7 +94,7 @@ gboolean org_credativ_evolution_readpst_supported (EPlugin *epl, EImportTarget * GtkWidget *org_credativ_evolution_readpst_getwidget (EImport *ei, EImportTarget *target, EImportImporter *im); void org_credativ_evolution_readpst_import (EImport *ei, EImportTarget *target, EImportImporter *im); void org_credativ_evolution_readpst_cancel (EImport *ei, EImportTarget *target, EImportImporter *im); -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); /* em-folder-selection-button.h is private, even though other internal evo plugins use it! so declare the functions here @@ -1655,7 +1655,7 @@ org_credativ_evolution_readpst_cancel (EImport *ei, EImportTarget *target, EImpo } gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { if (enable) { bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); diff --git a/plugins/python/ChangeLog b/plugins/python/ChangeLog deleted file mode 100644 index 38cd85f29f..0000000000 --- a/plugins/python/ChangeLog +++ /dev/null @@ -1,38 +0,0 @@ -2008-09-24 Philip Withnall - - ** Fixes bug #553479 - - * org-gnome-evolution-python.eplug.xml: String capitalisation - improvements. - -2008-09-12 Sankar P - -License Changes - - * python-plugin-loader.c: - * python-plugin-loader.h: - -2008-07-21 Johnny Jacob - - * Makefile.am (example_sources): More typo fixes. :( - -2008-07-21 Johnny Jacob - - * Makefile.am (example_SOURCES): Add example sources - EXTRA_DIST. - -2008-06-12 Johnny Jacob - - * example/org-gnome-hello-python-ui.xml: Added. - - * example/org-gnome-hello-python.eplug.xml: Added. - - * example/Makefile.am : Added. - - * example/hello_python.py: Added. - -2008-06-09 Johnny Jacob - - * python-plugin-loader.c: Python plugin loader. - Initial Commit. - diff --git a/plugins/python/Makefile.am b/plugins/python/Makefile.am deleted file mode 100644 index 6f62036a1d..0000000000 --- a/plugins/python/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - $(E_UTIL_CFLAGS) \ - $(PY_INCLUDES) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-evolution-python.eplug -plugin_LTLIBRARIES = liborg-gnome-evolution-python.la - -liborg_gnome_evolution_python_la_SOURCES = python-plugin-loader.c python-plugin-loader.h -liborg_gnome_evolution_python_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) -liborg_gnome_evolution_python_la_LIBADD = \ - -lpthread -ldl -lutil -lm \ - $(PY_LIBS) \ - $(E_UTIL_LIBS) - -example_sources = \ - example/hello_python.py \ - example/org-gnome-hello-python-ui.xml \ - example/org-gnome-hello-python.eplug.xml \ - example/Makefile.am - -EXTRA_DIST = org-gnome-evolution-python.eplug.xml \ - $(example_sources) - -BUILT_SOURCES = $(plugin_DATA) -CLEANFILES = $(BUILT_SOURCES) - --include $(top_srcdir)/git.mk diff --git a/plugins/python/example/Makefile.am b/plugins/python/example/Makefile.am deleted file mode 100644 index cc14dc94d9..0000000000 --- a/plugins/python/example/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -AM_CPPFLAGS = \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" - -@EVO_PLUGIN_RULE@ - -plugin_DATA = \ - hello_python.py \ - org-gnome-hello-python-ui.xml \ - org-gnome-hello-python.eplug - -liborg_gnome_py_plug_test_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) - -errordir = $(privdatadir)/errors - -BUILDME = org-gnome-hello-python.eplug \ -$(error_i18n) - -BUILT_SOURCES = \ - $(BUILDME) - -EXTRA_DIST = \ - hello_python.py \ - org-gnome-hello-python-ui.xml \ - org-gnome-hello-python.eplug.xml - -CLEANFILES = $(BUILT_SOURCES) - --include $(top_srcdir)/git.mk diff --git a/plugins/python/example/hello_python.py b/plugins/python/example/hello_python.py deleted file mode 100644 index 16dc2a12f8..0000000000 --- a/plugins/python/example/hello_python.py +++ /dev/null @@ -1,5 +0,0 @@ -'''hello_python.py - Python source designed to ''' -'''demonstrate the use of python Eplugins''' - -def say_hello(): - print 'Hello ! From python' diff --git a/plugins/python/example/org-gnome-hello-python-ui.xml b/plugins/python/example/org-gnome-hello-python-ui.xml deleted file mode 100644 index 074960e84d..0000000000 --- a/plugins/python/example/org-gnome-hello-python-ui.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - diff --git a/plugins/python/example/org-gnome-hello-python.eplug.xml b/plugins/python/example/org-gnome-hello-python.eplug.xml deleted file mode 100644 index 8f77d5ba01..0000000000 --- a/plugins/python/example/org-gnome-hello-python.eplug.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - <_description> - Test Plugin for Python EPlugin loader. - - - - - - - - - - - - diff --git a/plugins/python/org-gnome-evolution-python.eplug.xml b/plugins/python/org-gnome-evolution-python.eplug.xml deleted file mode 100644 index 5f215f65e5..0000000000 --- a/plugins/python/org-gnome-evolution-python.eplug.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - <_description>A plugin which loads other plugins written using Python. - - - - diff --git a/plugins/python/python-plugin-loader.c b/plugins/python/python-plugin-loader.c deleted file mode 100644 index 0a03809e97..0000000000 --- a/plugins/python/python-plugin-loader.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see - * - * - * Authors: - * Johnny Jacob - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#include -#include -#include - -#include "python-plugin-loader.h" - -#define d(x) - -static gpointer epp_parent_class; - -typedef struct _EPluginPythonPrivate { - PyObject *pModule; - PyObject *pClass; - PyObject *pFunc; - PyObject *pDict; - GHashTable *methods; -} EPluginPythonPrivate; - -#define epp ((EPluginPython *)ep) - -gpointer load_plugin_type_register_function (gpointer a, gpointer b); - -static gchar * -get_xml_prop(xmlNodePtr node, const gchar *id) -{ - gchar *p = xmlGetProp(node, id); - gchar *out = NULL; - - if (p) { - out = g_strdup(p); - xmlFree(p); - } - - return out; -} - -static gpointer -epp_invoke(EPlugin *ep, const gchar *name, gpointer data) -{ - EPluginPythonPrivate *p = epp->priv; - PyObject *pModuleName, *pFunc; - PyObject *pInstance, *pValue = NULL; - - /* we need to do this every time since we may be called from any thread for some uses */ - Py_Initialize(); - - if (p->pModule == NULL) { - pModuleName = PyString_FromString(epp->module_name); - - PyRun_SimpleString(g_strdup_printf ("import sys; sys.path.insert(0, '%s')", epp->location)); - - p->pModule = PyImport_Import(pModuleName); - - Py_DECREF(pModuleName); //Free - - if (p->pModule == NULL) { - PyErr_Print(); - g_warning("can't load python module '%s'", epp->location); - return NULL; - } - - p->pDict = PyModule_GetDict(p->pModule); - - if (epp->pClass) { - p->pClass = PyDict_GetItemString(p->pDict, epp->pClass); - } - } - - if (p->pClass) { - - if (PyCallable_Check(p->pClass)) - pInstance = PyObject_CallObject(p->pClass, NULL); - - pValue = PyObject_CallMethod(pInstance, name, NULL); - - } else { - - pFunc = PyDict_GetItemString(p->pDict, name); - - if (pFunc && PyCallable_Check(pFunc)) - pValue = PyObject_CallObject(pFunc, NULL); - else - PyErr_Print(); - } - - if (pValue) { - d(printf("%s(%d):%s: Result of call: %ld \n", __FILE__, __LINE__, __PRETTY_FUNCTION__, PyInt_AsLong(pValue))); - Py_DECREF(pValue); - /* Fixme */ - return NULL; - } else - return NULL; -} - -static gint -epp_construct(EPlugin *ep, xmlNodePtr root) -{ - if (((EPluginClass *)epp_parent_class)->construct(ep, root) == -1) - return -1; - - epp->location = get_xml_prop(root, "location"); - epp->module_name = get_xml_prop (root, "module_name"); - epp->pClass = get_xml_prop(root, "pClass"); - - if (epp->location == NULL) - return -1; - - return 0; -} - -static void -epp_finalise(GObject *o) -{ - EPlugin *ep = (EPlugin *)o; - EPluginPythonPrivate *p = epp->priv; - - g_free(epp->location); - g_free(epp->module_name); - g_free(epp->pClass); - - g_hash_table_destroy(p->methods); - - g_free(epp->priv); - - ((GObjectClass *)epp_parent_class)->finalize(o); -} - -static void -epp_class_init(EPluginClass *klass) -{ - ((GObjectClass *)klass)->finalize = epp_finalise; - klass->construct = epp_construct; - klass->invoke = epp_invoke; - klass->type = "python"; -} - -static void -epp_init(GObject *o) -{ - EPlugin *ep = (EPlugin *)o; - - epp->priv = g_malloc0(sizeof(*epp->priv)); - epp->priv->methods = g_hash_table_new_full( - g_str_hash, g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) NULL); -} - -gpointer -load_plugin_type_register_function (gpointer a, gpointer b) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof(EPluginPythonClass), NULL, NULL, (GClassInitFunc) epp_class_init, NULL, NULL, - sizeof(EPluginPython), 0, (GInstanceInitFunc) epp_init, - }; - - epp_parent_class = g_type_class_ref(e_plugin_get_type()); - type = g_type_register_static(e_plugin_get_type(), "EPluginPython", &info, 0); - e_plugin_register_type (type); - - d(printf("\nType EPluginPython registered from the python-plugin-loader\n")); - - Py_Initialize(); //TODO : Does this mean i can cache the instance of pyobjects ? - } - - return GUINT_TO_POINTER(type); -} diff --git a/plugins/python/python-plugin-loader.h b/plugins/python/python-plugin-loader.h deleted file mode 100644 index 66bd8d5ba2..0000000000 --- a/plugins/python/python-plugin-loader.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see - * - * - * Authors: - * Johnny Jacob - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef _ORG_GNOME_EVOLUTION_PYTHON_H -#define _ORG_GNOME_EVOLUTION_PYTHON_H - -#include "e-util/e-plugin.h" - -typedef struct _EPluginPython EPluginPython; -typedef struct _EPluginPythonClass EPluginPythonClass; - -struct _EPluginPython { - EPlugin plugin; - - struct _EPluginPythonPrivate *priv; - - gchar *location; /* location */ - gchar *pClass; /* handler class */ - gchar *module_name; -}; - -struct _EPluginPythonClass { - EPluginClass plugin_class; -}; - -gpointer org_gnome_evolution_python_get_type(gpointer a, gpointer b); - -#endif /* ! _ORG_GNOME_EVOLUTION_PYTHON_H */ diff --git a/plugins/sa-junk-plugin/em-junk-filter.c b/plugins/sa-junk-plugin/em-junk-filter.c index 74010f2555..ff38f18d6a 100644 --- a/plugins/sa-junk-plugin/em-junk-filter.c +++ b/plugins/sa-junk-plugin/em-junk-filter.c @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include @@ -58,10 +58,10 @@ static pthread_mutex_t em_junk_sa_report_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t em_junk_sa_preferred_socket_path_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t em_junk_sa_spamd_restart_lock = PTHREAD_MUTEX_INITIALIZER; -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); -gboolean em_junk_sa_check_junk (EPlugin *ep, EMJunkHookTarget *target); -void em_junk_sa_report_junk (EPlugin *ep, EMJunkHookTarget *target); -void em_junk_sa_report_non_junk (EPlugin *ep, EMJunkHookTarget *target); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); +gboolean em_junk_sa_check_junk (EPlugin *ep, EMJunkTarget *target); +void em_junk_sa_report_junk (EPlugin *ep, EMJunkTarget *target); +void em_junk_sa_report_non_junk (EPlugin *ep, EMJunkTarget *target); void em_junk_sa_commit_reports (EPlugin *ep); gpointer em_junk_sa_validate_binary (EPlugin *ep); GtkWidget *org_gnome_sa_use_remote_tests (struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data); @@ -571,7 +571,7 @@ em_junk_sa_respawn_spamd () } gboolean -em_junk_sa_check_junk(EPlugin *ep, EMJunkHookTarget *target) +em_junk_sa_check_junk(EPlugin *ep, EMJunkTarget *target) { GByteArray *out = NULL; const gchar *argv[7]; @@ -675,7 +675,7 @@ get_spamassassin_version () } void -em_junk_sa_report_junk (EPlugin *ep, EMJunkHookTarget *target) +em_junk_sa_report_junk (EPlugin *ep, EMJunkTarget *target) { const gchar *sync_op = (get_spamassassin_version () >= 3) @@ -715,7 +715,7 @@ em_junk_sa_report_junk (EPlugin *ep, EMJunkHookTarget *target) } void -em_junk_sa_report_non_junk (EPlugin *ep, EMJunkHookTarget *target) +em_junk_sa_report_non_junk (EPlugin *ep, EMJunkTarget *target) { const gchar *sync_op = (get_spamassassin_version () >= 3) @@ -812,7 +812,7 @@ em_junk_sa_setting_notify(GConfClient *gconf, guint cnxn_id, GConfEntry *entry, } gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { em_junk_sa_init(); diff --git a/plugins/sa-junk-plugin/org-gnome-sa-junk-plugin.eplug.xml b/plugins/sa-junk-plugin/org-gnome-sa-junk-plugin.eplug.xml index 3403a3b8aa..83ed170c74 100644 --- a/plugins/sa-junk-plugin/org-gnome-sa-junk-plugin.eplug.xml +++ b/plugins/sa-junk-plugin/org-gnome-sa-junk-plugin.eplug.xml @@ -6,14 +6,12 @@ <_description>Filter junk messages using SpamAssassin. - - - + @@ -21,6 +19,6 @@ - + diff --git a/plugins/tnef-attachments/tnef-plugin.c b/plugins/tnef-attachments/tnef-plugin.c index a74dcee7a6..3e537e1dca 100644 --- a/plugins/tnef-attachments/tnef-plugin.c +++ b/plugins/tnef-attachments/tnef-plugin.c @@ -192,10 +192,10 @@ org_gnome_format_tnef(gpointer ep, EMFormatHookTarget *t) g_free(tmpdir); } -gint e_plugin_lib_enable(EPluginLib *ep, gint enable); +gint e_plugin_lib_enable(EPlugin *ep, gint enable); gint -e_plugin_lib_enable(EPluginLib *ep, gint enable) +e_plugin_lib_enable(EPlugin *ep, gint enable) { if (loaded) return 0; diff --git a/plugins/webdav-account-setup/webdav-contacts-source.c b/plugins/webdav-account-setup/webdav-contacts-source.c index b6d4443d4d..990a541cc9 100644 --- a/plugins/webdav-account-setup/webdav-contacts-source.c +++ b/plugins/webdav-account-setup/webdav-contacts-source.c @@ -52,7 +52,7 @@ GtkWidget * plugin_webdav_contacts(EPlugin *epl, EConfigHookItemFactoryData *data); gint -e_plugin_lib_enable(EPluginLib *ep, gint enable); +e_plugin_lib_enable(EPlugin *ep, gint enable); static void ensure_webdav_contacts_source_group(void) @@ -341,7 +341,7 @@ plugin_webdav_contacts(EPlugin *epl, EConfigHookItemFactoryData *data) } gint -e_plugin_lib_enable(EPluginLib *ep, gint enable) +e_plugin_lib_enable(EPlugin *ep, gint enable) { if (enable) { ensure_webdav_contacts_source_group(); -- cgit v1.2.3