[gnome-software] appstream: Use as_app_search_matches_all() from libappstream-glib



commit c01108060ce6968c7720e927ea4bb5ccaeb8b02f
Author: Richard Hughes <richard hughsie com>
Date:   Tue Apr 8 11:06:20 2014 +0100

    appstream: Use as_app_search_matches_all() from libappstream-glib
    
    As well as code reduction, it also gets us the mimetype search fix.

 configure.ac                      |    2 +-
 src/plugins/gs-plugin-appstream.c |   20 +-------------------
 2 files changed, 2 insertions(+), 20 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 593f1ab..dc05038 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,7 +61,7 @@ dnl - Check library dependencies
 dnl ---------------------------------------------------------------------------
 PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.11.5 gio-unix-2.0)
 PKG_CHECK_MODULES(PACKAGEKIT, packagekit-glib2 >= 0.8.12)
-PKG_CHECK_MODULES(APPSTREAM, appstream-glib >= 0.1.2)
+PKG_CHECK_MODULES(APPSTREAM, appstream-glib >= 0.1.3)
 PKG_CHECK_MODULES(SQLITE, sqlite3)
 PKG_CHECK_MODULES(SOUP, libsoup-2.4)
 PKG_CHECK_MODULES(GSETTINGS_DESKTOP_SCHEMAS, gsettings-desktop-schemas >= 3.11.5)
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index a3ab114..6318c15 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -655,24 +655,6 @@ out:
 }
 
 /**
- * gs_plugin_appstream_match_item:
- */
-static gboolean
-gs_plugin_appstream_match_item (AsApp *item, gchar **values)
-{
-       guint matches = 0;
-       guint i;
-
-       /* does the GsApp match *all* search keywords */
-       for (i = 0; values[i] != NULL; i++) {
-               matches = as_app_search_matches (item, values[i]);
-               if (matches == 0)
-                       break;
-       }
-       return matches != 0;
-}
-
-/**
  * gs_plugin_add_search:
  */
 gboolean
@@ -701,7 +683,7 @@ gs_plugin_add_search (GsPlugin *plugin,
        array = as_store_get_apps (plugin->priv->store);
        for (i = 0; i < array->len; i++) {
                item = g_ptr_array_index (array, i);
-               if (gs_plugin_appstream_match_item (item, values)) {
+               if (as_app_search_matches_all (item, values) != 0) {
                        app = gs_app_new (as_app_get_id (item));
                        ret = gs_plugin_refine_item (plugin, app, item, error);
                        if (!ret)


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