[grilo] registry: load config from GRL_CONFIG_PATH_VAR if set



commit abbca701bd45c0710cb1bd69c0bded002405c336
Author: Victor Toso <victortoso gnome org>
Date:   Sat Mar 20 20:04:35 2021 +0100

    registry: load config from GRL_CONFIG_PATH_VAR if set
    
    This is a simple way to share a GrlConfig between multiple
    applications. The environment is set by the user and it should not
    conflict with applications cache if any.

 src/grl-registry.c | 4 ++++
 src/grl-registry.h | 1 +
 2 files changed, 5 insertions(+)
---
diff --git a/src/grl-registry.c b/src/grl-registry.c
index 51223e9c..9caf9e37 100644
--- a/src/grl-registry.c
+++ b/src/grl-registry.c
@@ -328,6 +328,10 @@ grl_registry_init (GrlRegistry *registry)
   key_id_handler_init (&registry->priv->key_id_handler);
 
   grl_registry_setup_ranks (registry);
+
+  const gchar *config_path = g_getenv (GRL_CONFIG_PATH_VAR);
+  if (config_path != NULL)
+    grl_registry_add_config_from_file (registry, config_path, NULL);
 }
 
 /* ================ Utitilies ================ */
diff --git a/src/grl-registry.h b/src/grl-registry.h
index 349c967d..c9f25ff7 100644
--- a/src/grl-registry.h
+++ b/src/grl-registry.h
@@ -40,6 +40,7 @@
 #define GRL_PLUGIN_PATH_VAR "GRL_PLUGIN_PATH"
 #define GRL_PLUGIN_LIST_VAR "GRL_PLUGIN_LIST"
 #define GRL_PLUGIN_RANKS_VAR "GRL_PLUGIN_RANKS"
+#define GRL_CONFIG_PATH_VAR "GRL_CONFIG_PATH"
 
 /* Macros */
 


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