summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2014-06-19 17:18:07 +0100
committerRichard Hughes <richard@hughsie.com>2014-06-19 18:23:29 +0100
commit45602f0e77a25a62b3af5e1b4c7a0cd815e54415 (patch)
treedafd7ddedd96c3e22b6b857ca4d332177cbc3485
parentc7ea8bf5daabb5174ffac9a14fc70c510a9caf23 (diff)
downloadappstream-glib-45602f0e77a25a62b3af5e1b4c7a0cd815e54415.tar.gz
Convert AsbPluginLoader to an actual GObject
We want to start storing things in addition to the array of plugins (e.g. the AsbContext) so expand this out into an actual object. Also, this is an API change, but the whole of libappstream-builder is marked as 'Unstable' for now, and asb-plugin-loader.h has never been installed.
-rw-r--r--libappstream-builder/asb-context-private.h3
-rw-r--r--libappstream-builder/asb-context.c22
-rw-r--r--libappstream-builder/asb-plugin-loader.c219
-rw-r--r--libappstream-builder/asb-plugin-loader.h67
-rw-r--r--libappstream-builder/asb-plugin.h5
-rw-r--r--libappstream-builder/asb-task.c10
6 files changed, 214 insertions, 112 deletions
diff --git a/libappstream-builder/asb-context-private.h b/libappstream-builder/asb-context-private.h
index 523b3ee..9661280 100644
--- a/libappstream-builder/asb-context-private.h
+++ b/libappstream-builder/asb-context-private.h
@@ -23,10 +23,11 @@
#define ASB_CONTEXT_INTERNAL_H
#include "asb-context.h"
+#include "asb-plugin-loader.h"
GPtrArray *asb_context_get_file_globs (AsbContext *ctx);
GPtrArray *asb_context_get_packages (AsbContext *ctx);
-GPtrArray *asb_context_get_plugins (AsbContext *ctx);
+AsbPluginLoader *asb_context_get_plugin_loader (AsbContext *ctx);
G_END_DECLS
diff --git a/libappstream-builder/asb-context.c b/libappstream-builder/asb-context.c
index 3cb568f..75de2d3 100644
--- a/libappstream-builder/asb-context.c
+++ b/libappstream-builder/asb-context.c
@@ -56,7 +56,7 @@ struct _AsbContextPrivate
GPtrArray *extra_pkgs; /* of AsbGlobValue */
GPtrArray *file_globs; /* of AsbPackage */
GPtrArray *packages; /* of AsbPackage */
- GPtrArray *plugins; /* of AsbPlugin */
+ AsbPluginLoader *plugin_loader;
gboolean add_cache_id;
gboolean extra_checks;
gboolean no_net;
@@ -427,20 +427,20 @@ asb_context_get_temp_dir (AsbContext *ctx)
}
/**
- * asb_context_get_plugins:
+ * asb_context_get_plugin_loader:
* @ctx: A #AsbContext
*
* Gets the plugins available to the metadata extractor.
*
- * Returns: array of plugins
+ * Returns: (transfer none): the plugin loader in use
*
* Since: 0.1.0
**/
-GPtrArray *
-asb_context_get_plugins (AsbContext *ctx)
+AsbPluginLoader *
+asb_context_get_plugin_loader (AsbContext *ctx)
{
AsbContextPrivate *priv = GET_PRIVATE (ctx);
- return priv->plugins;
+ return priv->plugin_loader;
}
/**
@@ -535,11 +535,11 @@ asb_context_setup (AsbContext *ctx, GError **error)
AsbContextPrivate *priv = GET_PRIVATE (ctx);
/* load plugins */
- if (!asb_plugin_loader_setup (priv->plugins, error))
+ if (!asb_plugin_loader_setup (priv->plugin_loader, error))
return FALSE;
/* get a cache of the file globs */
- priv->file_globs = asb_plugin_loader_get_globs (priv->plugins);
+ priv->file_globs = asb_plugin_loader_get_globs (priv->plugin_loader);
/* add old metadata */
if (priv->old_metadata != NULL) {
@@ -706,7 +706,7 @@ asb_context_process (AsbContext *ctx, GError **error)
/* merge */
g_print ("Merging applications...\n");
- asb_plugin_loader_merge (priv->plugins, &priv->apps);
+ asb_plugin_loader_merge (priv->plugin_loader, &priv->apps);
/* write XML file */
ret = asb_context_write_xml (ctx, priv->output_dir, priv->basename, error);
@@ -860,7 +860,7 @@ asb_context_finalize (GObject *object)
AsbContextPrivate *priv = GET_PRIVATE (ctx);
g_object_unref (priv->old_md_cache);
- asb_plugin_loader_free (priv->plugins);
+ g_object_unref (priv->plugin_loader);
g_ptr_array_unref (priv->packages);
g_ptr_array_unref (priv->extra_pkgs);
g_list_foreach (priv->apps, (GFunc) g_object_unref, NULL);
@@ -889,7 +889,7 @@ asb_context_init (AsbContext *ctx)
{
AsbContextPrivate *priv = GET_PRIVATE (ctx);
- priv->plugins = asb_plugin_loader_new ();
+ priv->plugin_loader = asb_plugin_loader_new (ctx);
priv->packages = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
priv->extra_pkgs = asb_glob_value_array_new ();
g_mutex_init (&priv->apps_mutex);
diff --git a/libappstream-builder/asb-plugin-loader.c b/libappstream-builder/asb-plugin-loader.c
index 1f4eb13..afa7201 100644
--- a/libappstream-builder/asb-plugin-loader.c
+++ b/libappstream-builder/asb-plugin-loader.c
@@ -30,11 +30,62 @@
#include "config.h"
-#include <glib.h>
-
#include "as-cleanup.h"
-#include "asb-plugin.h"
#include "asb-plugin-loader.h"
+#include "asb-plugin.h"
+
+typedef struct _AsbPluginLoaderPrivate AsbPluginLoaderPrivate;
+struct _AsbPluginLoaderPrivate
+{
+ GPtrArray *plugins;
+ AsbContext *ctx;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (AsbPluginLoader, asb_plugin_loader, G_TYPE_OBJECT)
+
+#define GET_PRIVATE(o) (asb_plugin_loader_get_instance_private (o))
+
+/**
+ * asb_plugin_loader_run:
+ **/
+static void
+asb_plugin_loader_run (AsbPluginLoader *plugin_loader, const gchar *function_name)
+{
+ AsbPluginLoaderPrivate *priv = GET_PRIVATE (plugin_loader);
+ AsbPluginFunc plugin_func = NULL;
+ AsbPlugin *plugin;
+ gboolean ret;
+ guint i;
+
+ /* run each plugin */
+ for (i = 0; i < priv->plugins->len; i++) {
+ plugin = g_ptr_array_index (priv->plugins, i);
+ ret = g_module_symbol (plugin->module,
+ function_name,
+ (gpointer *) &plugin_func);
+ if (!ret)
+ continue;
+ plugin_func (plugin);
+ }
+}
+
+/**
+ * asb_plugin_loader_finalize:
+ **/
+static void
+asb_plugin_loader_finalize (GObject *object)
+{
+ AsbPluginLoader *plugin_loader = ASB_PLUGIN_LOADER (object);
+ AsbPluginLoaderPrivate *priv = GET_PRIVATE (plugin_loader);
+
+ asb_plugin_loader_run (plugin_loader, "asb_plugin_destroy");
+
+ if (priv->ctx != NULL)
+ g_object_unref (priv->ctx);
+ g_ptr_array_unref (priv->plugins);
+
+ G_OBJECT_CLASS (asb_plugin_loader_parent_class)->finalize (object);
+}
/**
* asb_plugin_loader_plugin_free:
@@ -49,27 +100,38 @@ asb_plugin_loader_plugin_free (AsbPlugin *plugin)
}
/**
+ * asb_plugin_loader_init:
+ **/
+static void
+asb_plugin_loader_init (AsbPluginLoader *plugin_loader)
+{
+ AsbPluginLoaderPrivate *priv = GET_PRIVATE (plugin_loader);
+ priv->plugins = g_ptr_array_new_with_free_func ((GDestroyNotify) asb_plugin_loader_plugin_free);
+}
+
+/**
* asb_plugin_loader_match_fn:
- * @plugins: (element-type AsbPlugin): An array of plugins
+ * @plugin_loader: A #AsbPluginLoader
* @filename: filename
*
* Processes the list of plugins finding a plugin that can process the filename.
*
* Returns: (transfer none): a plugin, or %NULL
*
- * Since: 0.1.0
+ * Since: 0.2.1
**/
AsbPlugin *
-asb_plugin_loader_match_fn (GPtrArray *plugins, const gchar *filename)
+asb_plugin_loader_match_fn (AsbPluginLoader *plugin_loader, const gchar *filename)
{
- gboolean ret;
AsbPluginCheckFilenameFunc plugin_func = NULL;
+ AsbPluginLoaderPrivate *priv = GET_PRIVATE (plugin_loader);
AsbPlugin *plugin;
+ gboolean ret;
guint i;
/* run each plugin */
- for (i = 0; i < plugins->len; i++) {
- plugin = g_ptr_array_index (plugins, i);
+ for (i = 0; i < priv->plugins->len; i++) {
+ plugin = g_ptr_array_index (priv->plugins, i);
ret = g_module_symbol (plugin->module,
"asb_plugin_check_filename",
(gpointer *) &plugin_func);
@@ -83,7 +145,7 @@ asb_plugin_loader_match_fn (GPtrArray *plugins, const gchar *filename)
/**
* asb_plugin_loader_process_app:
- * @plugins: (element-type AsbPlugin): An array of plugins
+ * @plugin_loader: A #AsbPluginLoader
* @pkg: The #AsbPackage
* @app: The #AsbApp to refine
* @tmpdir: A temporary location to use
@@ -93,23 +155,24 @@ asb_plugin_loader_match_fn (GPtrArray *plugins, const gchar *filename)
*
* Returns: %TRUE for success, %FALSE otherwise
*
- * Since: 0.1.0
+ * Since: 0.2.1
**/
gboolean
-asb_plugin_loader_process_app (GPtrArray *plugins,
+asb_plugin_loader_process_app (AsbPluginLoader *plugin_loader,
AsbPackage *pkg,
AsbApp *app,
const gchar *tmpdir,
GError **error)
{
- gboolean ret;
- AsbPluginProcessAppFunc plugin_func = NULL;
+ AsbPluginLoaderPrivate *priv = GET_PRIVATE (plugin_loader);
AsbPlugin *plugin;
+ AsbPluginProcessAppFunc plugin_func = NULL;
+ gboolean ret;
guint i;
/* run each plugin */
- for (i = 0; i < plugins->len; i++) {
- plugin = g_ptr_array_index (plugins, i);
+ for (i = 0; i < priv->plugins->len; i++) {
+ plugin = g_ptr_array_index (priv->plugins, i);
ret = g_module_symbol (plugin->module,
"asb_plugin_process_app",
(gpointer *) &plugin_func);
@@ -126,51 +189,46 @@ asb_plugin_loader_process_app (GPtrArray *plugins,
}
/**
- * asb_plugin_loader_run:
+ * asb_plugin_loader_get_plugins:
+ * @plugin_loader: A #AsbPluginLoader
+ *
+ * Gets the list of plugins.
+ *
+ * Returns: (transfer none) (element-type AsbPlugin): plugins
+ *
+ * Since: 0.2.1
**/
-static void
-asb_plugin_loader_run (GPtrArray *plugins, const gchar *function_name)
+GPtrArray *
+asb_plugin_loader_get_plugins (AsbPluginLoader *plugin_loader)
{
- gboolean ret;
- AsbPluginFunc plugin_func = NULL;
- AsbPlugin *plugin;
- guint i;
-
- /* run each plugin */
- for (i = 0; i < plugins->len; i++) {
- plugin = g_ptr_array_index (plugins, i);
- ret = g_module_symbol (plugin->module,
- function_name,
- (gpointer *) &plugin_func);
- if (!ret)
- continue;
- plugin_func (plugin);
- }
+ AsbPluginLoaderPrivate *priv = GET_PRIVATE (plugin_loader);
+ return priv->plugins;
}
/**
* asb_plugin_loader_get_globs:
- * @plugins: (element-type AsbPlugin): An array of plugins
+ * @plugin_loader: A #AsbPluginLoader
*
* Gets the list of globs.
*
* Returns: (transfer container) (element-type utf8): globs
*
- * Since: 0.1.0
+ * Since: 0.2.1
**/
GPtrArray *
-asb_plugin_loader_get_globs (GPtrArray *plugins)
+asb_plugin_loader_get_globs (AsbPluginLoader *plugin_loader)
{
- gboolean ret;
AsbPluginGetGlobsFunc plugin_func = NULL;
+ AsbPluginLoaderPrivate *priv = GET_PRIVATE (plugin_loader);
AsbPlugin *plugin;
- guint i;
GPtrArray *globs;
+ gboolean ret;
+ guint i;
/* run each plugin */
globs = asb_glob_value_array_new ();
- for (i = 0; i < plugins->len; i++) {
- plugin = g_ptr_array_index (plugins, i);
+ for (i = 0; i < priv->plugins->len; i++) {
+ plugin = g_ptr_array_index (priv->plugins, i);
ret = g_module_symbol (plugin->module,
"asb_plugin_add_globs",
(gpointer *) &plugin_func);
@@ -183,30 +241,31 @@ asb_plugin_loader_get_globs (GPtrArray *plugins)
/**
* asb_plugin_loader_merge:
- * @plugins: (element-type AsbPlugin): An array of plugins
+ * @plugin_loader: A #AsbPluginLoader
* @apps: (element-type AsbApp): a list of applications that need merging
*
* Merge the list of applications using the plugins.
*
- * Since: 0.1.0
+ * Since: 0.2.1
**/
void
-asb_plugin_loader_merge (GPtrArray *plugins, GList **apps)
+asb_plugin_loader_merge (AsbPluginLoader *plugin_loader, GList **apps)
{
- const gchar *key;
- const gchar *tmp;
AsbApp *app;
AsbApp *found;
+ AsbPluginLoaderPrivate *priv = GET_PRIVATE (plugin_loader);
AsbPluginMergeFunc plugin_func = NULL;
AsbPlugin *plugin;
- gboolean ret;
GList *l;
+ const gchar *key;
+ const gchar *tmp;
+ gboolean ret;
guint i;
_cleanup_hashtable_unref_ GHashTable *hash;
/* run each plugin */
- for (i = 0; i < plugins->len; i++) {
- plugin = g_ptr_array_index (plugins, i);
+ for (i = 0; i < priv->plugins->len; i++) {
+ plugin = g_ptr_array_index (priv->plugins, i);
ret = g_module_symbol (plugin->module,
"asb_plugin_merge",
(gpointer *) &plugin_func);
@@ -256,13 +315,14 @@ asb_plugin_loader_merge (GPtrArray *plugins, GList **apps)
* asb_plugin_loader_open_plugin:
**/
static AsbPlugin *
-asb_plugin_loader_open_plugin (GPtrArray *plugins,
+asb_plugin_loader_open_plugin (AsbPluginLoader *plugin_loader,
const gchar *filename)
{
- gboolean ret;
- GModule *module;
AsbPluginGetNameFunc plugin_name = NULL;
+ AsbPluginLoaderPrivate *priv = GET_PRIVATE (plugin_loader);
AsbPlugin *plugin = NULL;
+ GModule *module;
+ gboolean ret;
module = g_module_open (filename, 0);
if (module == NULL) {
@@ -284,12 +344,13 @@ asb_plugin_loader_open_plugin (GPtrArray *plugins,
/* print what we know */
plugin = g_slice_new0 (AsbPlugin);
plugin->enabled = TRUE;
+ plugin->ctx = priv->ctx;
plugin->module = module;
plugin->name = g_strdup (plugin_name ());
g_debug ("opened plugin %s: %s", filename, plugin->name);
/* add to array */
- g_ptr_array_add (plugins, plugin);
+ g_ptr_array_add (priv->plugins, plugin);
return plugin;
}
@@ -306,18 +367,19 @@ asb_plugin_loader_sort_cb (gconstpointer a, gconstpointer b)
/**
* asb_plugin_loader_setup:
- * @plugins: (element-type AsbPlugin): An array of plugins
+ * @plugin_loader: A #AsbPluginLoader
* @error: A #GError or %NULL
*
* Set up the plugin loader.
*
* Returns: %TRUE for success, %FALSE otherwise
*
- * Since: 0.1.0
+ * Since: 0.2.1
**/
gboolean
-asb_plugin_loader_setup (GPtrArray *plugins, GError **error)
+asb_plugin_loader_setup (AsbPluginLoader *plugin_loader, GError **error)
{
+ AsbPluginLoaderPrivate *priv = GET_PRIVATE (plugin_loader);
const gchar *filename_tmp;
const gchar *location = "./plugins/.libs/";
_cleanup_dir_close_ GDir *dir;
@@ -343,41 +405,44 @@ asb_plugin_loader_setup (GPtrArray *plugins, GError **error)
filename_plugin = g_build_filename (location,
filename_tmp,
NULL);
- asb_plugin_loader_open_plugin (plugins, filename_plugin);
+ asb_plugin_loader_open_plugin (plugin_loader, filename_plugin);
} while (TRUE);
/* run the plugins */
- asb_plugin_loader_run (plugins, "asb_plugin_initialize");
- g_ptr_array_sort (plugins, asb_plugin_loader_sort_cb);
+ asb_plugin_loader_run (plugin_loader, "asb_plugin_initialize");
+ g_ptr_array_sort (priv->plugins, asb_plugin_loader_sort_cb);
return TRUE;
}
+
/**
- * asb_plugin_loader_new:
- *
- * Creates a new plugin loader interface.
- *
- * Returns: (transfer container) (element-type AsbPlugin): state
- *
- * Since: 0.1.0
+ * asb_plugin_loader_class_init:
**/
-GPtrArray *
-asb_plugin_loader_new (void)
+static void
+asb_plugin_loader_class_init (AsbPluginLoaderClass *klass)
{
- return g_ptr_array_new_with_free_func ((GDestroyNotify) asb_plugin_loader_plugin_free);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = asb_plugin_loader_finalize;
}
/**
- * asb_plugin_loader_free:
- * @plugins: (element-type AsbPlugin): An array of plugins
+ * asb_plugin_loader_new:
+ * @ctx: A #AsbContext, or %NULL
*
- * Destroy the plugin state.
+ * Creates a new plugin loader instance.
*
- * Since: 0.1.0
+ * Returns: a #AsbPluginLoader
+ *
+ * Since: 0.2.1
**/
-void
-asb_plugin_loader_free (GPtrArray *plugins)
+AsbPluginLoader *
+asb_plugin_loader_new (AsbContext *ctx)
{
- asb_plugin_loader_run (plugins, "asb_plugin_destroy");
- g_ptr_array_unref (plugins);
+ AsbPluginLoader *plugin_loader;
+ AsbPluginLoaderPrivate *priv;
+ plugin_loader = g_object_new (ASB_TYPE_PLUGIN_LOADER, NULL);
+ priv = GET_PRIVATE (plugin_loader);
+ if (ctx != NULL)
+ priv->ctx = g_object_ref (ctx);
+ return ASB_PLUGIN_LOADER (plugin_loader);
}
diff --git a/libappstream-builder/asb-plugin-loader.h b/libappstream-builder/asb-plugin-loader.h
index 1630d2c..3e75bdb 100644
--- a/libappstream-builder/asb-plugin-loader.h
+++ b/libappstream-builder/asb-plugin-loader.h
@@ -19,30 +19,61 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef __ASB_PLUGIN_LOADER_H
-#define __ASB_PLUGIN_LOADER_H
+#ifndef ASB_PLUGIN_LOADER_H
+#define ASB_PLUGIN_LOADER_H
-#include <glib.h>
+#include <glib-object.h>
#include "asb-plugin.h"
+#define ASB_TYPE_PLUGIN_LOADER (asb_plugin_loader_get_type())
+#define ASB_PLUGIN_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ASB_TYPE_PLUGIN_LOADER, AsbPluginLoader))
+#define ASB_PLUGIN_LOADER_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), ASB_TYPE_PLUGIN_LOADER, AsbPluginLoaderClass))
+#define ASB_IS_PLUGIN_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ASB_TYPE_PLUGIN_LOADER))
+#define ASB_IS_PLUGIN_LOADER_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), ASB_TYPE_PLUGIN_LOADER))
+#define ASB_PLUGIN_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ASB_TYPE_PLUGIN_LOADER, AsbPluginLoaderClass))
+
G_BEGIN_DECLS
-gboolean asb_plugin_loader_setup (GPtrArray *plugins,
- GError **error);
-GPtrArray *asb_plugin_loader_get_globs (GPtrArray *plugins);
-void asb_plugin_loader_merge (GPtrArray *plugins,
- GList **apps);
-gboolean asb_plugin_loader_process_app (GPtrArray *plugins,
- AsbPackage *pkg,
- AsbApp *app,
- const gchar *tmpdir,
- GError **error);
-GPtrArray *asb_plugin_loader_new (void);
-void asb_plugin_loader_free (GPtrArray *plugins);
-AsbPlugin *asb_plugin_loader_match_fn (GPtrArray *plugins,
- const gchar *filename);
+typedef struct _AsbPluginLoader AsbPluginLoader;
+typedef struct _AsbPluginLoaderClass AsbPluginLoaderClass;
+
+struct _AsbPluginLoader
+{
+ GObject parent;
+};
+
+struct _AsbPluginLoaderClass
+{
+ GObjectClass parent_class;
+ /*< private >*/
+ void (*_as_reserved1) (void);
+ void (*_as_reserved2) (void);
+ void (*_as_reserved3) (void);
+ void (*_as_reserved4) (void);
+ void (*_as_reserved5) (void);
+ void (*_as_reserved6) (void);
+ void (*_as_reserved7) (void);
+ void (*_as_reserved8) (void);
+};
+
+GType asb_plugin_loader_get_type (void);
+AsbPluginLoader *asb_plugin_loader_new (AsbContext *ctx);
+
+gboolean asb_plugin_loader_setup (AsbPluginLoader *plugin_loader,
+ GError **error);
+GPtrArray *asb_plugin_loader_get_globs (AsbPluginLoader *plugin_loader);
+GPtrArray *asb_plugin_loader_get_plugins (AsbPluginLoader *plugin_loader);
+void asb_plugin_loader_merge (AsbPluginLoader *plugin_loader,
+ GList **apps);
+gboolean asb_plugin_loader_process_app (AsbPluginLoader *plugin_loader,
+ AsbPackage *pkg,
+ AsbApp *app,
+ const gchar *tmpdir,
+ GError **error);
+AsbPlugin *asb_plugin_loader_match_fn (AsbPluginLoader *plugin_loader,
+ const gchar *filename);
G_END_DECLS
-#endif /* __ASB_PLUGIN_LOADER_H */
+#endif /* ASB_PLUGIN_LOADER_H */
diff --git a/libappstream-builder/asb-plugin.h b/libappstream-builder/asb-plugin.h
index 15ff1a1..7eaafc4 100644
--- a/libappstream-builder/asb-plugin.h
+++ b/libappstream-builder/asb-plugin.h
@@ -25,9 +25,12 @@
#include <glib-object.h>
#include <gmodule.h>
#include <gio/gio.h>
+#include <appstream-glib.h>
-#include "asb-app.h"
#include "as-cleanup.h"
+
+#include "asb-app.h"
+#include "asb-context.h"
#include "asb-package.h"
#include "asb-utils.h"
diff --git a/libappstream-builder/asb-task.c b/libappstream-builder/asb-task.c
index 0ea8376..130f518 100644
--- a/libappstream-builder/asb-task.c
+++ b/libappstream-builder/asb-task.c
@@ -57,8 +57,9 @@ G_DEFINE_TYPE_WITH_PRIVATE (AsbTask, asb_task, G_TYPE_OBJECT)
* asb_task_add_suitable_plugins:
**/
static void
-asb_task_add_suitable_plugins (AsbTask *task, GPtrArray *plugins)
+asb_task_add_suitable_plugins (AsbTask *task)
{
+ AsbPluginLoader *plugin_loader;
AsbPlugin *plugin;
AsbTaskPrivate *priv = GET_PRIVATE (task);
gchar **filelist;
@@ -68,8 +69,9 @@ asb_task_add_suitable_plugins (AsbTask *task, GPtrArray *plugins)
filelist = asb_package_get_filelist (priv->pkg);
if (filelist == NULL)
return;
+ plugin_loader = asb_context_get_plugin_loader (priv->ctx);
for (i = 0; filelist[i] != NULL; i++) {
- plugin = asb_plugin_loader_match_fn (plugins, filelist[i]);
+ plugin = asb_plugin_loader_match_fn (plugin_loader, filelist[i]);
if (plugin == NULL)
continue;
@@ -214,7 +216,7 @@ asb_task_process (AsbTask *task, GError **error_not_used)
ASB_PACKAGE_LOG_LEVEL_DEBUG,
"Getting filename match for %s",
basename);
- asb_task_add_suitable_plugins (task, asb_context_get_plugins (priv->ctx));
+ asb_task_add_suitable_plugins (task);
if (priv->plugins_to_run->len == 0)
goto out;
@@ -309,7 +311,7 @@ asb_task_process (AsbTask *task, GError **error_not_used)
}
/* run each refine plugin on each app */
- ret = asb_plugin_loader_process_app (asb_context_get_plugins (priv->ctx),
+ ret = asb_plugin_loader_process_app (asb_context_get_plugin_loader (priv->ctx),
priv->pkg,
app,
priv->tmpdir,