[gnome-software] Revert "app-tile: Completely remove star ratings"



commit cbcde321609d5418188d4776b15300ba1bd6d047
Author: Richard Hughes <richard hughsie com>
Date:   Thu Feb 27 13:07:33 2014 +0000

    Revert "app-tile: Completely remove star ratings"
    
    This reverts commit 0c78af8729158d39dfb73c1ae3bcff75fe217855.

 src/app-tile.ui   |   16 ++++++++++++++--
 src/gs-app-tile.c |   13 +++++++++++++
 2 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/src/app-tile.ui b/src/app-tile.ui
index c33c09b..fc92009 100644
--- a/src/app-tile.ui
+++ b/src/app-tile.ui
@@ -65,7 +65,7 @@
                     <property name="left-attach">0</property>
                     <property name="top-attach">0</property>
                     <property name="width">1</property>
-                    <property name="height">2</property>
+                    <property name="height">3</property>
                   </packing>
                 </child>
                 <child>
@@ -88,6 +88,18 @@
                   </packing>
                 </child>
                 <child>
+                  <object class="GsStarWidget" id="stars">
+                    <property name="visible">False</property>
+                    <property name="halign">start</property>
+                  </object>
+                  <packing>
+                    <property name="left-attach">1</property>
+                    <property name="top-attach">1</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
                   <object class="GtkLabel" id="summary">
                     <property name="visible">True</property>
                     <property name="ellipsize">end</property>
@@ -101,7 +113,7 @@
                   </object>
                   <packing>
                     <property name="left-attach">1</property>
-                    <property name="top-attach">1</property>
+                    <property name="top-attach">2</property>
                     <property name="width">1</property>
                     <property name="height">1</property>
                   </packing>
diff --git a/src/gs-app-tile.c b/src/gs-app-tile.c
index a87101d..df3a533 100644
--- a/src/gs-app-tile.c
+++ b/src/gs-app-tile.c
@@ -25,6 +25,7 @@
 #include <gtk/gtk.h>
 
 #include "gs-app-tile.h"
+#include "gs-star-widget.h"
 
 struct _GsAppTilePrivate
 {
@@ -35,6 +36,7 @@ struct _GsAppTilePrivate
        GtkWidget       *summary;
        GtkWidget       *eventbox;
        GtkWidget       *waiting;
+       GtkWidget       *stars;
 };
 
 G_DEFINE_TYPE_WITH_PRIVATE (GsAppTile, gs_app_tile, GTK_TYPE_BIN)
@@ -130,6 +132,15 @@ gs_app_tile_set_app (GsAppTile *tile, GsApp *app)
        if (!app)
                return;
        priv->app = g_object_ref (app);
+       if (gs_app_get_rating_kind (priv->app) == GS_APP_RATING_KIND_USER) {
+               gs_star_widget_set_rating (GS_STAR_WIDGET (priv->stars),
+                                          GS_APP_RATING_KIND_USER,
+                                          gs_app_get_rating (priv->app));
+       } else {
+               gs_star_widget_set_rating (GS_STAR_WIDGET (priv->stars),
+                                          GS_APP_RATING_KIND_KUDOS,
+                                          gs_app_get_kudos_weight (priv->app));
+       }
 
        gtk_widget_hide (priv->waiting);
 
@@ -179,6 +190,7 @@ gs_app_tile_init (GsAppTile *tile)
        priv = gs_app_tile_get_instance_private (tile);
        g_signal_connect_swapped (priv->button, "clicked",
                                  G_CALLBACK (button_clicked), tile);
+       gs_star_widget_set_icon_size (GS_STAR_WIDGET (priv->stars), 12);
 }
 
 static void
@@ -204,6 +216,7 @@ gs_app_tile_class_init (GsAppTileClass *klass)
        gtk_widget_class_bind_template_child_private (widget_class, GsAppTile, summary);
         gtk_widget_class_bind_template_child_private (widget_class, GsAppTile, eventbox);
         gtk_widget_class_bind_template_child_private (widget_class, GsAppTile, waiting);
+        gtk_widget_class_bind_template_child_private (widget_class, GsAppTile, stars);
 }
 
 GtkWidget *


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