From 131691156a4613ae87fb6b702bf7803b7919af7c Mon Sep 17 00:00:00 2001 From: deepend Date: Thu, 22 Jan 2026 23:55:49 -0700 Subject: [PATCH] Updated notify tree cell rendering to use the palette foreground property while preserving GTK2/GTK3 color cleanup logic. Reused the palette foreground property macro for user list and DCC text renderers to match RGBA usage in GTK3 while keeping GTK2 behavior intact. Aligned GTK2 setup color callbacks with PaletteColor and ensured RGBA parsing initialization in the palette helper. --- src/fe-gtk/dccgui.c | 6 +----- src/fe-gtk/notifygui.c | 7 ++++--- src/fe-gtk/palette.c | 2 +- src/fe-gtk/setup.c | 4 ++-- src/fe-gtk/userlistgui.c | 6 +----- 5 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/fe-gtk/dccgui.c b/src/fe-gtk/dccgui.c index cbe587a9..9604cb09 100644 --- a/src/fe-gtk/dccgui.c +++ b/src/fe-gtk/dccgui.c @@ -731,11 +731,7 @@ static void dcc_add_column (GtkWidget *tree, int textcol, int colorcol, char *title, gboolean right_justified) { GtkCellRenderer *renderer; -#if GTK_CHECK_VERSION(3,0,0) - const char *foreground_property = "foreground-rgba"; -#else - const char *foreground_property = "foreground-gdk"; -#endif + const char *foreground_property = PALETTE_FOREGROUND_PROPERTY; renderer = gtk_cell_renderer_text_new (); if (right_justified) diff --git a/src/fe-gtk/notifygui.c b/src/fe-gtk/notifygui.c index d1e39c45..ef31e895 100644 --- a/src/fe-gtk/notifygui.c +++ b/src/fe-gtk/notifygui.c @@ -78,13 +78,14 @@ notify_treecell_property_mapper (GtkTreeViewColumn *col, GtkCellRenderer *cell, gtk_tree_model_get (GTK_TREE_MODEL (model), iter, COLOUR_COLUMN, &colour, model_column, &text, -1); - g_object_set (G_OBJECT (cell), "text", text, NULL); #if GTK_CHECK_VERSION(3,0,0) - g_object_set (G_OBJECT (cell), "foreground-rgba", colour, NULL); + g_object_set (G_OBJECT (cell), "text", text, + PALETTE_FOREGROUND_PROPERTY, colour, NULL); if (colour) gdk_rgba_free (colour); #else - g_object_set (G_OBJECT (cell), "foreground-gdk", colour, NULL); + g_object_set (G_OBJECT (cell), "text", text, + PALETTE_FOREGROUND_PROPERTY, colour, NULL); if (colour) gdk_color_free (colour); #endif diff --git a/src/fe-gtk/palette.c b/src/fe-gtk/palette.c index 245a3f66..d07e05d8 100644 --- a/src/fe-gtk/palette.c +++ b/src/fe-gtk/palette.c @@ -51,7 +51,7 @@ palette_color_set_rgb16 (PaletteColor *color, guint16 red, guint16 green, guint1 g_snprintf (color_string, sizeof (color_string), "#%04x%04x%04x", red, green, blue); #if GTK_CHECK_VERSION(3,0,0) - GdkRGBA parsed; + GdkRGBA parsed = { 0 }; gboolean parsed_ok; parsed_ok = gdk_rgba_parse (&parsed, color_string); diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index f22e4b40..1bc484c8 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -1578,7 +1578,7 @@ static void setup_color_ok_cb (GtkWidget *button, GtkWidget *dialog) { GtkColorSelectionDialog *cdialog = GTK_COLOR_SELECTION_DIALOG (dialog); - GdkColor *col; + PaletteColor *col; col = g_object_get_data (G_OBJECT (button), "c"); button = g_object_get_data (G_OBJECT (button), "b"); @@ -1629,7 +1629,7 @@ setup_color_cb (GtkWidget *button, gpointer userdata) #else GtkWidget *dialog, *cancel_button, *ok_button, *help_button; GtkColorSelectionDialog *cdialog; - GdkColor *color; + PaletteColor *color; color = &colors[GPOINTER_TO_INT (userdata)]; diff --git a/src/fe-gtk/userlistgui.c b/src/fe-gtk/userlistgui.c index 25ccd8b6..14a93986 100644 --- a/src/fe-gtk/userlistgui.c +++ b/src/fe-gtk/userlistgui.c @@ -533,11 +533,7 @@ static void userlist_add_columns (GtkTreeView * treeview) { GtkCellRenderer *renderer; -#if GTK_CHECK_VERSION(3,0,0) - const char *foreground_property = "foreground-rgba"; -#else - const char *foreground_property = "foreground-gdk"; -#endif + const char *foreground_property = PALETTE_FOREGROUND_PROPERTY; /* icon column */ renderer = gtk_cell_renderer_pixbuf_new ();