From 69c139ac28c9f321b8ca49e7edff822621e5e4be Mon Sep 17 00:00:00 2001 From: ellson Date: Thu, 30 Aug 2007 19:18:41 +0000 Subject: [PATCH] load dependent plugins first --- lib/gvc/gvconfig.c | 15 +++++++++++---- lib/gvc/gvplugin.c | 10 +++++----- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/lib/gvc/gvconfig.c b/lib/gvc/gvconfig.c index 59da50295..2547bb225 100644 --- a/lib/gvc/gvconfig.c +++ b/lib/gvc/gvconfig.c @@ -243,7 +243,7 @@ static void gvconfig_plugin_install_builtins(GVC_t * gvc) } #ifdef ENABLE_LTDL -static void gvconfig_write_library_config(char *path, gvplugin_library_t *library, FILE *f) +static void gvconfig_write_library_config(GVC_t *gvc, char *path, gvplugin_library_t *library, FILE *f) { gvplugin_api_t *apis; gvplugin_installed_t *types; @@ -253,6 +253,14 @@ static void gvconfig_write_library_config(char *path, gvplugin_library_t *librar for (apis = library->apis; (types = apis->types); apis++) { fprintf(f, "\t%s {\n", gvplugin_api_name(apis->api)); for (i = 0; types[i].type; i++) { +#if 0 +/* this was a good idea, but fails because we need a config to load + * by plugin name, and were still generating the config. + */ + /* verify that dependencies are available */ + if (! (gvplugin_load(gvc, apis->api, types[i].type))) + fprintf(f, "#FAILS"); +#endif fprintf(f, "\t\t%s %d\n", types[i].type, types[i].quality); } fputs ("\t}\n", f); @@ -408,9 +416,8 @@ static void config_rescan(GVC_t *gvc, char *config_path) path = strrchr(globbuf.gl_pathv[i],'/'); if (path) path++; - if (f && path) { - gvconfig_write_library_config(path, library, f); - } + if (f && path) + gvconfig_write_library_config(gvc, path, library, f); } } } diff --git a/lib/gvc/gvplugin.c b/lib/gvc/gvplugin.c index 76817e27b..1aaabcd89 100644 --- a/lib/gvc/gvplugin.c +++ b/lib/gvc/gvplugin.c @@ -277,8 +277,12 @@ gvplugin_available_t *gvplugin_load(GVC_t * gvc, api_t api, char *str) if (strcmp(reqpkg, (*pnext)->packagename) == 0) break; /* found with required matching packagname */ } - rv = *pnext; + + if (dep && (apidep != api)) /* load dependency if needed */ + if (! (gvplugin_load(gvc, apidep, dep))) + rv = NULL; + if (rv && rv->typeptr == NULL) { library = gvplugin_library_load(gvc, rv->path); if (library) { @@ -302,10 +306,6 @@ gvplugin_available_t *gvplugin_load(GVC_t * gvc, api_t api, char *str) } } - if (dep && (apidep != api)) /* load dependency if needed */ - if (! (gvplugin_load(gvc, apidep, dep))) - rv = NULL; - /* one last check for successfull load */ if (rv && rv->typeptr == NULL) rv = NULL; -- 2.40.0