[gnome-software] Allow each plugin to define deps on other plugins



commit d30f0c8a8aabb4de10c00642a670f6c1768e8ec0
Author: Richard Hughes <richard hughsie com>
Date:   Fri Jan 31 10:12:09 2014 +0000

    Allow each plugin to define deps on other plugins
    
    This removes the requirement of each plugin having a manually-assigned priority
    number that's both magic and unflexible. As we also renamed a plugin which might
    be still installed with the old API, also bump the plugin version.

 configure.ac                                   |    2 +-
 contrib/gnome-software.spec.in                 |    2 +-
 src/gs-plugin-loader.c                         |   84 ++++++++++++++++++++---
 src/gs-plugin.h                                |    5 +-
 src/plugins/gs-plugin-appdata.c                |   11 ++-
 src/plugins/gs-plugin-appstream.c              |   11 ++-
 src/plugins/gs-plugin-datadir-apps.c           |   12 ++-
 src/plugins/gs-plugin-datadir-filename-local.c |   11 ++-
 src/plugins/gs-plugin-datadir-filename.c       |    9 ---
 src/plugins/gs-plugin-desktopdb.c              |    9 ---
 src/plugins/gs-plugin-dummy.c                  |    9 ---
 src/plugins/gs-plugin-epiphany.c               |    9 ---
 src/plugins/gs-plugin-fedora-tagger-ratings.c  |   12 ++-
 src/plugins/gs-plugin-fedora-tagger-usage.c    |   12 ++--
 src/plugins/gs-plugin-hardcoded-featured.c     |    9 ---
 src/plugins/gs-plugin-hardcoded-kind.c         |   11 ++-
 src/plugins/gs-plugin-hardcoded-popular.c      |   11 ++-
 src/plugins/gs-plugin-local-ratings.c          |   11 ++-
 src/plugins/gs-plugin-menu-spec-categories.c   |    9 ---
 src/plugins/gs-plugin-menu-spec-refine.c       |   12 ++-
 src/plugins/gs-plugin-packagekit-history.c     |   12 ++-
 src/plugins/gs-plugin-packagekit-offline.c     |    9 ---
 src/plugins/gs-plugin-packagekit-refine.c      |   12 ++-
 src/plugins/gs-plugin-packagekit-refresh.c     |    9 ---
 src/plugins/gs-plugin-packagekit-search.c      |    9 ---
 src/plugins/gs-plugin-packagekit-updates.c     |    9 ---
 src/plugins/gs-plugin-packagekit.c             |    9 ---
 src/plugins/gs-plugin-self-test.c              |    9 ---
 src/plugins/gs-plugin-systemd-updates.c        |    9 ---
 29 files changed, 167 insertions(+), 181 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6c97579..64ac827 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,7 +101,7 @@ AM_CONDITIONAL(ENABLE_DOGTAIL, test "$enable_dogtail" != no)
 
 # this refers to the gnome-software plugin API version
 # this is not in any way related to a package or soname version
-GS_PLUGIN_API_VERSION=2
+GS_PLUGIN_API_VERSION=3
 AC_SUBST(GS_PLUGIN_API_VERSION)
 AC_DEFINE_UNQUOTED([GS_PLUGIN_API_VERSION], "$GS_PLUGIN_API_VERSION", [the plugin API version])
 
diff --git a/contrib/gnome-software.spec.in b/contrib/gnome-software.spec.in
index bd363a1..8943f85 100644
--- a/contrib/gnome-software.spec.in
+++ b/contrib/gnome-software.spec.in
@@ -30,7 +30,7 @@ BuildRequires: PackageKit-glib-devel >= 0.8.10
 BuildRequires: libsoup-devel
 
 # this is not a library version
-%define gs_plugin_version               2
+%define gs_plugin_version               3
 
 %description
 gnome-software is an application that makes it easy to add, remove
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 6a40bb2..1888f5e 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -2412,7 +2412,7 @@ gs_plugin_loader_open_plugin (GsPluginLoader *plugin_loader,
        gboolean ret;
        GModule *module;
        GsPluginGetNameFunc plugin_name = NULL;
-       GsPluginGetPriorityFunc plugin_prio = NULL;
+       GsPluginGetDepsFunc plugin_deps = NULL;
        GsPlugin *plugin = NULL;
 
        module = g_module_open (filename, 0);
@@ -2432,22 +2432,18 @@ gs_plugin_loader_open_plugin (GsPluginLoader *plugin_loader,
                goto out;
        }
 
-       /* get priority */
-       ret = g_module_symbol (module,
-                              "gs_plugin_get_priority",
-                              (gpointer *) &plugin_prio);
-       if (!ret) {
-               g_warning ("Plugin %s requires priority", filename);
-               g_module_close (module);
-               goto out;
-       }
+       /* get plugins this plugin depends on */
+       g_module_symbol (module,
+                        "gs_plugin_get_deps",
+                        (gpointer *) &plugin_deps);
 
        /* print what we know */
        plugin = g_slice_new0 (GsPlugin);
        plugin->enabled = TRUE;
        plugin->module = module;
        plugin->pixbuf_size = 64;
-       plugin->priority = plugin_prio (plugin);
+       plugin->priority = 0.f;
+       plugin->deps = plugin_deps != NULL ? plugin_deps (plugin) : NULL;
        plugin->settings = g_object_ref (plugin_loader->priv->settings);
        plugin->name = g_strdup (plugin_name ());
        plugin->status_update_fn = gs_plugin_loader_status_update_cb;
@@ -2502,15 +2498,41 @@ gs_plugin_loader_plugin_sort_fn (gconstpointer a, gconstpointer b)
 }
 
 /**
+ * gs_plugin_loader_find_plugin:
+ */
+static GsPlugin *
+gs_plugin_loader_find_plugin (GsPluginLoader *plugin_loader,
+                             const gchar *plugin_name)
+{
+       GsPluginLoaderPrivate *priv = plugin_loader->priv;
+       GsPlugin *plugin;
+       guint i;
+
+       for (i = 0; i < priv->plugins->len; i++) {
+               plugin = g_ptr_array_index (priv->plugins, i);
+               if (g_strcmp0 (plugin->name, plugin_name) == 0)
+                       return plugin;
+       }
+       return NULL;
+}
+
+/**
  * gs_plugin_loader_setup:
  */
 gboolean
 gs_plugin_loader_setup (GsPluginLoader *plugin_loader, GError **error)
 {
        const gchar *filename_tmp;
+       const gdouble dep_increment = 1.f;
+       gboolean changes;
        gboolean ret = TRUE;
        gchar *filename_plugin;
        GDir *dir;
+       GsPlugin *dep;
+       GsPlugin *plugin;
+       guint dep_loop_check = 0;
+       guint i;
+       guint j;
 
        g_return_val_if_fail (plugin_loader->priv->location != NULL, FALSE);
 
@@ -2537,6 +2559,46 @@ gs_plugin_loader_setup (GsPluginLoader *plugin_loader, GError **error)
                g_free (filename_plugin);
        } while (TRUE);
 
+       /* order by deps */
+       do {
+               changes = FALSE;
+               for (i = 0; i < plugin_loader->priv->plugins->len; i++) {
+                       plugin = g_ptr_array_index (plugin_loader->priv->plugins, i);
+                       if (plugin->deps == NULL)
+                               continue;
+                       for (j = 0; plugin->deps[j] != NULL; j++) {
+                               dep = gs_plugin_loader_find_plugin (plugin_loader,
+                                                                   plugin->deps[j]);
+                               if (dep == NULL) {
+                                       g_warning ("cannot find plugin '%s'",
+                                                  plugin->deps[j]);
+                                       continue;
+                               }
+                               if (!dep->enabled)
+                                       continue;
+                               if (plugin->priority <= dep->priority) {
+                                       g_debug ("%s [%.1f] requires %s [%.1f] "
+                                                "so promoting to [%.1f]",
+                                                plugin->name, plugin->priority,
+                                                dep->name, dep->priority,
+                                                dep->priority + dep_increment);
+                                       plugin->priority = dep->priority + dep_increment;
+                                       changes = TRUE;
+                               }
+                       }
+               }
+
+               /* check we're not stuck */
+               if (dep_loop_check++ > 100) {
+                       ret = FALSE;
+                       g_set_error (error,
+                                    GS_PLUGIN_LOADER_ERROR,
+                                    GS_PLUGIN_LOADER_ERROR_FAILED,
+                                    "got stuck in dep loop");
+                       goto out;
+               }
+       } while (changes);
+
        /* sort by priority */
        g_ptr_array_sort (plugin_loader->priv->plugins,
                          gs_plugin_loader_plugin_sort_fn);
diff --git a/src/gs-plugin.h b/src/gs-plugin.h
index c91022f..f88b73e 100644
--- a/src/gs-plugin.h
+++ b/src/gs-plugin.h
@@ -61,6 +61,7 @@ typedef gboolean (*GsPluginListFilter)        (GsApp          *app,
 struct GsPlugin {
        GModule                 *module;
        gdouble                  priority;      /* largest number gets run first */
+       const gchar             **deps;         /* allow-none */
        gboolean                 enabled;
        gchar                   *name;
        GsPluginPrivate         *priv;
@@ -106,7 +107,7 @@ typedef enum {
 #define        GS_PLUGIN(x)                                    ((GsPlugin *) x);
 
 typedef const gchar    *(*GsPluginGetNameFunc)         (void);
-typedef gdouble                 (*GsPluginGetPriorityFunc)     (GsPlugin       *plugin);
+typedef const gchar    **(*GsPluginGetDepsFunc)        (GsPlugin       *plugin);
 typedef void            (*GsPluginFunc)                (GsPlugin       *plugin);
 typedef gboolean        (*GsPluginSearchFunc)          (GsPlugin       *plugin,
                                                         gchar          **value,
@@ -166,7 +167,7 @@ gboolean     gs_plugin_add_search                   (GsPlugin       *plugin,
                                                         GList          **list,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
-gdouble                 gs_plugin_get_priority                 (GsPlugin       *plugin);
+const gchar    **gs_plugin_get_deps                    (GsPlugin       *plugin);
 gboolean        gs_plugin_add_installed                (GsPlugin       *plugin,
                                                         GList          **list,
                                                         GCancellable   *cancellable,
diff --git a/src/plugins/gs-plugin-appdata.c b/src/plugins/gs-plugin-appdata.c
index 59ef9c7..02f438c 100644
--- a/src/plugins/gs-plugin-appdata.c
+++ b/src/plugins/gs-plugin-appdata.c
@@ -57,12 +57,15 @@ gs_plugin_initialize (GsPlugin *plugin)
 }
 
 /**
- * gs_plugin_get_priority:
+ * gs_plugin_get_deps:
  */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
+const gchar **
+gs_plugin_get_deps (GsPlugin *plugin)
 {
-       return 1.01f;
+       static const gchar *deps[] = {
+               "appstream",            /* faster than parsing the local file */
+               NULL };
+       return deps;
 }
 
 /**
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 9b7c400..ba843a6 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -287,12 +287,15 @@ gs_plugin_initialize (GsPlugin *plugin)
 }
 
 /**
- * gs_plugin_get_priority:
+ * gs_plugin_get_deps:
  */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
+const gchar **
+gs_plugin_get_deps (GsPlugin *plugin)
 {
-       return 1.0f;
+       static const gchar *deps[] = {
+               "datadir-apps",         /* set the state using the installed file */
+               NULL };
+       return deps;
 }
 
 /**
diff --git a/src/plugins/gs-plugin-datadir-apps.c b/src/plugins/gs-plugin-datadir-apps.c
index aef58aa..3dc4544 100644
--- a/src/plugins/gs-plugin-datadir-apps.c
+++ b/src/plugins/gs-plugin-datadir-apps.c
@@ -79,12 +79,16 @@ gs_plugin_initialize (GsPlugin *plugin)
 }
 
 /**
- * gs_plugin_get_priority:
+ * gs_plugin_get_deps:
  */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
+const gchar **
+gs_plugin_get_deps (GsPlugin *plugin)
 {
-       return 1.0f;
+       static const gchar *deps[] = {
+               "datadir-filename",     /* requires DataDir::desktop-filename */
+               "datadir-filename-local",       /* ^^^ */
+               NULL };
+       return deps;
 }
 
 /**
diff --git a/src/plugins/gs-plugin-datadir-filename-local.c b/src/plugins/gs-plugin-datadir-filename-local.c
index 84b156b..e24410d 100644
--- a/src/plugins/gs-plugin-datadir-filename-local.c
+++ b/src/plugins/gs-plugin-datadir-filename-local.c
@@ -33,12 +33,15 @@ gs_plugin_get_name (void)
 }
 
 /**
- * gs_plugin_get_priority:
+ * gs_plugin_get_deps:
  */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
+const gchar **
+gs_plugin_get_deps (GsPlugin *plugin)
 {
-       return 1.2f;
+       static const gchar *deps[] = {
+               "datadir-filename",     /* prefer apps installed system-wide over local */
+               NULL };
+       return deps;
 }
 
 /**
diff --git a/src/plugins/gs-plugin-datadir-filename.c b/src/plugins/gs-plugin-datadir-filename.c
index c6bc595..bf2d12c 100644
--- a/src/plugins/gs-plugin-datadir-filename.c
+++ b/src/plugins/gs-plugin-datadir-filename.c
@@ -53,15 +53,6 @@ gs_plugin_initialize (GsPlugin *plugin)
 }
 
 /**
- * gs_plugin_get_priority:
- */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
-{
-       return 0.9f;
-}
-
-/**
  * gs_plugin_destroy:
  */
 void
diff --git a/src/plugins/gs-plugin-desktopdb.c b/src/plugins/gs-plugin-desktopdb.c
index 233ac99..ba68d79 100644
--- a/src/plugins/gs-plugin-desktopdb.c
+++ b/src/plugins/gs-plugin-desktopdb.c
@@ -61,15 +61,6 @@ gs_plugin_initialize (GsPlugin *plugin)
 }
 
 /**
- * gs_plugin_get_priority:
- */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
-{
-       return 0.9f;
-}
-
-/**
  * gs_plugin_destroy:
  */
 void
diff --git a/src/plugins/gs-plugin-dummy.c b/src/plugins/gs-plugin-dummy.c
index 0178fab..a160af0 100644
--- a/src/plugins/gs-plugin-dummy.c
+++ b/src/plugins/gs-plugin-dummy.c
@@ -53,15 +53,6 @@ gs_plugin_initialize (GsPlugin *plugin)
 }
 
 /**
- * gs_plugin_get_priority:
- */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
-{
-       return 1.0f;
-}
-
-/**
  * gs_plugin_destroy:
  */
 void
diff --git a/src/plugins/gs-plugin-epiphany.c b/src/plugins/gs-plugin-epiphany.c
index 5a723c6..6c3f982 100644
--- a/src/plugins/gs-plugin-epiphany.c
+++ b/src/plugins/gs-plugin-epiphany.c
@@ -67,15 +67,6 @@ gs_plugin_initialize (GsPlugin *plugin)
 }
 
 /**
- * gs_plugin_get_priority:
- */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
-{
-       return 1.0f;
-}
-
-/**
  * gs_plugin_destroy:
  */
 void
diff --git a/src/plugins/gs-plugin-fedora-tagger-ratings.c b/src/plugins/gs-plugin-fedora-tagger-ratings.c
index 4bace6f..e44c647 100644
--- a/src/plugins/gs-plugin-fedora-tagger-ratings.c
+++ b/src/plugins/gs-plugin-fedora-tagger-ratings.c
@@ -92,12 +92,16 @@ out:
 }
 
 /**
- * gs_plugin_get_priority:
+ * gs_plugin_get_deps:
  */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
+const gchar **
+gs_plugin_get_deps (GsPlugin *plugin)
 {
-       return 1.2f;
+       static const gchar *deps[] = {
+               "local-ratings",        /* user rating is better than guessed */
+               "packagekit",           /* pkgname */
+               NULL };
+       return deps;
 }
 
 /**
diff --git a/src/plugins/gs-plugin-fedora-tagger-usage.c b/src/plugins/gs-plugin-fedora-tagger-usage.c
index 8c93224..907d18f 100644
--- a/src/plugins/gs-plugin-fedora-tagger-usage.c
+++ b/src/plugins/gs-plugin-fedora-tagger-usage.c
@@ -89,13 +89,15 @@ out:
 }
 
 /**
- * gs_plugin_get_priority:
+ * gs_plugin_get_deps:
  */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
+const gchar **
+gs_plugin_get_deps (GsPlugin *plugin)
 {
-       /* after packagekit */
-       return 20.f;
+       static const gchar *deps[] = {
+               "packagekit",           /* after the install/remove has succeeded */
+               NULL };
+       return deps;
 }
 
 /**
diff --git a/src/plugins/gs-plugin-hardcoded-featured.c b/src/plugins/gs-plugin-hardcoded-featured.c
index 8c82210..62ac4d6 100644
--- a/src/plugins/gs-plugin-hardcoded-featured.c
+++ b/src/plugins/gs-plugin-hardcoded-featured.c
@@ -33,15 +33,6 @@ gs_plugin_get_name (void)
 }
 
 /**
- * gs_plugin_get_priority:
- */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
-{
-       return -100.0f;
-}
-
-/**
  * gs_plugin_add_featured:
  */
 gboolean
diff --git a/src/plugins/gs-plugin-hardcoded-kind.c b/src/plugins/gs-plugin-hardcoded-kind.c
index 453fc64..6bb1859 100644
--- a/src/plugins/gs-plugin-hardcoded-kind.c
+++ b/src/plugins/gs-plugin-hardcoded-kind.c
@@ -33,12 +33,15 @@ gs_plugin_get_name (void)
 }
 
 /**
- * gs_plugin_get_priority:
+ * gs_plugin_get_deps:
  */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
+const gchar **
+gs_plugin_get_deps (GsPlugin *plugin)
 {
-       return 50.0f;
+       static const gchar *deps[] = {
+               "appstream",            /* requires id */
+               NULL };
+       return deps;
 }
 
 /**
diff --git a/src/plugins/gs-plugin-hardcoded-popular.c b/src/plugins/gs-plugin-hardcoded-popular.c
index bab8ff1..74b77b0 100644
--- a/src/plugins/gs-plugin-hardcoded-popular.c
+++ b/src/plugins/gs-plugin-hardcoded-popular.c
@@ -37,12 +37,15 @@ gs_plugin_get_name (void)
 }
 
 /**
- * gs_plugin_get_priority:
+ * gs_plugin_get_deps:
  */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
+const gchar **
+gs_plugin_get_deps (GsPlugin *plugin)
 {
-       return -100.0f;
+       static const gchar *deps[] = {
+               "menu-spec-categories", /* Featured subcat added to existing categories*/
+               NULL };
+       return deps;
 }
 
 /**
diff --git a/src/plugins/gs-plugin-local-ratings.c b/src/plugins/gs-plugin-local-ratings.c
index 6036652..0b87455 100644
--- a/src/plugins/gs-plugin-local-ratings.c
+++ b/src/plugins/gs-plugin-local-ratings.c
@@ -59,12 +59,15 @@ gs_plugin_initialize (GsPlugin *plugin)
 }
 
 /**
- * gs_plugin_get_priority:
+ * gs_plugin_get_deps:
  */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
+const gchar **
+gs_plugin_get_deps (GsPlugin *plugin)
 {
-       return 1.1f;
+       static const gchar *deps[] = {
+               "appstream",    /* requires the app_id from the pkgname */
+               NULL };
+       return deps;
 }
 
 /**
diff --git a/src/plugins/gs-plugin-menu-spec-categories.c b/src/plugins/gs-plugin-menu-spec-categories.c
index 38e46a5..780059e 100644
--- a/src/plugins/gs-plugin-menu-spec-categories.c
+++ b/src/plugins/gs-plugin-menu-spec-categories.c
@@ -36,15 +36,6 @@ gs_plugin_get_name (void)
 }
 
 /**
- * gs_plugin_get_priority:
- */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
-{
-       return -101.0f;
-}
-
-/**
  * gs_plugin_add_categories:
  */
 gboolean
diff --git a/src/plugins/gs-plugin-menu-spec-refine.c b/src/plugins/gs-plugin-menu-spec-refine.c
index 46c4c89..f6aa49f 100644
--- a/src/plugins/gs-plugin-menu-spec-refine.c
+++ b/src/plugins/gs-plugin-menu-spec-refine.c
@@ -36,12 +36,16 @@ gs_plugin_get_name (void)
 }
 
 /**
- * gs_plugin_get_priority:
+ * gs_plugin_get_deps:
  */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
+const gchar **
+gs_plugin_get_deps (GsPlugin *plugin)
 {
-       return 2.0f;
+       static const gchar *deps[] = {
+               "appstream",            /* need GsApp category data */
+               "menu-spec-categories", /* need menu-spec data */
+               NULL };
+       return deps;
 }
 
 /**
diff --git a/src/plugins/gs-plugin-packagekit-history.c b/src/plugins/gs-plugin-packagekit-history.c
index fdf6896..a0c7a00 100644
--- a/src/plugins/gs-plugin-packagekit-history.c
+++ b/src/plugins/gs-plugin-packagekit-history.c
@@ -52,12 +52,16 @@ gs_plugin_initialize (GsPlugin *plugin)
 }
 
 /**
- * gs_plugin_get_priority:
+ * gs_plugin_get_deps:
  */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
+const gchar **
+gs_plugin_get_deps (GsPlugin *plugin)
 {
-       return 200.0f;
+       static const gchar *deps[] = {
+               "appstream",            /* need pkgname */
+               "packagekit-refine",    /* need pkgname */
+               NULL };
+       return deps;
 }
 
 /**
diff --git a/src/plugins/gs-plugin-packagekit-offline.c b/src/plugins/gs-plugin-packagekit-offline.c
index bc3a2a4..63a9bb9 100644
--- a/src/plugins/gs-plugin-packagekit-offline.c
+++ b/src/plugins/gs-plugin-packagekit-offline.c
@@ -32,15 +32,6 @@ gs_plugin_get_name (void)
        return "packagekit-offline";
 }
 
-/**
- * gs_plugin_get_priority:
- */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
-{
-       return 9.5f;
-}
-
 #define PK_OFFLINE_UPDATE_RESULTS_GROUP                "PackageKit Offline Update Results"
 #define PK_OFFLINE_UPDATE_RESULTS_FILENAME     "/var/lib/PackageKit/offline-update-competed"
 
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index bce7fe3..4bfd168 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -58,12 +58,16 @@ gs_plugin_initialize (GsPlugin *plugin)
 }
 
 /**
- * gs_plugin_get_priority:
+ * gs_plugin_get_deps:
  */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
+const gchar **
+gs_plugin_get_deps (GsPlugin *plugin)
 {
-       return 150.0f;
+       static const gchar *deps[] = {
+               "appstream",            /* need pkgname */
+               "packagekit",           /* need package_id */
+               NULL };
+       return deps;
 }
 
 /**
diff --git a/src/plugins/gs-plugin-packagekit-refresh.c b/src/plugins/gs-plugin-packagekit-refresh.c
index c8cf665..de8956b 100644
--- a/src/plugins/gs-plugin-packagekit-refresh.c
+++ b/src/plugins/gs-plugin-packagekit-refresh.c
@@ -56,15 +56,6 @@ gs_plugin_initialize (GsPlugin *plugin)
 }
 
 /**
- * gs_plugin_get_priority:
- */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
-{
-       return 1.0f;
-}
-
-/**
  * gs_plugin_destroy:
  */
 void
diff --git a/src/plugins/gs-plugin-packagekit-search.c b/src/plugins/gs-plugin-packagekit-search.c
index f9cf87a..58c2831 100644
--- a/src/plugins/gs-plugin-packagekit-search.c
+++ b/src/plugins/gs-plugin-packagekit-search.c
@@ -61,15 +61,6 @@ gs_plugin_initialize (GsPlugin *plugin)
 }
 
 /**
- * gs_plugin_get_priority:
- */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
-{
-       return 10.0f;
-}
-
-/**
  * gs_plugin_destroy:
  */
 void
diff --git a/src/plugins/gs-plugin-packagekit-updates.c b/src/plugins/gs-plugin-packagekit-updates.c
index ab8a5c3..1f7d283 100644
--- a/src/plugins/gs-plugin-packagekit-updates.c
+++ b/src/plugins/gs-plugin-packagekit-updates.c
@@ -57,15 +57,6 @@ gs_plugin_initialize (GsPlugin *plugin)
 }
 
 /**
- * gs_plugin_get_priority:
- */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
-{
-       return 10.0f;
-}
-
-/**
  * gs_plugin_destroy:
  */
 void
diff --git a/src/plugins/gs-plugin-packagekit.c b/src/plugins/gs-plugin-packagekit.c
index ecdc1ef..f7ea96a 100644
--- a/src/plugins/gs-plugin-packagekit.c
+++ b/src/plugins/gs-plugin-packagekit.c
@@ -57,15 +57,6 @@ gs_plugin_initialize (GsPlugin *plugin)
 }
 
 /**
- * gs_plugin_get_priority:
- */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
-{
-       return 10.0f;
-}
-
-/**
  * gs_plugin_destroy:
  */
 void
diff --git a/src/plugins/gs-plugin-self-test.c b/src/plugins/gs-plugin-self-test.c
index 85e6942..f5a0401 100644
--- a/src/plugins/gs-plugin-self-test.c
+++ b/src/plugins/gs-plugin-self-test.c
@@ -33,15 +33,6 @@ gs_plugin_get_name (void)
 }
 
 /**
- * gs_plugin_get_priority:
- */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
-{
-       return 1.0f;
-}
-
-/**
  * gs_plugin_initialize:
  */
 void
diff --git a/src/plugins/gs-plugin-systemd-updates.c b/src/plugins/gs-plugin-systemd-updates.c
index 0bc9e41..5160777 100644
--- a/src/plugins/gs-plugin-systemd-updates.c
+++ b/src/plugins/gs-plugin-systemd-updates.c
@@ -41,15 +41,6 @@ gs_plugin_get_name (void)
        return "systemd-updates";
 }
 
-/**
- * gs_plugin_get_priority:
- */
-gdouble
-gs_plugin_get_priority (GsPlugin *plugin)
-{
-       return 10.0f;
-}
-
 #define PK_PREPARED_UPDATE_FN  "/var/lib/PackageKit/prepared-update"
 
 /**


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