[gnome-software/1205-reviews-ratings-are-rounded-to-integer-stars] gs-star-image: Fill the star without the outline
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1205-reviews-ratings-are-rounded-to-integer-stars] gs-star-image: Fill the star without the outline
- Date: Tue, 25 May 2021 15:53:56 +0000 (UTC)
commit 90cd890cda7e90609defaee682d0ab24436cfa35
Author: Milan Crha <mcrha redhat com>
Date: Tue May 25 17:53:08 2021 +0200
gs-star-image: Fill the star without the outline
src/gs-star-image.c | 36 ++++++++++++++++++++++--------------
src/gtk-style-hc.css | 14 +++++---------
src/gtk-style.css | 6 ++++--
3 files changed, 31 insertions(+), 25 deletions(-)
---
diff --git a/src/gs-star-image.c b/src/gs-star-image.c
index 05a66fb99..2c3baec90 100644
--- a/src/gs-star-image.c
+++ b/src/gs-star-image.c
@@ -99,32 +99,35 @@ gs_star_image_draw (GtkWidget *widget,
if (radius > 0) {
GtkStyleContext *style_context;
- GdkRGBA rgba;
+ GdkRGBA *star_bg = NULL;
+ GdkRGBA star_fg;
+
+ gtk_widget_style_get (widget,
+ "star-bg", &star_bg,
+ NULL);
style_context = gtk_widget_get_style_context (widget);
gtk_style_context_get_color (style_context,
gtk_style_context_get_state (style_context),
- &rgba);
-
- cairo_save (cr);
- gdk_cairo_set_source_rgba (cr, &rgba);
+ &star_fg);
cairo_save (cr);
gs_star_image_outline_star (cr, allocation.x, allocation.y, radius);
cairo_clip (cr);
- cairo_rectangle (cr, -radius, -radius, 2 * radius * fraction, 2 * radius);
+ if (star_bg)
+ gdk_cairo_set_source_rgba (cr, star_bg);
+ else
+ cairo_set_source_rgb (cr, 0xde / 255.0, 0xdd / 255.0, 0xda / 255.0);
+ cairo_rectangle (cr, -radius, -radius, 2 * radius, 2 * radius);
cairo_fill (cr);
- cairo_restore (cr);
- cairo_save (cr);
- gs_star_image_outline_star (cr, allocation.x, allocation.y, radius);
- cairo_set_antialias (cr, CAIRO_ANTIALIAS_SUBPIXEL);
- cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
- cairo_set_line_width (cr, 1);
- cairo_stroke (cr);
+ gdk_cairo_set_source_rgba (cr, &star_fg);
+ cairo_rectangle (cr, -radius, -radius, 2 * radius * fraction, 2 * radius);
+ cairo_fill (cr);
cairo_restore (cr);
- cairo_restore (cr);
+ if (star_bg)
+ gdk_rgba_free (star_bg);
}
return FALSE;
@@ -148,6 +151,11 @@ gs_star_image_class_init (GsStarImageClass *klass)
g_param_spec_double ("fraction", NULL, NULL,
0.0, 1.0, 1.0,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
+
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_boxed ("star-bg", NULL, NULL,
+ GDK_TYPE_RGBA,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
}
static void
diff --git a/src/gtk-style-hc.css b/src/gtk-style-hc.css
index 29a66ce8f..ef16a3154 100644
--- a/src/gtk-style-hc.css
+++ b/src/gtk-style-hc.css
@@ -200,19 +200,15 @@ button.star, .button.star {
}
/* for the review dialog */
-.star-enabled {
- color: #000000;
-}
-.star-disabled {
- color: #777777;
-}
-
-/* for the app details shell */
+.star-enabled,
.star-enabled:disabled {
color: #000000;
+ -GsStarImage-star-bg: #777777;
}
+.star-disabled,
.star-disabled:disabled {
- color: #777777;
+ color: #000000;
+ -GsStarImage-star-bg: #777777;
}
.counter-label {
diff --git a/src/gtk-style.css b/src/gtk-style.css
index 474199718..f4a062560 100644
--- a/src/gtk-style.css
+++ b/src/gtk-style.css
@@ -475,11 +475,13 @@ flowboxchild {
/* for the review dialog */
.star-enabled,
.star-enabled:disabled {
- color: shade(@theme_fg_color, 0.8);
+ color: #e5a50a;
+ -GsStarImage-star-bg: #deddda;
}
.star-disabled,
.star-disabled:disabled {
- color: @unfocused_insensitive_color;
+ color: #e5a50a;
+ -GsStarImage-star-bg: #deddda;
}
.counter-label {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]