[gnome-software: 8/12] gs-feature-tile: Recalculate background colour when style changes
- From: Phaedrus Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 8/12] gs-feature-tile: Recalculate background colour when style changes
- Date: Sat, 6 Mar 2021 05:32:15 +0000 (UTC)
commit 72af751beb14998d206b9c5c937ab4f2b5d4724c
Author: Philip Withnall <pwithnall endlessos org>
Date: Tue Feb 23 15:28:33 2021 +0000
gs-feature-tile: Recalculate background colour when style changes
This will happen if the user changes the desktop theme while a feature
tile is visible. That’s expected to be rare, but possible. More
typically, this will happen when a developer is testing gnome-software
with `GTK_DEBUG=interactive` and they toggle dark mode on/off. Useful
for testing.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
Helps: #1148
src/gs-feature-tile.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
---
diff --git a/src/gs-feature-tile.c b/src/gs-feature-tile.c
index b473ceb35..8c137c266 100644
--- a/src/gs-feature-tile.c
+++ b/src/gs-feature-tile.c
@@ -388,6 +388,19 @@ gs_feature_tile_direction_changed (GtkWidget *widget, GtkTextDirection previous_
gs_feature_tile_refresh (GS_APP_TILE (tile));
}
+static void
+gs_feature_tile_style_updated (GtkWidget *widget)
+{
+ GsFeatureTile *tile = GS_FEATURE_TILE (widget);
+
+ /* Clear the key colours cache, as the tile background colour will
+ * potentially need recalculating if the widget’s foreground colour has
+ * changed. */
+ tile->key_colors_cache = NULL;
+
+ gs_feature_tile_refresh (GS_APP_TILE (tile));
+}
+
static void
gs_feature_tile_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
@@ -424,6 +437,7 @@ gs_feature_tile_class_init (GsFeatureTileClass *klass)
object_class->dispose = gs_feature_tile_dispose;
widget_class->direction_changed = gs_feature_tile_direction_changed;
+ widget_class->style_updated = gs_feature_tile_style_updated;
widget_class->size_allocate = gs_feature_tile_size_allocate;
app_tile_class->refresh = gs_feature_tile_refresh;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]