|
|
0e7fe2 |
From 3a644c151f27f439c36170f0958fd21cf1cc54d0 Mon Sep 17 00:00:00 2001
|
|
|
0e7fe2 |
From: Milan Crha <mcrha@redhat.com>
|
|
|
0e7fe2 |
Date: Thu, 3 Jun 2021 08:33:53 +0200
|
|
|
0e7fe2 |
Subject: [PATCH] gs-feature-tile: Do not abort when the theme is broken
|
|
|
0e7fe2 |
|
|
|
0e7fe2 |
Just print a warning when the theme doesn't provide 'theme_fg_color' and
|
|
|
0e7fe2 |
fallback to black color.
|
|
|
0e7fe2 |
|
|
|
0e7fe2 |
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1228
|
|
|
0e7fe2 |
---
|
|
|
0e7fe2 |
src/gs-feature-tile.c | 14 +++++++++++---
|
|
|
0e7fe2 |
1 file changed, 11 insertions(+), 3 deletions(-)
|
|
|
0e7fe2 |
|
|
|
0e7fe2 |
diff --git a/src/gs-feature-tile.c b/src/gs-feature-tile.c
|
|
|
0e7fe2 |
index 1c85083eb..158af1e56 100644
|
|
|
0e7fe2 |
--- a/src/gs-feature-tile.c
|
|
|
0e7fe2 |
+++ b/src/gs-feature-tile.c
|
|
|
0e7fe2 |
@@ -268,7 +268,6 @@ gs_feature_tile_refresh (GsAppTile *self)
|
|
|
0e7fe2 |
if (key_colors != tile->key_colors_cache) {
|
|
|
0e7fe2 |
g_autoptr(GArray) colors = NULL;
|
|
|
0e7fe2 |
GdkRGBA fg_rgba;
|
|
|
0e7fe2 |
- gboolean fg_rgba_valid;
|
|
|
0e7fe2 |
GsHSBC fg_hsbc;
|
|
|
0e7fe2 |
|
|
|
0e7fe2 |
/* Look up the foreground colour for the feature tile,
|
|
|
0e7fe2 |
@@ -283,8 +282,17 @@ gs_feature_tile_refresh (GsAppTile *self)
|
|
|
0e7fe2 |
* @min_abs_contrast contrast with the foreground, so
|
|
|
0e7fe2 |
* that the text is legible.
|
|
|
0e7fe2 |
*/
|
|
|
0e7fe2 |
- fg_rgba_valid = gtk_style_context_lookup_color (context, "theme_fg_color", &fg_rgba);
|
|
|
0e7fe2 |
- g_assert (fg_rgba_valid);
|
|
|
0e7fe2 |
+ if (!gtk_style_context_lookup_color (context, "theme_fg_color", &fg_rgba)) {
|
|
|
0e7fe2 |
+ static gboolean i_know = FALSE;
|
|
|
0e7fe2 |
+ if (!i_know) {
|
|
|
0e7fe2 |
+ i_know = TRUE;
|
|
|
0e7fe2 |
+ g_warning ("The theme doesn't provide 'theme_fg_color', fallbacking to black");
|
|
|
0e7fe2 |
+ }
|
|
|
0e7fe2 |
+ fg_rgba.red = 0.0;
|
|
|
0e7fe2 |
+ fg_rgba.green = 0.0;
|
|
|
0e7fe2 |
+ fg_rgba.blue = 0.0;
|
|
|
0e7fe2 |
+ fg_rgba.alpha = 1.0;
|
|
|
0e7fe2 |
+ }
|
|
|
0e7fe2 |
|
|
|
0e7fe2 |
gtk_rgb_to_hsv (fg_rgba.red, fg_rgba.green, fg_rgba.blue,
|
|
|
0e7fe2 |
&fg_hsbc.hue, &fg_hsbc.saturation, &fg_hsbc.brightness);
|
|
|
0e7fe2 |
--
|
|
|
0e7fe2 |
GitLab
|
|
|
0e7fe2 |
|