gnucash master: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Thu Aug 31 04:17:00 EDT 2017


Updated	 via  https://github.com/Gnucash/gnucash/commit/74b6ef8a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/7ee32294 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/13505576 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/64563cae (commit)
	 via  https://github.com/Gnucash/gnucash/commit/08d7830f (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a9cc488c (commit)
	 via  https://github.com/Gnucash/gnucash/commit/048b8e37 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/b81a4a55 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/659d3b95 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d3e6a9c5 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/da9a57ee (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f7a4fa6f (commit)
	 via  https://github.com/Gnucash/gnucash/commit/efaa7dbb (commit)
	 via  https://github.com/Gnucash/gnucash/commit/4cdae248 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3a04e8b9 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/94d538d2 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/1051847e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/e8f8e561 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d4a248a2 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/2c5e2f7a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/cdfdfb48 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/ffe9a23c (commit)
	 via  https://github.com/Gnucash/gnucash/commit/908e3f3f (commit)
	 via  https://github.com/Gnucash/gnucash/commit/e18d56df (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3be45364 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/94841d9e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f034fd64 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/24751931 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/501671dc (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f7556b60 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/ec8e52e8 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/16a42799 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/404214b7 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/8d8073aa (commit)
	from  https://github.com/Gnucash/gnucash/commit/a670783e (commit)



commit 74b6ef8ab359c9a15f7556343693ae48c56949c9
Merge: 7ee3229 a9cc488
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Thu Aug 31 10:10:45 2017 +0200

    Merge branch 'kvpvaltostring' of https://github.com/limitedAtonement/gnucash


commit 7ee322942e0910e7ea2de1467f7d3eeda27c031a
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Thu Aug 31 10:03:55 2017 +0200

    Detail what is meant with a dark theme

diff --git a/gnucash/gnome-utils/gnc-gtk-utils.c b/gnucash/gnome-utils/gnc-gtk-utils.c
index 4b188b0..95586ea 100644
--- a/gnucash/gnome-utils/gnc-gtk-utils.c
+++ b/gnucash/gnome-utils/gnc-gtk-utils.c
@@ -224,10 +224,14 @@ gnc_cbwe_require_list_item (GtkComboBox *cbwe)
     g_object_set_data(G_OBJECT(cbwe), CHANGED_ID, GINT_TO_POINTER(id));
 }
 
-/** Test to see if fg_color is a light one which should be a foreground
- *  one and hence would be on a dark background
+/** Return whether the current gtk theme is a dark one. A theme is considered "dark" if
+ *  it has a dark background color with a light foreground color (used for text and so on).
+ *  We only test on the foregrond color assuming a sane theme chooses enough contrast between
+ *  foreground and background colors.
  *
  *  @param fg_color The foreground color to test.
+ *
+ *  @returns TRUE if the theme is considered dark, FALSE otherwise.
  */
 gboolean
 gnc_is_dark_theme (GdkRGBA *fg_color)

commit 135055764bd0f81765618e6d11c06fc83947678d
Merge: a670783 64563ca
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Thu Aug 31 09:56:22 2017 +0200

    Merge branch 'gtk3-update5' of https://github.com/Bob-IT/gnucash


commit 64563cae5070df7ec4056b08b17bd50362290c85
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Aug 30 11:20:47 2017 +0100

    Move another couple of functions used more than once to gnc-gtk-utils

diff --git a/gnucash/gnome-utils/gnc-dense-cal.c b/gnucash/gnome-utils/gnc-dense-cal.c
index f0cd3c2..befb37d 100644
--- a/gnucash/gnome-utils/gnc-dense-cal.c
+++ b/gnucash/gnome-utils/gnc-dense-cal.c
@@ -889,41 +889,6 @@ gnc_dense_cal_draw(GtkWidget *widget, cairo_t *cr, gpointer user_data)
 #define LOG_AND_RESET(timer, msg) do { g_debug("%s: %f", msg, g_timer_elapsed(timer, NULL) * 1000.); g_timer_reset(timer); } while (0);
 
 static void
-gnc_style_context_get_background_color (GtkStyleContext *context,
-                                        GtkStateFlags    state,
-                                        GdkRGBA         *color)
-{
-    GdkRGBA *c;
-
-    g_return_if_fail (color != NULL);
-    g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
-
-    gtk_style_context_get (context,
-                           state,
-                           GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &c,
-                           NULL);
-    *color = *c;
-    gdk_rgba_free (c);
-}
-
-static void
-gnc_style_context_get_border_color (GtkStyleContext *context,
-                                    GtkStateFlags    state,
-                                    GdkRGBA         *color)
-{
-    GdkRGBA *c;
-
-    g_return_if_fail (color != NULL);
-    g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
-
-    gtk_style_context_get (context,
-                           state,
-                           GTK_STYLE_PROPERTY_BORDER_COLOR, &c,
-                           NULL);
-    *color = *c;
-    gdk_rgba_free (c);
-}
-
 gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
 {
     GtkWidget *widget;
diff --git a/gnucash/gnome-utils/gnc-gtk-utils.c b/gnucash/gnome-utils/gnc-gtk-utils.c
index 4db6e79..4b188b0 100644
--- a/gnucash/gnome-utils/gnc-gtk-utils.c
+++ b/gnucash/gnome-utils/gnc-gtk-utils.c
@@ -242,3 +242,55 @@ gnc_is_dark_theme (GdkRGBA *fg_color)
 
     return is_dark;
 }
+
+/** Wrapper to get the background color of a widget for a given state
+ *
+ *  @param context Style context of widget.
+ *
+ *  @param state The stateflag of the widget.
+ *
+ *  @param color The returned background color of the widget.
+ */
+void
+gnc_style_context_get_background_color (GtkStyleContext *context,
+                                        GtkStateFlags    state,
+                                        GdkRGBA         *color)
+{
+    GdkRGBA *c;
+
+    g_return_if_fail (color != NULL);
+    g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
+
+    gtk_style_context_get (context,
+                           state,
+                           GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &c,
+                           NULL);
+    *color = *c;
+    gdk_rgba_free (c);
+}
+
+/** Wrapper to get the border color of a widget for a given state
+ *
+ *  @param context Style context of widget.
+ *
+ *  @param state The stateflag of the widget.
+ *
+ *  @param color The returned border color of the widget.
+ */
+void
+gnc_style_context_get_border_color (GtkStyleContext *context,
+                                    GtkStateFlags    state,
+                                    GdkRGBA         *color)
+{
+    GdkRGBA *c;
+
+    g_return_if_fail (color != NULL);
+    g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
+
+    gtk_style_context_get (context,
+                           state,
+                           GTK_STYLE_PROPERTY_BORDER_COLOR, &c,
+                           NULL);
+    *color = *c;
+    gdk_rgba_free (c);
+}
diff --git a/gnucash/gnome-utils/gnc-gtk-utils.h b/gnucash/gnome-utils/gnc-gtk-utils.h
index d75b9cb..6651f76 100644
--- a/gnucash/gnome-utils/gnc-gtk-utils.h
+++ b/gnucash/gnome-utils/gnc-gtk-utils.h
@@ -46,6 +46,13 @@ void gnc_cbwe_add_completion (GtkComboBox *cbwe);
 void gnc_cbwe_require_list_item (GtkComboBox *cbwe);
 
 gboolean gnc_is_dark_theme (GdkRGBA *fg_color);
+void gnc_style_context_get_background_color (GtkStyleContext *context,
+                                             GtkStateFlags    state,
+                                             GdkRGBA         *color);
+void gnc_style_context_get_border_color (GtkStyleContext *context,
+                                         GtkStateFlags    state,
+                                         GdkRGBA         *color);
+
 /** @} */
 
 #endif /* GNC_GTK_UTILS_H */
diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index 6bed9cc..f0908ea 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -671,24 +671,6 @@ gboolean gnc_gen_trans_list_run (GNCImportMainMatcher *info)
     return result;
 }
 
-static void
-gnc_style_context_get_background_color (GtkStyleContext *context,
-                                        GtkStateFlags    state,
-                                        GdkRGBA         *color)
-{
-    GdkRGBA *c;
-
-    g_return_if_fail (color != NULL);
-    g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
-
-    gtk_style_context_get (context,
-                           state,
-                           GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &c,
-                           NULL);
-    *color = *c;
-    gdk_rgba_free (c);
-}
-
 static gchar*
 get_required_color (const gchar *class_name)
 {
diff --git a/gnucash/register/register-gnome/gnucash-sheet.c b/gnucash/register/register-gnome/gnucash-sheet.c
index d0cdb46..258e88c 100644
--- a/gnucash/register/register-gnome/gnucash-sheet.c
+++ b/gnucash/register/register-gnome/gnucash-sheet.c
@@ -37,6 +37,7 @@
 #include "gnucash-sheetP.h"
 
 #include "dialog-utils.h"
+#include "gnc-gtk-utils.h"
 #include "gnc-prefs.h"
 #include "gnucash-color.h"
 #include "gnucash-cursor.h"
@@ -2330,25 +2331,6 @@ gnucash_sheet_realize_entry (GnucashSheet *sheet, GtkWidget *entry)
  * the register is rewritten.
  */
 
-static void
-gnc_style_context_get_background_color (GtkStyleContext *context,
-                                        GtkStateFlags    state,
-                                        GdkRGBA         *color)
-{
-    GdkRGBA *c;
-
-    g_return_if_fail (color != NULL);
-    g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
-
-    gtk_style_context_get (context,
-                           state,
-                           GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &c,
-                           NULL);
-    *color = *c;
-    gdk_rgba_free (c);
-}
-
-
 /** Map a cell type to a gtkrc specified color. */
 GdkRGBA *
 get_gtkrc_color (GnucashSheet *sheet,

commit 08d7830f7b51ffeea7513adeae6aecf66c381847
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Aug 30 11:13:26 2017 +0100

    Move function is_color_light to gnc-gtk-utils and rename
    
    Move is_color_light and rename to gnc_is_dark_theme and update required
    files where used.

diff --git a/gnucash/gnome-utils/gnc-dense-cal.c b/gnucash/gnome-utils/gnc-dense-cal.c
index 330eb04..f0cd3c2 100644
--- a/gnucash/gnome-utils/gnc-dense-cal.c
+++ b/gnucash/gnome-utils/gnc-dense-cal.c
@@ -25,6 +25,7 @@
 #include "gnc-dense-cal.h"
 #include "gnc-dense-cal-model.h"
 #include "gnc-engine.h"
+#include "gnc-gtk-utils.h"
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
@@ -923,21 +924,6 @@ gnc_style_context_get_border_color (GtkStyleContext *context,
     gdk_rgba_free (c);
 }
 
-static gboolean
-is_color_light (GdkRGBA *color)
-{
-    gboolean is_light = FALSE;
-
-    // Counting the perceptive luminance - human eye favors green color...
-    double a = (0.299 * color->red + 0.587 * color->green + 0.114 * color->blue);
-
-    if (a > 0.5)
-        is_light = TRUE;
-
-    return is_light;
-}
-
-static void
 gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
 {
     GtkWidget *widget;
@@ -980,7 +966,7 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
 
          gtk_style_context_get_color (stylectxt, GTK_STATE_FLAG_NORMAL, &color);
 
-          if (is_color_light (&color))
+          if (gnc_is_dark_theme (&color))
               class_extension = "-dark";
 
           primary_color_class = g_strconcat ("primary", class_extension, NULL);
diff --git a/gnucash/gnome-utils/gnc-gtk-utils.c b/gnucash/gnome-utils/gnc-gtk-utils.c
index 4dc971e..4db6e79 100644
--- a/gnucash/gnome-utils/gnc-gtk-utils.c
+++ b/gnucash/gnome-utils/gnc-gtk-utils.c
@@ -223,3 +223,22 @@ gnc_cbwe_require_list_item (GtkComboBox *cbwe)
 
     g_object_set_data(G_OBJECT(cbwe), CHANGED_ID, GINT_TO_POINTER(id));
 }
+
+/** Test to see if fg_color is a light one which should be a foreground
+ *  one and hence would be on a dark background
+ *
+ *  @param fg_color The foreground color to test.
+ */
+gboolean
+gnc_is_dark_theme (GdkRGBA *fg_color)
+{
+    gboolean is_dark = FALSE;
+
+    // Counting the perceptive luminance - human eye favors green color...
+    double lightness = (0.299 * fg_color->red + 0.587 * fg_color->green + 0.114 * fg_color->blue);
+
+    if (lightness > 0.5)
+        is_dark = TRUE;
+
+    return is_dark;
+}
diff --git a/gnucash/gnome-utils/gnc-gtk-utils.h b/gnucash/gnome-utils/gnc-gtk-utils.h
index d2b0a1a..d75b9cb 100644
--- a/gnucash/gnome-utils/gnc-gtk-utils.h
+++ b/gnucash/gnome-utils/gnc-gtk-utils.h
@@ -45,6 +45,7 @@ void gnc_cbwe_set_by_string(GtkComboBox *cbwe, const gchar *text);
 void gnc_cbwe_add_completion (GtkComboBox *cbwe);
 void gnc_cbwe_require_list_item (GtkComboBox *cbwe);
 
+gboolean gnc_is_dark_theme (GdkRGBA *fg_color);
 /** @} */
 
 #endif /* GNC_GTK_UTILS_H */
diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index 3157242..6bed9cc 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -43,6 +43,7 @@
 #include "gnc-ui.h"
 #include "gnc-ui-util.h"
 #include "gnc-engine.h"
+#include "gnc-gtk-utils.h"
 #include "import-settings.h"
 #include "import-match-picker.h"
 #include "import-backend.h"
@@ -511,19 +512,7 @@ gnc_gen_trans_init_view (GNCImportMainMatcher *info,
                      G_CALLBACK(gnc_gen_trans_row_changed_cb), info);
 }
 
-static gboolean
-is_color_light (GdkRGBA *color)
-{
-    gboolean is_light = FALSE;
-
-    // Counting the perceptive luminance - human eye favors green color...
-    double a = (0.299 * color->red + 0.587 * color->green + 0.114 * color->blue);
 
-    if (a > 0.5)
-        is_light = TRUE;
-
-    return is_light;
-}
 
 GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
         const gchar* heading,
@@ -547,7 +536,7 @@ GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
 
     stylectxt = gtk_widget_get_style_context (GTK_WIDGET(parent));
     gtk_style_context_get_color (stylectxt, GTK_STATE_FLAG_NORMAL, &color);
-    info->dark_theme = is_color_light (&color);
+    info->dark_theme = gnc_is_dark_theme (&color);
 
     /* Initialize the GtkDialog. */
     builder = gtk_builder_new();
@@ -616,7 +605,7 @@ GNCImportMainMatcher * gnc_gen_trans_assist_new (GtkWidget *parent,
 
     stylectxt = gtk_widget_get_style_context (GTK_WIDGET(parent));
     gtk_style_context_get_color (stylectxt, GTK_STATE_FLAG_NORMAL, &color);
-    info->dark_theme = is_color_light (&color);
+    info->dark_theme = gnc_is_dark_theme (&color);
 
     /* load the interface */
     builder = gtk_builder_new();

commit a9cc488cbfe84082abd6075175aecce58e295cd2
Author: lmat <dartme18 at gmail.com>
Date:   Fri Aug 18 17:44:53 2017 -0400

    Should return std::string
    
    This is only used in C++, so there is no need to g_strdup in here. Also,
    this fixes a memory leak in KvpFrameImpl.

diff --git a/libgnucash/backend/xml/test/test-kvp-frames.cpp b/libgnucash/backend/xml/test/test-kvp-frames.cpp
index 1b8e39f..81ab41b 100644
--- a/libgnucash/backend/xml/test/test-kvp-frames.cpp
+++ b/libgnucash/backend/xml/test/test-kvp-frames.cpp
@@ -35,7 +35,7 @@ test_kvp_get_slot (int run,
     {
         gchar* tmp;
         failure_args (msg, __FILE__, __LINE__, "run=%d", run);
-        printf ("    Value is %s\n", test_val2->to_string ());
+        printf ("    Value is %s\n", test_val2->to_string ().c_str ());
     }
 }
 
diff --git a/libgnucash/engine/kvp-value.cpp b/libgnucash/engine/kvp-value.cpp
index 277cca0..55e0e6e 100644
--- a/libgnucash/engine/kvp-value.cpp
+++ b/libgnucash/engine/kvp-value.cpp
@@ -149,16 +149,8 @@ struct to_string_visitor : boost::static_visitor<void>
         /*Since val is passed by value, we can modify it*/
         for (;val; val = val->next)
         {
-            gchar *tmp3;
             auto realvalue = static_cast<const KvpValue *>(val->data);
-            tmp3 = realvalue->to_string();
-            output << ' ';
-            if (tmp3)
-            {
-                output << tmp3;
-                g_free(tmp3);
-            }
-            output << ',';
+            output << ' ' << realvalue->to_string() << ',';
         }
 
         output << " ]";
@@ -207,7 +199,7 @@ struct to_string_visitor : boost::static_visitor<void>
     }
 };
 
-char *
+std::string
 KvpValueImpl::to_string() const noexcept
 {
     std::ostringstream ret;
@@ -215,7 +207,7 @@ KvpValueImpl::to_string() const noexcept
     boost::apply_visitor(visitor, datastore);
 
     /*We still use g_strdup since the return value will be freed by g_free*/
-    return g_strdup(ret.str().c_str());
+    return ret.str();
 }
 
 static int
diff --git a/libgnucash/engine/kvp-value.hpp b/libgnucash/engine/kvp-value.hpp
index 99ddcf8..1aeb1fd 100644
--- a/libgnucash/engine/kvp-value.hpp
+++ b/libgnucash/engine/kvp-value.hpp
@@ -137,7 +137,7 @@ struct KvpValueImpl
 
     KvpValueImpl::Type get_type() const noexcept;
 
-    char * to_string() const noexcept;
+    std::string to_string() const noexcept;
 
     template <typename T>
     T get() const noexcept;

commit 048b8e37a14fd4a4c96b59d289fa2b0f20668bb0
Author: lmat <dartme18 at gmail.com>
Date:   Tue Aug 8 16:32:33 2017 -0400

    Clear up guile2 vs. guile cmake confusion

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f017a85..f8626c7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -261,7 +261,7 @@ IF (GUILE2_FOUND) # found guile-2.0
   SET(GUILE_INCLUDE_DIRS ${GUILE2_INCLUDE_DIRS})
   SET(GUILE_LDFLAGS ${GUILE2_LDFLAGS})
 
-  FIND_PROGRAM (GUILD_EXECUTABLE guild)
+  FIND_PROGRAM (GUILD_EXECUTABLE guild2.0 guild)
   IF (NOT GUILD_EXECUTABLE)
     MESSAGE (SEND_ERROR "The guild executable was not found, but is required. Please set GUILD_EXECUTABLE.")
   ENDIF (NOT GUILD_EXECUTABLE)
@@ -280,7 +280,7 @@ ELSE()
   MESSAGE(STATUS "Using guile-1.8.x")
 ENDIF()
 
-FIND_PROGRAM (GUILE_EXECUTABLE guile)
+FIND_PROGRAM (GUILE_EXECUTABLE guile2.0 guile)
 IF (NOT GUILE_EXECUTABLE)
   MESSAGE (SEND_ERROR "The guile executable was not found, but is required. Please set GUILE_EXECUTABLE.")
 ENDIF (NOT GUILE_EXECUTABLE)

commit b81a4a559d04177ba79ea4f1446dd6d8c4ac5f5a
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Aug 28 10:25:34 2017 +0100

    Change the background colours of the import-main-matcher
    
    Use the same procedure as that used in the dense calendar to change the
    background colours in the import main matcher to be based on the
    brightness of the foreground colour.

diff --git a/gnucash/gnome-utils/ui/gnucash-fallback.css b/gnucash/gnome-utils/ui/gnucash-fallback.css
index 079c66d..21cb616 100644
--- a/gnucash/gnome-utils/ui/gnucash-fallback.css
+++ b/gnucash/gnome-utils/ui/gnucash-fallback.css
@@ -4,16 +4,32 @@
 
 
 /* Import Matcher, amount of intervention required */
+ at define-color intervention-required_bg_color brown1;
+ at define-color intervention-probably-required_bg_color gold;
+ at define-color intervention-not-required_bg_color DarkSeaGreen1;
+
 .intervention-required {
-  background-color: brown1;
+  background-color: @intervention-required_bg_color;
 }
 
 .intervention-probably-required {
-  background-color: gold;
+  background-color: @intervention-probably-required_bg_color;
 }
 
 .intervention-not-required {
-  background-color: DarkSeaGreen1;
+  background-color: @intervention-not-required_bg_color;
+}
+
+.intervention-required-dark {
+  background-color: shade (@intervention-required_bg_color, 0.7);
+}
+
+.intervention-probably-required-dark {
+  background-color: shade (@intervention-probably-required_bg_color, 0.8);
+}
+
+.intervention-not-required-dark {
+  background-color: shade (@intervention-not-required_bg_color, 0.3);
 }
 
 /* Negative value label colors */
diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index 6117c30..3157242 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -60,6 +60,7 @@ struct _main_matcher_info
     GtkTreeView *view;
     GNCImportSettings *user_settings;
     int selected_row;
+    gboolean dark_theme;
     GNCTransactionProcessedCB transaction_processed_cb;
     gpointer user_data;
     GNCImportPendingMatches *pending_matches;
@@ -206,6 +207,8 @@ on_matcher_help_clicked (GtkButton *button, gpointer user_data)
     GNCImportMainMatcher *info = user_data;
     GtkBuilder *builder;
     GtkWidget *help_dialog, *box;
+    gchar *int_required_class, *int_prob_required_class, *int_not_required_class;
+    gchar *class_extension = NULL;
 
     builder = gtk_builder_new();
     gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer2");
@@ -214,14 +217,21 @@ on_matcher_help_clicked (GtkButton *button, gpointer user_data)
     gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer5");
     gnc_builder_add_from_file (builder, "dialog-import.glade", "matcher_help_dialog");
 
+    if (info->dark_theme == TRUE)
+        class_extension = "-dark";
+
+    int_required_class = g_strconcat (CSS_INT_REQUIRED_CLASS, class_extension, NULL);
+    int_prob_required_class = g_strconcat (CSS_INT_PROB_REQUIRED_CLASS, class_extension, NULL);
+    int_not_required_class = g_strconcat (CSS_INT_NOT_REQUIRED_CLASS, class_extension, NULL);
+
     box = GTK_WIDGET(gtk_builder_get_object (builder, "intervention_required_box"));
-    gnc_widget_set_style_context (GTK_WIDGET(box), CSS_INT_REQUIRED_CLASS);
+    gnc_widget_set_style_context (GTK_WIDGET(box), int_required_class);
 
     box = GTK_WIDGET(gtk_builder_get_object (builder, "intervention_probably_required_box"));
-    gnc_widget_set_style_context (GTK_WIDGET(box), CSS_INT_PROB_REQUIRED_CLASS);
+    gnc_widget_set_style_context (GTK_WIDGET(box), int_prob_required_class);
 
     box = GTK_WIDGET(gtk_builder_get_object (builder, "intervention_not_required_box"));
-    gnc_widget_set_style_context (GTK_WIDGET(box), CSS_INT_NOT_REQUIRED_CLASS);
+    gnc_widget_set_style_context (GTK_WIDGET(box), int_not_required_class);
 
     help_dialog = GTK_WIDGET(gtk_builder_get_object (builder, "matcher_help_dialog"));
     gtk_window_set_transient_for(GTK_WINDOW(help_dialog),
@@ -232,6 +242,10 @@ on_matcher_help_clicked (GtkButton *button, gpointer user_data)
 
     g_object_unref(G_OBJECT(builder));
 
+    g_free (int_required_class);
+    g_free (int_prob_required_class);
+    g_free (int_not_required_class);
+
     gtk_widget_show(help_dialog);
 }
 
@@ -497,6 +511,20 @@ gnc_gen_trans_init_view (GNCImportMainMatcher *info,
                      G_CALLBACK(gnc_gen_trans_row_changed_cb), info);
 }
 
+static gboolean
+is_color_light (GdkRGBA *color)
+{
+    gboolean is_light = FALSE;
+
+    // Counting the perceptive luminance - human eye favors green color...
+    double a = (0.299 * color->red + 0.587 * color->green + 0.114 * color->blue);
+
+    if (a > 0.5)
+        is_light = TRUE;
+
+    return is_light;
+}
+
 GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
         const gchar* heading,
         gboolean all_from_same_account,
@@ -507,6 +535,8 @@ GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
     GtkWidget *heading_label;
     GtkWidget *box, *pbox;
     gboolean show_update;
+    GtkStyleContext *stylectxt;
+    GdkRGBA color;
 
     info = g_new0 (GNCImportMainMatcher, 1);
     info->pending_matches = gnc_import_PendingMatches_new();
@@ -515,6 +545,10 @@ GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
     info->user_settings = gnc_import_Settings_new ();
     gnc_import_Settings_set_match_date_hardlimit (info->user_settings, match_date_hardlimit);
 
+    stylectxt = gtk_widget_get_style_context (GTK_WIDGET(parent));
+    gtk_style_context_get_color (stylectxt, GTK_STATE_FLAG_NORMAL, &color);
+    info->dark_theme = is_color_light (&color);
+
     /* Initialize the GtkDialog. */
     builder = gtk_builder_new();
     gnc_builder_add_from_file (builder, "dialog-import.glade", "transaction_matcher_dialog");
@@ -538,7 +572,7 @@ GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
 
     /* if (parent)
       gtk_window_set_transient_for (GTK_WINDOW (info->dialog),
-    			  GTK_WINDOW (parent));*/
+                  GTK_WINDOW (parent));*/
 
     if (heading)
         gtk_label_set_text (GTK_LABEL (heading_label), heading);
@@ -570,6 +604,8 @@ GNCImportMainMatcher * gnc_gen_trans_assist_new (GtkWidget *parent,
     GtkWidget *heading_label;
     GtkWidget *box;
     gboolean show_update;
+    GtkStyleContext *stylectxt;
+    GdkRGBA color;
 
     info = g_new0 (GNCImportMainMatcher, 1);
     info->pending_matches = gnc_import_PendingMatches_new();
@@ -578,6 +614,10 @@ GNCImportMainMatcher * gnc_gen_trans_assist_new (GtkWidget *parent,
     info->user_settings = gnc_import_Settings_new ();
     gnc_import_Settings_set_match_date_hardlimit (info->user_settings, match_date_hardlimit);
 
+    stylectxt = gtk_widget_get_style_context (GTK_WIDGET(parent));
+    gtk_style_context_get_color (stylectxt, GTK_STATE_FLAG_NORMAL, &color);
+    info->dark_theme = is_color_light (&color);
+
     /* load the interface */
     builder = gtk_builder_new();
     gnc_builder_add_from_file (builder, "dialog-import.glade", "transaction_matcher_content");
@@ -681,6 +721,8 @@ refresh_model_row (GNCImportMainMatcher *gui,
     GtkTreeSelection *selection;
     gchar *tmp, *imbalance, *text, *color;
     const gchar *ro_text;
+    gchar *int_required_class, *int_prob_required_class, *int_not_required_class;
+    gchar *class_extension = NULL;
     Split *split;
     g_assert (gui);
     g_assert (model);
@@ -690,6 +732,13 @@ refresh_model_row (GNCImportMainMatcher *gui,
     store = GTK_LIST_STORE(model);
     gtk_list_store_set(store, iter, DOWNLOADED_COL_DATA, info, -1);
 
+    if (gui->dark_theme == TRUE)
+        class_extension = "-dark";
+
+    int_required_class = g_strconcat (CSS_INT_REQUIRED_CLASS, class_extension, NULL);
+    int_prob_required_class = g_strconcat (CSS_INT_PROB_REQUIRED_CLASS, class_extension, NULL);
+    int_not_required_class = g_strconcat (CSS_INT_NOT_REQUIRED_CLASS, class_extension, NULL);
+
     /*Account:*/
     split = gnc_import_TransInfo_get_fsplit (info);
     g_assert(split); // Must not be NULL
@@ -726,7 +775,7 @@ refresh_model_row (GNCImportMainMatcher *gui,
         if (gnc_import_TransInfo_is_balanced(info) == TRUE)
         {
             ro_text = _("New, already balanced");
-            color = get_required_color (CSS_INT_NOT_REQUIRED_CLASS);
+            color = get_required_color (int_not_required_class);
         }
         else
         {
@@ -742,7 +791,7 @@ refresh_model_row (GNCImportMainMatcher *gui,
                    TRUE) ));
             if (gnc_import_TransInfo_get_destacc (info) != NULL)
             {
-                color = get_required_color (CSS_INT_NOT_REQUIRED_CLASS);
+                color = get_required_color (int_not_required_class);
                 tmp = gnc_account_get_full_name
                       (gnc_import_TransInfo_get_destacc (info));
                 if (gnc_import_TransInfo_get_destacc_selected_manually(info)
@@ -767,7 +816,7 @@ refresh_model_row (GNCImportMainMatcher *gui,
             }
             else
             {
-                color = get_required_color (CSS_INT_PROB_REQUIRED_CLASS);
+                color = get_required_color (int_prob_required_class);
                 text =
                     /* Translators: %s is the amount to be transferred. */
                     g_strdup_printf(_("New, UNBALANCED (need acct to transfer %s)!"),
@@ -779,7 +828,7 @@ refresh_model_row (GNCImportMainMatcher *gui,
     case GNCImport_CLEAR:
         if (gnc_import_TransInfo_get_selected_match(info))
         {
-            color = get_required_color (CSS_INT_NOT_REQUIRED_CLASS);
+            color = get_required_color (int_not_required_class);
             if (gnc_import_TransInfo_get_match_selected_manually(info) == TRUE)
             {
                 ro_text = _("Reconcile (manual) match");
@@ -791,14 +840,14 @@ refresh_model_row (GNCImportMainMatcher *gui,
         }
         else
         {
-            color = get_required_color (CSS_INT_REQUIRED_CLASS);
+            color = get_required_color (int_required_class);
             ro_text = _("Match missing!");
         }
         break;
     case GNCImport_UPDATE:
         if (gnc_import_TransInfo_get_selected_match(info))
         {
-            color = get_required_color (CSS_INT_NOT_REQUIRED_CLASS);
+            color = get_required_color (int_not_required_class);
             if (gnc_import_TransInfo_get_match_selected_manually(info) == TRUE)
             {
                 ro_text = _("Update and reconcile (manual) match");
@@ -810,12 +859,12 @@ refresh_model_row (GNCImportMainMatcher *gui,
         }
         else
         {
-            color = get_required_color (CSS_INT_REQUIRED_CLASS);
+            color = get_required_color (int_required_class);
             ro_text = _("Match missing!");
         }
         break;
     case GNCImport_SKIP:
-        color = get_required_color (CSS_INT_REQUIRED_CLASS);
+        color = get_required_color (int_required_class);
         ro_text = _("Do not import (no action selected)");
         break;
     default:
@@ -831,6 +880,10 @@ refresh_model_row (GNCImportMainMatcher *gui,
     if (text)
         g_free(text);
 
+    g_free (int_required_class);
+    g_free (int_prob_required_class);
+    g_free (int_not_required_class);
+
     /* Set the pixmaps */
     gtk_list_store_set(store, iter,
                        DOWNLOADED_COL_ACTION_ADD,

commit 659d3b95825d548db22c670a927c430ef6214eb3
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Aug 28 10:21:44 2017 +0100

    Change colour function to is_color_light in gnc-dense-cal
    
    Change colour function to is_color_light and correct syntax and also
    change some character strings.

diff --git a/gnucash/gnome-utils/gnc-dense-cal.c b/gnucash/gnome-utils/gnc-dense-cal.c
index 903e985..330eb04 100644
--- a/gnucash/gnome-utils/gnc-dense-cal.c
+++ b/gnucash/gnome-utils/gnc-dense-cal.c
@@ -924,17 +924,17 @@ gnc_style_context_get_border_color (GtkStyleContext *context,
 }
 
 static gboolean
-is_color_dark (GdkRGBA *color)
+is_color_light (GdkRGBA *color)
 {
-    gboolean is_dark = FALSE;
+    gboolean is_light = FALSE;
 
     // Counting the perceptive luminance - human eye favors green color...
     double a = (0.299 * color->red + 0.587 * color->green + 0.114 * color->blue);
 
     if (a > 0.5)
-        is_dark = TRUE;
+        is_light = TRUE;
 
-    return is_dark;
+    return is_light;
 }
 
 static void
@@ -949,7 +949,7 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
     PangoLayout *layout;
     GTimer *timer;
     cairo_t *cr;
-    const gchar *primary_color_class, *secondary_color_class, *marker_color_class;
+    gchar *primary_color_class, *secondary_color_class, *marker_color_class;
 
     timer = g_timer_new();
     g_debug("drawing");
@@ -976,16 +976,16 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
     /* get the colors */
     {
          GdkRGBA color;
-         gchar *color_extension = NULL;
+         gchar *class_extension = NULL;
 
          gtk_style_context_get_color (stylectxt, GTK_STATE_FLAG_NORMAL, &color);
 
-          if (is_color_dark (&color))
-              color_extension = "-dark";
+          if (is_color_light (&color))
+              class_extension = "-dark";
 
-          primary_color_class = g_strconcat ("primary", color_extension, NULL);
-          secondary_color_class = g_strconcat ("secondary", color_extension, NULL);
-          marker_color_class = g_strconcat ("markers", color_extension, NULL);
+          primary_color_class = g_strconcat ("primary", class_extension, NULL);
+          secondary_color_class = g_strconcat ("secondary", class_extension, NULL);
+          marker_color_class = g_strconcat ("markers", class_extension, NULL);
     }
 
 
@@ -1232,6 +1232,10 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
 
     LOG_AND_RESET(timer, "queue draw");
 
+    g_free (primary_color_class);
+    g_free (secondary_color_class);
+    g_free (marker_color_class);
+
     g_object_unref(layout);
     cairo_destroy (cr);
 

commit d3e6a9c53b02d5be41ef8a9b57ac89843125161e
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Thu Aug 24 09:02:18 2017 +0100

    Change comment in fallback css file for emphasize-label

diff --git a/gnucash/gnome-utils/ui/gnucash-fallback.css b/gnucash/gnome-utils/ui/gnucash-fallback.css
index 60c69b3..079c66d 100644
--- a/gnucash/gnome-utils/ui/gnucash-fallback.css
+++ b/gnucash/gnome-utils/ui/gnucash-fallback.css
@@ -30,7 +30,7 @@
   border-color: black;
 }
 
-/* Make Label bold and larger */
+/* Make label more important */
 .emphasize-label {
   font-size: large;
   font-weight: bold;

commit da9a57eef3c6a8c963237e921d533532739bb4f8
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Aug 23 17:31:42 2017 +0100

    Rename the colour defines to closely match the text in import matcher

diff --git a/gnucash/import-export/dialog-import.glade b/gnucash/import-export/dialog-import.glade
index 8224c72..05a03da9 100644
--- a/gnucash/import-export/dialog-import.glade
+++ b/gnucash/import-export/dialog-import.glade
@@ -1004,7 +1004,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkEventBox" id="red">
+              <object class="GtkEventBox" id="intervention_required_box">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <child>
@@ -1021,7 +1021,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkEventBox" id="yellow">
+              <object class="GtkEventBox" id="intervention_probably_required_box">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <child>
@@ -1038,7 +1038,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkEventBox" id="green">
+              <object class="GtkEventBox" id="intervention_not_required_box">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <child>
diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index 7ef178b..6117c30 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -82,9 +82,9 @@ enum downloaded_cols
     NUM_DOWNLOADED_COLS
 };
 
-#define COLOR_RED_CLASS    "intervention-required"
-#define COLOR_YELLOW_CLASS "intervention-probably-required"
-#define COLOR_GREEN_CLASS  "intervention-not-required"
+#define CSS_INT_REQUIRED_CLASS      "intervention-required"
+#define CSS_INT_PROB_REQUIRED_CLASS "intervention-probably-required"
+#define CSS_INT_NOT_REQUIRED_CLASS  "intervention-not-required"
 
 static QofLogModule log_module = GNC_MOD_IMPORT;
 
@@ -214,14 +214,14 @@ on_matcher_help_clicked (GtkButton *button, gpointer user_data)
     gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer5");
     gnc_builder_add_from_file (builder, "dialog-import.glade", "matcher_help_dialog");
 
-    box = GTK_WIDGET(gtk_builder_get_object (builder, "red"));
-    gnc_widget_set_style_context (GTK_WIDGET(box), COLOR_RED_CLASS);
+    box = GTK_WIDGET(gtk_builder_get_object (builder, "intervention_required_box"));
+    gnc_widget_set_style_context (GTK_WIDGET(box), CSS_INT_REQUIRED_CLASS);
 
-    box = GTK_WIDGET(gtk_builder_get_object (builder, "yellow"));
-    gnc_widget_set_style_context (GTK_WIDGET(box), COLOR_YELLOW_CLASS);
+    box = GTK_WIDGET(gtk_builder_get_object (builder, "intervention_probably_required_box"));
+    gnc_widget_set_style_context (GTK_WIDGET(box), CSS_INT_PROB_REQUIRED_CLASS);
 
-    box = GTK_WIDGET(gtk_builder_get_object (builder, "green"));
-    gnc_widget_set_style_context (GTK_WIDGET(box), COLOR_GREEN_CLASS);
+    box = GTK_WIDGET(gtk_builder_get_object (builder, "intervention_not_required_box"));
+    gnc_widget_set_style_context (GTK_WIDGET(box), CSS_INT_NOT_REQUIRED_CLASS);
 
     help_dialog = GTK_WIDGET(gtk_builder_get_object (builder, "matcher_help_dialog"));
     gtk_window_set_transient_for(GTK_WINDOW(help_dialog),
@@ -726,7 +726,7 @@ refresh_model_row (GNCImportMainMatcher *gui,
         if (gnc_import_TransInfo_is_balanced(info) == TRUE)
         {
             ro_text = _("New, already balanced");
-            color = get_required_color (COLOR_GREEN_CLASS);
+            color = get_required_color (CSS_INT_NOT_REQUIRED_CLASS);
         }
         else
         {
@@ -742,7 +742,7 @@ refresh_model_row (GNCImportMainMatcher *gui,
                    TRUE) ));
             if (gnc_import_TransInfo_get_destacc (info) != NULL)
             {
-                color = get_required_color (COLOR_GREEN_CLASS);
+                color = get_required_color (CSS_INT_NOT_REQUIRED_CLASS);
                 tmp = gnc_account_get_full_name
                       (gnc_import_TransInfo_get_destacc (info));
                 if (gnc_import_TransInfo_get_destacc_selected_manually(info)
@@ -767,7 +767,7 @@ refresh_model_row (GNCImportMainMatcher *gui,
             }
             else
             {
-                color = get_required_color (COLOR_YELLOW_CLASS);
+                color = get_required_color (CSS_INT_PROB_REQUIRED_CLASS);
                 text =
                     /* Translators: %s is the amount to be transferred. */
                     g_strdup_printf(_("New, UNBALANCED (need acct to transfer %s)!"),
@@ -779,7 +779,7 @@ refresh_model_row (GNCImportMainMatcher *gui,
     case GNCImport_CLEAR:
         if (gnc_import_TransInfo_get_selected_match(info))
         {
-            color = get_required_color (COLOR_GREEN_CLASS);
+            color = get_required_color (CSS_INT_NOT_REQUIRED_CLASS);
             if (gnc_import_TransInfo_get_match_selected_manually(info) == TRUE)
             {
                 ro_text = _("Reconcile (manual) match");
@@ -791,14 +791,14 @@ refresh_model_row (GNCImportMainMatcher *gui,
         }
         else
         {
-            color = get_required_color (COLOR_RED_CLASS);
+            color = get_required_color (CSS_INT_REQUIRED_CLASS);
             ro_text = _("Match missing!");
         }
         break;
     case GNCImport_UPDATE:
         if (gnc_import_TransInfo_get_selected_match(info))
         {
-            color = get_required_color (COLOR_GREEN_CLASS);
+            color = get_required_color (CSS_INT_NOT_REQUIRED_CLASS);
             if (gnc_import_TransInfo_get_match_selected_manually(info) == TRUE)
             {
                 ro_text = _("Update and reconcile (manual) match");
@@ -810,12 +810,12 @@ refresh_model_row (GNCImportMainMatcher *gui,
         }
         else
         {
-            color = get_required_color (COLOR_RED_CLASS);
+            color = get_required_color (CSS_INT_REQUIRED_CLASS);
             ro_text = _("Match missing!");
         }
         break;
     case GNCImport_SKIP:
-        color = get_required_color (COLOR_RED_CLASS);
+        color = get_required_color (CSS_INT_REQUIRED_CLASS);
         ro_text = _("Do not import (no action selected)");
         break;
     default:

commit f7a4fa6fb03a2a3b202a409713970af33f82ac12
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Aug 23 16:58:28 2017 +0100

    Rename direction boolean to arrow_down

diff --git a/gnucash/register/register-gnome/gnucash-item-edit.c b/gnucash/register/register-gnome/gnucash-item-edit.c
index 236150c..ba249dd 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.c
+++ b/gnucash/register/register-gnome/gnucash-item-edit.c
@@ -167,7 +167,7 @@ gnc_item_edit_init (GncItemEdit *item_edit)
 
     item_edit->popup_toggle.ebox = NULL;
     item_edit->popup_toggle.tbutton = NULL;
-    item_edit->popup_toggle.direction = TRUE;
+    item_edit->popup_toggle.arrow_down = TRUE;
     item_edit->popup_toggle.signals_connected = FALSE;
 
     item_edit->popup_item = NULL;
@@ -347,7 +347,7 @@ draw_arrow_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
 
     size = MIN(width / 2, height / 2);
 
-    if (item_edit->popup_toggle.direction == 0)
+    if (item_edit->popup_toggle.arrow_down == 0)
         gtk_render_arrow (context, cr, 0,
                          (width - size)/2, (height - size)/2, size);
     else
@@ -685,7 +685,7 @@ gnc_item_edit_show_popup (GncItemEdit *item_edit)
     }
 
     // set the popup arrow direction up
-    item_edit->popup_toggle.direction = FALSE;
+    item_edit->popup_toggle.arrow_down = FALSE;
 
     if (item_edit->popup_set_focus)
         item_edit->popup_set_focus (item_edit->popup_item,
@@ -731,7 +731,7 @@ gnc_item_edit_hide_popup (GncItemEdit *item_edit)
     gtk_container_remove (GTK_CONTAINER(item_edit->sheet), item_edit->popup_item);
 
     // set the popup arrow direction down
-    item_edit->popup_toggle.direction = TRUE;
+    item_edit->popup_toggle.arrow_down = TRUE;
 
     gtk_toggle_button_set_active
     (GTK_TOGGLE_BUTTON(item_edit->popup_toggle.tbutton), FALSE);
diff --git a/gnucash/register/register-gnome/gnucash-item-edit.h b/gnucash/register/register-gnome/gnucash-item-edit.h
index 0c394e5..d6b7e73 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.h
+++ b/gnucash/register/register-gnome/gnucash-item-edit.h
@@ -61,7 +61,7 @@ struct _PopupToggle
 {
     GtkWidget *ebox;
     GtkWidget *tbutton;
-    gboolean   direction;
+    gboolean   arrow_down;
     gboolean signals_connected;
 };
 

commit efaa7dbb1a65470136f883116316e7883ea6e961
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Aug 23 16:53:34 2017 +0100

    Change the way dense calendar background colours are sourced
    
    Defined the three colours and function to decide if the foreground
    colour is light and make the colours darker. Also changed the colour of
    the grid to based on border colour.

diff --git a/gnucash/gnome-utils/gnc-dense-cal.c b/gnucash/gnome-utils/gnc-dense-cal.c
index 705cd17..903e985 100644
--- a/gnucash/gnome-utils/gnc-dense-cal.c
+++ b/gnucash/gnome-utils/gnc-dense-cal.c
@@ -923,6 +923,20 @@ gnc_style_context_get_border_color (GtkStyleContext *context,
     gdk_rgba_free (c);
 }
 
+static gboolean
+is_color_dark (GdkRGBA *color)
+{
+    gboolean is_dark = FALSE;
+
+    // Counting the perceptive luminance - human eye favors green color...
+    double a = (0.299 * color->red + 0.587 * color->green + 0.114 * color->blue);
+
+    if (a > 0.5)
+        is_dark = TRUE;
+
+    return is_dark;
+}
+
 static void
 gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
 {
@@ -935,6 +949,7 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
     PangoLayout *layout;
     GTimer *timer;
     cairo_t *cr;
+    const gchar *primary_color_class, *secondary_color_class, *marker_color_class;
 
     timer = g_timer_new();
     g_debug("drawing");
@@ -958,6 +973,22 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
                            cairo_image_surface_get_width (dcal->surface),
                            cairo_image_surface_get_height (dcal->surface));
 
+    /* get the colors */
+    {
+         GdkRGBA color;
+         gchar *color_extension = NULL;
+
+         gtk_style_context_get_color (stylectxt, GTK_STATE_FLAG_NORMAL, &color);
+
+          if (is_color_dark (&color))
+              color_extension = "-dark";
+
+          primary_color_class = g_strconcat ("primary", color_extension, NULL);
+          secondary_color_class = g_strconcat ("secondary", color_extension, NULL);
+          marker_color_class = g_strconcat ("markers", color_extension, NULL);
+    }
+
+
     /* Fill in alternating month colors. */
     {
         gint i;
@@ -984,20 +1015,15 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
             for (mcListIter = mcList; mcListIter != NULL; mcListIter = mcListIter->next)
             {
                 rect = (GdkRectangle*)mcListIter->data;
+                gtk_style_context_save (stylectxt);
 
                 if (i % 2 == 0)
-                {
-                    gtk_style_context_add_class (stylectxt, "primary");
-                    if (gtk_style_context_has_class (stylectxt, "secondary"))
-                        gtk_style_context_remove_class (stylectxt, "secondary");
-                }
+                    gtk_style_context_add_class (stylectxt, primary_color_class);
                 else
-                {
-                    if (gtk_style_context_has_class (stylectxt, "primary"))
-                        gtk_style_context_remove_class (stylectxt, "primary");
-                    gtk_style_context_add_class (stylectxt, "secondary");
-                }
+                    gtk_style_context_add_class (stylectxt, secondary_color_class);
+
                 gtk_render_background (stylectxt, cr, rect->x, rect->y, rect->width, rect->height);
+                gtk_style_context_restore (stylectxt);
             }
             g_list_foreach(mcList, free_rect, NULL);
             g_list_free(mcList);
@@ -1013,7 +1039,7 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
         int x1, x2, y1, y2;
 
         gtk_style_context_save (stylectxt);
-        gtk_style_context_add_class (stylectxt, "markers");
+        gtk_style_context_add_class (stylectxt, marker_color_class);
 #if GTK_CHECK_VERSION(3,22,0)
         gtk_style_context_add_class (stylectxt, GTK_STYLE_CLASS_VIEW);
         gtk_style_context_set_state (stylectxt, GTK_STATE_FLAG_SELECTED);
@@ -1064,12 +1090,16 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
         w = col_width(dcal) - COL_BORDER_SIZE - dcal->label_width;
         h = col_height(dcal);
 
+        gtk_style_context_save (stylectxt);
+
         /* draw the outside border [inside the month labels] */
+        gtk_style_context_add_class (stylectxt, GTK_STYLE_CLASS_FRAME);
+
+        gtk_render_frame (stylectxt, cr, x, y, w + 1, h + 1);
+
         gnc_style_context_get_border_color (stylectxt, state_flags, &color);
         cairo_set_source_rgb (cr, color.red, color.green, color.blue);
         cairo_set_line_width (cr, 1);
-        cairo_rectangle (cr, x + 0.5, y + 0.5, w, h);
-        cairo_stroke (cr);
 
         /* draw the week separations */
         for (j = 0; j < num_weeks_per_col(dcal); j++)
@@ -1089,6 +1119,7 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
             cairo_stroke (cr);
         }
         cairo_restore (cr);
+        gtk_style_context_restore (stylectxt);
 
 
         /* draw the day of the week labels */
diff --git a/gnucash/gnome-utils/ui/gnucash-fallback.css b/gnucash/gnome-utils/ui/gnucash-fallback.css
index 0cf3cc5..60c69b3 100644
--- a/gnucash/gnome-utils/ui/gnucash-fallback.css
+++ b/gnucash/gnome-utils/ui/gnucash-fallback.css
@@ -37,14 +37,31 @@
 }
 
 /* The Dense Calendar defaults */
+ at define-color primary_bg_color lavender;
+ at define-color secondary_bg_color SlateGray1;
+ at define-color marker_bg_color yellow;
+
 *.primary {
-  background-color: lavender;
+   background-color: @primary_bg_color;
+}
+
+*.primary-dark {
+  background-color: shade (@primary_bg_color, 0.7);
 }
 
 *.secondary {
-  background-color: SlateGray1;
+  background-color: @secondary_bg_color;
+}
+
+*.secondary-dark {
+  background-color: shade (@secondary_bg_color, 0.7);
 }
 
 *.markers {
-  background-color: yellow;
+  background-color: @marker_bg_color;
+}
+
+*.markers-dark {
+  background-color: shade (@marker_bg_color, 0.8);
 }
+

commit 4cdae2481e3c0c35d095b52dccb69b4c13a233f7
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Aug 23 16:51:59 2017 +0100

    Improve marker alignment depending on row height being odd or even

diff --git a/gnucash/gnome-utils/gnc-dense-cal.c b/gnucash/gnome-utils/gnc-dense-cal.c
index 3442e27..705cd17 100644
--- a/gnucash/gnome-utils/gnc-dense-cal.c
+++ b/gnucash/gnome-utils/gnc-dense-cal.c
@@ -1030,7 +1030,15 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
                 center_y = (y1 + y2 ) / 2;
                 radius = MIN((x2 - x1), (y2 - y1)) * .75;
 
-                gtk_render_background (stylectxt, cr, center_x - radius - 2, center_y - radius, (radius * 2) + 4, radius * 2);
+                // try to compensate for row height being odd or even
+                if (((y2 -y1) % 2) == 0)
+                    gtk_render_background (stylectxt, cr,
+                                           center_x - radius - 2, center_y - radius - 1,
+                                            (radius * 2) + 4, radius * 2);
+                else
+                    gtk_render_background (stylectxt, cr,
+                                           center_x - radius - 2, center_y - radius,
+                                            (radius * 2) + 4, (radius * 2) + 1);
             }
         }
         gtk_style_context_restore (stylectxt);

commit 3a04e8b937afe1f4f72a66aaa78adaddb882c38c
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Aug 23 16:50:38 2017 +0100

    Fix some lines with spaces on them

diff --git a/gnucash/gnome-utils/gnc-dense-cal.c b/gnucash/gnome-utils/gnc-dense-cal.c
index a154594..3442e27 100644
--- a/gnucash/gnome-utils/gnc-dense-cal.c
+++ b/gnucash/gnome-utils/gnc-dense-cal.c
@@ -419,8 +419,8 @@ gnc_dense_cal_init(GncDenseCal *dcal)
     dcal->topPadding = 2;
 
     {
-	GDate now;
-	g_date_clear (&now, 1);
+    GDate now;
+    g_date_clear (&now, 1);
         gnc_gdate_set_today (&now);
         _gnc_dense_cal_set_month(dcal, g_date_get_month(&now), FALSE);
         _gnc_dense_cal_set_year(dcal, g_date_get_year(&now), FALSE);
@@ -1341,7 +1341,7 @@ gnc_dense_cal_motion_notify(GtkWidget *widget,
         GdkWindow *win = gdk_screen_get_root_window (gtk_widget_get_screen (widget));
         GdkMonitor *mon = gdk_display_get_monitor_at_window (gtk_widget_get_display (widget), win);
         GdkRectangle monitor_size;
-                
+
         gdk_monitor_get_geometry (mon, &monitor_size);
 
         screen_width = monitor_size.width;
@@ -1355,7 +1355,7 @@ gnc_dense_cal_motion_notify(GtkWidget *widget,
 
         gtk_widget_get_allocation(GTK_WIDGET(dcal->transPopup), &alloc);
 
-        gtk_widget_show_all(GTK_WIDGET(dcal->transPopup));      
+        gtk_widget_show_all(GTK_WIDGET(dcal->transPopup));
 
         if (event->x_root + 5 + alloc.width > screen_width)
             win_xpos = event->x_root - 2 - alloc.width;

commit 94d538d233dfd0ed447fd44c83e2bd46df69c564
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Aug 23 15:47:12 2017 +0100

    Change glade comment in css file

diff --git a/gnucash/gnome-utils/ui/gnucash-fallback.css b/gnucash/gnome-utils/ui/gnucash-fallback.css
index 548b7ea..0cf3cc5 100644
--- a/gnucash/gnome-utils/ui/gnucash-fallback.css
+++ b/gnucash/gnome-utils/ui/gnucash-fallback.css
@@ -1,5 +1,5 @@
 /* Note: Widgets obtained from Glade files will not be addressable
-   directly by name as these are not brought in when loaded, only
+   unless they have been named or have style classes added. Only 
    the widget type can be configured unless they are named in code */
 
 
diff --git a/gnucash/gnome-utils/ui/gnucash.css b/gnucash/gnome-utils/ui/gnucash.css
index c6d1bad..c8cc093 100644
--- a/gnucash/gnome-utils/ui/gnucash.css
+++ b/gnucash/gnome-utils/ui/gnucash.css
@@ -1,4 +1,4 @@
 /* Note: Widgets obtained from Glade files will not be addressable
-   directly by name as these are not brought in when loaded, only
+   unless they have been named or have style classes added. Only 
    the widget type can be configured unless they are named in code */
 

commit 1051847e2b03ba05e31b984e9a6089f6518f2480
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Aug 22 14:22:11 2017 +0100

    Use GTK_STYLE_PROVIDER_PRIORITY_FALLBACK for fallback css file

diff --git a/gnucash/gnome-utils/gnc-gnome-utils.c b/gnucash/gnome-utils/gnc-gnome-utils.c
index 12fa9c2..eefcadc 100644
--- a/gnucash/gnome-utils/gnc-gnome-utils.c
+++ b/gnucash/gnome-utils/gnc-gnome-utils.c
@@ -186,7 +186,7 @@ gnc_add_css_file (void)
     display = gdk_display_get_default ();
     screen = gdk_display_get_default_screen (display);
 
-    gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider_fallback), GTK_STYLE_PROVIDER_PRIORITY_THEME - 50);
+    gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider_fallback), GTK_STYLE_PROVIDER_PRIORITY_FALLBACK);
     gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider_app), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
     gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider_user), GTK_STYLE_PROVIDER_PRIORITY_USER);
 
@@ -195,7 +195,7 @@ gnc_add_css_file (void)
         str = g_build_filename (pkgdatadir, "ui", "gnucash-fallback.css", (char *)NULL);
         gtk_css_provider_load_from_path (provider_fallback, str, &error);
         g_free (str);
- 
+
         str = g_build_filename (pkgdatadir, "ui", "gnucash.css", (char *)NULL);
         gtk_css_provider_load_from_path (provider_app, str, &error);
         g_free (str);

commit e8f8e561279681655c6b820e55f090c590da8c13
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Aug 14 09:27:33 2017 +0100

    Use the css class defines in the import matcher help dialog

diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index 3617fd8..7ef178b 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -215,13 +215,13 @@ on_matcher_help_clicked (GtkButton *button, gpointer user_data)
     gnc_builder_add_from_file (builder, "dialog-import.glade", "matcher_help_dialog");
 
     box = GTK_WIDGET(gtk_builder_get_object (builder, "red"));
-    gnc_widget_set_style_context (GTK_WIDGET(box), "intervention-required");
+    gnc_widget_set_style_context (GTK_WIDGET(box), COLOR_RED_CLASS);
 
     box = GTK_WIDGET(gtk_builder_get_object (builder, "yellow"));
-    gnc_widget_set_style_context (GTK_WIDGET(box), "intervention-probably-required");
+    gnc_widget_set_style_context (GTK_WIDGET(box), COLOR_YELLOW_CLASS);
 
     box = GTK_WIDGET(gtk_builder_get_object (builder, "green"));
-    gnc_widget_set_style_context (GTK_WIDGET(box), "intervention-not-required");
+    gnc_widget_set_style_context (GTK_WIDGET(box), COLOR_GREEN_CLASS);
 
     help_dialog = GTK_WIDGET(gtk_builder_get_object (builder, "matcher_help_dialog"));
     gtk_window_set_transient_for(GTK_WINDOW(help_dialog),

commit d4a248a244083c04f6d0320a41439e4303270d7b
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Aug 13 17:10:30 2017 +0100

    Minor fix to gnc-tree-model-account, removal of double ;

diff --git a/gnucash/gnome-utils/gnc-tree-model-account.c b/gnucash/gnome-utils/gnc-tree-model-account.c
index 2b8558c..e19ace3 100644
--- a/gnucash/gnome-utils/gnc-tree-model-account.c
+++ b/gnucash/gnome-utils/gnc-tree-model-account.c
@@ -115,7 +115,7 @@ get_negative_color (void)
     gtk_style_context_add_class (context, "negative-numbers");
     gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
 
-    return gdk_rgba_to_string (&color);;
+    return gdk_rgba_to_string (&color);
 }
 
 /** Tell the GncTreeModelAccount code to update the color that it will

commit 2c5e2f7ade4e7ed85be0bcdbb20c73cb8e981409
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Aug 13 17:09:29 2017 +0100

    These variables are not required any more in gnc-dense-cal

diff --git a/gnucash/gnome-utils/gnc-dense-cal.c b/gnucash/gnome-utils/gnc-dense-cal.c
index 261b44f..a154594 100644
--- a/gnucash/gnome-utils/gnc-dense-cal.c
+++ b/gnucash/gnome-utils/gnc-dense-cal.c
@@ -262,7 +262,6 @@ static void
 gnc_dense_cal_init(GncDenseCal *dcal)
 {
     GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET(dcal));
-    gboolean colorAllocSuccess[MAX_COLORS];
 
     gtk_orientable_set_orientation (GTK_ORIENTABLE(dcal), GTK_ORIENTATION_VERTICAL);
 
diff --git a/gnucash/gnome-utils/gnc-dense-cal.h b/gnucash/gnome-utils/gnc-dense-cal.h
index cb9f148..f4e0f78 100644
--- a/gnucash/gnome-utils/gnc-dense-cal.h
+++ b/gnucash/gnome-utils/gnc-dense-cal.h
@@ -44,13 +44,6 @@ typedef struct _gdc_month_coords
     gint x, y;
 } gdc_month_coords;
 
-enum GDC_COLORS
-{
-    MONTH_THIS = 0,
-    MONTH_THAT,
-    MAX_COLORS
-};
-
 struct _GncDenseCal
 {
     GtkBox widget;
@@ -84,8 +77,6 @@ struct _GncDenseCal
 
     gdc_month_coords monthPositions[12];
 
-    GdkRGBA weekColors[MAX_COLORS];
-
     guint label_width;
     guint label_height;
     gint dayLabelHeight;

commit cdfdfb48c15032781ecf4ad812068b2414a991c4
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Aug 13 17:07:58 2017 +0100

    Change the css for the primary label in dialog account
    
    Renamed the css class used and moved to the fallback css file.

diff --git a/gnucash/gnome-utils/dialog-account.c b/gnucash/gnome-utils/dialog-account.c
index 565472c..8cb11a5 100644
--- a/gnucash/gnome-utils/dialog-account.c
+++ b/gnucash/gnome-utils/dialog-account.c
@@ -669,7 +669,7 @@ verify_children_compatible (AccountWindow *aw)
     gnc_label_set_alignment (label, 0.0, 0.0);
 
     /* make label large */
-    gnc_widget_set_style_context (GTK_WIDGET(label), "primary_label_size");
+    gnc_widget_set_style_context (GTK_WIDGET(label), "emphasize-label");
 
     gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
 
diff --git a/gnucash/gnome-utils/ui/gnucash-fallback.css b/gnucash/gnome-utils/ui/gnucash-fallback.css
index 75f162d..548b7ea 100644
--- a/gnucash/gnome-utils/ui/gnucash-fallback.css
+++ b/gnucash/gnome-utils/ui/gnucash-fallback.css
@@ -30,6 +30,13 @@
   border-color: black;
 }
 
+/* Make Label bold and larger */
+.emphasize-label {
+  font-size: large;
+  font-weight: bold;
+}
+
+/* The Dense Calendar defaults */
 *.primary {
   background-color: lavender;
 }
diff --git a/gnucash/gnome-utils/ui/gnucash.css b/gnucash/gnome-utils/ui/gnucash.css
index 7d19159..c6d1bad 100644
--- a/gnucash/gnome-utils/ui/gnucash.css
+++ b/gnucash/gnome-utils/ui/gnucash.css
@@ -2,9 +2,3 @@
    directly by name as these are not brought in when loaded, only
    the widget type can be configured unless they are named in code */
 
-/* Increase label size # dialog-account.c */
-.primary_label_size {
-  font-size: large;
-  font-weight: bold;
-}
-

commit ffe9a23ca5109ec9f9e0c5f39dfdfacd2d763545
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Aug 13 17:05:45 2017 +0100

    Change the Register2 css to be from the fallback file

diff --git a/gnucash/gnome-utils/gnc-tree-view-split-reg.c b/gnucash/gnome-utils/gnc-tree-view-split-reg.c
index ab387a9..91dcae2 100644
--- a/gnucash/gnome-utils/gnc-tree-view-split-reg.c
+++ b/gnucash/gnome-utils/gnc-tree-view-split-reg.c
@@ -1017,7 +1017,7 @@ gnc_tree_view_split_reg_new_with_model (GncTreeModelSplitReg *model)
     view->help_text = g_strdup ("Help Text");
 
     /* Set the grid lines to be solid */
-    gnc_widget_set_style_context (GTK_WIDGET(view), "treeview_grid_lines");
+    gnc_widget_set_style_context (GTK_WIDGET(view), "register2_grid_lines");
 
     /* TreeView Grid lines */
     if (view->priv->use_horizontal_lines)
diff --git a/gnucash/gnome-utils/ui/gnucash-fallback.css b/gnucash/gnome-utils/ui/gnucash-fallback.css
index 81957f1..75f162d 100644
--- a/gnucash/gnome-utils/ui/gnucash-fallback.css
+++ b/gnucash/gnome-utils/ui/gnucash-fallback.css
@@ -25,7 +25,11 @@
   color: rgb(75%, 0%, 0%);
 }
 
-/* These are the defaults used in # gnc-dense-cal.c */
+/* Register2 grid lines color */
+.register2_grid_lines {
+  border-color: black;
+}
+
 *.primary {
   background-color: lavender;
 }
diff --git a/gnucash/gnome-utils/ui/gnucash.css b/gnucash/gnome-utils/ui/gnucash.css
index e54838a..7d19159 100644
--- a/gnucash/gnome-utils/ui/gnucash.css
+++ b/gnucash/gnome-utils/ui/gnucash.css
@@ -2,11 +2,6 @@
    directly by name as these are not brought in when loaded, only
    the widget type can be configured unless they are named in code */
 
-/* Set the grid lines to be solid # gnc-tree-view-split-reg.c */
-.treeview_grid_lines {
-  border-color: black;
-}
-
 /* Increase label size # dialog-account.c */
 .primary_label_size {
   font-size: large;

commit 908e3f3fc0a091569fe96401addf0a969c78b125
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Aug 13 17:04:55 2017 +0100

    Do not set the foreground colour in Import Matcher
    
    Let the theme set the foreground colour which is more relevant on dark
    themes

diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index 1293b7e..3617fd8 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -398,10 +398,6 @@ add_text_column(GtkTreeView *view, const gchar *title, int col_num)
     GtkTreeViewColumn *column;
 
     renderer = gtk_cell_renderer_text_new();
-    g_object_set(G_OBJECT(renderer),
-                 "foreground", "black",
-                 "foreground-set", TRUE,
-                 NULL);
     column = gtk_tree_view_column_new_with_attributes
              (title, renderer,
               "text", col_num,
@@ -481,10 +477,6 @@ gnc_gen_trans_init_view (GNCImportMainMatcher *info,
              "cell-background", DOWNLOADED_COL_COLOR,
              NULL);
     renderer = gtk_cell_renderer_text_new();
-    g_object_set(G_OBJECT(renderer),
-                 "foreground", "black",
-                 "foreground-set", TRUE,
-                 NULL);
     gtk_tree_view_column_pack_start(column, renderer, TRUE);
     gtk_tree_view_column_set_attributes(column, renderer,
                                         "text", DOWNLOADED_COL_ACTION_INFO,

commit e18d56dfc4a9ac63fcbcaae7f1b586056cabc5c4
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Aug 13 17:03:20 2017 +0100

    Rework the Import Matcher colours to be from the fallback css file
    
    Rename the css classes used and make sure the import matcher used them.

diff --git a/gnucash/gnome-utils/ui/gnucash-fallback.css b/gnucash/gnome-utils/ui/gnucash-fallback.css
index 865f833..81957f1 100644
--- a/gnucash/gnome-utils/ui/gnucash-fallback.css
+++ b/gnucash/gnome-utils/ui/gnucash-fallback.css
@@ -2,7 +2,21 @@
    directly by name as these are not brought in when loaded, only
    the widget type can be configured unless they are named in code */
 
-/* negative value label colors # dialog-utils.c */
+
+/* Import Matcher, amount of intervention required */
+.intervention-required {
+  background-color: brown1;
+}
+
+.intervention-probably-required {
+  background-color: gold;
+}
+
+.intervention-not-required {
+  background-color: DarkSeaGreen1;
+}
+
+/* Negative value label colors */
 .default-color {
   color: currentColor;
 }
diff --git a/gnucash/gnome-utils/ui/gnucash.css b/gnucash/gnome-utils/ui/gnucash.css
index 0b23218..e54838a 100644
--- a/gnucash/gnome-utils/ui/gnucash.css
+++ b/gnucash/gnome-utils/ui/gnucash.css
@@ -2,19 +2,6 @@
    directly by name as these are not brought in when loaded, only
    the widget type can be configured unless they are named in code */
 
-/* Import Matcher # import-main-matcher.*/
-.color_back_red {
-  background-color: brown1;
-}
-
-.color_back_yellow {
-  background-color: gold;
-}
-
-.color_back_green {
-  background-color: DarkSeaGreen1;
-}
-
 /* Set the grid lines to be solid # gnc-tree-view-split-reg.c */
 .treeview_grid_lines {
   border-color: black;
diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index cfbaa5a..1293b7e 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -82,9 +82,9 @@ enum downloaded_cols
     NUM_DOWNLOADED_COLS
 };
 
-#define COLOR_RED    "brown1"
-#define COLOR_YELLOW "gold"
-#define COLOR_GREEN  "DarkSeaGreen1"
+#define COLOR_RED_CLASS    "intervention-required"
+#define COLOR_YELLOW_CLASS "intervention-probably-required"
+#define COLOR_GREEN_CLASS  "intervention-not-required"
 
 static QofLogModule log_module = GNC_MOD_IMPORT;
 
@@ -215,13 +215,13 @@ on_matcher_help_clicked (GtkButton *button, gpointer user_data)
     gnc_builder_add_from_file (builder, "dialog-import.glade", "matcher_help_dialog");
 
     box = GTK_WIDGET(gtk_builder_get_object (builder, "red"));
-    gnc_widget_set_style_context (GTK_WIDGET(box), "color_back_red");
+    gnc_widget_set_style_context (GTK_WIDGET(box), "intervention-required");
 
     box = GTK_WIDGET(gtk_builder_get_object (builder, "yellow"));
-    gnc_widget_set_style_context (GTK_WIDGET(box), "color_back_yellow");
+    gnc_widget_set_style_context (GTK_WIDGET(box), "intervention-probably-required");
 
     box = GTK_WIDGET(gtk_builder_get_object (builder, "green"));
-    gnc_widget_set_style_context (GTK_WIDGET(box), "color_back_green");
+    gnc_widget_set_style_context (GTK_WIDGET(box), "intervention-not-required");
 
     help_dialog = GTK_WIDGET(gtk_builder_get_object (builder, "matcher_help_dialog"));
     gtk_window_set_transient_for(GTK_WINDOW(help_dialog),
@@ -651,6 +651,35 @@ gboolean gnc_gen_trans_list_run (GNCImportMainMatcher *info)
 }
 
 static void
+gnc_style_context_get_background_color (GtkStyleContext *context,
+                                        GtkStateFlags    state,
+                                        GdkRGBA         *color)
+{
+    GdkRGBA *c;
+
+    g_return_if_fail (color != NULL);
+    g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
+
+    gtk_style_context_get (context,
+                           state,
+                           GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &c,
+                           NULL);
+    *color = *c;
+    gdk_rgba_free (c);
+}
+
+static gchar*
+get_required_color (const gchar *class_name)
+{
+    GdkRGBA color;
+    GtkWidget *label = gtk_label_new ("Color");
+    GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET(label));
+    gtk_style_context_add_class (context, class_name);
+    gnc_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &color);
+    return gdk_rgba_to_string (&color);
+}
+
+static void
 refresh_model_row (GNCImportMainMatcher *gui,
                    GtkTreeModel *model,
                    GtkTreeIter *iter,
@@ -705,7 +734,7 @@ refresh_model_row (GNCImportMainMatcher *gui,
         if (gnc_import_TransInfo_is_balanced(info) == TRUE)
         {
             ro_text = _("New, already balanced");
-            color = COLOR_GREEN;
+            color = get_required_color (COLOR_GREEN_CLASS);
         }
         else
         {
@@ -721,7 +750,7 @@ refresh_model_row (GNCImportMainMatcher *gui,
                    TRUE) ));
             if (gnc_import_TransInfo_get_destacc (info) != NULL)
             {
-                color = COLOR_GREEN;
+                color = get_required_color (COLOR_GREEN_CLASS);
                 tmp = gnc_account_get_full_name
                       (gnc_import_TransInfo_get_destacc (info));
                 if (gnc_import_TransInfo_get_destacc_selected_manually(info)
@@ -746,7 +775,7 @@ refresh_model_row (GNCImportMainMatcher *gui,
             }
             else
             {
-                color = COLOR_YELLOW;
+                color = get_required_color (COLOR_YELLOW_CLASS);
                 text =
                     /* Translators: %s is the amount to be transferred. */
                     g_strdup_printf(_("New, UNBALANCED (need acct to transfer %s)!"),
@@ -758,7 +787,7 @@ refresh_model_row (GNCImportMainMatcher *gui,
     case GNCImport_CLEAR:
         if (gnc_import_TransInfo_get_selected_match(info))
         {
-            color = COLOR_GREEN;
+            color = get_required_color (COLOR_GREEN_CLASS);
             if (gnc_import_TransInfo_get_match_selected_manually(info) == TRUE)
             {
                 ro_text = _("Reconcile (manual) match");
@@ -770,14 +799,14 @@ refresh_model_row (GNCImportMainMatcher *gui,
         }
         else
         {
-            color = COLOR_RED;
+            color = get_required_color (COLOR_RED_CLASS);
             ro_text = _("Match missing!");
         }
         break;
     case GNCImport_UPDATE:
         if (gnc_import_TransInfo_get_selected_match(info))
         {
-            color = COLOR_GREEN;
+            color = get_required_color (COLOR_GREEN_CLASS);
             if (gnc_import_TransInfo_get_match_selected_manually(info) == TRUE)
             {
                 ro_text = _("Update and reconcile (manual) match");
@@ -789,12 +818,12 @@ refresh_model_row (GNCImportMainMatcher *gui,
         }
         else
         {
-            color = COLOR_RED;
+            color = get_required_color (COLOR_RED_CLASS);
             ro_text = _("Match missing!");
         }
         break;
     case GNCImport_SKIP:
-        color = COLOR_RED;
+        color = get_required_color (COLOR_RED_CLASS);
         ro_text = _("Do not import (no action selected)");
         break;
     default:

commit 3be453649da7e8c9ae901680f0ff07cde6c4d181
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Aug 13 09:18:08 2017 +0100

    Rename css class negative-color to negative-numbers

diff --git a/gnucash/gnome-utils/dialog-utils.c b/gnucash/gnome-utils/dialog-utils.c
index cd0d233..108a83f 100644
--- a/gnucash/gnome-utils/dialog-utils.c
+++ b/gnucash/gnome-utils/dialog-utils.c
@@ -69,7 +69,7 @@ gnc_set_label_color(GtkWidget *label, gnc_numeric value)
     deficit = gnc_numeric_negative_p (value);
 
     if (deficit)
-        gnc_widget_set_style_context (GTK_WIDGET(label), "negative-color");
+        gnc_widget_set_style_context (GTK_WIDGET(label), "negative-numbers");
     else
         gnc_widget_set_style_context (GTK_WIDGET(label), "default-color");
 }
diff --git a/gnucash/gnome-utils/gnc-tree-model-account.c b/gnucash/gnome-utils/gnc-tree-model-account.c
index d78f45c..2b8558c 100644
--- a/gnucash/gnome-utils/gnc-tree-model-account.c
+++ b/gnucash/gnome-utils/gnc-tree-model-account.c
@@ -112,7 +112,7 @@ get_negative_color (void)
     GdkRGBA color;
     GtkWidget *label = gtk_label_new ("Color");
     GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET(label));
-    gtk_style_context_add_class (context, "negative-color");
+    gtk_style_context_add_class (context, "negative-numbers");
     gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
 
     return gdk_rgba_to_string (&color);;
diff --git a/gnucash/gnome-utils/ui/gnucash-fallback.css b/gnucash/gnome-utils/ui/gnucash-fallback.css
index 6192594..865f833 100644
--- a/gnucash/gnome-utils/ui/gnucash-fallback.css
+++ b/gnucash/gnome-utils/ui/gnucash-fallback.css
@@ -7,7 +7,7 @@
   color: currentColor;
 }
 
-.negative-color {
+.negative-numbers {
   color: rgb(75%, 0%, 0%);
 }
 
diff --git a/gnucash/gnome-utils/window-main-summarybar.c b/gnucash/gnome-utils/window-main-summarybar.c
index a809d7c..f26c3ed 100644
--- a/gnucash/gnome-utils/window-main-summarybar.c
+++ b/gnucash/gnome-utils/window-main-summarybar.c
@@ -453,7 +453,7 @@ get_negative_color (void)
     gchar *color_str;
     GtkWidget *label = gtk_label_new ("Color");
     GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET(label));
-    gtk_style_context_add_class (context, "negative-color");
+    gtk_style_context_add_class (context, "negative-numbers");
     gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
     rgba = gdk_rgba_copy (&color);
 

commit 94841d9e6492f8141adfadfd5bf94a968c8febde
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sat Aug 12 13:07:28 2017 +0100

    The summary bar never respected the use of a negative colour
    
    Changed the summary bar to use the css negative colour if required. This
    involved adding a boolean columns to the model for the result of
    checking values for being negative and changing to use the 'markup'
    property to display the negative values in the negative colour.

diff --git a/gnucash/gnome-utils/window-main-summarybar.c b/gnucash/gnome-utils/window-main-summarybar.c
index 10a5dbd..a809d7c 100644
--- a/gnucash/gnome-utils/window-main-summarybar.c
+++ b/gnucash/gnome-utils/window-main-summarybar.c
@@ -47,6 +47,8 @@ typedef struct
     int           component_id;
     int           cnxn_id;
     gboolean      combo_popped;
+    gboolean      show_negative_color;
+    gchar        *negative_color;
 } GNCMainSummary;
 
 #define WINDOW_SUMMARYBAR_CM_CLASS "summary-bar"
@@ -327,6 +329,8 @@ enum
     COLUMN_ASSETS_VALUE,
     COLUMN_PROFITS,
     COLUMN_PROFITS_VALUE,
+    COLUMN_ASSETS_NEG,
+    COLUMN_PROFITS_NEG,
     N_COLUMNS
 };
 
@@ -417,8 +421,10 @@ gnc_main_window_summary_refresh (GNCMainSummary * summary)
                                COLUMN_MNEMONIC_TYPE, total_mode_label,
                                COLUMN_ASSETS,        _("Net Assets:"),
                                COLUMN_ASSETS_VALUE,  asset_amount_string,
+                               COLUMN_ASSETS_NEG,    gnc_numeric_negative_p(currency_accum->assets),
                                COLUMN_PROFITS,       _("Profits:"),
                                COLUMN_PROFITS_VALUE, profit_amount_string,
+                               COLUMN_PROFITS_NEG,   gnc_numeric_negative_p(currency_accum->profits),
                                -1);
             g_free(total_mode_label);
         }
@@ -439,12 +445,48 @@ gnc_main_window_summary_refresh (GNCMainSummary * summary)
     g_list_free(currency_list);
 }
 
+static gchar*
+get_negative_color (void)
+{
+    GdkRGBA color;
+    GdkRGBA *rgba;
+    gchar *color_str;
+    GtkWidget *label = gtk_label_new ("Color");
+    GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET(label));
+    gtk_style_context_add_class (context, "negative-color");
+    gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+    rgba = gdk_rgba_copy (&color);
+
+    color_str = g_strdup_printf ("#%02X%02X%02X",
+                              (int)(0.5 + CLAMP (rgba->red, 0., 1.) * 255.),
+                              (int)(0.5 + CLAMP (rgba->green, 0., 1.) * 255.),
+                              (int)(0.5 + CLAMP (rgba->blue, 0., 1.) * 255.));
+    gdk_rgba_free (rgba);
+    return color_str;
+}
+
+static void
+summarybar_update_color (gpointer gsettings, gchar *key, gpointer user_data)
+{
+    GNCMainSummary *summary = user_data;
+
+    summary->negative_color = get_negative_color();
+    summary->show_negative_color = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED);
+
+    gnc_main_window_summary_refresh (summary);
+}
+
 static void
 gnc_main_window_summary_destroy_cb(GNCMainSummary *summary, gpointer data)
 {
     gnc_prefs_remove_cb_by_id (GNC_PREFS_GROUP, summary->cnxn_id);
     gnc_unregister_gui_component(summary->component_id);
-    g_free(summary);
+
+    gnc_prefs_remove_cb_by_func(GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED,
+                                summarybar_update_color, summary);
+
+    g_free (summary->negative_color);
+    g_free (summary);
 }
 
 static void
@@ -461,12 +503,57 @@ prefs_changed_cb (gpointer prefs, gchar *pref, gpointer user_data)
     gnc_main_window_summary_refresh(summary);
 }
 
+static gchar*
+check_string_for_markup (gchar *string)
+{
+    gchar **strings;
+    gchar *ret_string = g_strdup (string);
+
+    if (g_strrstr (ret_string, "&") != NULL)
+    {
+        strings = g_strsplit (ret_string, "&", -1);
+        g_free (ret_string);
+        ret_string = g_strjoinv ("&", strings);
+        g_strfreev (strings);
+    }
+    if (g_strrstr (ret_string, "<") != NULL)
+    {
+        strings = g_strsplit (ret_string, "<", -1);
+        g_free (ret_string);
+        ret_string = g_strjoinv ("<", strings);
+        g_strfreev (strings);
+    }
+    if (g_strrstr (ret_string, ">") != NULL)
+    {
+        strings = g_strsplit (ret_string, ">", -1);
+        g_free (ret_string);
+        ret_string = g_strjoinv (">", strings);
+        g_strfreev (strings);
+    }
+    if (g_strrstr (ret_string, "\"") != NULL)
+    {
+        strings = g_strsplit (ret_string, "\"", -1);
+        g_free (ret_string);
+        ret_string = g_strjoinv (""", strings);
+        g_strfreev (strings);
+    }
+    if (g_strrstr (ret_string, "'") != NULL)
+    {
+        strings = g_strsplit (ret_string, "'", -1);
+        g_free (ret_string);
+        ret_string = g_strjoinv ("'", strings);
+        g_strfreev (strings);
+    }
+    return ret_string;
+}
+
 static void
 cdf (GtkCellLayout *cell_layout, GtkCellRenderer *cell, GtkTreeModel *tree_model, GtkTreeIter *iter,
                           gpointer user_data)
 {
     GNCMainSummary * summary = user_data;
     gchar *type, *assets, *assets_val, *profits, *profits_val;
+    gboolean assets_neg, profits_neg;
     gint viewcol;
 
     viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "view_column"));
@@ -481,23 +568,37 @@ cdf (GtkCellLayout *cell_layout, GtkCellRenderer *cell, GtkTreeModel *tree_model
                             COLUMN_ASSETS, &assets,
                             COLUMN_ASSETS_VALUE, &assets_val,
                             COLUMN_PROFITS, &profits,
-                            COLUMN_PROFITS_VALUE, &profits_val, -1);
+                            COLUMN_PROFITS_VALUE, &profits_val,
+                            COLUMN_ASSETS_NEG, &assets_neg,
+                            COLUMN_PROFITS_NEG, &profits_neg, -1);
 
     if (viewcol == 0)
         g_object_set (cell, "text", type, NULL);
 
     if (viewcol == 2)
     {
-        gchar *a_string = g_strconcat (assets, " ", assets_val, NULL);
-        g_object_set (cell, "text", a_string, NULL);
+        gchar *a_string, *checked_string = check_string_for_markup (assets_val);
+        if ((summary->show_negative_color == TRUE) && (assets_neg == TRUE))
+            a_string = g_strconcat (assets, " <span foreground='", summary->negative_color, "'>", checked_string, "</span>", NULL);
+        else
+            a_string = g_strconcat (assets, " ", checked_string, NULL);
+
+        g_object_set (cell, "markup", a_string, NULL);
         g_free (a_string);
+        g_free (checked_string);
     }
 
     if (viewcol == 4)
     {
-        gchar *p_string = g_strconcat (profits, " ", profits_val, NULL);
-        g_object_set (cell, "text", p_string, NULL);
+        gchar *p_string, *checked_string = check_string_for_markup (profits_val);
+        if ((summary->show_negative_color == TRUE) && (profits_neg == TRUE))
+            p_string = g_strconcat (profits, " <span foreground='", summary->negative_color, "'>", checked_string, "</span>", NULL);
+        else
+            p_string = g_strconcat (profits, " ", checked_string, NULL);
+
+        g_object_set (cell, "markup", p_string, NULL);
         g_free (p_string);
+        g_free (checked_string);
     }
 
     g_free (type);
@@ -529,17 +630,24 @@ gnc_main_window_summary_new (void)
                                             G_TYPE_STRING,
                                             G_TYPE_STRING,
                                             G_TYPE_STRING,
-                                            G_TYPE_STRING);
+                                            G_TYPE_STRING,
+                                            G_TYPE_BOOLEAN,
+                                            G_TYPE_BOOLEAN);
 
     retval->hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
     gtk_box_set_homogeneous (GTK_BOX (retval->hbox), FALSE);
 
     // Set the style context for this widget so it can be easily manipulated with css
-    gnc_widget_set_style_context (GTK_WIDGET(retval->hbox), "GncSummaryBar");
+    gnc_widget_set_style_context (GTK_WIDGET(retval->hbox), "summary-bar");
 
     retval->totals_combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (retval->datamodel));
     g_object_unref (retval->datamodel);
 
+    retval->negative_color = get_negative_color();
+    retval->show_negative_color = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED);
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED,
+                          summarybar_update_color, retval);
+
     retval->component_id = gnc_register_gui_component (WINDOW_SUMMARYBAR_CM_CLASS,
                            summarybar_refresh_handler,
                            NULL, retval);
@@ -553,7 +661,7 @@ gnc_main_window_summary_new (void)
 
     retval->combo_popped = FALSE;
 
-    for (i = 0; i <= N_COLUMNS; i += 2)
+    for (i = 0; i <= N_COLUMNS - 2; i += 2)
     {
         textRenderer = GTK_CELL_RENDERER(gtk_cell_renderer_text_new());
 

commit f034fd6467534ce042d770ef61f1c962f4392f29
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sat Aug 12 13:06:25 2017 +0100

    Change the account treeview to use the css negative color

diff --git a/gnucash/gnome-utils/gnc-tree-model-account.c b/gnucash/gnome-utils/gnc-tree-model-account.c
index ded9207..d78f45c 100644
--- a/gnucash/gnome-utils/gnc-tree-model-account.c
+++ b/gnucash/gnome-utils/gnc-tree-model-account.c
@@ -106,6 +106,17 @@ typedef struct GncTreeModelAccountPrivate
 /************************************************************/
 /*           Account Tree Model - Misc Functions            */
 /************************************************************/
+static gchar*
+get_negative_color (void)
+{
+    GdkRGBA color;
+    GtkWidget *label = gtk_label_new ("Color");
+    GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET(label));
+    gtk_style_context_add_class (context, "negative-color");
+    gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+
+    return gdk_rgba_to_string (&color);;
+}
 
 /** Tell the GncTreeModelAccount code to update the color that it will
  *  use for negative numbers.  This function will iterate over all
@@ -124,7 +135,7 @@ gnc_tree_model_account_update_color (gpointer gsettings, gchar *key, gpointer us
     model = user_data;
     priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
     use_red = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED);
-    priv->negative_color = use_red ? "red" : NULL;
+    priv->negative_color = use_red ? get_negative_color () : NULL;
 }
 /************************************************************/
 /*               g_object required functions                */
@@ -205,7 +216,7 @@ gnc_tree_model_account_init (GncTreeModelAccount *model)
     priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
     priv->book = NULL;
     priv->root = NULL;
-    priv->negative_color = red ? "red" : NULL;
+    priv->negative_color = red ? get_negative_color () : NULL;
 
     gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED,
                           gnc_tree_model_account_update_color,

commit 2475193120cd7e14716127850a221cb4f9b017dd
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sat Aug 12 13:04:55 2017 +0100

    Rework the negative label colour
    
    Changed the class name to negative-color and moved the default to the
    fallback css file.

diff --git a/gnucash/gnome-utils/dialog-utils.c b/gnucash/gnome-utils/dialog-utils.c
index 27ef5b1..cd0d233 100644
--- a/gnucash/gnome-utils/dialog-utils.c
+++ b/gnucash/gnome-utils/dialog-utils.c
@@ -69,9 +69,9 @@ gnc_set_label_color(GtkWidget *label, gnc_numeric value)
     deficit = gnc_numeric_negative_p (value);
 
     if (deficit)
-        gnc_widget_set_style_context (GTK_WIDGET(label), "css_red_color");
+        gnc_widget_set_style_context (GTK_WIDGET(label), "negative-color");
     else
-        gnc_widget_set_style_context (GTK_WIDGET(label), "css_default_color");
+        gnc_widget_set_style_context (GTK_WIDGET(label), "default-color");
 }
 
 
diff --git a/gnucash/gnome-utils/ui/gnucash-fallback.css b/gnucash/gnome-utils/ui/gnucash-fallback.css
index df0d6fe..6192594 100644
--- a/gnucash/gnome-utils/ui/gnucash-fallback.css
+++ b/gnucash/gnome-utils/ui/gnucash-fallback.css
@@ -2,8 +2,16 @@
    directly by name as these are not brought in when loaded, only
    the widget type can be configured unless they are named in code */
 
+/* negative value label colors # dialog-utils.c */
+.default-color {
+  color: currentColor;
+}
+
+.negative-color {
+  color: rgb(75%, 0%, 0%);
+}
 
-/* These are the defaults used in the dense-cal */
+/* These are the defaults used in # gnc-dense-cal.c */
 *.primary {
   background-color: lavender;
 }
diff --git a/gnucash/gnome-utils/ui/gnucash.css b/gnucash/gnome-utils/ui/gnucash.css
index 8abcb59..0b23218 100644
--- a/gnucash/gnome-utils/ui/gnucash.css
+++ b/gnucash/gnome-utils/ui/gnucash.css
@@ -15,15 +15,6 @@
   background-color: DarkSeaGreen1;
 }
 
-/* label colors # dialog-utils.c */
-.css_default_color {
-  color: currentColor;
-}
-
-.css_red_color {
-  color: rgb(75%, 0%, 0%);
-}
-
 /* Set the grid lines to be solid # gnc-tree-view-split-reg.c */
 .treeview_grid_lines {
   border-color: black;

commit 501671dca77b05ed4136b2ae8be3c50e5889f86f
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Aug 9 11:31:04 2017 +0100

    Replace toggle arrow with a theme drawn one

diff --git a/gnucash/register/register-gnome/gnucash-item-edit.c b/gnucash/register/register-gnome/gnucash-item-edit.c
index ac08ed3..236150c 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.c
+++ b/gnucash/register/register-gnome/gnucash-item-edit.c
@@ -167,8 +167,7 @@ gnc_item_edit_init (GncItemEdit *item_edit)
 
     item_edit->popup_toggle.ebox = NULL;
     item_edit->popup_toggle.tbutton = NULL;
-    item_edit->popup_toggle.arrow_up = NULL;
-    item_edit->popup_toggle.arrow_down = NULL;
+    item_edit->popup_toggle.direction = TRUE;
     item_edit->popup_toggle.signals_connected = FALSE;
 
     item_edit->popup_item = NULL;
@@ -333,6 +332,32 @@ unblock_toggle_signals(GncItemEdit *item_edit)
 }
 
 
+static gboolean
+draw_arrow_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
+{
+    GncItemEdit *item_edit = GNC_ITEM_EDIT (data);
+    GtkStyleContext *context = gtk_widget_get_style_context (widget);
+    gint width = gtk_widget_get_allocated_width (widget);
+    gint height = gtk_widget_get_allocated_height (widget);
+    gint size;
+
+    gtk_render_background (context, cr, 0, 0, width, height);
+
+    gtk_style_context_add_class (context, GTK_STYLE_CLASS_ARROW);
+
+    size = MIN(width / 2, height / 2);
+
+    if (item_edit->popup_toggle.direction == 0)
+        gtk_render_arrow (context, cr, 0,
+                         (width - size)/2, (height - size)/2, size);
+    else
+        gtk_render_arrow (context, cr, G_PI,
+                         (width - size)/2, (height - size)/2, size);
+
+    return FALSE;
+}
+
+
 static void
 connect_popup_toggle_signals (GncItemEdit *item_edit)
 {
@@ -353,6 +378,10 @@ connect_popup_toggle_signals (GncItemEdit *item_edit)
                       G_CALLBACK(key_press_popup_cb),
                       item_edit);
 
+    g_signal_connect_after (object, "draw",
+                            G_CALLBACK (draw_arrow_cb),
+                            item_edit);
+
     item_edit->popup_toggle.signals_connected = TRUE;
 }
 
@@ -507,7 +536,6 @@ GtkWidget *
 gnc_item_edit_new (GnucashSheet *sheet)
 {
     char *hpad_str, *vpad_str, *entry_css;
-    GtkWidget *box;
     GtkStyleContext *stylecontext;
     GtkCssProvider *provider;
     GncItemEdit *item_edit =
@@ -543,17 +571,8 @@ gnc_item_edit_new (GnucashSheet *sheet)
     /* Create the popup button
        It will only be displayed when the cell being edited provides
        a popup item (like a calendar or account list) */
-    item_edit->popup_toggle.arrow_down = gtk_image_new_from_icon_name ("go-down", GTK_ICON_SIZE_BUTTON);
-    item_edit->popup_toggle.arrow_up = gtk_image_new_from_icon_name ("go-up", GTK_ICON_SIZE_BUTTON);
-
-    box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-    gtk_box_pack_start (GTK_BOX(box), GTK_WIDGET(item_edit->popup_toggle.arrow_down), FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX(box), GTK_WIDGET(item_edit->popup_toggle.arrow_up),FALSE, FALSE, 0);
-
     item_edit->popup_toggle.tbutton = gtk_toggle_button_new();
-    gtk_toggle_button_set_mode (
-        GTK_TOGGLE_BUTTON (item_edit->popup_toggle.tbutton), FALSE);
-    gtk_container_add(GTK_CONTAINER(item_edit->popup_toggle.tbutton), GTK_WIDGET(box));
+    gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (item_edit->popup_toggle.tbutton), FALSE);
 
     /* Force padding on the button to
        1. keep it small
@@ -576,8 +595,6 @@ gnc_item_edit_new (GnucashSheet *sheet)
                         FALSE, TRUE, 0);
     gtk_widget_show_all(GTK_WIDGET(item_edit));
 
-    gtk_widget_hide (GTK_WIDGET(item_edit->popup_toggle.arrow_up));
-
     return GTK_WIDGET(item_edit);
 }
 
@@ -667,8 +684,8 @@ gnc_item_edit_show_popup (GncItemEdit *item_edit)
         unblock_toggle_signals (item_edit);
     }
 
-    gtk_widget_hide (item_edit->popup_toggle.arrow_down);
-    gtk_widget_show (item_edit->popup_toggle.arrow_up);
+    // set the popup arrow direction up
+    item_edit->popup_toggle.direction = FALSE;
 
     if (item_edit->popup_set_focus)
         item_edit->popup_set_focus (item_edit->popup_item,
@@ -713,8 +730,8 @@ gnc_item_edit_hide_popup (GncItemEdit *item_edit)
 
     gtk_container_remove (GTK_CONTAINER(item_edit->sheet), item_edit->popup_item);
 
-    gtk_widget_hide (item_edit->popup_toggle.arrow_up);
-    gtk_widget_show (item_edit->popup_toggle.arrow_down);
+    // set the popup arrow direction down
+    item_edit->popup_toggle.direction = TRUE;
 
     gtk_toggle_button_set_active
     (GTK_TOGGLE_BUTTON(item_edit->popup_toggle.tbutton), FALSE);
diff --git a/gnucash/register/register-gnome/gnucash-item-edit.h b/gnucash/register/register-gnome/gnucash-item-edit.h
index 07ded69..0c394e5 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.h
+++ b/gnucash/register/register-gnome/gnucash-item-edit.h
@@ -61,8 +61,7 @@ struct _PopupToggle
 {
     GtkWidget *ebox;
     GtkWidget *tbutton;
-    GtkWidget *arrow_up;
-    GtkWidget *arrow_down;
+    gboolean   direction;
     gboolean signals_connected;
 };
 

commit f7556b6094d2dcc122e24b1c5ea361a32bfee6e9
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Aug 9 11:30:10 2017 +0100

    Add draw arrow call back to various widgets

diff --git a/gnucash/gnome-utils/gnc-cell-renderer-popup-entry.c b/gnucash/gnome-utils/gnc-cell-renderer-popup-entry.c
index e1e0da5..e9945b5 100644
--- a/gnucash/gnome-utils/gnc-cell-renderer-popup-entry.c
+++ b/gnucash/gnome-utils/gnc-cell-renderer-popup-entry.c
@@ -111,6 +111,9 @@ gnc_popup_entry_init (GncPopupEntry *widget)
     arrow = gtk_image_new_from_icon_name ("go-down", GTK_ICON_SIZE_BUTTON);
     gtk_widget_show (arrow);
 
+    g_signal_connect (G_OBJECT (arrow), "draw",
+                      G_CALLBACK (gnc_draw_arrow_cb), GINT_TO_POINTER(1));
+
     gtk_container_add (GTK_CONTAINER (widget->button), arrow);
 
     gtk_box_pack_start (GTK_BOX (widget->hbox), widget->entry, TRUE, TRUE, 0);
diff --git a/gnucash/gnome-utils/gnc-combott.c b/gnucash/gnome-utils/gnc-combott.c
index ea5bfd1..d68dfac 100644
--- a/gnucash/gnome-utils/gnc-combott.c
+++ b/gnucash/gnome-utils/gnc-combott.c
@@ -229,6 +229,9 @@ gctt_init (GncCombott *combott)
 
     arrow = gtk_image_new_from_icon_name ("go-down", GTK_ICON_SIZE_BUTTON);
 
+    g_signal_connect (G_OBJECT (arrow), "draw",
+                      G_CALLBACK (gnc_draw_arrow_cb), GINT_TO_POINTER(1));
+
 #if GTK_CHECK_VERSION(3,12,0)
     gtk_widget_set_margin_start (GTK_WIDGET(arrow), 5);
 #else
diff --git a/gnucash/gnome-utils/gnc-date-edit.c b/gnucash/gnome-utils/gnc-date-edit.c
index 1c9dcbe..583043d 100644
--- a/gnucash/gnome-utils/gnc-date-edit.c
+++ b/gnucash/gnome-utils/gnc-date-edit.c
@@ -929,6 +929,9 @@ create_children (GNCDateEdit *gde)
     /* Graphic for the popup button. */
     arrow = gtk_image_new_from_icon_name ("go-down", GTK_ICON_SIZE_BUTTON);
 
+    g_signal_connect (G_OBJECT (arrow), "draw",
+                      G_CALLBACK (gnc_draw_arrow_cb), GINT_TO_POINTER(1));
+
     gtk_box_pack_start (GTK_BOX (hbox), arrow, TRUE, FALSE, 0);
     gtk_widget_show (GTK_WIDGET(arrow));
 
diff --git a/gnucash/gnome-utils/gnc-tree-view.c b/gnucash/gnome-utils/gnc-tree-view.c
index 6e903f9..5999cd9 100644
--- a/gnucash/gnome-utils/gnc-tree-view.c
+++ b/gnucash/gnome-utils/gnc-tree-view.c
@@ -273,9 +273,12 @@ gnc_tree_view_init (GncTreeView *view, GncTreeViewClass *klass)
     /* Create the last column which contains the column selection
      * widget.  gnc_tree_view_add_text_column will do most of the
      * work. */
-    icon = gtk_image_new_from_icon_name ("go-down",
-                                    GTK_ICON_SIZE_SMALL_TOOLBAR);
+    icon = gtk_image_new_from_icon_name ("go-down", GTK_ICON_SIZE_SMALL_TOOLBAR);
     gtk_widget_show(icon);
+
+    g_signal_connect (G_OBJECT (icon), "draw",
+                      G_CALLBACK (gnc_draw_arrow_cb), GINT_TO_POINTER(1));
+
     gtk_widget_get_preferred_size(icon, &requisition, NULL);
     column = gnc_tree_view_add_text_column (view, NULL, NULL, NULL, NULL,
                                             -1, -1, NULL);

commit ec8e52e87e6977d1dfba58c662bd1dd228eaa141
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Aug 9 11:29:21 2017 +0100

    Add a draw callback to draw a theme based up/down arrow

diff --git a/gnucash/gnome-utils/dialog-utils.c b/gnucash/gnome-utils/dialog-utils.c
index 247b5d3..27ef5b1 100644
--- a/gnucash/gnome-utils/dialog-utils.c
+++ b/gnucash/gnome-utils/dialog-utils.c
@@ -293,6 +293,38 @@ gnc_widget_set_style_context (GtkWidget *widget, const char *gnc_class)
     gtk_style_context_add_class (context, gnc_class);
 }
 
+/********************************************************************\
+ * Draw an arrow on a Widget so it can be altered with css          *
+ *                                                                  *
+ * Args:     widget - widget to add arrow to in the draw callback   *
+ *               cr - cairo context for the draw callback           *
+ *        direction - 0 for up, 1 for down                          *
+ * Returns:  TRUE, stop other handlers being invoked for the event  *
+\********************************************************************/
+gboolean
+gnc_draw_arrow_cb (GtkWidget *widget, cairo_t *cr, gpointer direction)
+{
+    GtkStyleContext *context = gtk_widget_get_style_context (widget);
+    gint width = gtk_widget_get_allocated_width (widget);
+    gint height = gtk_widget_get_allocated_height (widget);
+    gint size;
+
+    gtk_render_background (context, cr, 0, 0, width, height);
+    gtk_style_context_add_class (context, GTK_STYLE_CLASS_ARROW);
+
+    size = MIN(width / 2, height / 2);
+
+    if (GPOINTER_TO_INT(direction) == 0)
+        gtk_render_arrow (context, cr, 0,
+                         (width - size)/2, (height - size)/2, size);
+    else
+        gtk_render_arrow (context, cr, G_PI,
+                         (width - size)/2, (height - size)/2, size);
+
+    return TRUE;
+}
+
+
 gboolean
 gnc_handle_date_accelerator (GdkEventKey *event,
                              struct tm *tm,
diff --git a/gnucash/gnome-utils/dialog-utils.h b/gnucash/gnome-utils/dialog-utils.h
index f311efa..06d7ff8 100644
--- a/gnucash/gnome-utils/dialog-utils.h
+++ b/gnucash/gnome-utils/dialog-utils.h
@@ -88,6 +88,16 @@ GtkTreeViewGridLines gnc_tree_view_get_grid_lines_pref (void);
 \********************************************************************/
 void gnc_widget_set_style_context (GtkWidget *widget, const char *gnc_class);
 
+/********************************************************************\
+ * Draw an arrow on a Widget so it can be altered with css          *
+ *                                                                  *
+ * Args:     widget - widget to add arrow to in the draw callback   *
+ *               cr - cairo context for the draw callback           *
+ *        direction - 0 for up, 1 for down                          *
+ * Returns:  TRUE, stop other handlers being invoked for the event  *
+\********************************************************************/
+gboolean gnc_draw_arrow_cb (GtkWidget *widget, cairo_t *cr, gpointer direction);
+
 gboolean gnc_handle_date_accelerator (GdkEventKey *event,
                                       struct tm *tm,
                                       const char *date_str);

commit 16a42799c02cf2e829b54e68d5b9c8bee83973bb
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Aug 8 17:22:14 2017 +0100

    Change the dense calender to use css so that it can be themed
    
    Change the dense calender so that it is based on css and can be made
    similar to the basic calender.

diff --git a/gnucash/gnome-utils/gnc-dense-cal.c b/gnucash/gnome-utils/gnc-dense-cal.c
index 8d2bc32..261b44f 100644
--- a/gnucash/gnome-utils/gnc-dense-cal.c
+++ b/gnucash/gnome-utils/gnc-dense-cal.c
@@ -69,11 +69,6 @@ static const int DENSE_CAL_DEFAULT_HEIGHT = 105;
 static const int MINOR_BORDER_SIZE = 1;
 static const int COL_BORDER_SIZE = 3;
 
-static const gchar* MONTH_THIS_COLOR = "lavender";
-static const gchar* MONTH_THAT_COLOR = "SlateGray1";
-
-static const gchar* MARK_COLOR = "Yellow";
-
 #undef G_LOG_DOMAIN
 #define G_LOG_DOMAIN "gnc.gui.dense-cal"
 
@@ -226,6 +221,10 @@ gnc_dense_cal_class_init(GncDenseCalClass *klass)
     object_class = G_OBJECT_CLASS (klass);
     widget_class = GTK_WIDGET_CLASS (klass);
 
+#if GTK_CHECK_VERSION(3,20,0)
+    gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(klass), "calendar");
+#endif
+
     parent_class = g_type_class_peek_parent (klass);
 
     object_class->finalize = gnc_dense_cal_finalize;
@@ -262,13 +261,17 @@ _gdc_get_view_options(void)
 static void
 gnc_dense_cal_init(GncDenseCal *dcal)
 {
+    GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET(dcal));
     gboolean colorAllocSuccess[MAX_COLORS];
 
     gtk_orientable_set_orientation (GTK_ORIENTABLE(dcal), GTK_ORIENTATION_VERTICAL);
 
     // Set the style context for this widget so it can be easily manipulated with css
-    gnc_widget_set_style_context (GTK_WIDGET(dcal), "GncDenseCal");
+    gnc_widget_set_style_context (GTK_WIDGET(dcal), "calendar");
 
+    gtk_widget_set_name (GTK_WIDGET(dcal), "dense-cal");
+
+    gtk_style_context_add_class (context, GTK_STYLE_CLASS_CALENDAR);
     {
         GtkTreeModel *options;
         GtkCellRenderer *text_rend;
@@ -300,6 +303,7 @@ gnc_dense_cal_init(GncDenseCal *dcal)
         gtk_box_pack_start(GTK_BOX(dcal), GTK_WIDGET(hbox), FALSE, FALSE, 0);
     }
     dcal->cal_drawing_area = GTK_DRAWING_AREA(gtk_drawing_area_new());
+
     gtk_widget_add_events(GTK_WIDGET(dcal->cal_drawing_area), (GDK_EXPOSURE_MASK
                           | GDK_BUTTON_PRESS_MASK
                           | GDK_BUTTON_RELEASE_MASK
@@ -331,6 +335,8 @@ gnc_dense_cal_init(GncDenseCal *dcal)
         hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
         gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);
 
+        gtk_widget_set_name (GTK_WIDGET(dcal->transPopup), "dense-cal-popup");
+
         l = gtk_label_new(_("Date: "));
         gtk_container_add(GTK_CONTAINER(hbox), l);
         l = gtk_label_new("YY/MM/DD");
@@ -344,6 +350,7 @@ gnc_dense_cal_init(GncDenseCal *dcal)
         tree_view = GTK_TREE_VIEW(gtk_tree_view_new_with_model(GTK_TREE_MODEL(tree_data)));
         gtk_tree_view_insert_column_with_attributes(tree_view, -1, _("Name"), gtk_cell_renderer_text_new(), "text", 0, NULL);
         gtk_tree_view_insert_column_with_attributes(tree_view, -1, _("Frequency"), gtk_cell_renderer_text_new(), "text", 1, NULL);
+        gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW(tree_view)), GTK_SELECTION_NONE);
         g_object_set_data(G_OBJECT(dcal->transPopup), "model", tree_data);
         gtk_container_add(GTK_CONTAINER(vbox), GTK_WIDGET(tree_view));
 
@@ -354,12 +361,6 @@ gnc_dense_cal_init(GncDenseCal *dcal)
         gtk_widget_realize(GTK_WIDGET(dcal->transPopup));
     }
 
-    gdk_rgba_parse(&dcal->weekColors[MONTH_THIS], MONTH_THIS_COLOR);
-    gdk_rgba_parse(&dcal->weekColors[MONTH_THAT], MONTH_THAT_COLOR);
-
-    /* success array must be as big as number of colors */
-    g_assert(MAX_COLORS == (sizeof(colorAllocSuccess)/sizeof(gboolean)));
-
     /* Deal with the various label sizes. */
     {
         PangoLayout *layout = gtk_widget_create_pango_layout(GTK_WIDGET(dcal), NULL);
@@ -877,11 +878,11 @@ gnc_dense_cal_draw(GtkWidget *widget, cairo_t *cr, gpointer user_data)
     g_return_val_if_fail(GNC_IS_DENSE_CAL(user_data), FALSE);
 
     dcal = GNC_DENSE_CAL(user_data);
+
     cairo_save (cr);;
     cairo_set_source_surface (cr, dcal->surface, 0, 0);
     cairo_paint (cr);
     cairo_restore (cr);
-
     return TRUE;
 }
 
@@ -930,7 +931,6 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
     GtkStyleContext *stylectxt;
     GtkStateFlags state_flags;
     GtkAllocation alloc;
-    GdkRGBA color, test_color;
     gint i;
     int maxWidth;
     PangoLayout *layout;
@@ -949,22 +949,15 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
     layout = gtk_widget_create_pango_layout(GTK_WIDGET(dcal), NULL);
     LOG_AND_RESET(timer, "create_pango_layout");
 
-    gdk_rgba_parse (&test_color, "rgba(0, 0, 0, 0)");
-
     gtk_widget_get_allocation (GTK_WIDGET(dcal->cal_drawing_area), &alloc);
-    stylectxt = gtk_widget_get_style_context (widget);
+    stylectxt = gtk_widget_get_style_context (GTK_WIDGET(dcal->cal_drawing_area));
     state_flags = gtk_style_context_get_state (stylectxt);
-    gnc_style_context_get_background_color (stylectxt, state_flags, &color);
 
-    // test for no color set
-    if (gdk_rgba_equal (&color, &test_color))
-        gdk_rgba_parse (&color, "white");
+    gtk_style_context_add_class (stylectxt, GTK_STYLE_CLASS_CALENDAR);
 
-    cairo_set_source_rgb (cr, color.red, color.green, color.blue);
-    cairo_rectangle (cr, 0, 0,
-                     cairo_image_surface_get_width (dcal->surface),
-                     cairo_image_surface_get_height (dcal->surface));
-    cairo_fill (cr);
+    gtk_render_background (stylectxt, cr, 0, 0,
+                           cairo_image_surface_get_width (dcal->surface),
+                           cairo_image_surface_get_height (dcal->surface));
 
     /* Fill in alternating month colors. */
     {
@@ -978,6 +971,8 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
             dcal->monthPositions[i].x = dcal->monthPositions[i].y = -1;
         }
 
+        gtk_style_context_save (stylectxt);
+
         /* Paint the weeks for the upcoming N months. */
         for (i = 0; i < dcal->numMonths; i++)
         {
@@ -990,25 +985,40 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
             for (mcListIter = mcList; mcListIter != NULL; mcListIter = mcListIter->next)
             {
                 rect = (GdkRectangle*)mcListIter->data;
-                color = dcal->weekColors[ i % 2 ];
-                cairo_set_source_rgb (cr, color.red, color.green, color.blue);
-                cairo_rectangle (cr, rect->x, rect->y,
-                                     rect->width, rect->height);
-                cairo_fill (cr);
+
+                if (i % 2 == 0)
+                {
+                    gtk_style_context_add_class (stylectxt, "primary");
+                    if (gtk_style_context_has_class (stylectxt, "secondary"))
+                        gtk_style_context_remove_class (stylectxt, "secondary");
+                }
+                else
+                {
+                    if (gtk_style_context_has_class (stylectxt, "primary"))
+                        gtk_style_context_remove_class (stylectxt, "primary");
+                    gtk_style_context_add_class (stylectxt, "secondary");
+                }
+                gtk_render_background (stylectxt, cr, rect->x, rect->y, rect->width, rect->height);
             }
             g_list_foreach(mcList, free_rect, NULL);
             g_list_free(mcList);
         }
+        gtk_style_context_restore (stylectxt);
     }
     LOG_AND_RESET(timer, "alternating month colors");
 
+
     /* Highlight the marked days. */
     {
         int i;
         int x1, x2, y1, y2;
 
-        gdk_rgba_parse(&color, MARK_COLOR);
-        cairo_set_source_rgb (cr, color.red, color.green, color.blue);
+        gtk_style_context_save (stylectxt);
+        gtk_style_context_add_class (stylectxt, "markers");
+#if GTK_CHECK_VERSION(3,22,0)
+        gtk_style_context_add_class (stylectxt, GTK_STYLE_CLASS_VIEW);
+        gtk_style_context_set_state (stylectxt, GTK_STATE_FLAG_SELECTED);
+#endif
 
         for (i = 0; i < dcal->numMarks; i++)
         {
@@ -1021,21 +1031,25 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
                 center_y = (y1 + y2 ) / 2;
                 radius = MIN((x2 - x1), (y2 - y1)) * .75;
 
-                cairo_arc (cr, center_x, center_y, radius, 0.0, 2 * M_PI);
-                cairo_fill (cr);
+                gtk_render_background (stylectxt, cr, center_x - radius - 2, center_y - radius, (radius * 2) + 4, radius * 2);
             }
         }
+        gtk_style_context_restore (stylectxt);
     }
     LOG_AND_RESET(timer, "marked days");
 
     for (i = 0; i < num_cols(dcal); i++)
     {
+        GdkRGBA color;
         gint x, y, w, h;
         gint j;
 
+        cairo_save (cr);
         pango_layout_set_text(layout, "S", -1);
         pango_layout_get_pixel_size(layout, NULL, &dcal->dayLabelHeight);
 
+        gdk_rgba_parse (&color, "black");
+
         x = dcal->leftPadding
             + (i * (col_width(dcal) + COL_BORDER_SIZE))
             + dcal->label_width;
@@ -1067,20 +1081,26 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
             cairo_line_to (cr, dx + 0.5, y + col_height(dcal));
             cairo_stroke (cr);
         }
+        cairo_restore (cr);
+
 
-        /* draw the day labels */
+        /* draw the day of the week labels */
         pango_layout_set_text(layout, "88", -1);
         pango_layout_get_pixel_size(layout, &maxWidth, NULL);
 
         if (dcal->x_scale > maxWidth)
         {
+            gtk_style_context_save (stylectxt);
+            gtk_style_context_add_class (stylectxt, GTK_STYLE_CLASS_HEADER);
+
+            gtk_render_background (stylectxt, cr, x, y - dcal->dayLabelHeight, (day_width(dcal) * 7) + 1, dcal->dayLabelHeight);
+
             for (j = 0; j < 7; j++)
             {
                 int day_label_width;
                 gint label_x_offset, label_y_offset;
-                gint day_label_str_len = 3;
+                gint day_label_str_len = 4;
                 gchar day_label_str[day_label_str_len+1];
-
                 day_label(day_label_str, day_label_str_len, (j + dcal->week_starts_monday) % 7);
                 pango_layout_set_text(layout, day_label_str, -1);
                 pango_layout_get_pixel_size(layout, &day_label_width, NULL);
@@ -1090,18 +1110,31 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
                                  - (day_label_width / 2);
                 label_y_offset = y - dcal->dayLabelHeight;
                 pango_layout_set_text(layout, day_label_str, -1);
-                gtk_style_context_get_color (stylectxt, state_flags, &color);
-                cairo_set_source_rgb (cr, color.red, color.green, color.blue);
-                cairo_move_to (cr, label_x_offset, label_y_offset);
-                pango_cairo_show_layout (cr, layout);
+                gtk_render_layout (stylectxt, cr, label_x_offset, label_y_offset, layout);
             }
+            gtk_style_context_restore (stylectxt);
         }
     }
     LOG_AND_RESET(timer, "lines and labels");
 
+
     /* Month labels. */
     {
         gint i;
+        gint x_offset = dcal->label_height - (dcal->leftPadding * 2);
+
+        gtk_style_context_save (stylectxt);
+        gtk_style_context_add_class (stylectxt, GTK_STYLE_CLASS_HEADER);
+
+        for (i = 0; i < 12; i++)
+        {
+            if (dcal->monthPositions[i].x == -1)
+                break;
+
+            gtk_render_background (stylectxt, cr, dcal->monthPositions[i].x + x_offset + 1, dcal->topPadding,
+                                   dcal->dayLabelHeight, col_height(dcal) + dcal->dayLabelHeight + 1);
+        }
+
         for (i = 0; i < 12; i++)
         {
             guint idx;
@@ -1110,19 +1143,18 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
                 break;
             idx = (dcal->month - 1 + i) % 12;
             pango_layout_set_text(layout, month_name(idx), -1);
-
             cairo_save (cr);
-            cairo_translate (cr, dcal->leftPadding + dcal->monthPositions[i].x,
-                               dcal->monthPositions[i].y);
-            cairo_move_to (cr, 0, 0);
+            cairo_translate (cr, dcal->monthPositions[i].x + x_offset, dcal->monthPositions[i].y);
             cairo_rotate (cr, -G_PI / 2.);
-            pango_cairo_show_layout (cr, layout);
+            gtk_render_layout (stylectxt, cr, 0, 0, layout);
             cairo_restore (cr);
         }
+        gtk_style_context_restore (stylectxt);
     }
     LOG_AND_RESET(timer, "month labels");
 
-    /* Try the per-day strings [dates] */
+
+    /* Day number strings [dates] */
     {
         GDate d, eoc;
         gint doc;
@@ -1130,6 +1162,10 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
         gint numW, numH;
         gint x1, y1, x2, y2, w, h;
 
+        gtk_style_context_save (stylectxt);
+        gtk_style_context_add_class (stylectxt, "day-number");
+
+        cairo_save (cr);
         g_date_set_dmy(&d, 1, dcal->month, dcal->year);
         eoc = d;
         g_date_add_months(&eoc, dcal->numMonths);
@@ -1142,10 +1178,10 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
             pango_layout_get_pixel_size(layout, &numW, &numH);
             w = (x2 - x1) + 1;
             h = (y2 - y1) + 1;
-            cairo_move_to (cr, x1 + (w / 2) - (numW / 2),
-                               y1 + (h / 2) - (numH / 2));
-            pango_cairo_show_layout (cr, layout);
+            gtk_render_layout (stylectxt, cr, x1 + (w / 2) - (numW / 2), y1 + (h / 2) - (numH / 2), layout);
         }
+        cairo_restore (cr);
+        gtk_style_context_restore (stylectxt);
     }
     LOG_AND_RESET(timer, "dates");
 
diff --git a/gnucash/gnome-utils/ui/gnucash-fallback.css b/gnucash/gnome-utils/ui/gnucash-fallback.css
index c6d1bad..df0d6fe 100644
--- a/gnucash/gnome-utils/ui/gnucash-fallback.css
+++ b/gnucash/gnome-utils/ui/gnucash-fallback.css
@@ -2,3 +2,16 @@
    directly by name as these are not brought in when loaded, only
    the widget type can be configured unless they are named in code */
 
+
+/* These are the defaults used in the dense-cal */
+*.primary {
+  background-color: lavender;
+}
+
+*.secondary {
+  background-color: SlateGray1;
+}
+
+*.markers {
+  background-color: yellow;
+}

commit 404214b7937b7baac0b2a663c4ace4e01b067304
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Aug 8 17:17:31 2017 +0100

    Add CSS provider of a lesser priority than themes
    
    Add a css provider that has a lesser priority than themes so that it
    can be over-ridden by the theme. This may turn out to be the only one
    required but for now keep the application one also.

diff --git a/gnucash/gnome-utils/gnc-gnome-utils.c b/gnucash/gnome-utils/gnc-gnome-utils.c
index 845f63e..12fa9c2 100644
--- a/gnucash/gnome-utils/gnc-gnome-utils.c
+++ b/gnucash/gnome-utils/gnc-gnome-utils.c
@@ -172,7 +172,7 @@ gnc_configure_date_completion (void)
 void
 gnc_add_css_file (void)
 {
-    GtkCssProvider *provider_user, *provider_app;
+    GtkCssProvider *provider_user, *provider_app, *provider_fallback;
     GdkDisplay *display;
     GdkScreen *screen;
     const gchar *var;
@@ -182,13 +182,20 @@ gnc_add_css_file (void)
 
     provider_user = gtk_css_provider_new ();
     provider_app = gtk_css_provider_new ();
+    provider_fallback = gtk_css_provider_new ();
     display = gdk_display_get_default ();
     screen = gdk_display_get_default_screen (display);
+
+    gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider_fallback), GTK_STYLE_PROVIDER_PRIORITY_THEME - 50);
     gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider_app), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
     gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider_user), GTK_STYLE_PROVIDER_PRIORITY_USER);
 
     if (pkgdatadir)
     {
+        str = g_build_filename (pkgdatadir, "ui", "gnucash-fallback.css", (char *)NULL);
+        gtk_css_provider_load_from_path (provider_fallback, str, &error);
+        g_free (str);
+ 
         str = g_build_filename (pkgdatadir, "ui", "gnucash.css", (char *)NULL);
         gtk_css_provider_load_from_path (provider_app, str, &error);
         g_free (str);
@@ -204,6 +211,7 @@ gnc_add_css_file (void)
     }
     g_object_unref (provider_user);
     g_object_unref (provider_app);
+    g_object_unref (provider_fallback);
 }
 
 #ifdef MAC_INTEGRATION
diff --git a/gnucash/gnome-utils/ui/CMakeLists.txt b/gnucash/gnome-utils/ui/CMakeLists.txt
index a014a1a..d0bfa4a 100644
--- a/gnucash/gnome-utils/ui/CMakeLists.txt
+++ b/gnucash/gnome-utils/ui/CMakeLists.txt
@@ -16,6 +16,7 @@ SET(gnome_utils_ui_DIST_local
         Makefile.am
         osx_accel_map
         gnucash.css
+        gnucash-fallback.css
         )
 
 SET_DIST_LIST(gnome_utils_ui_DIST ${gnome_utils_ui_DIST_local})
diff --git a/gnucash/gnome-utils/ui/Makefile.am b/gnucash/gnome-utils/ui/Makefile.am
index 7acda83..4eeeec0 100644
--- a/gnucash/gnome-utils/ui/Makefile.am
+++ b/gnucash/gnome-utils/ui/Makefile.am
@@ -4,6 +4,7 @@ ui_DATA = \
 	gnc-windows-menu-ui.xml \
 	gnc-windows-menu-ui-quartz.xml \
 	osx_accel_map \
-	gnucash.css
+	gnucash.css \
+	gnucash-fallback.css
 
 EXTRA_DIST = $(ui_DATA) CMakeLists.txt
diff --git a/gnucash/gnome-utils/ui/gnucash-fallback.css b/gnucash/gnome-utils/ui/gnucash-fallback.css
new file mode 100644
index 0000000..c6d1bad
--- /dev/null
+++ b/gnucash/gnome-utils/ui/gnucash-fallback.css
@@ -0,0 +1,4 @@
+/* Note: Widgets obtained from Glade files will not be addressable
+   directly by name as these are not brought in when loaded, only
+   the widget type can be configured unless they are named in code */
+

commit 8d8073aafa75b1492fe5f171d83539d16b98fa05
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Aug 8 17:10:21 2017 +0100

    Remove the rules hint from gnc-tree-view to align with current setting

diff --git a/gnucash/gnome-utils/gnc-tree-view.c b/gnucash/gnome-utils/gnc-tree-view.c
index 3028c99..6e903f9 100644
--- a/gnucash/gnome-utils/gnc-tree-view.c
+++ b/gnucash/gnome-utils/gnc-tree-view.c
@@ -247,9 +247,6 @@ gnc_tree_view_init (GncTreeView *view, GncTreeViewClass *klass)
     priv->sort_column_changed_cb_id = 0;
     priv->size_allocate_cb_id = 0;
 
-    /* Ask gtk to help the user keep track of rows. */
-    g_object_set(view, "rules-hint", TRUE, NULL);
-
     // Set the style context for this page so it can be easily manipulated with css
     gnc_widget_set_style_context (GTK_WIDGET(view), "GncTreeView");
 



Summary of changes:
 CMakeLists.txt                                     |   4 +-
 gnucash/gnome-utils/dialog-account.c               |   2 +-
 gnucash/gnome-utils/dialog-utils.c                 |  36 +++-
 gnucash/gnome-utils/dialog-utils.h                 |  10 +
 .../gnome-utils/gnc-cell-renderer-popup-entry.c    |   3 +
 gnucash/gnome-utils/gnc-combott.c                  |   3 +
 gnucash/gnome-utils/gnc-date-edit.c                |   3 +
 gnucash/gnome-utils/gnc-dense-cal.c                | 217 ++++++++++++---------
 gnucash/gnome-utils/gnc-dense-cal.h                |   9 -
 gnucash/gnome-utils/gnc-gnome-utils.c              |  10 +-
 gnucash/gnome-utils/gnc-gtk-utils.c                |  75 +++++++
 gnucash/gnome-utils/gnc-gtk-utils.h                |   8 +
 gnucash/gnome-utils/gnc-tree-model-account.c       |  15 +-
 gnucash/gnome-utils/gnc-tree-view-split-reg.c      |   2 +-
 gnucash/gnome-utils/gnc-tree-view.c                |  10 +-
 gnucash/gnome-utils/ui/CMakeLists.txt              |   1 +
 gnucash/gnome-utils/ui/Makefile.am                 |   3 +-
 gnucash/gnome-utils/ui/gnucash-fallback.css        |  83 ++++++++
 gnucash/gnome-utils/ui/gnucash.css                 |  35 +---
 gnucash/gnome-utils/window-main-summarybar.c       | 126 +++++++++++-
 gnucash/import-export/dialog-import.glade          |   6 +-
 gnucash/import-export/import-main-matcher.c        |  97 ++++++---
 .../register/register-gnome/gnucash-item-edit.c    |  55 ++++--
 .../register/register-gnome/gnucash-item-edit.h    |   3 +-
 gnucash/register/register-gnome/gnucash-sheet.c    |  20 +-
 libgnucash/backend/xml/test/test-kvp-frames.cpp    |   2 +-
 libgnucash/engine/kvp-value.cpp                    |  14 +-
 libgnucash/engine/kvp-value.hpp                    |   2 +-
 28 files changed, 611 insertions(+), 243 deletions(-)
 create mode 100644 gnucash/gnome-utils/ui/gnucash-fallback.css



More information about the gnucash-changes mailing list