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. --- mail/em-event.c | 80 --------------------------------------------------------- 1 file changed, 80 deletions(-) (limited to 'mail/em-event.c') diff --git a/mail/em-event.c b/mail/em-event.c index 2cdbb23125..de8f468fa9 100644 --- a/mail/em-event.c +++ b/mail/em-event.c @@ -204,83 +204,3 @@ em_event_target_new_custom_icon(EMEvent *eme, GtkTreeStore *store, GtkTreeIter * return t; } - -/* ********************************************************************** */ - -static gpointer emeh_parent_class; -#define emeh ((EMEventHook *)eph) - -static const EEventHookTargetMask emeh_folder_masks[] = { - { "newmail", EM_EVENT_FOLDER_NEWMAIL }, - { NULL } -}; - -static const EEventHookTargetMask emeh_composer_masks[] = { - { "sendoption", EM_EVENT_COMPOSER_SEND_OPTION }, - { NULL } -}; - -static const EEventHookTargetMask emeh_message_masks[] = { - { "replyall", EM_EVENT_MESSAGE_REPLY_ALL }, - { "reply", EM_EVENT_MESSAGE_REPLY }, - { NULL } -}; - -static const EEventHookTargetMask emeh_send_receive_masks[] = { - { "sendreceive", EM_EVENT_SEND_RECEIVE }, - { NULL } -}; - -static const EEventHookTargetMask emeh_custom_icon_masks[] = { - { "customicon", EM_EVENT_CUSTOM_ICON }, - { NULL } -}; - -static const EEventHookTargetMap emeh_targets[] = { - { "folder", EM_EVENT_TARGET_FOLDER, emeh_folder_masks }, - { "message", EM_EVENT_TARGET_MESSAGE, emeh_message_masks }, - { "composer", EM_EVENT_TARGET_COMPOSER, emeh_composer_masks}, - { "sendreceive", EM_EVENT_TARGET_SEND_RECEIVE, emeh_send_receive_masks}, - { "customicon", EM_EVENT_TARGET_CUSTOM_ICON, emeh_custom_icon_masks}, - { NULL } -}; - -static void -emeh_finalise(GObject *o) -{ - /*EPluginHook *eph = (EPluginHook *)o;*/ - - ((GObjectClass *)emeh_parent_class)->finalize(o); -} - -static void -emeh_class_init(EPluginHookClass *klass) -{ - gint i; - - ((GObjectClass *)klass)->finalize = emeh_finalise; - ((EPluginHookClass *)klass)->id = "org.gnome.evolution.mail.events:1.0"; - - for (i=0;emeh_targets[i].type;i++) - e_event_hook_class_add_target_map((EEventHookClass *)klass, &emeh_targets[i]); - - ((EEventHookClass *)klass)->event = (EEvent *)em_event_peek(); -} - -GType -em_event_hook_get_type(void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof(EMEventHookClass), NULL, NULL, (GClassInitFunc) emeh_class_init, NULL, NULL, - sizeof(EMEventHook), 0, (GInstanceInitFunc) NULL, - }; - - emeh_parent_class = g_type_class_ref(e_event_hook_get_type()); - type = g_type_register_static(e_event_hook_get_type(), "EMEventHook", &info, 0); - } - - return type; -} -- cgit