From f5991437c3e620708f1701310bd1e67b40ca3b42 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 31 Aug 2009 12:53:52 -0400 Subject: Get EConfig and EEvent hooks working again. There were a number of problems: - Walk the GType tree to find EPluginHook subclasses, instead of just registering the immediate children. - Some EConfig and EEvent subclasses were not being configured properly (particularly the mail and calendar subclasses). - Add preference window pages after the main loop starts to make sure all plugins and plugin hooks are installed first. --- e-util/e-config.c | 4 +++- e-util/e-plugin.c | 22 ++++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) (limited to 'e-util') diff --git a/e-util/e-config.c b/e-util/e-config.c index 9974da72cb..3695069eea 100644 --- a/e-util/e-config.c +++ b/e-util/e-config.c @@ -1654,7 +1654,9 @@ e_config_hook_get_type(void) * target map enumates the target types available for the implenting * class. **/ -void e_config_hook_class_add_target_map(EConfigHookClass *klass, const EConfigHookTargetMap *map) +void +e_config_hook_class_add_target_map (EConfigHookClass *klass, + const EConfigHookTargetMap *map) { g_hash_table_insert(klass->target_map, (gpointer)map->type, (gpointer)map); } diff --git a/e-util/e-plugin.c b/e-util/e-plugin.c index 5c5e55b147..5d77decfd9 100644 --- a/e-util/e-plugin.c +++ b/e-util/e-plugin.c @@ -508,14 +508,27 @@ plugin_load_subclasses (void) } g_free (children); +} - /* Load EPluginHook subclasses. */ +static void +plugin_load_hook_subclasses (GType parent_type) +{ + GType *children; + guint n_children, ii; - children = g_type_children (E_TYPE_PLUGIN_HOOK, &n_children); + children = g_type_children (parent_type, &n_children); for (ii = 0; ii < n_children; ii++) { EPluginHookClass *hook_class; EPluginHookClass *dupe_class; + gpointer key; + + /* First load the child's children. */ + plugin_load_hook_subclasses (children[ii]); + + /* Skip abstract types. */ + if (G_TYPE_IS_ABSTRACT (children[ii])) + continue; hook_class = g_type_class_ref (children[ii]); @@ -542,8 +555,8 @@ plugin_load_subclasses (void) continue; } - g_hash_table_insert ( - eph_types, (gpointer) hook_class->id, hook_class); + key = (gpointer) hook_class->id; + g_hash_table_insert (eph_types, key, hook_class); } g_free (children); @@ -571,6 +584,7 @@ e_plugin_load_plugins(void) * subclasses be registered prior to loading any plugins. * It greatly simplifies the loading process. */ plugin_load_subclasses (); + plugin_load_hook_subclasses (E_TYPE_PLUGIN_HOOK); client = gconf_client_get_default (); ep_disabled = gconf_client_get_list ( -- cgit