[gnome-software/wip/hughsie/remove-keywords: 2/2] trivial: Remove gs_app_[g|s]et_keywords()
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/hughsie/remove-keywords: 2/2] trivial: Remove gs_app_[g|s]et_keywords()
- Date: Thu, 4 Oct 2018 15:16:45 +0000 (UTC)
commit e54d36af0ea0b2daaa893c13160ccc8163c545e3
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 | 47 ---------------------------------------------
lib/gs-app.h | 3 ---
lib/gs-plugin-loader.c | 22 ++++-----------------
plugins/core/gs-appstream.c | 7 -------
4 files changed, 4 insertions(+), 75 deletions(-)
---
diff --git a/lib/gs-app.c b/lib/gs-app.c
index 74580b2b..3e616d4c 100644
--- a/lib/gs-app.c
+++ b/lib/gs-app.c
@@ -84,7 +84,6 @@ typedef struct
GPtrArray *screenshots;
GPtrArray *categories;
GPtrArray *key_colors;
- GPtrArray *keywords;
GHashTable *urls;
GHashTable *launchables;
gchar *license;
@@ -623,12 +622,6 @@ gs_app_to_string_append (GsApp *app, GString *str)
color->green * 255.f,
color->blue * 255.f);
}
- if (priv->keywords != NULL) {
- for (i = 0; i < priv->keywords->len; i++) {
- tmp = g_ptr_array_index (priv->keywords, i);
- gs_app_kv_lpad (str, "keyword", tmp);
- }
- }
keys = g_hash_table_get_keys (priv->metadata);
for (GList *l = keys; l != NULL; l = l->next) {
GVariant *val;
@@ -3670,44 +3663,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
@@ -4248,8 +4203,6 @@ gs_app_finalize (GObject *object)
g_ptr_array_unref (priv->categories);
g_ptr_array_unref (priv->key_colors);
g_clear_object (&priv->cancellable);
- if (priv->keywords != NULL)
- g_ptr_array_unref (priv->keywords);
if (priv->local_file != NULL)
g_object_unref (priv->local_file);
if (priv->content_rating != NULL)
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]