diff --git a/src/fe-gtk/dccgui.c b/src/fe-gtk/dccgui.c index 98ad2e1f..b37a777d 100644 --- a/src/fe-gtk/dccgui.c +++ b/src/fe-gtk/dccgui.c @@ -730,11 +730,7 @@ dcc_add_column (GtkWidget *tree, int textcol, int colorcol, char *title, gboolea if (right_justified) g_object_set (G_OBJECT (renderer), "xalign", (float) 1.0, NULL); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree), -1, title, renderer, -#if GTK_CHECK_VERSION(3,0,0) - "text", textcol, "foreground-rgba", colorcol, -#else - "text", textcol, "foreground-gdk", colorcol, -#endif + "text", textcol, PALETTE_FOREGROUND_PROPERTY, colorcol, NULL); 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 8c021217..92b88c84 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 e1b188ec..2eecb7c6 100644 --- a/src/fe-gtk/palette.c +++ b/src/fe-gtk/palette.c @@ -248,21 +248,7 @@ palette_dark_set_color (int idx, const PaletteColor *col) void palette_alloc (GtkWidget * widget) { -#if GTK_CHECK_VERSION(3,0,0) (void) widget; -#else - int i; - static int done_alloc = FALSE; - GdkColormap *cmap; - - if (!done_alloc) /* don't do it again */ - { - done_alloc = TRUE; - cmap = gtk_widget_get_colormap (widget); - for (i = MAX_COL; i >= 0; i--) - gdk_colormap_alloc_color (cmap, &colors[i], FALSE, TRUE); - } -#endif } void @@ -473,15 +459,7 @@ palette_apply_dark_mode (gboolean enable) memcpy (colors, user_colors, sizeof (colors)); /* Allocate the new colors for GTK's colormap. */ -#if !GTK_CHECK_VERSION(3,0,0) - { - GdkColormap *cmap; - - cmap = gdk_colormap_get_system (); - for (i = 0; i <= MAX_COL; i++) - gdk_colormap_alloc_color (cmap, &colors[i], FALSE, TRUE); - } -#endif + (void) i; for (i = 0; i <= MAX_COL; i++) { diff --git a/src/fe-gtk/palette.h b/src/fe-gtk/palette.h index 1dbb66cf..80b7860d 100644 --- a/src/fe-gtk/palette.h +++ b/src/fe-gtk/palette.h @@ -27,9 +27,11 @@ #if GTK_CHECK_VERSION(3,0,0) typedef GdkRGBA PaletteColor; #define PALETTE_GDK_TYPE GDK_TYPE_RGBA +#define PALETTE_FOREGROUND_PROPERTY "foreground-rgba" #else typedef GdkColor PaletteColor; #define PALETTE_GDK_TYPE GDK_TYPE_COLOR +#define PALETTE_FOREGROUND_PROPERTY "foreground-gdk" #endif extern PaletteColor colors[]; diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index 439615c0..0a2f37f6 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -1559,9 +1559,7 @@ setup_color_ok_cb (GtkWidget *button, GtkWidget *dialog) { GtkColorSelectionDialog *cdialog = GTK_COLOR_SELECTION_DIALOG (dialog); GdkColor *col; - GdkColor old_color; col = g_object_get_data (G_OBJECT (button), "c"); - old_color = *col; button = g_object_get_data (G_OBJECT (button), "b"); @@ -1575,17 +1573,8 @@ setup_color_ok_cb (GtkWidget *button, GtkWidget *dialog) gtk_color_selection_get_current_color (GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (cdialog)), col); -#if !GTK_CHECK_VERSION(3,0,0) - gdk_colormap_alloc_color (gtk_widget_get_colormap (button), col, TRUE, TRUE); -#endif - setup_color_button_apply (button, col); - /* is this line correct?? */ -#if !GTK_CHECK_VERSION(3,0,0) - gdk_colormap_free_colors (gtk_widget_get_colormap (button), &old_color, 1); -#endif - /* Persist custom colors for the palette the user is editing. */ if (fe_dark_mode_is_enabled_for (setup_prefs.hex_gui_dark_mode)) palette_dark_set_color ((int)(col - colors), col); diff --git a/src/fe-gtk/userlistgui.c b/src/fe-gtk/userlistgui.c index b34fc3bb..3515cd35 100644 --- a/src/fe-gtk/userlistgui.c +++ b/src/fe-gtk/userlistgui.c @@ -528,11 +528,7 @@ userlist_add_columns (GtkTreeView * treeview) gtk_cell_renderer_text_set_fixed_height_from_font (GTK_CELL_RENDERER_TEXT (renderer), 1); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), -1, NULL, renderer, -#if GTK_CHECK_VERSION(3,0,0) - "text", 1, "foreground-rgba", 4, NULL); -#else - "text", 1, "foreground-gdk", 4, NULL); -#endif + "text", 1, PALETTE_FOREGROUND_PROPERTY, 4, NULL); if (prefs.hex_gui_ulist_show_hosts) {