[gnome-software/wip/hughsie/remove-keywords] trivial: Remove gs_app_[g|s]et_keywords()



commit ecda08dbb21dd81f5fb8bb02f17d5bc9ad040cdc
Author: Richard Hughes <richard hughsie com>
Date:   Thu Oct 4 16:06:02 2018 +0100

    trivial: Remove gs_app_[g|s]et_keywords()
    
    The keywords are only used for one dubious feature that most users won't
    actually use, and not saving the keywords array for each application reduces
    RSS usage slightly.

 lib/gs-app.c                | 38 --------------------------------------
 lib/gs-app.h                |  3 ---
 lib/gs-plugin-loader.c      | 22 ++++------------------
 plugins/core/gs-appstream.c |  7 -------
 4 files changed, 4 insertions(+), 66 deletions(-)
---
diff --git a/lib/gs-app.c b/lib/gs-app.c
index 74580b2b..4fd5bb43 100644
--- a/lib/gs-app.c
+++ b/lib/gs-app.c
@@ -3670,44 +3670,6 @@ gs_app_add_key_color (GsApp *app, GdkRGBA *key_color)
        g_ptr_array_add (priv->key_colors, gdk_rgba_copy (key_color));
 }
 
-/**
- * gs_app_get_keywords:
- * @app: a #GsApp
- *
- * Gets the list of application keywords in the users locale.
- *
- * Returns: (element-type utf8) (transfer none): a list
- *
- * Since: 3.22
- **/
-GPtrArray *
-gs_app_get_keywords (GsApp *app)
-{
-       GsAppPrivate *priv = gs_app_get_instance_private (app);
-       g_return_val_if_fail (GS_IS_APP (app), NULL);
-       return priv->keywords;
-}
-
-/**
- * gs_app_set_keywords:
- * @app: a #GsApp
- * @keywords: (element-type utf8): a set of keywords
- *
- * Sets the list of application keywords in the users locale.
- *
- * Since: 3.22
- **/
-void
-gs_app_set_keywords (GsApp *app, GPtrArray *keywords)
-{
-       GsAppPrivate *priv = gs_app_get_instance_private (app);
-       g_autoptr(GMutexLocker) locker = NULL;
-       g_return_if_fail (GS_IS_APP (app));
-       g_return_if_fail (keywords != NULL);
-       locker = g_mutex_locker_new (&priv->mutex);
-       _g_set_ptr_array (&priv->keywords, keywords);
-}
-
 /**
  * gs_app_add_kudo:
  * @app: a #GsApp
diff --git a/lib/gs-app.h b/lib/gs-app.h
index daf39592..69745b41 100644
--- a/lib/gs-app.h
+++ b/lib/gs-app.h
@@ -299,9 +299,6 @@ void                 gs_app_add_category            (GsApp          *app,
                                                 const gchar    *category);
 gboolean        gs_app_remove_category         (GsApp          *app,
                                                 const gchar    *category);
-GPtrArray      *gs_app_get_keywords            (GsApp          *app);
-void            gs_app_set_keywords            (GsApp          *app,
-                                                GPtrArray      *keywords);
 void            gs_app_add_kudo                (GsApp          *app,
                                                 GsAppKudo       kudo);
 void            gs_app_remove_kudo             (GsApp          *app,
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 8ba1d580..557f6618 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -1410,30 +1410,16 @@ gs_plugin_loader_app_sort_prio_cb (GsApp *app1, GsApp *app2, gpointer user_data)
 static gboolean
 gs_plugin_loader_convert_unavailable_app (GsApp *app, const gchar *search)
 {
-       GPtrArray *keywords;
-       const gchar *keyword;
-       guint i;
        g_autoptr(GString) tmp = NULL;
 
-       /* is the search string one of the codec keywords */
-       keywords = gs_app_get_keywords (app);
-       for (i = 0; i < keywords->len; i++) {
-               keyword = g_ptr_array_index (keywords, i);
-               if (g_ascii_strcasecmp (search, keyword) == 0) {
-                       search = keyword;
-                       break;
-               }
-       }
-
        tmp = g_string_new ("");
        /* TRANSLATORS: this is when we know about an application or
         * addon, but it can't be listed for some reason */
-       g_string_append_printf (tmp, _("No addon codecs are available "
-                               "for the %s format."), search);
+       g_string_append (tmp, _("No addon codecs are available "
+                               "for this format."));
        g_string_append (tmp, "\n");
-       g_string_append_printf (tmp, _("Information about %s, as well as options "
-                               "for how to get a codec that can play this format "
-                               "can be found on the website."), search);
+       g_string_append (tmp, _("Options for how to get a codec that can play this format "
+                               "can be found on the website."));
        gs_app_set_summary_missing (app, tmp->str);
        gs_app_set_kind (app, AS_APP_KIND_GENERIC);
        gs_app_set_state (app, AS_APP_STATE_UNAVAILABLE);
diff --git a/plugins/core/gs-appstream.c b/plugins/core/gs-appstream.c
index feac9325..40deb734 100644
--- a/plugins/core/gs-appstream.c
+++ b/plugins/core/gs-appstream.c
@@ -631,13 +631,6 @@ gs_appstream_refine_app (GsPlugin *plugin,
                                    GS_APP_QUALITY_HIGHEST,
                                    as_app_get_project_license (item));
 
-       /* set keywords */
-       if (as_app_get_keywords (item, NULL) != NULL &&
-           gs_app_get_keywords (app) == NULL) {
-               gs_app_set_keywords (app, as_app_get_keywords (item, NULL));
-               gs_app_add_kudo (app, GS_APP_KUDO_HAS_KEYWORDS);
-       }
-
        /* set origin */
        if (as_app_get_origin (item) != NULL &&
            gs_app_get_origin (app) == NULL ) {


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