[gnome-software] Do not set the description to the update text



commit 549bad1db59699f663c03658139c38e8b722c191
Author: Richard Hughes <richard hughsie com>
Date:   Fri Sep 6 13:55:35 2013 +0100

    Do not set the description to the update text
    
    This should be handled in the UI, not in the plugin loader.

 src/gs-app-widget.c    |   32 ++++++++++++++++++--------------
 src/gs-plugin-loader.c |    5 -----
 2 files changed, 18 insertions(+), 19 deletions(-)
---
diff --git a/src/gs-app-widget.c b/src/gs-app-widget.c
index 1462397..ea592a9 100644
--- a/src/gs-app-widget.c
+++ b/src/gs-app-widget.c
@@ -98,24 +98,27 @@ gs_app_widget_refresh (GsAppWidget *app_widget)
        GsAppWidgetPrivate *priv = app_widget->priv;
        GtkStyleContext *context;
        GtkWidget *box;
-        const gchar *tmp;
-        GString *s = NULL;
+       const gchar *tmp = NULL;
+       GString *str = NULL;
 
        if (app_widget->priv->app == NULL)
                return;
 
-       tmp = (gchar *)gs_app_get_description (app_widget->priv->app);
-       if (tmp) {
-               s = g_string_new (tmp);
-               _g_string_replace (s, "\n", " ");
-               tmp = s->str;
-       }
-        else {
-                tmp = (gchar *)gs_app_get_summary (app_widget->priv->app);
-        }
-       gtk_label_set_label (GTK_LABEL (priv->widget_description), tmp);
-        if (s)
-                g_string_free (s, TRUE);
+       /* get the main body text */
+       if (gs_app_get_state (app_widget->priv->app) == GS_APP_STATE_UPDATABLE)
+               tmp = gs_app_get_metadata_item (app_widget->priv->app, "update-details");
+       if (tmp == NULL)
+               tmp = gs_app_get_description (app_widget->priv->app);
+       if (tmp == NULL)
+               tmp = gs_app_get_summary (app_widget->priv->app);
+       if (tmp == NULL)
+               tmp = gs_app_get_name (app_widget->priv->app);
+
+       /* join the lines*/
+       str = g_string_new (tmp);
+       _g_string_replace (str, "\n", " ");
+
+       gtk_label_set_label (GTK_LABEL (priv->widget_description), str->str);
        gtk_label_set_label (GTK_LABEL (priv->widget_name),
                             gs_app_get_name (priv->app));
        gtk_label_set_label (GTK_LABEL (priv->widget_version),
@@ -172,6 +175,7 @@ gs_app_widget_refresh (GsAppWidget *app_widget)
        box = gtk_widget_get_parent (priv->widget_button);
        gtk_widget_set_visible (box, gtk_widget_get_visible (priv->widget_spinner) ||
                                     gtk_widget_get_visible (priv->widget_button));
+       g_string_free (str, TRUE);
 }
 
 /**
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 3e1a0f5..d02405a 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -440,11 +440,6 @@ cd_plugin_loader_get_updates_thread_cb (GSimpleAsyncResult *res,
                app_tmp = GS_APP (l->data);
                if (gs_app_get_kind (app_tmp) == GS_APP_KIND_PACKAGE) {
                        has_os_update = TRUE;
-               } else {
-                       /* if we have update text, then use it */
-                       tmp = gs_app_get_metadata_item (app_tmp, "update-details");
-                       if (tmp != NULL && tmp[0] != '\0')
-                               gs_app_set_description (app_tmp, tmp);
                }
        }
 


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