[gnome-software] Updates to the app widget layout



commit 6266a180da5e21d0160b9e1fd316ed7aa20c6077
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Dec 18 19:48:04 2013 -0500

    Updates to the app widget layout
    
    This gets us closer to the updated design guidance in
    https://bugzilla.gnome.org/show_bug.cgi?id=712698
    We also replace the version number with the rating on the
    installed list. The updates list still shows the version
    information. At the same time, don't show folders in
    the updates list.

 src/app-widget.ui        |   35 +++++++++++++++++++++++++----------
 src/gs-app-widget.c      |   30 ++++++++++++++++++++++--------
 src/gs-shell-installed.c |    3 ++-
 src/gtk-style.css        |    5 +++--
 4 files changed, 52 insertions(+), 21 deletions(-)
---
diff --git a/src/app-widget.ui b/src/app-widget.ui
index b6d4963..55247db 100644
--- a/src/app-widget.ui
+++ b/src/app-widget.ui
@@ -3,15 +3,16 @@
   <!-- interface-requires gtk+ 3.10 -->
   <template class="GsAppWidget" parent="GtkBin">
     <property name="visible">True</property>
-    <property name="margin">9</property>
+    <property name="margin-top">16</property>
+    <property name="margin-bottom">16</property>
     <child>
       <object class="GtkBox" id="box">
         <property name="visible">True</property>
         <property name="orientation">horizontal</property>
-        <property name="spacing">3</property>
         <child>
           <object class="GtkCheckButton" id="checkbox">
-            <property name="margin-right">9</property>
+            <property name="margin-start">12</property>
+            <property name="valign">center</property>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -22,7 +23,8 @@
           <object class="GtkImage" id="image">
             <property name="visible">True</property>
             <property name="pixel_size">64</property>
-            <property name="margin-right">9</property>
+            <property name="margin-start">20</property>
+            <property name="valign">center</property>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -33,7 +35,9 @@
           <object class="GtkBox" id="name_box">
             <property name="visible">True</property>
             <property name="orientation">vertical</property>
+            <property name="margin-start">12</property>
             <property name="spacing">6</property>
+            <property name="valign">start</property>
             <child>
               <object class="GtkLabel" id="name_label">
                 <property name="visible">True</property>
@@ -41,7 +45,7 @@
                 <property name="max_width_chars">20</property>
                 <property name="xalign">0.0</property>
                 <property name="yalign">0.5</property>
-                <property name="width_request">200</property>
+                <property name="width_request">164</property>
                 <attributes>
                   <attribute name="weight" value="bold"/>
                 </attributes>
@@ -63,6 +67,15 @@
               </packing>
             </child>
             <child>
+              <object class="GsStarWidget" id="star">
+                <property name="halign">start</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkLabel" id="folder_label">
                 <property name="visible">True</property>
                 <property name="xalign">0.0</property>
@@ -87,6 +100,8 @@
           <object class="GtkLabel" id="description_label">
             <property name="visible">True</property>
             <property name="halign">fill</property>
+            <property name="valign">start</property>
+            <property name="margin-start">20</property>
             <property name="xalign">0</property>
             <property name="yalign">0.5</property>
             <property name="wrap">True</property>
@@ -107,7 +122,7 @@
             <property name="valign">center</property>
             <child>
               <object class="GtkButton" id="button">
-                <property name="margin_end">9</property>
+                <property name="margin_end">24</property>
                 <property name="width_request">100</property>
                 <property name="halign">end</property>
               </object>
@@ -119,8 +134,8 @@
             </child>
             <child>
               <object class="GtkSpinner" id="spinner">
-                <property name="margin_start">6</property>
-                <property name="margin_end">6</property>
+                <property name="margin_start">12</property>
+                <property name="margin_end">12</property>
                 <property name="halign">end</property>
               </object>
               <packing>
@@ -131,8 +146,8 @@
             </child>
             <child>
               <object class="GtkLabel" id="label">
-                <property name="margin_start">6</property>
-                <property name="margin_end">6</property>
+                <property name="margin_start">12</property>
+                <property name="margin_end">12</property>
                 <property name="halign">end</property>
               </object>
               <packing>
diff --git a/src/gs-app-widget.c b/src/gs-app-widget.c
index fff84c6..eef42fe 100644
--- a/src/gs-app-widget.c
+++ b/src/gs-app-widget.c
@@ -26,6 +26,7 @@
 #include <gtk/gtk.h>
 
 #include "gs-app-widget.h"
+#include "gs-star-widget.h"
 #include "gs-markdown.h"
 #include "gs-utils.h"
 #include "gs-folders.h"
@@ -37,6 +38,7 @@ struct _GsAppWidgetPrivate
        GtkWidget       *name_box;
        GtkWidget       *name_label;
        GtkWidget       *version_label;
+       GtkWidget       *star;
        GtkWidget       *folder_label;
        GtkWidget       *description_label;
        GtkWidget       *button_box;
@@ -142,21 +144,32 @@ gs_app_widget_refresh (GsAppWidget *app_widget)
                             gs_app_get_name (priv->app));
        if (priv->show_update &&
            gs_app_get_state (priv->app) == GS_APP_STATE_UPDATABLE) {
+               gtk_widget_show (priv->version_label);
+               gtk_widget_hide (priv->star);
                gtk_label_set_label (GTK_LABEL (priv->version_label),
                                     gs_app_get_update_version_ui (priv->app));
        } else {
+               gtk_widget_hide (priv->version_label);
+               gtk_widget_show (priv->star);
+               gtk_widget_set_sensitive (priv->star, FALSE);
+               gs_star_widget_set_rating (GS_STAR_WIDGET (priv->star),
+                                          gs_app_get_rating_kind (priv->app),
+                                          gs_app_get_rating (priv->app));
                gtk_label_set_label (GTK_LABEL (priv->version_label),
                                     gs_app_get_version_ui (priv->app));
        }
 
-       folders = gs_folders_get ();
-       folder = gs_folders_get_app_folder (folders, gs_app_get_id (priv->app));
-       if (folder)
-               folder = gs_folders_get_folder_name (folders, folder);
-       gtk_label_set_label (GTK_LABEL (priv->folder_label), folder);
-       gtk_widget_set_visible (priv->folder_label, folder != NULL);
-
-       g_object_unref (folders);
+       if (priv->show_update) {
+               gtk_widget_hide (priv->folder_label);
+       } else {
+               folders = gs_folders_get ();
+               folder = gs_folders_get_app_folder (folders, gs_app_get_id (priv->app));
+               if (folder)
+                       folder = gs_folders_get_folder_name (folders, folder);
+               gtk_label_set_label (GTK_LABEL (priv->folder_label), folder);
+               gtk_widget_set_visible (priv->folder_label, folder != NULL);
+               g_object_unref (folders);
+       }
 
        if (gs_app_get_pixbuf (priv->app))
                gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image),
@@ -306,6 +319,7 @@ gs_app_widget_class_init (GsAppWidgetClass *klass)
        gtk_widget_class_bind_template_child_private (widget_class, GsAppWidget, name_box);
        gtk_widget_class_bind_template_child_private (widget_class, GsAppWidget, name_label);
        gtk_widget_class_bind_template_child_private (widget_class, GsAppWidget, version_label);
+       gtk_widget_class_bind_template_child_private (widget_class, GsAppWidget, star);
        gtk_widget_class_bind_template_child_private (widget_class, GsAppWidget, folder_label);
        gtk_widget_class_bind_template_child_private (widget_class, GsAppWidget, description_label);
        gtk_widget_class_bind_template_child_private (widget_class, GsAppWidget, button_box);
diff --git a/src/gs-shell-installed.c b/src/gs-shell-installed.c
index 34ba6fa..500ea77 100644
--- a/src/gs-shell-installed.c
+++ b/src/gs-shell-installed.c
@@ -349,7 +349,8 @@ gs_shell_installed_refresh (GsShellInstalled *shell_installed, gboolean scroll_u
                                              GS_PLUGIN_REFINE_FLAGS_DEFAULT |
                                              GS_PLUGIN_REFINE_FLAGS_REQUIRE_HISTORY |
                                              GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION |
-                                             GS_PLUGIN_REFINE_FLAGS_REQUIRE_VERSION,
+                                             GS_PLUGIN_REFINE_FLAGS_REQUIRE_VERSION |
+                                             GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING,
                                              priv->cancellable,
                                              gs_shell_installed_get_installed_cb,
                                              shell_installed);
diff --git a/src/gtk-style.css b/src/gtk-style.css
index 3033e28..7ecd8c7 100644
--- a/src/gtk-style.css
+++ b/src/gtk-style.css
@@ -62,9 +62,10 @@ GtkNotebook.main-notebook-software > GtkScrolledWindow {
 }
 
 .folder-label {
+       font-size: 9px;
        background-color: #999999;
-       border-radius: 5px;
-       padding: 5px;
+       border-radius: 4px;
+       padding: 4px 8px;
        color: white;
 }
 


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