Bug 798202 - Register editor Black on Black background

The GtkEntry of the register editor was not having the appropriate
style class gnc-class-register-cursor or gnc-class-user-register-cursor
applied resulting in black text on a black background when the theme
"Breeze Dark" was used.

To fix this, in function gnucash_sheet_refresh_from_prefs add setting
the appropriate style classes for the entry after first removing the
existing "gnc-class-" classes.
This commit is contained in:
Robert Fewell 2021-06-10 11:32:30 +01:00
parent 321b5efabc
commit 9546c0587f

View File

@ -1549,6 +1549,10 @@ gnucash_sheet_button_press_event (GtkWidget *widget, GdkEventButton *event)
void
gnucash_sheet_refresh_from_prefs (GnucashSheet *sheet)
{
GtkStyleContext *stylectxt;
GncItemEdit *item_edit;
GList *classes = NULL;
g_return_if_fail (sheet != NULL);
g_return_if_fail (GNUCASH_IS_SHEET(sheet));
@ -1558,6 +1562,26 @@ gnucash_sheet_refresh_from_prefs (GnucashSheet *sheet)
GNC_PREF_DRAW_HOR_LINES);
sheet->use_vertical_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
GNC_PREF_DRAW_VERT_LINES);
item_edit = GNC_ITEM_EDIT(sheet->item_editor);
stylectxt = gtk_widget_get_style_context (GTK_WIDGET(item_edit->editor));
// Get the CSS classes for the editor
classes = gtk_style_context_list_classes (stylectxt);
for (GList *l = classes; l; l = l->next)
{
if (g_str_has_prefix (l->data, "gnc-class-"))
gtk_style_context_remove_class (stylectxt, l->data);
}
g_list_free (classes);
gtk_style_context_remove_class (stylectxt, GTK_STYLE_CLASS_VIEW);
// Note: COLOR_PRIMARY_ACTIVE, COLOR_SECONDARY_ACTIVE, COLOR_SPLIT_ACTIVE
// all equate to *-cursor style class used for the editor
gnucash_get_style_classes (sheet, stylectxt, COLOR_PRIMARY_ACTIVE, FALSE);
}
static gboolean