gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sun Jul 15 13:50:32 EDT 2018


Updated	 via  https://github.com/Gnucash/gnucash/commit/374477c3 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/8c4a5adb (commit)
	 via  https://github.com/Gnucash/gnucash/commit/b95981e6 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/aa77b21d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/c513d788 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/0199fef5 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a75eb4c8 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3b093131 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3e37b879 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/36dc2acd (commit)
	 via  https://github.com/Gnucash/gnucash/commit/0e4898fe (commit)
	from  https://github.com/Gnucash/gnucash/commit/43af50bd (commit)



commit 374477c3604112349bf685afacdf80d8681a64f2
Merge: 8c4a5ad 36dc2ac
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Jul 15 10:47:19 2018 -0700

    Merge Bob Fewell's 'color-accounts' into maint.


commit 8c4a5adb43a1ca9a90fdee565625136349771405
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Jul 15 16:42:24 2018 +0100

    Align the Reconcile totals in the Reconcile Window.
    
    This change aligns the totals with the account column by obtaining the
    reconcile column width and adjusting the label padding. This is done at
    initial display so it does not track column resizing or the use of the
    scrollbar.

diff --git a/gnucash/gnome/reconcile-view.c b/gnucash/gnome/reconcile-view.c
index 713d2de..382807a 100644
--- a/gnucash/gnome/reconcile-view.c
+++ b/gnucash/gnome/reconcile-view.c
@@ -233,6 +233,18 @@ gnc_reconcile_view_tooltip_cb (GNCQueryView *qview, gint x, gint y,
 }
 
 
+gint
+gnc_reconcile_view_get_column_width (GNCReconcileView *view, gint column)
+{
+    GNCQueryView      *qview = GNC_QUERY_VIEW (view);
+    GtkTreeViewColumn *col;
+
+    //allow for pointer model column at column 0
+    col = gtk_tree_view_get_column (GTK_TREE_VIEW (qview), (column - 1));
+    return  gtk_tree_view_column_get_width (col);
+}
+
+
 void
 gnc_reconcile_view_add_padding (GNCReconcileView *view, gint column, gint xpadding)
 {
diff --git a/gnucash/gnome/reconcile-view.h b/gnucash/gnome/reconcile-view.h
index 13763d2..1265794 100644
--- a/gnucash/gnome/reconcile-view.h
+++ b/gnucash/gnome/reconcile-view.h
@@ -112,6 +112,8 @@ gboolean gnc_reconcile_view_changed (GNCReconcileView *view);
 
 void gnc_reconcile_view_add_padding (GNCReconcileView *view, gint column, gint xpadding);
 
+gint gnc_reconcile_view_get_column_width (GNCReconcileView *view, gint column);
+
 G_END_DECLS
 
 #endif /* GNC_RECONCILE_VIEW_H */
diff --git a/gnucash/gnome/window-reconcile.c b/gnucash/gnome/window-reconcile.c
index d4b0dd9..1bcf896 100644
--- a/gnucash/gnome/window-reconcile.c
+++ b/gnucash/gnome/window-reconcile.c
@@ -2001,6 +2001,18 @@ recnWindowWithBalance (Account *account, gnc_numeric new_ending,
 
     gtk_widget_grab_focus (recnData->debit);
 
+    {   // align the Totals value with that of the amount column
+        gint recn_widthc = gnc_reconcile_view_get_column_width (GNC_RECONCILE_VIEW(recnData->credit), REC_RECN);
+        gint recn_widthd = gnc_reconcile_view_get_column_width (GNC_RECONCILE_VIEW(recnData->debit), REC_RECN);
+
+#if GTK_CHECK_VERSION(3,12,0)
+        gtk_widget_set_margin_end (GTK_WIDGET(recnData->total_credit), 10 + recn_widthc);
+        gtk_widget_set_margin_end (GTK_WIDGET(recnData->total_debit), 10 + recn_widthd);
+#else
+        gtk_widget_set_margin_right (GTK_WIDGET(recnData->total_credit), 10 + recn_widthc);
+        gtk_widget_set_margin_right (GTK_WIDGET(recnData->total_debit), 10 + recn_widthd);
+#endif
+    }
     return recnData;
 }
 

commit b95981e6af9a47e09c104c08a448553d19dfa53b
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Jul 15 16:41:30 2018 +0100

    Bug 796751 - reconcile window usability - R column should be...
    
    next to Amount.
    
    With the use of the previous update the original order is possible as
    the scrollbar is not hovering over the reconcile tick box

diff --git a/gnucash/gnome/reconcile-view.c b/gnucash/gnome/reconcile-view.c
index e3d2389..713d2de 100644
--- a/gnucash/gnome/reconcile-view.c
+++ b/gnucash/gnome/reconcile-view.c
@@ -242,6 +242,7 @@ gnc_reconcile_view_add_padding (GNCReconcileView *view, gint column, gint xpaddi
     GtkCellRenderer   *cr0;
     gint xpad, ypad;
 
+    //allow for pointer model column at column 0
     col = gtk_tree_view_get_column (GTK_TREE_VIEW (qview), (column - 1));
     renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (col));
     cr0 = g_list_nth_data (renderers, 0);
@@ -328,8 +329,8 @@ gnc_reconcile_view_new (Account *account, GNCReconcileViewType type,
 
     /* Create the list store with 6 columns and add to treeview,
        column 0 will be a pointer to the entry */
-    liststore = gtk_list_store_new (6, G_TYPE_POINTER, G_TYPE_BOOLEAN,
-                G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING );
+    liststore = gtk_list_store_new (6, G_TYPE_POINTER, G_TYPE_STRING,
+                G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,  G_TYPE_BOOLEAN );
     gtk_tree_view_set_model (GTK_TREE_VIEW (view), GTK_TREE_MODEL (liststore));
     g_object_unref (liststore);
 
@@ -407,6 +408,15 @@ gnc_reconcile_view_init (GNCReconcileView *view)
     view->account = NULL;
     view->sibling = NULL;
 
+    param = gnc_search_param_simple_new();
+    gnc_search_param_set_param_fcn (param, QOF_TYPE_BOOLEAN,
+                                    gnc_reconcile_view_is_reconciled, view);
+    gnc_search_param_set_title ((GNCSearchParam *) param, _("Reconciled:R") + 11);
+    gnc_search_param_set_justify ((GNCSearchParam *) param, GTK_JUSTIFY_CENTER);
+    gnc_search_param_set_passive ((GNCSearchParam *) param, FALSE);
+    gnc_search_param_set_non_resizeable ((GNCSearchParam *) param, TRUE);
+    columns = g_list_prepend (columns, param);
+
     columns = gnc_search_param_prepend_with_justify (columns, _("Amount"),
               GTK_JUSTIFY_RIGHT,
               NULL, GNC_ID_SPLIT,
@@ -426,15 +436,6 @@ gnc_reconcile_view_init (GNCReconcileView *view)
     columns = gnc_search_param_prepend (columns, _("Date"), NULL, GNC_ID_SPLIT,
                                         SPLIT_TRANS, TRANS_DATE_POSTED, NULL);
 
-    param = gnc_search_param_simple_new();
-    gnc_search_param_set_param_fcn (param, QOF_TYPE_BOOLEAN,
-                                    gnc_reconcile_view_is_reconciled, view);
-    gnc_search_param_set_title ((GNCSearchParam *) param, _("Reconciled:R") + 11);
-    gnc_search_param_set_justify ((GNCSearchParam *) param, GTK_JUSTIFY_CENTER);
-    gnc_search_param_set_passive ((GNCSearchParam *) param, FALSE);
-    gnc_search_param_set_non_resizeable ((GNCSearchParam *) param, TRUE);
-    columns = g_list_prepend (columns, param);
-
     view->column_list = columns;
 }
 
diff --git a/gnucash/gnome/reconcile-view.h b/gnucash/gnome/reconcile-view.h
index 4206935..13763d2 100644
--- a/gnucash/gnome/reconcile-view.h
+++ b/gnucash/gnome/reconcile-view.h
@@ -47,11 +47,11 @@ typedef enum
 enum
 {
     REC_POINTER, //0
-    REC_RECN,    //1
-    REC_DATE,    //2
-    REC_NUM,     //3
-    REC_DESC,    //4
-    REC_AMOUNT   //5
+    REC_DATE,    //1
+    REC_NUM,     //2
+    REC_DESC,    //3
+    REC_AMOUNT,  //4
+    REC_RECN,    //5
 };
 
 struct GNCReconcileView
diff --git a/gnucash/gnome/window-reconcile.c b/gnucash/gnome/window-reconcile.c
index cdb4050..d4b0dd9 100644
--- a/gnucash/gnome/window-reconcile.c
+++ b/gnucash/gnome/window-reconcile.c
@@ -1190,8 +1190,8 @@ gnc_reconcile_window_create_view_box(Account *account,
     vscroll = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (scrollWin));
     gtk_widget_get_preferred_size (vscroll, NULL, &nat_sb);
 
-    // add xpadding to amount column so scrollbar does not cover
-    gnc_reconcile_view_add_padding (GNC_RECONCILE_VIEW(view), REC_AMOUNT, nat_sb.width);
+    // add xpadding to recn column so scrollbar does not cover
+    gnc_reconcile_view_add_padding (GNC_RECONCILE_VIEW(view), REC_RECN, nat_sb.width);
 
     hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
     gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);

commit aa77b21dfb49c2ba2c86814d0362fc0dca7c5d26
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Jul 15 16:40:18 2018 +0100

    Reconcile vertical scrollbars hover over tree view data
    
    In the reconcile window the vertical scrollbars when selected obscure
    the tree view data so get the width of the scrollbar and add it to the
    cell renderer x padding of the last column.

diff --git a/gnucash/gnome/reconcile-view.c b/gnucash/gnome/reconcile-view.c
index 673825e..e3d2389 100644
--- a/gnucash/gnome/reconcile-view.c
+++ b/gnucash/gnome/reconcile-view.c
@@ -233,6 +233,25 @@ gnc_reconcile_view_tooltip_cb (GNCQueryView *qview, gint x, gint y,
 }
 
 
+void
+gnc_reconcile_view_add_padding (GNCReconcileView *view, gint column, gint xpadding)
+{
+    GNCQueryView      *qview = GNC_QUERY_VIEW (view);
+    GtkTreeViewColumn *col;
+    GList             *renderers;
+    GtkCellRenderer   *cr0;
+    gint xpad, ypad;
+
+    col = gtk_tree_view_get_column (GTK_TREE_VIEW (qview), (column - 1));
+    renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (col));
+    cr0 = g_list_nth_data (renderers, 0);
+    g_list_free (renderers);
+
+    gtk_cell_renderer_get_padding (cr0, &xpad, &ypad);
+    gtk_cell_renderer_set_padding (cr0, xpadding, ypad);
+}
+
+
 /****************************************************************************\
  * gnc_reconcile_view_new                                                   *
  *   creates the account tree                                               *
diff --git a/gnucash/gnome/reconcile-view.h b/gnucash/gnome/reconcile-view.h
index f0d433e..4206935 100644
--- a/gnucash/gnome/reconcile-view.h
+++ b/gnucash/gnome/reconcile-view.h
@@ -110,6 +110,8 @@ void gnc_reconcile_view_unselect_all (GNCReconcileView *view);
 
 gboolean gnc_reconcile_view_changed (GNCReconcileView *view);
 
+void gnc_reconcile_view_add_padding (GNCReconcileView *view, gint column, gint xpadding);
+
 G_END_DECLS
 
 #endif /* GNC_RECONCILE_VIEW_H */
diff --git a/gnucash/gnome/window-reconcile.c b/gnucash/gnome/window-reconcile.c
index 6d6f8b7..cdb4050 100644
--- a/gnucash/gnome/window-reconcile.c
+++ b/gnucash/gnome/window-reconcile.c
@@ -1141,6 +1141,8 @@ gnc_reconcile_window_create_view_box(Account *account,
                                      GtkWidget **total_save)
 {
     GtkWidget *frame, *scrollWin, *view, *vbox, *label, *hbox;
+    GtkWidget *vscroll;
+    GtkRequisition nat_sb;
 
     frame = gtk_frame_new(NULL);
 
@@ -1184,6 +1186,13 @@ gnc_reconcile_window_create_view_box(Account *account,
     gtk_container_add(GTK_CONTAINER(scrollWin), view);
     gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
 
+    // get the vertical scroll bar width
+    vscroll = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (scrollWin));
+    gtk_widget_get_preferred_size (vscroll, NULL, &nat_sb);
+
+    // add xpadding to amount column so scrollbar does not cover
+    gnc_reconcile_view_add_padding (GNC_RECONCILE_VIEW(view), REC_AMOUNT, nat_sb.width);
+
     hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
     gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);
     gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
@@ -1197,9 +1206,9 @@ gnc_reconcile_window_create_view_box(Account *account,
     *total_save = label;
 
 #if GTK_CHECK_VERSION(3,12,0)
-    gtk_widget_set_margin_end (GTK_WIDGET(label), 10);
+    gtk_widget_set_margin_end (GTK_WIDGET(label), 10 + nat_sb.width);
 #else
-    gtk_widget_set_margin_right (GTK_WIDGET(label), 10);
+    gtk_widget_set_margin_right (GTK_WIDGET(label), 10 + nat_sb.width);
 #endif
 
     return vbox;

commit c513d788460afb9727c0fc82224235387850464c
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Jul 15 16:39:18 2018 +0100

    Remove white space and tabs from gnc-main-window.c

diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
index f5b2b58..11e8095 100644
--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -1,6 +1,6 @@
 /*
  * gnc-main-window.c -- GtkWindow which represents the
- *	GnuCash main window.
+ *  GnuCash main window.
  *
  * Copyright (C) 2003 Jan Arne Petersen <jpetersen at uni-bonn.de>
  * Copyright (C) 2003,2005,2006 David Hampton <hampton at employees.org>
@@ -1670,9 +1670,8 @@ static gchar *generate_statusbar_lastmodified_message()
                     last modification. The string is a format string using
                     boost::date_time's format flags, see the boost docs for an
                     explanation of the modifiers. */
-                    char *time_string =
-			gnc_print_time64(statbuf.st_mtime,
-					 _("Last modified on %a, %b %d, %Y at %I:%M %p"));
+                    char *time_string = gnc_print_time64(statbuf.st_mtime,
+                     _("Last modified on %a, %b %d, %Y at %I:%M %p"));
                     //g_warning("got time %ld, str=%s\n", mtime, time_string);
                     /* Translators: This message appears in the status bar after opening the file. */
                     message = g_strdup_printf(_("File %s opened. %s"),
@@ -2695,7 +2694,7 @@ gnc_main_window_destroy (GtkWidget *widget)
         g_list_free (plugins);
     }
     if (priv->about_dialog)
-	g_object_unref (priv->about_dialog);
+        g_object_unref (priv->about_dialog);
     GTK_WIDGET_CLASS (parent_class)->destroy (widget);
 }
 
@@ -4481,11 +4480,11 @@ get_file (const gchar *partial)
     filename = gnc_filepath_locate_doc_file(partial);
     if (filename && g_file_get_contents(filename, &text, &length, NULL))
     {
-	if (length)
-	{
-	    g_free(filename);
-	    return text;
-	}
+        if (length)
+        {
+            g_free(filename);
+            return text;
+        }
         g_free(text);
     }
     g_free (filename);
@@ -4544,15 +4543,15 @@ gnc_main_window_cmd_help_about (GtkAction *action, GncMainWindow *window)
     if (priv->about_dialog == NULL)
     {
         /* Translators: %s will be replaced with the current year */
-	gchar *copyright = g_strdup_printf(_("Copyright © 1997-%s The GnuCash contributors."),
+        gchar *copyright = g_strdup_printf(_("Copyright © 1997-%s The GnuCash contributors."),
                                            GNC_VCS_REV_YEAR);
-	gchar **authors = get_file_strsplit("AUTHORS");
-	gchar **documenters = get_file_strsplit("DOCUMENTERS");
-	gchar *license = get_file("LICENSE");
+        gchar **authors = get_file_strsplit("AUTHORS");
+        gchar **documenters = get_file_strsplit("DOCUMENTERS");
+        gchar *license = get_file("LICENSE");
         gchar *version = NULL;
         gchar *vcs = NULL;
         GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
-	GdkPixbuf *logo = gtk_icon_theme_load_icon (icon_theme,
+        GdkPixbuf *logo = gtk_icon_theme_load_icon (icon_theme,
                                                     GNC_ICON_APP,
                                                     128,
                                                     GTK_ICON_LOOKUP_USE_BUILTIN,
@@ -4574,41 +4573,44 @@ gnc_main_window_cmd_help_about (GtkAction *action, GncMainWindow *window)
             version = g_strdup_printf ("%s: %s\n%s: %s%s (%s)\nFinance::Quote: %s", _("Version"), VERSION,
                                        _("Build ID"), vcs, GNC_VCS_REV, GNC_VCS_REV_DATE,
                                        gnc_quote_source_fq_version () ? gnc_quote_source_fq_version () : "-");
-	priv->about_dialog = gtk_about_dialog_new ();
-	g_object_set (priv->about_dialog,
-		      "authors", authors,
-		      "documenters", documenters,
-		      "comments", _("Accounting for personal and small business finance."),
-		      "copyright", copyright,
-		      "license", license,
-		      "logo", logo,
-		      "name", "GnuCash",
-     /* Translators: the following string will be shown in Help->About->Credits
-      * Enter your name or that of your team and an email contact for feedback.
-      * The string can have multiple rows, so you can also add a list of
-      * contributors. */
-		      "translator-credits", _("translator_credits"),
-		      "version", version,
-		      "website", "http://www.gnucash.org",
-		      "website_label", _("Visit the GnuCash website."),
-		      NULL);
+        priv->about_dialog = gtk_about_dialog_new ();
+        g_object_set (priv->about_dialog,
+                  "authors", authors,
+                  "documenters", documenters,
+                  "comments", _("Accounting for personal and small business finance."),
+                  "copyright", copyright,
+                  "license", license,
+                  "logo", logo,
+                  "name", "GnuCash",
+         /* Translators: the following string will be shown in Help->About->Credits
+          * Enter your name or that of your team and an email contact for feedback.
+          * The string can have multiple rows, so you can also add a list of
+          * contributors. */
+                  "translator-credits", _("translator_credits"),
+                  "version", version,
+                  "website", "http://www.gnucash.org",
+                  "website_label", _("Visit the GnuCash website."),
+                  NULL);
 
         g_free(version);
-	g_free(copyright);
-	if (license)     g_free(license);
-	if (documenters) g_strfreev(documenters);
-	if (authors)     g_strfreev(authors);
-	g_object_unref (logo);
-	g_signal_connect (priv->about_dialog, "activate-link",
-			  G_CALLBACK (url_signal_cb), NULL);
-	g_signal_connect (priv->about_dialog, "response",
-			  G_CALLBACK (gtk_widget_hide), NULL);
+        g_free(copyright);
+        if (license)
+             g_free(license);
+        if (documenters)
+             g_strfreev(documenters);
+        if (authors)
+             g_strfreev(authors);
+        g_object_unref (logo);
+        g_signal_connect (priv->about_dialog, "activate-link",
+              G_CALLBACK (url_signal_cb), NULL);
+        g_signal_connect (priv->about_dialog, "response",
+              G_CALLBACK (gtk_widget_hide), NULL);
 
         /* Set dialog to resize. */
         gtk_window_set_resizable(GTK_WINDOW(priv->about_dialog), TRUE);
 
-	gtk_window_set_transient_for (GTK_WINDOW (priv->about_dialog),
-				      GTK_WINDOW (window));
+        gtk_window_set_transient_for (GTK_WINDOW (priv->about_dialog),
+                          GTK_WINDOW (window));
     }
     gtk_dialog_run (GTK_DIALOG (priv->about_dialog));
 }

commit 0199fef5847fc60f5ed36e1dcf9cc4ed0717dedc
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Jul 15 16:38:29 2018 +0100

    Add the toolbar preference changes to window-reconcile.
    
    Fixes Bug 796739 - Toolbar buttons have no labels, part 3 of 3.

diff --git a/gnucash/gnome/window-reconcile.c b/gnucash/gnome/window-reconcile.c
index 3836bfd..6d6f8b7 100644
--- a/gnucash/gnome/window-reconcile.c
+++ b/gnucash/gnome/window-reconcile.c
@@ -81,6 +81,8 @@ struct _RecnWindow
 
     GtkUIManager *ui_merge;
     GtkActionGroup *action_group;
+    GtkWidget *dock;
+    GtkWidget *toolbar;
 
     GtkWidget *starting;         /* The starting balance                 */
     GtkWidget *ending;           /* The ending balance                   */
@@ -1670,13 +1672,44 @@ recnWindow (GtkWidget *parent, Account *account)
 static void
 recnWindow_add_widget (GtkUIManager *merge,
                        GtkWidget *widget,
-                       GtkBox *dock)
+                       RecnWindow *recnData)
 {
-    gtk_box_pack_start (GTK_BOX (dock), widget, FALSE, FALSE, 0);
+
+    if (GTK_IS_TOOLBAR (widget))
+    {
+      recnData->toolbar = widget;
+
+        gtk_toolbar_set_style (GTK_TOOLBAR(widget),
+            gnc_prefs_get_int (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TOOLBAR_STYLE));
+
+        // prefs has only small and large icons so add 2 to get right enum
+        gtk_toolbar_set_icon_size (GTK_TOOLBAR(widget),
+           (gnc_prefs_get_int (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TOOLBAR_ICON_SIZE)) + 2);
+    }
+
+    gtk_box_pack_start (GTK_BOX (recnData->dock), widget, FALSE, FALSE, 0);
     gtk_widget_show (widget);
 }
 
 
+static void
+recn_window_update_toolbar (gpointer prefs, gchar *pref, RecnWindow *recnData)
+{
+    GtkToolbar *tb;
+    gint selection;
+
+    tb = GTK_TOOLBAR(recnData->toolbar);
+
+    selection = gnc_prefs_get_int (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TOOLBAR_STYLE);
+    if (gtk_toolbar_get_style (tb) != selection)
+        gtk_toolbar_set_style (tb, selection);
+
+    selection = gnc_prefs_get_int (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TOOLBAR_ICON_SIZE);
+    // prefs has only small and large icons so add 2 to get right enum
+    if (gtk_toolbar_get_icon_size (tb) != selection + 2)
+        gtk_toolbar_set_icon_size (tb, selection + 2);
+}
+
 /********************************************************************\
  * recnWindowWithBalance
  *
@@ -1743,8 +1776,9 @@ recnWindowWithBalance (Account *account, gnc_numeric new_ending,
         GError *error = NULL;
 
         recnData->ui_merge = gtk_ui_manager_new ();
+        recnData->dock = dock;
         g_signal_connect (recnData->ui_merge, "add_widget",
-                          G_CALLBACK (recnWindow_add_widget), dock);
+                          G_CALLBACK (recnWindow_add_widget), recnData);
 
         action_group = gtk_action_group_new ("ReconcileWindowActions");
         recnData->action_group = action_group;
@@ -1922,6 +1956,13 @@ recnWindowWithBalance (Account *account, gnc_numeric new_ending,
         recnRefresh (recnData);
     }
 
+    /* track toolbar preference changes */
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TOOLBAR_STYLE,
+                           recn_window_update_toolbar, recnData);
+
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TOOLBAR_ICON_SIZE,
+                           recn_window_update_toolbar, recnData);
+
     /* Allow resize */
     gtk_window_set_resizable(GTK_WINDOW(recnData->window), TRUE);
     gtk_widget_show_all(recnData->window);
@@ -1993,6 +2034,12 @@ recn_destroy_cb (GtkWidget *w, gpointer data)
     if (recnData->delete_refresh)
         gnc_resume_gui_refresh ();
 
+    gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TOOLBAR_STYLE,
+                                 recn_window_update_toolbar, recnData);
+
+    gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TOOLBAR_ICON_SIZE,
+                                 recn_window_update_toolbar, recnData);
+
     g_free (recnData);
 }
 

commit a75eb4c8ec2668e4e79895b2923ca6a816c90fe1
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Jul 15 16:37:50 2018 +0100

    Add toolbar preference changes to embedded-window.
    
    Fixes Bug 796739 - Toolbar buttons have no labels, part 2 of 3.

diff --git a/gnucash/gnome-utils/gnc-embedded-window.c b/gnucash/gnome-utils/gnc-embedded-window.c
index 605d7dd..c32d1de 100644
--- a/gnucash/gnome-utils/gnc-embedded-window.c
+++ b/gnucash/gnome-utils/gnc-embedded-window.c
@@ -1,6 +1,6 @@
 /*
  * gnc-main-window.c -- GtkWindow which represents the
- *	GnuCash main window.
+ *  GnuCash main window.
  *
  * Copyright (C) 2003 Jan Arne Petersen <jpetersen at uni-bonn.de>
  * Copyright (C) 2003 David Hampton <hampton at employees.org>
@@ -38,6 +38,7 @@
 #include "gnc-plugin-manager.h"
 #include "gnc-ui.h"
 #include "gnc-window.h"
+#include "gnc-prefs.h"
 #include "dialog-utils.h"
 
 /* Static Globals *******************************************************/
@@ -308,6 +309,13 @@ gnc_embedded_window_add_widget (GtkUIManager *merge,
     if (GTK_IS_TOOLBAR (widget))
     {
         priv->toolbar = widget;
+
+        gtk_toolbar_set_style (GTK_TOOLBAR(priv->toolbar),
+            gnc_prefs_get_int (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TOOLBAR_STYLE));
+
+        // prefs has only small and large icons so add 2 to get right enum
+        gtk_toolbar_set_icon_size (GTK_TOOLBAR(priv->toolbar),
+           (gnc_prefs_get_int (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TOOLBAR_ICON_SIZE)) + 2);
     }
 
     gtk_box_pack_start (GTK_BOX (priv->menu_dock), widget, FALSE, FALSE, 0);

commit 3b0931310730a4ae5d028a1e2120d2a619ae975a
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Jul 15 16:36:56 2018 +0100

    Add preference to control toolbar appearance
    
    Add preferences to select icon size and item layout on the toolbar.
    Fixes Bug 796739 - Toolbar buttons have no labels, part 1 of 3.

diff --git a/gnucash/gnome-utils/dialog-preferences.c b/gnucash/gnome-utils/dialog-preferences.c
index 815587e..f17b2d9 100644
--- a/gnucash/gnome-utils/dialog-preferences.c
+++ b/gnucash/gnome-utils/dialog-preferences.c
@@ -1229,6 +1229,8 @@ gnc_preferences_dialog_create(GtkWindow *parent)
     gnc_builder_add_from_file (builder, "dialog-preferences.glade", "retain_days_adj");
     gnc_builder_add_from_file (builder, "dialog-preferences.glade", "tab_width_adj");
     gnc_builder_add_from_file (builder, "dialog-preferences.glade", "date_formats");
+    gnc_builder_add_from_file (builder, "dialog-preferences.glade", "toolbar-styles");
+    gnc_builder_add_from_file (builder, "dialog-preferences.glade", "toolbar-icon-sizes");
     gnc_builder_add_from_file (builder, "dialog-preferences.glade", "gnucash_preferences_dialog");
 
     dialog = GTK_WIDGET(gtk_builder_get_object (builder, "gnucash_preferences_dialog"));
diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
index 51a0f49..f5b2b58 100644
--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -3341,6 +3341,28 @@ gnc_main_window_update_tab_position (gpointer prefs, gchar *pref, gpointer user_
     LEAVE ("");
 }
 
+static void
+gnc_main_window_update_toolbar (gpointer prefs, gchar *pref, gpointer user_data)
+{
+    GncMainWindow *window;
+    GtkToolbar *tb;
+    GncMainWindowPrivate *priv;
+    gint selection;
+
+    window = GNC_MAIN_WINDOW(user_data);
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE (window);
+    tb = GTK_TOOLBAR(priv->toolbar);
+
+    selection = gnc_prefs_get_int (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TOOLBAR_STYLE);
+    if (gtk_toolbar_get_style (tb) != selection)
+        gtk_toolbar_set_style (tb, selection);
+
+    selection = gnc_prefs_get_int (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TOOLBAR_ICON_SIZE);
+    // prefs has only small and large icons so add 2 to get right enum
+    if (gtk_toolbar_get_icon_size (tb) != selection + 2)
+        gtk_toolbar_set_icon_size (tb, selection + 2);
+}
+
 /*
  * Based on code from Epiphany (src/ephy-window.c)
  */
@@ -3707,6 +3729,13 @@ gnc_main_window_setup_window (GncMainWindow *window)
                            GNC_PREF_TAB_POSITION_RIGHT,
                            gnc_main_window_update_tab_position,
                            window);
+
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TOOLBAR_STYLE,
+                           gnc_main_window_update_toolbar, window);
+
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TOOLBAR_ICON_SIZE,
+                           gnc_main_window_update_toolbar, window);
+
     gnc_main_window_update_tab_position(NULL, NULL, window);
 
     gnc_main_window_init_menu_updaters(window);
@@ -3839,6 +3868,13 @@ gnc_main_window_add_widget (GtkUIManager *merge,
     if (GTK_IS_TOOLBAR (widget))
     {
         priv->toolbar = widget;
+
+        gtk_toolbar_set_style (GTK_TOOLBAR(priv->toolbar),
+            gnc_prefs_get_int (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TOOLBAR_STYLE));
+
+        // prefs has only small and large icons so add 2 to get right enum
+        gtk_toolbar_set_icon_size (GTK_TOOLBAR(priv->toolbar),
+           (gnc_prefs_get_int (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TOOLBAR_ICON_SIZE)) + 2);
     }
 
     gtk_box_pack_start (GTK_BOX (priv->menu_dock), widget, FALSE, FALSE, 0);
diff --git a/gnucash/gschemas/org.gnucash.gschema.xml.in b/gnucash/gschemas/org.gnucash.gschema.xml.in
index f2b21ac..44d3126 100644
--- a/gnucash/gschemas/org.gnucash.gschema.xml.in
+++ b/gnucash/gschemas/org.gnucash.gschema.xml.in
@@ -205,6 +205,16 @@
       <summary>Display the notebook tabs at the right of the window.</summary>
       <description>This setting determines the edge at which the tabs for switching pages in notebooks are drawn. Possible values are "top", "left", "bottom" and "right". It defaults to "top".</description>
     </key>
+    <key name="toolbar-style" type="i">
+      <default>3</default>
+      <summary>Toolbar Style choice</summary>
+      <description>This setting controls how the toolbar icons are displayed.</description>
+    </key>
+        <key name="toolbar-icon-size" type="i">
+      <default>1</default>
+      <summary>Toolbar Icon Size</summary>
+      <description>This setting controls the size of the toolbar icons.</description>
+    </key>
     <key name="summarybar-position-top" type="b">
       <default>false</default>
       <summary>Display the summary bar at the top of the page.</summary>
@@ -336,7 +346,7 @@
       <description>This sets the number of characters before auto complete starts for description, notes and memo fields.</description>
     </key>
   </schema>
-  
+
   <schema id="org.gnucash.general.report" path="/org/gnucash/general/report/">
     <key name="use-new-window" type="b">
       <default>false</default>
diff --git a/gnucash/gtkbuilder/dialog-preferences.glade b/gnucash/gtkbuilder/dialog-preferences.glade
index 092f822..3a6631d 100644
--- a/gnucash/gtkbuilder/dialog-preferences.glade
+++ b/gnucash/gtkbuilder/dialog-preferences.glade
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.2 -->
+<!-- Generated with glade 3.20.4 -->
 <interface>
   <requires lib="gtk+" version="3.10"/>
   <object class="GtkAdjustment" id="auto_decimal_places_adj">
@@ -97,6 +97,40 @@
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
+  <object class="GtkListStore" id="toolbar-icon-sizes">
+    <columns>
+      <!-- column-name sizes-text -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">Small Icons</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Large Icons</col>
+      </row>
+    </data>
+  </object>
+  <object class="GtkListStore" id="toolbar-styles">
+    <columns>
+      <!-- column-name styles-text -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">Icons</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Text</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Icons and Text</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Icons and Important Text</col>
+      </row>
+    </data>
+  </object>
   <object class="GtkDialog" id="gnucash_preferences_dialog">
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">GnuCash Preferences</property>
@@ -3222,6 +3256,114 @@ many months before the current month:</property>
                   </packing>
                 </child>
                 <child>
+                  <object class="GtkComboBox" id="pref/general/toolbar-icon-size">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="has_tooltip">True</property>
+                    <property name="tooltip_markup">Specify the icon size for the toolbars.</property>
+                    <property name="tooltip_text" translatable="yes">Specify the icon size for the toolbars.</property>
+                    <property name="halign">start</property>
+                    <property name="margin_left">12</property>
+                    <property name="model">toolbar-icon-sizes</property>
+                    <property name="active">1</property>
+                    <property name="id_column">0</property>
+                    <child>
+                      <object class="GtkCellRendererText" id="toolbar-icon-renderer"/>
+                      <attributes>
+                        <attribute name="text">0</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">15</property>
+                    <property name="width">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkComboBox" id="pref/general/toolbar-style">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="has_tooltip">True</property>
+                    <property name="tooltip_markup">Change the way the toolbar items are displayed.</property>
+                    <property name="tooltip_text" translatable="yes">Change the way the toolbar items are displayed.</property>
+                    <property name="halign">start</property>
+                    <property name="margin_left">12</property>
+                    <property name="model">toolbar-styles</property>
+                    <property name="active">3</property>
+                    <property name="id_column">0</property>
+                    <child>
+                      <object class="GtkCellRendererText" id="toolbar-style-renderer"/>
+                      <attributes>
+                        <attribute name="text">0</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">18</property>
+                    <property name="width">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label22">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="label" translatable="yes"><b>Toolbar Icon Size</b></property>
+                    <property name="use_markup">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">14</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label23">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="label" translatable="yes"><b>Toolbar Style</b></property>
+                    <property name="use_markup">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">17</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label24">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">13</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label25">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">16</property>
+                  </packing>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
                   <placeholder/>
                 </child>
                 <child>
diff --git a/libgnucash/core-utils/gnc-prefs.h b/libgnucash/core-utils/gnc-prefs.h
index 41c241d..4c9137c 100644
--- a/libgnucash/core-utils/gnc-prefs.h
+++ b/libgnucash/core-utils/gnc-prefs.h
@@ -71,6 +71,8 @@
 #define GNC_PREF_DATE_BACKMONTHS     "date-backmonths"
 #define GNC_PREF_SHOW_LEAF_ACCT_NAMES "show-leaf-account-names"
 #define GNC_PREF_ENTER_MOVES_TO_END  "enter-moves-to-end"
+#define GNC_PREF_TOOLBAR_STYLE        "toolbar-style"
+#define GNC_PREF_TOOLBAR_ICON_SIZE    "toolbar-icon-size"
 /* Register preferences */
 #define GNC_PREF_DRAW_HOR_LINES      "draw-horizontal-lines"
 #define GNC_PREF_DRAW_VERT_LINES     "draw-vertical-lines"

commit 3e37b879977c94e1e1a2fd23e50ef5f031a2a0c2
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Jul 15 16:35:33 2018 +0100

    Bug 796669 - Dark Theme Text Colors Hard to Read
    
    Only add the register-foreground class when using Gnucash built in
    colours. When this setting not used, the foreground colour by default
    will be what ever the theme has set and will be down to the user to
    over ride along with the other register colours.

diff --git a/gnucash/register/register-gnome/gnucash-sheet.c b/gnucash/register/register-gnome/gnucash-sheet.c
index 3b54bb4..d3f68ac 100644
--- a/gnucash/register/register-gnome/gnucash-sheet.c
+++ b/gnucash/register/register-gnome/gnucash-sheet.c
@@ -2451,8 +2451,11 @@ gnucash_get_style_classes (GnucashSheet *sheet, GtkStyleContext *stylectxt,
         field_type -= COLOR_NEGATIVE;
     }
     else
-        gtk_style_context_add_class (stylectxt, "register-foreground");
-
+    {
+        if (sheet->use_gnc_color_theme) // only add this class if builtin colors used
+            gtk_style_context_add_class (stylectxt, "register-foreground");
+    }
+    
     switch (field_type)
     {
     default:

commit 36dc2acd4a6313f599c39a567ef8866892a750dd
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Jul 15 16:45:41 2018 +0100

    Remove some white space and replace tabs with spaces.

diff --git a/gnucash/gnome-utils/dialog-account.c b/gnucash/gnome-utils/dialog-account.c
index 5eb2cf7..d6bbf9a 100644
--- a/gnucash/gnome-utils/dialog-account.c
+++ b/gnucash/gnome-utils/dialog-account.c
@@ -1866,7 +1866,7 @@ gnc_ui_edit_account_window(GtkWindow *parent, Account *account)
 
     parent_acct = gnc_account_get_parent (account);
     if (parent_acct == NULL)
-        parent_acct = account;		/* must be at the root */
+        parent_acct = account;      /* must be at the root */
 
     gtk_tree_view_collapse_all (aw->parent_tree);
     gnc_tree_view_account_set_selected_account (
@@ -1951,23 +1951,23 @@ gnc_account_renumber_update_examples (RenumberDialog *data)
     prefix = gtk_editable_get_chars(GTK_EDITABLE(data->prefix), 0, -1);
     interval = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(data->interval));
     if (interval <= 0)
-	interval = 10;
+    interval = 10;
     num_digits = (unsigned int)log10((double)(data->num_children * interval)) + 1;
 
     if (strlen (prefix))
-	str = g_strdup_printf("%s-%0*d", prefix, num_digits, interval);
+    str = g_strdup_printf("%s-%0*d", prefix, num_digits, interval);
     else
-	str = g_strdup_printf("%0*d", num_digits, interval);
+    str = g_strdup_printf("%0*d", num_digits, interval);
 
     gtk_label_set_text(GTK_LABEL(data->example1), str);
     g_free(str);
 
     if (strlen (prefix))
-	str = g_strdup_printf("%s-%0*d", prefix, num_digits,
-			      interval * data->num_children);
+    str = g_strdup_printf("%s-%0*d", prefix, num_digits,
+                  interval * data->num_children);
     else
-	str = g_strdup_printf("%0*d", num_digits,
-			      interval * data->num_children);
+    str = g_strdup_printf("%0*d", num_digits,
+                  interval * data->num_children);
 
     gtk_label_set_text(GTK_LABEL(data->example2), str);
     g_free(str);
@@ -2004,27 +2004,28 @@ gnc_account_renumber_response_cb (GtkDialog *dialog,
     {
         gtk_widget_hide(data->dialog);
         children = gnc_account_get_children_sorted(data->parent);
-	if (children == NULL)
-	{
-	    PWARN ("Can't renumber children of an account with no children!");
-	    g_free (data);
-	    return;
-	}
+        if (children == NULL)
+        {
+            PWARN ("Can't renumber children of an account with no children!");
+            g_free (data);
+            return;
+        }
         prefix = gtk_editable_get_chars(GTK_EDITABLE(data->prefix), 0, -1);
-        interval =
-            gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(data->interval));
-	if (interval <= 0)
-	    interval = 10;
+        interval = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(data->interval));
+
+        if (interval <= 0)
+            interval = 10;
+
         num_digits = (unsigned int)log10 ((double)(data->num_children * interval) + 1);
 
         gnc_set_busy_cursor (NULL, TRUE);
         for (tmp = children, i = 1; tmp; tmp = g_list_next(tmp), i += 1)
         {
-	    if (strlen (prefix))
-		str = g_strdup_printf("%s-%0*d", prefix,
-				      num_digits, interval * i);
-	    else
-		str = g_strdup_printf("%0*d", num_digits, interval * i);
+            if (strlen (prefix))
+                str = g_strdup_printf("%s-%0*d", prefix,
+                          num_digits, interval * i);
+            else
+                str = g_strdup_printf("%0*d", num_digits, interval * i);
             xaccAccountSetCode(tmp->data, str);
             g_free(str);
         }
@@ -2058,7 +2059,7 @@ gnc_account_renumber_create_dialog (GtkWidget *window, Account *account)
     data->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "account_renumber_dialog"));
     gtk_window_set_transient_for(GTK_WINDOW(data->dialog), GTK_WINDOW(window));
     g_object_set_data_full(G_OBJECT(data->dialog), "builder", builder,
-			   g_object_unref);
+               g_object_unref);
 
     widget = GTK_WIDGET(gtk_builder_get_object (builder, "header_label"));
     string = g_strdup_printf(_( "Renumber the immediate sub-accounts of %s? "
diff --git a/gnucash/ui/gnc-plugin-page-account-tree-ui.xml b/gnucash/ui/gnc-plugin-page-account-tree-ui.xml
index 1970817..c07f440 100644
--- a/gnucash/ui/gnc-plugin-page-account-tree-ui.xml
+++ b/gnucash/ui/gnc-plugin-page-account-tree-ui.xml
@@ -3,10 +3,10 @@
     <menu name="Edit" action="EditAction">
       <placeholder name="EditSelectedPlaceholder">
         <menuitem name="EditEditAccount" action="EditEditAccountAction"/>
-	<menuitem name="EditDeleteAccount" action="EditDeleteAccountAction"/>
+        <menuitem name="EditDeleteAccount" action="EditDeleteAccountAction"/>
         <menuitem name="EditAccountFindAccount" action="EditFindAccountAction"/>
-	<menuitem name="EditRenumberSubaccounts" action="EditRenumberSubaccountsAction"/>
         <menuitem name="AccountColorCascade" action="ColorCascadeAccountAction"/>
+        <menuitem name="EditRenumberSubaccounts" action="EditRenumberSubaccountsAction"/>
         <separator name="EditSep2"/>
         <menuitem name="FileOpenAccount" action="FileOpenAccountAction"/>
         <menuitem name="FileOpenSubaccounts" action="FileOpenSubaccountsAction"/>
@@ -14,29 +14,29 @@
     </menu>
     <menu name="Actions" action="ActionsAction">
       <placeholder name="ActionsPlaceholder">
-	<separator name="ActionsSep1"/>
-        <menuitem name="FileNewAccount" action="FileNewAccountAction"/>
-        <menuitem name="FileAddAccountHierarchyAssistant" action="FileAddAccountHierarchyAssistantAction"/>
-        <separator name="ActionsSep2"/>
-	<menuitem name="ActionsTransfer" action="ActionsTransferAction"/>
-	<menuitem name="ActionsReconcile" action="ActionsReconcileAction"/>
-	<menuitem name="ActionsAutoClear" action="ActionsAutoClearAction"/>
-	<menuitem name="ActionsStockSplit" action="ActionsStockSplitAction"/>
-	<menuitem name="ActionLots" action="ActionsLotsAction"/>
-	<separator name="ActionsSep3"/>
-	<menu name="ScrubMenu" action="ScrubMenuAction">
-	  <menuitem name="Scrub" action="ScrubAction"/>
-	  <menuitem name="ScrubSub" action="ScrubSubAction"/>
-	  <menuitem name="ScrubAll" action="ScrubAllAction"/>
-	</menu>
+      <separator name="ActionsSep1"/>
+      <menuitem name="FileNewAccount" action="FileNewAccountAction"/>
+      <menuitem name="FileAddAccountHierarchyAssistant" action="FileAddAccountHierarchyAssistantAction"/>
+      <separator name="ActionsSep2"/>
+      <menuitem name="ActionsTransfer" action="ActionsTransferAction"/>
+      <menuitem name="ActionsReconcile" action="ActionsReconcileAction"/>
+      <menuitem name="ActionsAutoClear" action="ActionsAutoClearAction"/>
+      <menuitem name="ActionsStockSplit" action="ActionsStockSplitAction"/>
+      <menuitem name="ActionLots" action="ActionsLotsAction"/>
+      <separator name="ActionsSep3"/>
+      <menu name="ScrubMenu" action="ScrubMenuAction">
+        <menuitem name="Scrub" action="ScrubAction"/>
+        <menuitem name="ScrubSub" action="ScrubSubAction"/>
+        <menuitem name="ScrubAll" action="ScrubAllAction"/>
+      </menu>
       </placeholder>
     </menu>
     <menu name="Extensions" action="ExtensionsAction">
       <placeholder name="ExtensionsPlaceholder">
-	<menu name="Register2Test" action="Register2TestAction">
-	  <menuitem name="Register2TestAccount" action="Register2TestAccountAction"/>
-	  <menuitem name="Register2TestSubAccount" action="Register2TestSubAccountAction"/>
-	</menu>
+    <menu name="Register2Test" action="Register2TestAction">
+      <menuitem name="Register2TestAccount" action="Register2TestAccountAction"/>
+      <menuitem name="Register2TestSubAccount" action="Register2TestSubAccountAction"/>
+    </menu>
       </placeholder>
     </menu>
   </menubar>

commit 0e4898fe0a5dd6108ca9fa281789c4e27157aa9a
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Jul 15 16:44:50 2018 +0100

    Add the ability to cascade account colours in account tree
    
    Add the ability to select an account that has sub-accounts and use that
    accounts colour on all sub accounts. By default only sub accounts that
    do not have a colour set are updated but there is an option to over ride
     this.

diff --git a/gnucash/gnome-utils/dialog-account.c b/gnucash/gnome-utils/dialog-account.c
index ae697c3..5eb2cf7 100644
--- a/gnucash/gnome-utils/dialog-account.c
+++ b/gnucash/gnome-utils/dialog-account.c
@@ -2080,3 +2080,119 @@ gnc_account_renumber_create_dialog (GtkWidget *window, Account *account)
 
     gtk_widget_show_all(data->dialog);
 }
+
+static void
+default_color_button_cb (GtkButton *button, gpointer user_data)
+{
+    GdkRGBA color;
+
+    if (gdk_rgba_parse (&color, DEFAULT_COLOR))
+        gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER(user_data), &color);
+}
+
+static void
+update_account_color (Account *acc, const gchar *old_color, const gchar *new_color, gboolean replace)
+{
+    // check to see if the color has been changed
+    if (g_strcmp0 (new_color, old_color) != 0)
+    {
+        if ((old_color == NULL) || (g_strcmp0 (old_color, "Not Set") == 0) || (replace == TRUE))
+        {
+             xaccAccountBeginEdit (acc);
+             xaccAccountSetColor (acc, new_color);
+             xaccAccountCommitEdit (acc);
+        }
+    }
+}
+
+void
+gnc_account_cascade_color_dialog (GtkWidget *window, Account *account)
+{
+    GtkWidget *dialog;
+    GtkBuilder *builder;
+    GtkWidget *color_label, *color_button, *over_write, *color_button_default;
+    gchar *string;
+    const char *color_string;
+    gchar *old_color_string;
+    GdkRGBA color;
+    gint response;
+
+    // check if we actualy do have sub accounts
+    g_return_if_fail (gnc_account_n_children (account) > 0);
+
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "dialog-account.glade", "account_cascade_color_dialog");
+    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "account_cascade_color_dialog"));
+    gtk_window_set_transient_for (GTK_WINDOW(dialog), GTK_WINDOW(window));
+
+    color_label = GTK_WIDGET(gtk_builder_get_object (builder, "color_label"));
+    over_write = GTK_WIDGET(gtk_builder_get_object (builder, "replace_check"));
+    color_button = GTK_WIDGET(gtk_builder_get_object (builder, "color_button"));
+    color_button_default = GTK_WIDGET(gtk_builder_get_object (builder, "color_button_default"));
+
+    gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER(color_button), FALSE);
+
+    g_signal_connect (G_OBJECT(color_button_default), "clicked",
+                      G_CALLBACK(default_color_button_cb), (gpointer)color_button);
+
+    string = g_strdup_printf(_( "Set the account color for account '%s' "
+                                "including all sub-accounts to the selected color:"),
+                             gnc_account_get_full_name(account));
+    gtk_label_set_text (GTK_LABEL(color_label), string);
+    g_free (string);
+
+    color_string = xaccAccountGetColor (account); // get existing account color
+
+    old_color_string = g_strdup (color_string); // save the old color string
+
+    if ((color_string == NULL) || (g_strcmp0 (color_string, "Not Set") == 0))
+        color_string = DEFAULT_COLOR;
+
+    // set the color chooser to account color
+    if (gdk_rgba_parse (&color, color_string))
+        gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER(color_button), &color);
+
+    /* default to cancel */
+    gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_CANCEL);
+
+    gtk_builder_connect_signals (builder, dialog);
+    g_object_unref (G_OBJECT(builder));
+
+    gtk_widget_show_all (dialog);
+
+    response = gtk_dialog_run (GTK_DIALOG(dialog));
+
+    if (response == GTK_RESPONSE_OK)
+    {
+        GList *accounts = gnc_account_get_descendants (account);
+        gboolean replace = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(over_write));
+        GList *acct;
+        GdkRGBA new_color;
+        const gchar *new_color_string;
+
+        gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER(color_button), &new_color);
+        new_color_string = gdk_rgba_to_string (&new_color);
+
+        if (g_strcmp0 (new_color_string, DEFAULT_COLOR) == 0)
+            new_color_string = "Not Set";
+
+        // check/update selected account
+        update_account_color (account, old_color_string, new_color_string, replace);
+
+        if (accounts != NULL)
+        {
+            for (acct = accounts; acct; acct = g_list_next(acct))
+            {
+                const char *string = xaccAccountGetColor (acct->data);
+
+                // check/update sub-account
+                update_account_color (acct->data, string, new_color_string, replace);
+            }
+            g_list_free (accounts);
+        }
+    }
+    if (old_color_string)
+        g_free (old_color_string);
+
+    gtk_widget_destroy (dialog);
+}
diff --git a/gnucash/gnome-utils/dialog-account.h b/gnucash/gnome-utils/dialog-account.h
index ffdb44b..099f1a3 100644
--- a/gnucash/gnome-utils/dialog-account.h
+++ b/gnucash/gnome-utils/dialog-account.h
@@ -161,6 +161,8 @@ void gnc_ui_register_account_destroy_callback (void (*cb)(Account *));
 
 void gnc_account_renumber_create_dialog (GtkWidget *window, Account *account);
 
+void gnc_account_cascade_color_dialog (GtkWidget *window, Account *account);
+
 /** @} */
 /** @} */
 
diff --git a/gnucash/gnome/gnc-plugin-page-account-tree.c b/gnucash/gnome/gnc-plugin-page-account-tree.c
index 5913b75..80478f5 100644
--- a/gnucash/gnome/gnc-plugin-page-account-tree.c
+++ b/gnucash/gnome/gnc-plugin-page-account-tree.c
@@ -153,6 +153,7 @@ static void gnc_plugin_page_account_tree_cmd_lots (GtkAction *action, GncPluginP
 static void gnc_plugin_page_account_tree_cmd_scrub (GtkAction *action, GncPluginPageAccountTree *page);
 static void gnc_plugin_page_account_tree_cmd_scrub_sub (GtkAction *action, GncPluginPageAccountTree *page);
 static void gnc_plugin_page_account_tree_cmd_scrub_all (GtkAction *action, GncPluginPageAccountTree *page);
+static void gnc_plugin_page_account_tree_cmd_cascade_color_account (GtkAction *action, GncPluginPageAccountTree *page);
 
 /* Command callback for new Register Test */
 static void gnc_plugin_page_account_tree_cmd_open2_account (GtkAction *action, GncPluginPageAccountTree *page);
@@ -227,6 +228,11 @@ static GtkActionEntry gnc_plugin_page_account_tree_actions [] =
         G_CALLBACK (gnc_plugin_page_account_tree_cmd_delete_account)
     },
     {
+        "ColorCascadeAccountAction", NULL, N_("_Cascade Account Color..."), NULL,
+        N_("Cascade selected account color"),
+        G_CALLBACK (gnc_plugin_page_account_tree_cmd_cascade_color_account)
+    },
+    {
         "EditFindAccountAction", "edit-find", N_("F_ind Account"), "<primary>i",
         N_("Find an account"),
         G_CALLBACK (gnc_plugin_page_account_tree_cmd_find_account)
@@ -1179,6 +1185,24 @@ gnc_plugin_page_account_tree_cmd_find_account_popup (GtkAction *action, GncPlugi
     LEAVE(" ");
 }
 
+static void
+gnc_plugin_page_account_tree_cmd_cascade_color_account (GtkAction *action, GncPluginPageAccountTree *page)
+{
+    Account *account = NULL;
+    GtkWidget *window;
+
+    ENTER("action %p, page %p", action, page);
+
+    account = gnc_plugin_page_account_tree_get_current_account (page);
+
+    window = gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(page));
+
+    if (account != NULL)
+        gnc_account_cascade_color_dialog (window, account);
+
+    LEAVE(" ");
+}
+
 /********************************************************************
  * delete_account_helper
  * See if this account has any splits present.  Set the user data
diff --git a/gnucash/gtkbuilder/dialog-account.glade b/gnucash/gtkbuilder/dialog-account.glade
index 399febe..998d380 100644
--- a/gnucash/gtkbuilder/dialog-account.glade
+++ b/gnucash/gtkbuilder/dialog-account.glade
@@ -2,6 +2,156 @@
 <!-- Generated with glade 3.20.0 -->
 <interface>
   <requires lib="gtk+" version="3.10"/>
+  <object class="GtkDialog" id="account_cascade_color_dialog">
+    <property name="can_focus">False</property>
+    <property name="title" translatable="yes">Cascade Account Color</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="cancelbutton3">
+                <property name="label" translatable="yes">_Cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="okbutton3">
+                <property name="label">_OK</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">12</property>
+            <child>
+              <object class="GtkLabel" id="color_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="wrap">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">center</property>
+                <child>
+                  <object class="GtkColorButton" id="color_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="color_button_default">
+                    <property name="label" translatable="yes">Default</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="sub_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">If any account has an existing color it will not be replaced unless the following is ticked.</property>
+                <property name="wrap">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="replace_check">
+                <property name="label" translatable="yes">Replace any existing account colors</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="halign">center</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">cancelbutton3</action-widget>
+      <action-widget response="-5">okbutton3</action-widget>
+    </action-widgets>
+    <child>
+      <placeholder/>
+    </child>
+  </object>
   <object class="GtkDialog" id="account_delete_dialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
diff --git a/gnucash/ui/gnc-plugin-page-account-tree-ui.xml b/gnucash/ui/gnc-plugin-page-account-tree-ui.xml
index a1165b3..1970817 100644
--- a/gnucash/ui/gnc-plugin-page-account-tree-ui.xml
+++ b/gnucash/ui/gnc-plugin-page-account-tree-ui.xml
@@ -6,6 +6,7 @@
 	<menuitem name="EditDeleteAccount" action="EditDeleteAccountAction"/>
         <menuitem name="EditAccountFindAccount" action="EditFindAccountAction"/>
 	<menuitem name="EditRenumberSubaccounts" action="EditRenumberSubaccountsAction"/>
+        <menuitem name="AccountColorCascade" action="ColorCascadeAccountAction"/>
         <separator name="EditSep2"/>
         <menuitem name="FileOpenAccount" action="FileOpenAccountAction"/>
         <menuitem name="FileOpenSubaccounts" action="FileOpenSubaccountsAction"/>
@@ -45,6 +46,7 @@
       <menuitem name="AccountOpenAccount" action="FileOpenAccountAction"/>
       <menuitem name="AccountOpenSubaccounts" action="FileOpenSubaccountsAction"/>
       <menuitem name="AccountEditAccount" action="EditEditAccountAction"/>
+      <menuitem name="AccountColorCascade" action="ColorCascadeAccountAction"/>
       <menuitem name="AccountFindAccountPopup" action="EditFindAccountPopupAction"/>
       <separator name="AccountSep1"/>
       <menuitem name="AccountReconcile" action="ActionsReconcileAction"/>



Summary of changes:
 gnucash/gnome-utils/dialog-account.c            | 165 ++++++++++++++++++++----
 gnucash/gnome-utils/dialog-account.h            |   2 +
 gnucash/gnome-utils/dialog-preferences.c        |   2 +
 gnucash/gnome-utils/gnc-embedded-window.c       |  10 +-
 gnucash/gnome-utils/gnc-main-window.c           | 126 +++++++++++-------
 gnucash/gnome/gnc-plugin-page-account-tree.c    |  24 ++++
 gnucash/gnome/reconcile-view.c                  |  54 ++++++--
 gnucash/gnome/reconcile-view.h                  |  14 +-
 gnucash/gnome/window-reconcile.c                |  78 ++++++++++-
 gnucash/gschemas/org.gnucash.gschema.xml.in     |  12 +-
 gnucash/gtkbuilder/dialog-account.glade         | 150 +++++++++++++++++++++
 gnucash/gtkbuilder/dialog-preferences.glade     | 144 ++++++++++++++++++++-
 gnucash/register/register-gnome/gnucash-sheet.c |   7 +-
 gnucash/ui/gnc-plugin-page-account-tree-ui.xml  |  44 ++++---
 libgnucash/core-utils/gnc-prefs.h               |   2 +
 15 files changed, 719 insertions(+), 115 deletions(-)



More information about the gnucash-changes mailing list