mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-29 15:22:11 +02:00
clapper: Fix importing enhancers with extra path
We cannot use "goto" here, like it was before, as we would fall into an endless loop.
This commit is contained in:
@@ -40,6 +40,18 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
|||||||
static PeasEngine *_engine = NULL;
|
static PeasEngine *_engine = NULL;
|
||||||
static GMutex load_lock;
|
static GMutex load_lock;
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
_import_enhancers (const gchar *enhancers_path)
|
||||||
|
{
|
||||||
|
gchar **dir_paths = g_strsplit (enhancers_path, G_SEARCHPATH_SEPARATOR_S, 0);
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
for (i = 0; dir_paths[i]; ++i)
|
||||||
|
peas_engine_add_search_path (_engine, dir_paths[i], NULL);
|
||||||
|
|
||||||
|
g_strfreev (dir_paths);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* clapper_enhancers_loader_initialize:
|
* clapper_enhancers_loader_initialize:
|
||||||
*
|
*
|
||||||
@@ -49,8 +61,7 @@ void
|
|||||||
clapper_enhancers_loader_initialize (void)
|
clapper_enhancers_loader_initialize (void)
|
||||||
{
|
{
|
||||||
const gchar *enhancers_path;
|
const gchar *enhancers_path;
|
||||||
gchar **dir_paths, *custom_path = NULL;
|
gchar *custom_path = NULL;
|
||||||
guint i;
|
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "clapperenhancersloader", 0,
|
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "clapperenhancersloader", 0,
|
||||||
"Clapper Enhancer Loader");
|
"Clapper Enhancer Loader");
|
||||||
@@ -84,22 +95,18 @@ clapper_enhancers_loader_initialize (void)
|
|||||||
peas_engine_enable_loader (_engine, "python");
|
peas_engine_enable_loader (_engine, "python");
|
||||||
peas_engine_enable_loader (_engine, "gjs");
|
peas_engine_enable_loader (_engine, "gjs");
|
||||||
|
|
||||||
load_enhancers:
|
_import_enhancers (enhancers_path);
|
||||||
dir_paths = g_strsplit (enhancers_path, G_SEARCHPATH_SEPARATOR_S, 0);
|
|
||||||
|
|
||||||
for (i = 0; dir_paths[i]; ++i)
|
|
||||||
peas_engine_add_search_path (_engine, dir_paths[i], NULL);
|
|
||||||
|
|
||||||
g_strfreev (dir_paths);
|
|
||||||
|
|
||||||
/* Support loading additional enhancers from non-default directory */
|
/* Support loading additional enhancers from non-default directory */
|
||||||
enhancers_path = g_getenv ("CLAPPER_ENHANCERS_EXTRA_PATH");
|
enhancers_path = g_getenv ("CLAPPER_ENHANCERS_EXTRA_PATH");
|
||||||
if (enhancers_path && *enhancers_path != '\0')
|
if (enhancers_path && *enhancers_path != '\0') {
|
||||||
goto load_enhancers;
|
GST_INFO ("Enhancers extra path: \"%s\"", enhancers_path);
|
||||||
|
_import_enhancers (enhancers_path);
|
||||||
|
}
|
||||||
|
|
||||||
if (gst_debug_category_get_threshold (GST_CAT_DEFAULT) >= GST_LEVEL_INFO) {
|
if (gst_debug_category_get_threshold (GST_CAT_DEFAULT) >= GST_LEVEL_INFO) {
|
||||||
GListModel *list = (GListModel *) _engine;
|
GListModel *list = (GListModel *) _engine;
|
||||||
guint n_items = g_list_model_get_n_items (list);
|
guint i, n_items = g_list_model_get_n_items (list);
|
||||||
|
|
||||||
for (i = 0; i < n_items; ++i) {
|
for (i = 0; i < n_items; ++i) {
|
||||||
PeasPluginInfo *info = (PeasPluginInfo *) g_list_model_get_item (list, i);
|
PeasPluginInfo *info = (PeasPluginInfo *) g_list_model_get_item (list, i);
|
||||||
|
Reference in New Issue
Block a user