gnucash maint: Bug 798202 - Register editor Black on Black background

Robert Fewell bobit at code.gnucash.org
Thu Jun 10 06:33:37 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/9546c058 (commit)
	from  https://github.com/Gnucash/gnucash/commit/321b5efa (commit)



commit 9546c0587f3d9fe14c0e1a4d5dc8b61ba5db1362
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Thu Jun 10 11:32:30 2021 +0100

    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.

diff --git a/gnucash/register/register-gnome/gnucash-sheet.c b/gnucash/register/register-gnome/gnucash-sheet.c
index 1cd995cda..54d32ba61 100644
--- a/gnucash/register/register-gnome/gnucash-sheet.c
+++ b/gnucash/register/register-gnome/gnucash-sheet.c
@@ -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



Summary of changes:
 gnucash/register/register-gnome/gnucash-sheet.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)



More information about the gnucash-changes mailing list