[gnome-software] Use new API from libappstream-glib for tokenizing the search string



commit 66dedfb26fc0e26cfbeed467bb0e056b71e056e0
Author: Richard Hughes <richard hughsie com>
Date:   Thu Jan 15 13:42:10 2015 +0000

    Use new API from libappstream-glib for tokenizing the search string

 configure.ac           |    2 +-
 src/gs-plugin-loader.c |   27 ++-------------------------
 2 files changed, 3 insertions(+), 26 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 0bb196f..6527df4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,7 +61,7 @@ dnl - Check library dependencies
 dnl ---------------------------------------------------------------------------
 PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.14.1 gio-unix-2.0)
 PKG_CHECK_MODULES(PACKAGEKIT, packagekit-glib2 >= 1.0.0)
-PKG_CHECK_MODULES(APPSTREAM, appstream-glib >= 0.3.2)
+PKG_CHECK_MODULES(APPSTREAM, appstream-glib >= 0.3.4)
 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/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 9613ba0..f86795e 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -22,6 +22,7 @@
 #include "config.h"
 
 #include <glib/gi18n.h>
+#include <appstream-glib.h>
 
 #include "gs-cleanup.h"
 #include "gs-plugin-loader.h"
@@ -1561,30 +1562,6 @@ gs_plugin_loader_convert_unavailable (GList *list, const gchar *search)
 }
 
 /**
- * gs_plugin_loader_search_tokenize_keywords:
- **/
-static gchar **
-gs_plugin_loader_search_tokenize_keywords (const gchar *value)
-{
-       gchar **values = NULL;
-       guint i;
-       guint idx = 0;
-       _cleanup_strv_free_ gchar **tmp = NULL;
-
-       /* only add keywords that are long enough */
-       tmp = g_strsplit (value, " ", -1);
-       values = g_new0 (gchar *, g_strv_length (tmp) + 1);
-       for (i = 0; tmp[i] != NULL; i++) {
-               if (strlen (tmp[i]) < 3)
-                       continue;
-               values[idx++] = g_utf8_casefold (tmp[i], -1);
-       }
-       if (idx == 0)
-               return NULL;
-       return values;
-}
-
-/**
  * gs_plugin_loader_search_thread_cb:
  **/
 static void
@@ -1605,7 +1582,7 @@ gs_plugin_loader_search_thread_cb (GTask *task,
        _cleanup_strv_free_ gchar **values = NULL;
 
        /* run each plugin */
-       values = gs_plugin_loader_search_tokenize_keywords (state->value);
+       values = as_utils_search_tokenize (state->value);
        if (values == NULL) {
                g_task_return_new_error (task,
                                         GS_PLUGIN_LOADER_ERROR,


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