[gnome-software/gnome-3-22] Remove the (Nightly) prefix on flatpak app names
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-22] Remove the (Nightly) prefix on flatpak app names
- Date: Mon, 7 Nov 2016 13:38:37 +0000 (UTC)
commit d71ad7cb4eb3ee4c52150ae12ed07db6f6a1d693
Author: Richard Hughes <richard hughsie com>
Date: Wed Sep 28 12:17:51 2016 +0100
Remove the (Nightly) prefix on flatpak app names
We can't rely on the prefix being there due to a misunderstanding in
appstream-compose, so strip it off and then add it back in the search results.
(cherry picked from commit 5b6fb98492e49b906234fbc07b230dad39e18c45)
src/gs-app-row.c | 13 +++++++++++--
src/plugins/gs-flatpak.c | 26 ++++++++++++++++++++++++++
2 files changed, 37 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-app-row.c b/src/gs-app-row.c
index 8459bef..186b99b 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -379,8 +379,17 @@ gs_app_row_refresh (GsAppRow *app_row)
gtk_widget_set_visible (priv->label_installed, FALSE);
}
- gtk_label_set_label (GTK_LABEL (priv->name_label),
- gs_app_get_name (priv->app));
+ /* name */
+ if (g_strcmp0 (gs_app_get_branch (priv->app), "master") == 0) {
+ g_autofree gchar *name = NULL;
+ /* TRANSLATORS: not translated to match what flatpak does */
+ name = g_strdup_printf ("(Nightly) %s",
+ gs_app_get_name (priv->app));
+ gtk_label_set_label (GTK_LABEL (priv->name_label), name);
+ } else {
+ gtk_label_set_label (GTK_LABEL (priv->name_label),
+ gs_app_get_name (priv->app));
+ }
if (priv->show_update &&
(gs_app_get_state (priv->app) == AS_APP_STATE_UPDATABLE ||
gs_app_get_state (priv->app) == AS_APP_STATE_UPDATABLE_LIVE)) {
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index 88abf0c..bd989ad 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -127,6 +127,26 @@ gs_plugin_flatpak_changed_cb (GFileMonitor *monitor,
}
}
+static void
+gs_flatpak_remove_prefixed_names (AsApp *app)
+{
+ GHashTable *names;
+ GList *l;
+ g_autoptr(GList) keys = NULL;
+
+ names = as_app_get_names (app);
+ keys = g_hash_table_get_keys (names);
+ for (l = keys; l != NULL; l = l->next) {
+ const gchar *locale = l->data;
+ const gchar *value = g_hash_table_lookup (names, locale);
+ if (value == NULL)
+ continue;
+ if (!g_str_has_prefix (value, "(Nightly) "))
+ continue;
+ as_app_set_name (app, locale, value + 10);
+ }
+}
+
static gboolean
gs_flatpak_add_apps_from_xremote (GsFlatpak *self,
FlatpakRemote *xremote,
@@ -187,6 +207,9 @@ gs_flatpak_add_apps_from_xremote (GsFlatpak *self,
continue;
}
+ /* fix the names when using old versions of appstream-compose */
+ gs_flatpak_remove_prefixed_names (app);
+
/* add */
as_app_set_scope (app, self->scope);
as_app_set_origin (app, flatpak_remote_get_name (xremote));
@@ -247,6 +270,9 @@ gs_flatpak_rescan_installed (GsFlatpak *self, GCancellable *cancellable, GError
}
}
+ /* fix the names when using old versions of appstream-compose */
+ gs_flatpak_remove_prefixed_names (app);
+
/* add */
as_app_set_state (app, AS_APP_STATE_INSTALLED);
as_app_set_scope (app, self->scope);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]