--- a/gplugin/gplugin-manager.c Mon Feb 10 04:32:22 2020 -0600
+++ b/gplugin/gplugin-manager.c Mon Feb 10 05:14:14 2020 -0600
@@ -605,19 +605,52 @@
+ GSList *dependencies = NULL, *l = NULL; + GError *ourerror = NULL; + gboolean all_loaded = TRUE; + dependencies = gplugin_manager_get_plugin_dependencies(plugin, &ourerror); + g_propagate_error(error, ourerror); + for(l = dependencies; l != NULL; l = l->next) { + GPluginPlugin *dependency = GPLUGIN_PLUGIN(l->data); + gboolean loaded = FALSE; + loaded = gplugin_manager_load_plugin(dependency, error); + gplugin_manager_free_plugin_list(dependencies); +gplugin_manager_real_get_plugin_dependencies(G_GNUC_UNUSED GPluginManager *manager, + GPluginPluginInfo *info = NULL; const gchar * const *dependencies = NULL;
- gboolean all_found = TRUE;
- /* now walk through any dependencies the plugin has and load them. If they
- * fail to load we need to fail as well.
+ info = gplugin_plugin_get_info(plugin); dependencies = gplugin_plugin_info_get_dependencies(info);
if(dependencies == NULL) {
- for(i = 0; dependencies[i]; i++) {
+ for(i = 0; dependencies[i] != NULL; i++) { @@ -625,7 +658,7 @@
ors = g_strsplit(dependencies[i], "|", 0);
for(o = 0; ors[o]; o++) {
GMatchInfo *match = NULL;
- GSList *matches = NULL, *m = NULL;
+ GSList *matches = NULL; gchar *oid = NULL, *oop = NULL, *over = NULL;
if(!g_regex_match(dependency_regex, ors[o], 0, &match)) {
@@ -643,88 +676,38 @@
/* now look for a plugin matching the id */
matches = gplugin_manager_find_plugins_with_version(oid, oop,
- g_message("looking for %s %s%s: found %p", oid, oop, over, matches);
- /* now iterate the matches */
- for(m = matches; m; m = m->next) {
- GPluginPlugin *dplugin = GPLUGIN_PLUGIN(g_object_ref(G_OBJECT(m->data)));
- ret = gplugin_manager_load_plugin(dplugin, error);
-# warning need to figure out dependencies
-// gplugin_plugin_add_dependent_plugin(dplugin, plugin);
- g_object_unref(G_OBJECT(dplugin));
+ /* prepend the first found match to our return value */ + ret = g_slist_prepend(ret, g_object_ref(matches->data)); + gplugin_manager_free_plugin_list(matches);
+ g_set_error(error, GPLUGIN_DOMAIN, 0, + _("failed to find dependency %s for %s"), + dependencies[i], gplugin_plugin_info_get_id(info)); + gplugin_manager_free_plugin_list(ret); + g_object_unref(G_OBJECT(info));
-gplugin_manager_real_get_plugin_dependencies(G_GNUC_UNUSED GPluginManager *manager,
- GPluginPluginInfo *info = NULL;
- const gchar * const *dependencies = NULL;
- info = gplugin_plugin_get_info(plugin);
- dependencies = gplugin_plugin_info_get_dependencies(info);
- if(dependencies == NULL) {
- for(idx = 0; dependencies[idx] != NULL; idx++) {
- GPluginPlugin *dep = gplugin_manager_find_plugin(dependencies[idx]);
- if(!GPLUGIN_IS_PLUGIN(dep)) {
- "failed to find plugin dependency '%s'",
- g_slist_free_full(ret, g_object_unref);
- ret = g_slist_prepend(ret, dep);
+ g_object_unref(G_OBJECT(info)); @@ -1334,8 +1317,6 @@
/* get the plugin's version from it's info */
info = gplugin_plugin_get_info(plugin);
found_version = gplugin_plugin_info_get_version(info);
@@ -1383,7 +1364,7 @@
* gplugin_manager_free_plugin_list:
- * @plugins_list: (element-type GPlugin.Plugin): Returned value from
+ * @plugins_list: (element-type GPlugin.Plugin) (nullable): Returned value from * #gplugin_manager_find_plugins
* Frees the return value of #gplugin_manager_find_plugins.
@@ -1392,8 +1373,6 @@
gplugin_manager_free_plugin_list(GSList *plugins_list) {
- g_return_if_fail(plugins_list != NULL);
for(l = plugins_list; l; l = l->next) {
GPluginPlugin *plugin = NULL;
@@ -1446,7 +1425,8 @@
* Return value: (element-type GPlugin.Plugin) (transfer full): A #GSList of
* #GPluginPlugin's that @plugin depends on, or NULL on error
+ * with @error set. Call #gplugin_manager_free_plugin_list on + * the returned value when you're done with it. gplugin_manager_get_plugin_dependencies(GPluginPlugin *plugin, GError **error) {