X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-plugin-factory.c;h=84d1736d1ebcc17303e9ac733d220d0c3ca1df2b;hp=f7905b277a2322f1304ed1dbebc3923bec562114;hb=4d39841513a3a7f7aa9d38ab97cb9fcc9171e80b;hpb=627c4af6ac85444cc3256fa568baf4a8d62178ae diff --git a/src/modest-plugin-factory.c b/src/modest-plugin-factory.c index f7905b2..84d1736 100644 --- a/src/modest-plugin-factory.c +++ b/src/modest-plugin-factory.c @@ -116,7 +116,7 @@ modest_plugin_factory_finalize (GObject *obj) /* Free the plugin list */ for (iter = priv->plugins; iter; iter = g_slist_next (iter)) - g_module_close ((GModule*) iter->data); + g_object_unref ((GObject *) iter->data); g_slist_free (priv->plugins); priv->plugins = NULL; @@ -127,18 +127,7 @@ modest_plugin_factory_finalize (GObject *obj) ModestPluginFactory* modest_plugin_factory_new (void) { - ModestPluginFactory *self; - ModestPluginFactoryPrivate *priv; - - self = MODEST_PLUGIN_FACTORY (g_object_new (MODEST_TYPE_PLUGIN_FACTORY, NULL)); - priv = MODEST_PLUGIN_FACTORY_GET_PRIVATE(self); - -/* if (priv->plugins == NULL) { */ -/* g_critical ("%s, no mail plugins detected", __FUNCTION__); */ -/* g_object_unref (self); */ -/* self = NULL; */ -/* } */ - return self; + return MODEST_PLUGIN_FACTORY (g_object_new (MODEST_TYPE_PLUGIN_FACTORY, NULL)); } void @@ -171,7 +160,7 @@ modest_plugin_factory_load_all (ModestPluginFactory *self) if (g_str_has_suffix (dirent, PLUGIN_EXT)) { gchar *plugin_file; ModestPlugin *plugin; - + plugin_file = g_build_filename (MODEST_MAILPLUGINDIR, dirent, NULL); plugin = modest_plugin_factory_load (plugin_file); g_free (plugin_file); @@ -189,7 +178,7 @@ modest_plugin_factory_load_all (ModestPluginFactory *self) static ModestPlugin* modest_plugin_factory_load (const gchar *file) { - ModestPlugin *plugin; + ModestPlugin *plugin = NULL; GKeyFile *plugin_file = NULL; gchar *plugin_name, *dir, *path; GTypeModule *type_module; @@ -217,16 +206,18 @@ modest_plugin_factory_load (const gchar *file) g_key_file_free (plugin_file); /* Build path to plugin */ - dir = g_path_get_dirname (file); + dir = g_path_get_dirname (file); path = g_module_build_path (dir, plugin_name); g_free (dir); /* plugin = g_module_open (path, G_MODULE_BIND_LAZY); */ - g_message ("PLUGIN TYPE IS %d", (gint) modest_plugin_get_type ()); type_module = G_TYPE_MODULE (modest_module_new (path)); if (type_module) { g_type_module_use (type_module); plugin = MODEST_PLUGIN (modest_module_new_object (MODEST_MODULE (type_module))); + if (plugin) + g_debug ("Plugin %s API version %s", plugin_name, modest_plugin_get_api_version (plugin)); + g_type_module_unuse (type_module); } g_free (path);