gnucash maint: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Fri May 11 15:36:19 EDT 2018


Updated	 via  https://github.com/Gnucash/gnucash/commit/fc963f87 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/836705f9 (commit)
	from  https://github.com/Gnucash/gnucash/commit/2e53d647 (commit)



commit fc963f877cd725ee4e561530e2deb0f9bba6e515
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue May 1 15:11:16 2018 +0100

    Change the right margin setting for reconcile totals
    
    Change the margin setting from the gtk box to the label so it looks
    correct when styled.

diff --git a/gnucash/gnome/window-reconcile.c b/gnucash/gnome/window-reconcile.c
index 5491c48..9ed3dd8 100644
--- a/gnucash/gnome/window-reconcile.c
+++ b/gnucash/gnome/window-reconcile.c
@@ -1186,12 +1186,6 @@ gnc_reconcile_window_create_view_box(Account *account,
     gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);
     gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
 
-#if GTK_CHECK_VERSION(3,12,0)
-    gtk_widget_set_margin_end (GTK_WIDGET(hbox), 10);
-#else
-    gtk_widget_set_margin_right (GTK_WIDGET(hbox), 10);
-#endif
-
     label = gtk_label_new(_("Total:"));
     gnc_label_set_alignment(label, 1.0, 0.5);
     gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
@@ -1200,6 +1194,12 @@ gnc_reconcile_window_create_view_box(Account *account,
     gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
     *total_save = label;
 
+#if GTK_CHECK_VERSION(3,12,0)
+    gtk_widget_set_margin_end (GTK_WIDGET(label), 10);
+#else
+    gtk_widget_set_margin_right (GTK_WIDGET(label), 10);
+#endif
+
     return vbox;
 }
 
diff --git a/gnucash/gnome/window-reconcile2.c b/gnucash/gnome/window-reconcile2.c
index aa089ae..699f97d 100644
--- a/gnucash/gnome/window-reconcile2.c
+++ b/gnucash/gnome/window-reconcile2.c
@@ -1154,6 +1154,12 @@ gnc_reconcile_window_create_view_box (Account *account,
     gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
     *total_save = label;
 
+#if GTK_CHECK_VERSION(3,12,0)
+    gtk_widget_set_margin_end (GTK_WIDGET(label), 10);
+#else
+    gtk_widget_set_margin_right (GTK_WIDGET(label), 10);
+#endif
+
     return vbox;
 }
 

commit 836705f98087ec7bf9418cef71af939fcff6a393
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue May 1 15:07:46 2018 +0100

    Bug 795101 - Fix the reconcile window sort order
    
    When the reconcile column was moved, the default sort order was not
    altered for the change so fixed it. Also added enum so model columns
    can be referenced by name which hopefully will make it easier to read.

diff --git a/gnucash/gnome/reconcile-view.c b/gnucash/gnome/reconcile-view.c
index a4e7404..0dfb661 100644
--- a/gnucash/gnome/reconcile-view.c
+++ b/gnucash/gnome/reconcile-view.c
@@ -125,10 +125,10 @@ gnc_reconcile_view_tooltip_cb (GNCQueryView *qview, gint x, gint y,
         g_list_free (cols);
 
         /* If column is not description, do not show tooltip */
-        if (col_pos != 2)
+        if (col_pos != (REC_DESC - 1)) // allow for the pointer model column at 0
             return FALSE;
 
-        gtk_tree_model_get (model, &iter, 3, &desc_text, -1);
+        gtk_tree_model_get (model, &iter, REC_DESC, &desc_text, -1);
 
         if (desc_text)
         {
@@ -259,8 +259,9 @@ gnc_reconcile_view_construct (GNCReconcileView *view, Query *query)
     gnc_query_view_construct (qview, view->column_list, query);
     gnc_query_view_set_numerics (qview, TRUE, inv_sort);
 
-    /* Set the description field to have spare space */
-    col = gtk_tree_view_get_column (GTK_TREE_VIEW (qview), 3);
+    /* Set the description field to have spare space,
+       REC_DESC -1 to allow for the pointer model column at 0 */
+    col = gtk_tree_view_get_column (GTK_TREE_VIEW (qview), (REC_DESC - 1));
     gtk_tree_view_column_set_expand (col, TRUE);
 
     /* Get the renderer of the description column and set ellipsize value */
@@ -411,7 +412,7 @@ gnc_reconcile_view_init (GNCReconcileView *view)
                                     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, TRUE);
+    gnc_search_param_set_passive ((GNCSearchParam *) param, FALSE);
     gnc_search_param_set_non_resizeable ((GNCSearchParam *) param, TRUE);
     columns = g_list_prepend (columns, param);
 
@@ -540,13 +541,13 @@ gnc_reconcile_view_toggle_children (Account *account, GNCReconcileView *view, Sp
         while (valid)
         {
             // Walk through the list, reading each row
-            gtk_tree_model_get (model, &iter, 0, &pointer, -1);
+            gtk_tree_model_get (model, &iter, REC_POINTER, &pointer, -1);
 
             if(pointer == other_split)
             {
                 gboolean toggled;
-                gtk_tree_model_get (model, &iter, 1, &toggled, -1);
-                gtk_list_store_set (GTK_LIST_STORE (model), &iter, 1, !toggled, -1);
+                gtk_tree_model_get (model, &iter, REC_RECN, &toggled, -1);
+                gtk_list_store_set (GTK_LIST_STORE (model), &iter, REC_RECN, !toggled, -1);
                 break;
             }
 
@@ -597,7 +598,7 @@ gnc_reconcile_view_line_toggled (GNCQueryView *qview,
     model = gtk_tree_view_get_model (GTK_TREE_VIEW (qview));
     gtk_tree_model_iter_nth_child (model, &iter, NULL, qview->toggled_row);
     gtk_list_store_set (GTK_LIST_STORE (model), &iter, qview->toggled_column, GPOINTER_TO_INT(item), -1);
-    gtk_tree_model_get (model, &iter, 0, &entry, -1);
+    gtk_tree_model_get (model, &iter, REC_POINTER, &entry, -1);
 
     gnc_reconcile_view_toggle (view, entry);
 }
@@ -659,10 +660,10 @@ gnc_reconcile_view_set_list ( GNCReconcileView  *view, gboolean reconcile)
         if(gtk_tree_model_get_iter(model, &iter, node->data))
         {
             /* now iter is a valid row iterator */
-            gtk_tree_model_get (model, &iter, 0, &entry, -1);
-            gtk_tree_model_get (model, &iter, 1, &toggled, -1);
+            gtk_tree_model_get (model, &iter, REC_POINTER, &entry, -1);
+            gtk_tree_model_get (model, &iter, REC_RECN, &toggled, -1);
 
-            gtk_list_store_set (GTK_LIST_STORE (model), &iter, 1, reconcile, -1);
+            gtk_list_store_set (GTK_LIST_STORE (model), &iter, REC_RECN, reconcile, -1);
 
             if(reconcile != toggled)
                 gnc_reconcile_view_toggle (view, entry);
@@ -709,7 +710,7 @@ gnc_reconcile_view_set_toggle (GNCReconcileView  *view)
         if(gtk_tree_model_get_iter(model, &iter, node->data))
         {
             /* now iter is a valid row iterator */
-            gtk_tree_model_get (model, &iter, 1, &toggled, -1);
+            gtk_tree_model_get (model, &iter, REC_RECN, &toggled, -1);
 
             if(toggled)
                 num_toggled++;
@@ -943,7 +944,7 @@ gnc_reconcile_view_postpone (GNCReconcileView *view)
     {
         char recn;
 
-        gtk_tree_model_get (model, &iter, 0, &entry, -1);
+        gtk_tree_model_get (model, &iter, REC_POINTER, &entry, -1);
 
         // Don't change splits past reconciliation date that haven't been
         // set to be reconciled
diff --git a/gnucash/gnome/reconcile-view.h b/gnucash/gnome/reconcile-view.h
index 03f4259..f0d433e 100644
--- a/gnucash/gnome/reconcile-view.h
+++ b/gnucash/gnome/reconcile-view.h
@@ -44,6 +44,16 @@ typedef enum
     RECLIST_CREDIT
 } GNCReconcileViewType;
 
+enum
+{
+    REC_POINTER, //0
+    REC_RECN,    //1
+    REC_DATE,    //2
+    REC_NUM,     //3
+    REC_DESC,    //4
+    REC_AMOUNT   //5
+};
+
 struct GNCReconcileView
 {
     GNCQueryView         qview;
diff --git a/gnucash/gnome/window-reconcile.c b/gnucash/gnome/window-reconcile.c
index 8405a32..5491c48 100644
--- a/gnucash/gnome/window-reconcile.c
+++ b/gnucash/gnome/window-reconcile.c
@@ -1946,8 +1946,8 @@ recnWindowWithBalance (Account *account, gnc_numeric new_ending,
     gnc_window_adjust_for_screen(GTK_WINDOW(recnData->window));
 
     /* Set the sort orders of the debit and credit tree views */
-    gnc_query_sort_order(GNC_QUERY_VIEW(recnData->debit), 1, GTK_SORT_ASCENDING);
-    gnc_query_sort_order(GNC_QUERY_VIEW(recnData->credit), 1, GTK_SORT_ASCENDING);
+    gnc_query_sort_order(GNC_QUERY_VIEW(recnData->debit), REC_DATE, GTK_SORT_ASCENDING);
+    gnc_query_sort_order(GNC_QUERY_VIEW(recnData->credit), REC_DATE, GTK_SORT_ASCENDING);
 
     gtk_widget_grab_focus (recnData->debit);
 
diff --git a/gnucash/gnome/window-reconcile2.c b/gnucash/gnome/window-reconcile2.c
index 4f7cbc9..aa089ae 100644
--- a/gnucash/gnome/window-reconcile2.c
+++ b/gnucash/gnome/window-reconcile2.c
@@ -1886,8 +1886,8 @@ recnWindow2WithBalance (GtkWidget *parent, Account *account,
     gnc_window_adjust_for_screen (GTK_WINDOW (recnData->window));
 
     /* Set the sort orders of the debit and credit tree views */
-    gnc_query_sort_order (GNC_QUERY_VIEW (recnData->debit), 1, GTK_SORT_ASCENDING);
-    gnc_query_sort_order (GNC_QUERY_VIEW (recnData->credit), 1, GTK_SORT_ASCENDING);
+    gnc_query_sort_order (GNC_QUERY_VIEW (recnData->debit), REC_DATE, GTK_SORT_ASCENDING);
+    gnc_query_sort_order (GNC_QUERY_VIEW (recnData->credit), REC_DATE, GTK_SORT_ASCENDING);
 
     gtk_widget_grab_focus (recnData->debit);
 



Summary of changes:
 gnucash/gnome/reconcile-view.c    | 29 +++++++++++++++--------------
 gnucash/gnome/reconcile-view.h    | 10 ++++++++++
 gnucash/gnome/window-reconcile.c  | 16 ++++++++--------
 gnucash/gnome/window-reconcile2.c | 10 ++++++++--
 4 files changed, 41 insertions(+), 24 deletions(-)



More information about the gnucash-changes mailing list