diff --git a/src/fe-gtk/dccgui.c b/src/fe-gtk/dccgui.c index cbf4e697..59a77373 100644 --- a/src/fe-gtk/dccgui.c +++ b/src/fe-gtk/dccgui.c @@ -735,15 +735,9 @@ dcc_add_column (GtkWidget *tree, int textcol, int colorcol, char *title, gboolea renderer = gtk_cell_renderer_text_new (); if (right_justified) g_object_set (G_OBJECT (renderer), "xalign", (float) 1.0, NULL); -#if GTK_CHECK_VERSION(3,0,0) gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree), -1, title, renderer, - "text", textcol, "foreground-rgba", colorcol, + "text", textcol, PALETTE_FOREGROUND_PROPERTY, colorcol, NULL); -#else - gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree), -1, title, renderer, - "text", textcol, "foreground-gdk", colorcol, - NULL); -#endif gtk_cell_renderer_text_set_fixed_height_from_font (GTK_CELL_RENDERER_TEXT (renderer), 1); } diff --git a/src/fe-gtk/notifygui.c b/src/fe-gtk/notifygui.c index b7d8b86f..c036b210 100644 --- a/src/fe-gtk/notifygui.c +++ b/src/fe-gtk/notifygui.c @@ -79,11 +79,7 @@ notify_treecell_property_mapper (GtkTreeViewColumn *col, GtkCellRenderer *cell, 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); -#else - g_object_set (G_OBJECT (cell), "foreground-gdk", colour, NULL); -#endif + g_object_set (G_OBJECT (cell), PALETTE_FOREGROUND_PROPERTY, colour, NULL); g_free (text); } diff --git a/src/fe-gtk/palette.c b/src/fe-gtk/palette.c index de94be44..3365ed8f 100644 --- a/src/fe-gtk/palette.c +++ b/src/fe-gtk/palette.c @@ -48,12 +48,13 @@ static void palette_color_set_rgb16 (PaletteColor *color, guint16 red, guint16 green, guint16 blue) { #if GTK_CHECK_VERSION(3,0,0) - char buf[8]; GdkRGBA parsed; gboolean parsed_ok; + char *color_string; - g_snprintf (buf, sizeof (buf), "#%02x%02x%02x", red >> 8, green >> 8, blue >> 8); - parsed_ok = gdk_rgba_parse (&parsed, buf); + color_string = g_strdup_printf ("#%02x%02x%02x", red >> 8, green >> 8, blue >> 8); + parsed_ok = gdk_rgba_parse (&parsed, color_string); + g_free (color_string); if (!parsed_ok) { parsed.red = red / 65535.0; diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index 9ebb6ea2..a3924dc7 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -2543,16 +2543,15 @@ setup_apply_to_sess (session_gui *gui) if (prefs.hex_gui_input_style) { #if GTK_CHECK_VERSION(3,0,0) - guint8 red = (guint8) CLAMP (colors[COL_FG].red * 255.0 + 0.5, 0.0, 255.0); - guint8 green = (guint8) CLAMP (colors[COL_FG].green * 255.0 + 0.5, 0.0, 255.0); - guint8 blue = (guint8) CLAMP (colors[COL_FG].blue * 255.0 + 0.5, 0.0, 255.0); char buf[128]; GtkCssProvider *provider = gtk_css_provider_new (); GtkStyleContext *context; + char *color_string = gdk_rgba_to_string (&colors[COL_FG]); - g_snprintf (buf, sizeof (buf), ".zoitechat-inputbox { caret-color: #%02x%02x%02x; }", - red, green, blue); + g_snprintf (buf, sizeof (buf), ".zoitechat-inputbox { caret-color: %s; }", + color_string); gtk_css_provider_load_from_data (provider, buf, -1, NULL); + g_free (color_string); context = gtk_widget_get_style_context (gui->input_box); gtk_style_context_add_provider (context, GTK_STYLE_PROVIDER (provider), diff --git a/src/fe-gtk/userlistgui.c b/src/fe-gtk/userlistgui.c index 76a9bef9..7676dc34 100644 --- a/src/fe-gtk/userlistgui.c +++ b/src/fe-gtk/userlistgui.c @@ -547,15 +547,9 @@ userlist_add_columns (GtkTreeView * treeview) if (prefs.hex_gui_compact) g_object_set (G_OBJECT (renderer), "ypad", 0, NULL); gtk_cell_renderer_text_set_fixed_height_from_font (GTK_CELL_RENDERER_TEXT (renderer), 1); -#if GTK_CHECK_VERSION(3,0,0) gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), -1, NULL, renderer, - "text", 1, "foreground-rgba", 4, NULL); -#else - gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), - -1, NULL, renderer, - "text", 1, "foreground-gdk", 4, NULL); -#endif + "text", 1, PALETTE_FOREGROUND_PROPERTY, 4, NULL); if (prefs.hex_gui_ulist_show_hosts) {