[gnome-software/wip/exalm/style-cleanups: 9/21] review-bar: Remove the bar height hack




commit 19fa5744414b52e795fad4f53b1fa9e7b0a48566
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Nov 9 19:38:10 2021 +0500

    review-bar: Remove the bar height hack
    
    Reduce the widget height instead of drawing a smaller line within it.
    This doesn't work in GTK4 - in GTK3 it presumably drawn background for the
    smaller height too. It also wasn't rounded, and there's just no point in
    doing this.

 src/gs-review-bar.c        |  8 +++-----
 src/gs-review-histogram.ui | 12 ++++++------
 2 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/src/gs-review-bar.c b/src/gs-review-bar.c
index a20c997a2..8e65449ac 100644
--- a/src/gs-review-bar.c
+++ b/src/gs-review-bar.c
@@ -36,20 +36,18 @@ static void
 gs_review_bar_snapshot (GtkWidget   *widget,
                         GtkSnapshot *snapshot)
 {
-       gdouble y_offset, bar_width, bar_height;
+       gdouble bar_width, bar_height;
        GdkRGBA color;
 
        gtk_style_context_get_color (gtk_widget_get_style_context (widget), &color);
 
-       /* don't fill the complete height (too heavy beside GtkLabel of that height) */
-       y_offset = floor (0.15 * gtk_widget_get_height (widget));
-       bar_height = gtk_widget_get_height (widget) - (y_offset * 2);
        bar_width = round (GS_REVIEW_BAR (widget)->fraction * gtk_widget_get_width (widget));
+       bar_height = gtk_widget_get_height (widget);
 
        gtk_snapshot_append_color (snapshot,
                                   &color,
                                   &GRAPHENE_RECT_INIT (0,
-                                                       y_offset,
+                                                       0,
                                                        bar_width,
                                                        bar_height));
 
diff --git a/src/gs-review-histogram.ui b/src/gs-review-histogram.ui
index bd4c1ee3e..fff8baf2b 100644
--- a/src/gs-review-histogram.ui
+++ b/src/gs-review-histogram.ui
@@ -116,7 +116,7 @@
                 <property name="halign">fill</property>
                 <property name="hexpand">true</property>
                 <property name="valign">center</property>
-                <property name="height-request">8</property>
+                <property name="height-request">6</property>
                 <layout>
                   <property name="column">0</property>
                   <property name="row">0</property>
@@ -196,7 +196,7 @@
                 <property name="halign">fill</property>
                 <property name="hexpand">true</property>
                 <property name="valign">center</property>
-                <property name="height-request">8</property>
+                <property name="height-request">6</property>
                 <layout>
                   <property name="column">0</property>
                   <property name="row">1</property>
@@ -263,7 +263,7 @@
                 <property name="halign">fill</property>
                 <property name="hexpand">true</property>
                 <property name="valign">center</property>
-                <property name="height-request">8</property>
+                <property name="height-request">6</property>
                 <layout>
                   <property name="column">0</property>
                   <property name="row">2</property>
@@ -317,7 +317,7 @@
                 <property name="halign">fill</property>
                 <property name="hexpand">true</property>
                 <property name="valign">center</property>
-                <property name="height-request">8</property>
+                <property name="height-request">6</property>
                 <layout>
                   <property name="column">0</property>
                   <property name="row">3</property>
@@ -358,7 +358,7 @@
                 <property name="halign">fill</property>
                 <property name="hexpand">true</property>
                 <property name="valign">center</property>
-                <property name="height-request">8</property>
+                <property name="height-request">6</property>
                 <layout>
                   <property name="column">0</property>
                   <property name="row">4</property>
@@ -394,7 +394,7 @@
             <property name="valign">center</property>
             <property name="hexpand">True</property>
             <property name="label">0</property>
-            <property name="margin-top">10</property>
+            <property name="margin-top">6</property>
             <layout>
               <property name="column">0</property>
               <property name="row">2</property>


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