[grilo-plugins] lua-factory: Print debug when a required config key is missing



commit 7035130a62e9ec4f74a3e8c344890c845788e400
Author: Bastien Nocera <hadess hadess net>
Date:   Sat Jun 13 01:51:37 2015 +0200

    lua-factory: Print debug when a required config key is missing
    
    This will stop the plugin developer from going bonkers.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=750903

 src/lua-factory/grl-lua-factory.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/lua-factory/grl-lua-factory.c b/src/lua-factory/grl-lua-factory.c
index d4bd64e..b092bb0 100644
--- a/src/lua-factory/grl-lua-factory.c
+++ b/src/lua-factory/grl-lua-factory.c
@@ -130,7 +130,8 @@ static GrlConfig *merge_all_configs (const gchar *source_id,
                                      GHashTable *source_configs,
                                      GList *available_configs);
 
-static gboolean all_mandatory_options_has_value (GHashTable *source_configs,
+static gboolean all_mandatory_options_has_value (const gchar *source_id,
+                                                 GHashTable *source_configs,
                                                  GrlConfig *merged_configs);
 
 static gboolean lua_plugin_source_init (GrlLuaFactorySource *lua_source);
@@ -326,7 +327,7 @@ grl_lua_factory_source_new (gchar *lua_plugin_path,
     goto bail;
 
   source->priv->configs = merge_all_configs (source_id, config_keys, configs);
-  if (!all_mandatory_options_has_value (config_keys, source->priv->configs))
+  if (!all_mandatory_options_has_value (source_id, config_keys, source->priv->configs))
     goto bail;
 
   g_free (source_id);
@@ -601,7 +602,8 @@ get_lua_sources (void)
  * If any mandatory option is not settled, return FALSE.
  */
 static gboolean
-all_mandatory_options_has_value (GHashTable *source_configs,
+all_mandatory_options_has_value (const gchar *source_id,
+                                 GHashTable *source_configs,
                                  GrlConfig *merged_configs)
 {
   const gchar *key = NULL;
@@ -618,6 +620,8 @@ all_mandatory_options_has_value (GHashTable *source_configs,
     if (g_strcmp0 (is_mandatory, "true") == 0
         && grl_config_get_string (merged_configs, key) == NULL) {
 
+      GRL_DEBUG ("Source %s is missing config for required key '%s'", source_id, key);
+
       g_list_free (list_keys);
       return FALSE;
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]