[grilo] core: Added GError parameter to grl_plugin_registry_add_config
- From: Iago Toral Quiroga <itoral src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo] core: Added GError parameter to grl_plugin_registry_add_config
- Date: Mon, 20 Dec 2010 11:14:08 +0000 (UTC)
commit 2dd14064adb363d5f6870353af02e428dfe4689f
Author: Iago Toral Quiroga <itoral igalia com>
Date: Mon Dec 20 10:31:01 2010 +0100
core: Added GError parameter to grl_plugin_registry_add_config
src/grl-plugin-registry.c | 22 ++++++++++++++++------
src/grl-plugin-registry.h | 5 +++--
2 files changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/src/grl-plugin-registry.c b/src/grl-plugin-registry.c
index 075ad44..d12c3f4 100644
--- a/src/grl-plugin-registry.c
+++ b/src/grl-plugin-registry.c
@@ -843,23 +843,31 @@ grl_plugin_registry_get_metadata_keys (GrlPluginRegistry *registry)
* grl_plugin_registry_add_config:
* @registry: the registry instance
* @config: a configuration set
+ * @error: error return location or @NULL to ignore
*
* Add a configuration for a plugin/source.
*/
-void
+gboolean
grl_plugin_registry_add_config (GrlPluginRegistry *registry,
- GrlConfig *config)
+ GrlConfig *config,
+ GError **error)
{
const gchar *plugin_id;
GList *configs = NULL;
- g_return_if_fail (config != NULL);
- g_return_if_fail (GRL_IS_PLUGIN_REGISTRY (registry));
+ g_return_val_if_fail (config != NULL, FALSE);
+ g_return_val_if_fail (GRL_IS_PLUGIN_REGISTRY (registry), FALSE);
plugin_id = grl_config_get_plugin (config);
if (!plugin_id) {
GRL_WARNING ("Plugin configuration missed plugin information, ignoring...");
- return;
+ if (error) {
+ *error = g_error_new (GRL_CORE_ERROR,
+ GRL_CORE_ERROR_CONFIG_FAILED,
+ "Plugin configuration does not contain " \
+ "plugin-id reference");
+ }
+ return FALSE;
}
configs = g_hash_table_lookup (registry->priv->configs, plugin_id);
@@ -873,6 +881,8 @@ grl_plugin_registry_add_config (GrlPluginRegistry *registry,
(gpointer) plugin_id,
configs);
}
+
+ return TRUE;
}
/**
@@ -923,7 +933,7 @@ grl_plugin_registry_add_config_from_file (GrlPluginRegistry *registry,
g_free (value);
}
}
- grl_plugin_registry_add_config (registry, config);
+ grl_plugin_registry_add_config (registry, config, NULL);
g_strfreev (keys);
}
g_strfreev (plugins);
diff --git a/src/grl-plugin-registry.h b/src/grl-plugin-registry.h
index defe847..d7b0618 100644
--- a/src/grl-plugin-registry.h
+++ b/src/grl-plugin-registry.h
@@ -236,8 +236,9 @@ GrlKeyID grl_plugin_registry_lookup_metadata_key (GrlPluginRegistry *registry,
GList *grl_plugin_registry_get_metadata_keys (GrlPluginRegistry *registry);
-void grl_plugin_registry_add_config (GrlPluginRegistry *registry,
- GrlConfig *config);
+gboolean grl_plugin_registry_add_config (GrlPluginRegistry *registry,
+ GrlConfig *config,
+ GError **error);
gboolean grl_plugin_registry_add_config_from_file (GrlPluginRegistry *registry,
const gchar *config_file,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]