[gnome-software] Use the app description when showing shell extension tiles



commit 88211951804c135357759b88bc061622f62f8476
Author: Richard Hughes <richard hughsie com>
Date:   Wed Mar 2 14:46:02 2016 +0000

    Use the app description when showing shell extension tiles

 src/app-tile.ui   |    1 +
 src/gs-app-tile.c |   19 +++++++++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/src/app-tile.ui b/src/app-tile.ui
index 74879ad..3e41e70 100644
--- a/src/app-tile.ui
+++ b/src/app-tile.ui
@@ -106,6 +106,7 @@
                     <property name="yalign">0.0</property>
                     <property name="lines">2</property>
                     <property name="vexpand">True</property>
+                    <property name="single-line-mode">True</property>
                     <style>
                       <class name="app-tile-label"/>
                     </style>
diff --git a/src/gs-app-tile.c b/src/gs-app-tile.c
index 5d58eb0..905484e 100644
--- a/src/gs-app-tile.c
+++ b/src/gs-app-tile.c
@@ -126,8 +126,8 @@ app_state_changed (GsApp *app, GParamSpec *pspec, GsAppTile *tile)
 void
 gs_app_tile_set_app (GsAppTile *tile, GsApp *app)
 {
-       const gchar *summary;
        const GdkPixbuf *pixbuf;
+       g_autofree gchar *text = NULL;
 
        g_return_if_fail (GS_IS_APP_TILE (tile));
        g_return_if_fail (GS_IS_APP (app) || app == NULL);
@@ -152,9 +152,20 @@ gs_app_tile_set_app (GsAppTile *tile, GsApp *app)
        if (pixbuf != NULL)
                gs_image_set_from_pixbuf (GTK_IMAGE (tile->image), pixbuf);
        gtk_label_set_label (GTK_LABEL (tile->name), gs_app_get_name (app));
-       summary = gs_app_get_summary (app);
-       gtk_label_set_label (GTK_LABEL (tile->summary), summary);
-       gtk_widget_set_visible (tile->summary, summary && summary[0]);
+
+       /* some kinds have boring summaries */
+       switch (gs_app_get_kind (app)) {
+       case AS_APP_KIND_SHELL_EXTENSION:
+               text = g_strdup (gs_app_get_description (app));
+               g_strdelimit (text, "\n\t", ' ');
+               break;
+       default:
+               text = g_strdup (gs_app_get_summary (app));
+               break;
+       }
+
+       gtk_label_set_label (GTK_LABEL (tile->summary), text);
+       gtk_widget_set_visible (tile->summary, text && text[0]);
 }
 
 static void


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