[grilo] core: Added GError parameter to grl_plugin_registry_unload
- From: Iago Toral Quiroga <itoral src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo] core: Added GError parameter to grl_plugin_registry_unload
- Date: Mon, 20 Dec 2010 11:13:42 +0000 (UTC)
commit 5ba5ee55e8b6301786833e5e9b836d79e7a952ed
Author: Iago Toral Quiroga <itoral igalia com>
Date: Mon Dec 20 09:51:47 2010 +0100
core: Added GError parameter to grl_plugin_registry_unload
src/grl-plugin-registry.c | 21 ++++++++++++++++-----
src/grl-plugin-registry.h | 5 +++--
2 files changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/src/grl-plugin-registry.c b/src/grl-plugin-registry.c
index a58b060..39df3b1 100644
--- a/src/grl-plugin-registry.c
+++ b/src/grl-plugin-registry.c
@@ -675,13 +675,17 @@ grl_plugin_registry_get_sources_by_operations (GrlPluginRegistry *registry,
* grl_plugin_registry_unload:
* @registry: the registry instance
* @plugin_id: the identifier of the plugin
+ * @error: error return location or @NULL to ignore
*
* Unload from memory a module identified by @plugin_id. This means call the
* module's deinit function.
+ *
+ * Returns %TRUE% on success.
*/
-void
+gboolean
grl_plugin_registry_unload (GrlPluginRegistry *registry,
- const gchar *plugin_id)
+ const gchar *plugin_id,
+ GError **error)
{
GrlPluginDescriptor *plugin;
GList *sources = NULL;
@@ -689,14 +693,19 @@ grl_plugin_registry_unload (GrlPluginRegistry *registry,
GRL_DEBUG ("grl_plugin_registry_unload: %s", plugin_id);
- g_return_if_fail (GRL_IS_PLUGIN_REGISTRY (registry));
- g_return_if_fail (plugin_id != NULL);
+ g_return_val_if_fail (GRL_IS_PLUGIN_REGISTRY (registry), FALSE);
+ g_return_val_if_fail (plugin_id != NULL, FALSE);
/* First check the plugin is valid */
plugin = g_hash_table_lookup (registry->priv->plugins, plugin_id);
if (!plugin) {
GRL_WARNING ("Could not deinit plugin '%s'. Plugin not found.", plugin_id);
- return;
+ if (error) {
+ *error = g_error_new (GRL_CORE_ERROR,
+ GRL_CORE_ERROR_UNLOAD_PLUGIN_FAILED,
+ "Plugin not found: '%s'", plugin_id);
+ }
+ return FALSE;
}
/* Second, shut down any sources spawned by this plugin */
@@ -730,6 +739,8 @@ grl_plugin_registry_unload (GrlPluginRegistry *registry,
if (plugin->module) {
g_module_close (plugin->module);
}
+
+ return TRUE;
}
/**
diff --git a/src/grl-plugin-registry.h b/src/grl-plugin-registry.h
index 06b0ea0..d792120 100644
--- a/src/grl-plugin-registry.h
+++ b/src/grl-plugin-registry.h
@@ -201,8 +201,9 @@ gboolean grl_plugin_registry_load_directory (GrlPluginRegistry *registry,
const gchar *path,
GError **error);
-void grl_plugin_registry_unload (GrlPluginRegistry *registry,
- const gchar *plugin_id);
+gboolean grl_plugin_registry_unload (GrlPluginRegistry *registry,
+ const gchar *plugin_id,
+ GError **error);
gboolean grl_plugin_registry_load_all (GrlPluginRegistry *registry,
GError **error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]