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.
This commit is contained in:
2026-01-22 23:55:49 -07:00
parent 864bf5e059
commit 131691156a
5 changed files with 9 additions and 16 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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);

View File

@@ -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)];

View File

@@ -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 ();