From 8c4a5adb43a1ca9a90fdee565625136349771405 Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Sun, 15 Jul 2018 16:42:24 +0100 Subject: [PATCH] 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. --- gnucash/gnome/reconcile-view.c | 12 ++++++++++++ gnucash/gnome/reconcile-view.h | 2 ++ gnucash/gnome/window-reconcile.c | 12 ++++++++++++ 3 files changed, 26 insertions(+) diff --git a/gnucash/gnome/reconcile-view.c b/gnucash/gnome/reconcile-view.c index 713d2de6e3..382807a808 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 13763d21fc..12657946b1 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 d4b0dd90cb..1bcf8967b9 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; }