[gimp] app: make sure the icon size and button relief are updated when changing theme.



commit dfbaf4d501d2699c86763964f72ce17b6dc54003
Author: Jehan <jehan girinstud io>
Date:   Mon Sep 26 21:06:58 2022 +0200

    app: make sure the icon size and button relief are updated when changing theme.
    
    When changing the theme, the style-updated signal is *usually* run, but not
    always. For instance, moving from a theme with big icons to one with smaller
    icons (or the other way around) sometimes work, and sometimes doesn't. I'm not
    sure if it's to be considered a bug in GTK or if this signal depends on other
    things. Anyway we have our own "theme" signal on the GimpGuiConfig and we know
    exactly that we need to make sure that the icons are properly redrawn in such a
    case. So let's just connect to this signal.

 app/widgets/gimptoolpalette.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/app/widgets/gimptoolpalette.c b/app/widgets/gimptoolpalette.c
index 7b04da2043..6d7f8032cc 100644
--- a/app/widgets/gimptoolpalette.c
+++ b/app/widgets/gimptoolpalette.c
@@ -78,6 +78,10 @@ static void     gimp_tool_palette_height_for_width    (GtkWidget       *widget,
                                                        gint            *pref_height);
 static void     gimp_tool_palette_style_updated       (GtkWidget       *widget);
 
+static void     gimp_tool_palette_notify_theme        (GimpGuiConfig   *config,
+                                                       GParamSpec      *pspec,
+                                                       GimpToolPalette *palette);
+
 static void     gimp_tool_palette_tool_add            (GimpContainer   *container,
                                                        GimpToolItem    *tool_item,
                                                        GimpToolPalette *palette);
@@ -298,6 +302,14 @@ gimp_tool_palette_style_updated (GtkWidget *widget)
   gimp_dock_invalidate_geometry (GIMP_DOCK (private->toolbox));
 }
 
+static void
+gimp_tool_palette_notify_theme (GimpGuiConfig   *config,
+                                GParamSpec      *pspec,
+                                GimpToolPalette *palette)
+{
+  gimp_tool_palette_style_updated (GTK_WIDGET (palette));
+}
+
 
 /*  public functions  */
 
@@ -348,6 +360,11 @@ gimp_tool_palette_set_toolbox (GimpToolPalette *palette,
   g_signal_connect_object (context->gimp->tool_item_ui_list, "reorder",
                            G_CALLBACK (gimp_tool_palette_tool_reorder),
                            palette, 0);
+
+  g_signal_connect_after (GIMP_GUI_CONFIG (context->gimp->config),
+                          "notify::theme",
+                          G_CALLBACK (gimp_tool_palette_notify_theme),
+                          palette);
 }
 
 gboolean


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