[grilo] core: Added GError parameter to grl_plugin_registry_load_directory
- From: Iago Toral Quiroga <itoral src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo] core: Added GError parameter to grl_plugin_registry_load_directory
- Date: Mon, 20 Dec 2010 11:13:12 +0000 (UTC)
commit d2b77b297c57f0d86304a8c31004ad51b4ad4b56
Author: Iago Toral Quiroga <itoral igalia com>
Date: Mon Dec 20 09:26:10 2010 +0100
core: Added GError parameter to grl_plugin_registry_load_directory
src/grl-plugin-registry.c | 17 +++++++++++++----
src/grl-plugin-registry.h | 3 ++-
2 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/src/grl-plugin-registry.c b/src/grl-plugin-registry.c
index b746b91..ae4e901 100644
--- a/src/grl-plugin-registry.c
+++ b/src/grl-plugin-registry.c
@@ -485,19 +485,22 @@ grl_plugin_registry_load (GrlPluginRegistry *registry,
* grl_plugin_registry_load_directory:
* @registry: the registry instance
* @path: the path to the directory
+ * @error: error return location or @NULL to ignore
*
* Loads a set of modules from directory in @path which contains
* a group shared object files.
*
- * Returns: %TRUE if the directory exists.
+ * Returns: %TRUE if the directory is valid.
*/
gboolean
grl_plugin_registry_load_directory (GrlPluginRegistry *registry,
- const gchar *path)
+ const gchar *path,
+ GError **error)
{
GDir *dir;
gchar *file;
const gchar *entry;
+ gboolean loaded_one = FALSE;
g_return_val_if_fail (GRL_IS_PLUGIN_REGISTRY (registry), FALSE);
@@ -516,11 +519,17 @@ grl_plugin_registry_load_directory (GrlPluginRegistry *registry,
while ((entry = g_dir_read_name (dir)) != NULL) {
if (g_str_has_suffix (entry, "." G_MODULE_SUFFIX)) {
file = g_build_filename (path, entry, NULL);
- grl_plugin_registry_load (registry, file, NULL);
+ if (grl_plugin_registry_load (registry, file, NULL)) {
+ loaded_one = TRUE;
+ }
g_free (file);
}
}
+ if (!loaded_one) {
+ GRL_WARNING ("No plugins loaded from directory '%s'", path);
+ }
+
g_dir_close (dir);
return TRUE;
}
@@ -547,7 +556,7 @@ grl_plugin_registry_load_all (GrlPluginRegistry *registry)
for (plugin_dir = registry->priv->plugins_dir;
plugin_dir;
plugin_dir = g_slist_next (plugin_dir)) {
- grl_plugin_registry_load_directory (registry, plugin_dir->data);
+ grl_plugin_registry_load_directory (registry, plugin_dir->data, NULL);
}
if (!loaded_one && error) {
diff --git a/src/grl-plugin-registry.h b/src/grl-plugin-registry.h
index 531d2b2..b038d00 100644
--- a/src/grl-plugin-registry.h
+++ b/src/grl-plugin-registry.h
@@ -198,7 +198,8 @@ gboolean grl_plugin_registry_load (GrlPluginRegistry *registry,
GError **error);
gboolean grl_plugin_registry_load_directory (GrlPluginRegistry *registry,
- const gchar *path);
+ const gchar *path,
+ GError **error);
void grl_plugin_registry_unload (GrlPluginRegistry *registry,
const gchar *plugin_id);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]