gnucash stable: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sat Apr 29 13:53:39 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/5582e479 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f3991639 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/5663efa1 (commit)
	from  https://github.com/Gnucash/gnucash/commit/98776629 (commit)



commit 5582e4793abd020272cadbdcb8ae79884b723a0d
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Apr 4 12:26:13 2023 +0100

    Change the preference option 'Future transactions after blank transaction'
    
    With the use of reverse sort, the preference option needs changing, use
    'Placement of future transactions' with appropriate tooltip changes.

diff --git a/gnucash/gtkbuilder/dialog-preferences.glade b/gnucash/gtkbuilder/dialog-preferences.glade
index 232a9ddc5c..450d6f99bb 100644
--- a/gnucash/gtkbuilder/dialog-preferences.glade
+++ b/gnucash/gtkbuilder/dialog-preferences.glade
@@ -2762,13 +2762,13 @@ many months before the current month</property>
                 </child>
                 <child>
                   <object class="GtkCheckButton" id="pref/general.register/future-after-blank-transaction">
-                    <property name="label" translatable="yes">_Future transactions after blank transaction</property>
+                    <property name="label" translatable="yes">_Placement of future transactions</property>
                     <property name="visible">True</property>
                     <property name="can-focus">True</property>
                     <property name="receives-default">False</property>
                     <property name="has-tooltip">True</property>
-                    <property name="tooltip-markup">If checked, transactions with a date in the future will be displayed at the bottom of the register after the blank transaction. If clear, the blank transaction will be at the bottom of the register after all transactions.</property>
-                    <property name="tooltip-text" translatable="yes">If checked, transactions with a date in the future will be displayed at the bottom of the register after the blank transaction. If clear, the blank transaction will be at the bottom of the register after all transactions.</property>
+                    <property name="tooltip-markup">If checked, transactions with a date in the future will be displayed at the bottom of the register after the blank transaction unless in reverse sort order when they are displayed at the top before the blank transaction. If clear, the blank transaction will be at the bottom of the register after all transactions unless in reverse sort order when it will be at the top.</property>
+                    <property name="tooltip-text" translatable="yes">If checked, transactions with a date in the future will be displayed at the bottom of the register after the blank transaction unless in reverse sort order when they are displayed at the top before the blank transaction. If clear, the blank transaction will be at the bottom of the register after all transactions unless in reverse sort order when it will be at the top.</property>
                     <property name="halign">start</property>
                     <property name="use-underline">True</property>
                     <property name="draw-indicator">True</property>

commit f3991639c8e01ecf94c94fd368101e1b613039c8
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Apr 4 11:05:16 2023 +0100

    Change tooltip for 'Blank Transaction' in register
    
    Change the tooltip to mention moving to the blank transaction.

diff --git a/gnucash/ui/gnc-plugin-page-register.ui b/gnucash/ui/gnc-plugin-page-register.ui
index fcc7a0a828..c3c9d1e8b1 100644
--- a/gnucash/ui/gnc-plugin-page-register.ui
+++ b/gnucash/ui/gnc-plugin-page-register.ui
@@ -269,7 +269,7 @@
       <attribute name="label" translatable="yes">_Blank Transaction</attribute>
       <attribute name="action">GncPluginPageRegisterActions.BlankTransactionAction</attribute>
       <attribute name="accel"><Primary>b</attribute>
-      <attribute name="tooltip" translatable="yes">Move to the blank transaction at the bottom of the register</attribute>
+      <attribute name="tooltip" translatable="yes">Move to the blank transaction in the register</attribute>
       <attribute name="temp" translatable="no">yes</attribute>
     </item>
     <item>
@@ -411,7 +411,7 @@
       <item>
         <attribute name="label" translatable="yes">_Blank Transaction</attribute>
         <attribute name="action">GncPluginPageRegisterActions.BlankTransactionAction</attribute>
-        <attribute name="tooltip" translatable="yes">Move to the blank transaction at the bottom of the register</attribute>
+        <attribute name="tooltip" translatable="yes">Move to the blank transaction in the register</attribute>
       </item>
       <item>
         <attribute name="label" translatable="yes">_Go to Date</attribute>
@@ -523,7 +523,7 @@
       <item>
         <attribute name="label" translatable="yes">_Blank Transaction</attribute>
         <attribute name="action">GncPluginPageRegisterActions.BlankTransactionAction</attribute>
-        <attribute name="tooltip" translatable="yes">Move to the blank transaction at the bottom of the register</attribute>
+        <attribute name="tooltip" translatable="yes">Move to the blank transaction in the register</attribute>
       </item>
       <item>
         <attribute name="label" translatable="yes">_Go to Date</attribute>
@@ -602,7 +602,7 @@
       <item>
         <attribute name="label" translatable="yes">_Blank Transaction</attribute>
         <attribute name="action">GncPluginPageRegisterActions.BlankTransactionAction</attribute>
-        <attribute name="tooltip" translatable="yes">Move to the blank transaction at the bottom of the register</attribute>
+        <attribute name="tooltip" translatable="yes">Move to the blank transaction in the register</attribute>
       </item>
     </section>
   </menu>
@@ -641,7 +641,7 @@
       <item>
         <attribute name="label" translatable="yes">_Blank Transaction</attribute>
         <attribute name="action">GncPluginPageRegisterActions.BlankTransactionAction</attribute>
-        <attribute name="tooltip" translatable="yes">Move to the blank transaction at the bottom of the register</attribute>
+        <attribute name="tooltip" translatable="yes">Move to the blank transaction in the register</attribute>
       </item>
     </section>
   </menu>
@@ -801,7 +801,7 @@
         <property name="can-focus">False</property>
         <property name="label" translatable="yes">_Blank Transaction</property>
         <property name="action-name">GncPluginPageRegisterActions.BlankTransactionAction</property>
-        <property name="tooltip-text" translatable="yes">Move to the blank transaction at the bottom of the register</property>
+        <property name="tooltip-text" translatable="yes">Move to the blank transaction in the register</property>
         <property name="use-underline">True</property>
         <property name="icon-name">go-jump</property>
       </object>

commit 5663efa1131ebd2d47a2ce8f390090aede20e28b
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Mar 6 11:54:29 2023 +0000

    Add the blank transaction at top of register
    
    When the register is sorted in reverse order, add the blank transaction
    at the top of the register.

diff --git a/gnucash/register/ledger-core/split-register-load.c b/gnucash/register/ledger-core/split-register-load.c
index a04d95e1c1..8874ddacba 100644
--- a/gnucash/register/ledger-core/split-register-load.c
+++ b/gnucash/register/ledger-core/split-register-load.c
@@ -574,6 +574,41 @@ gnc_split_register_load (SplitRegister* reg, GList* slist,
     if (multi_line)
         trans_table = g_hash_table_new (g_direct_hash, g_direct_equal);
 
+    // View reversed add blank transaction at the top
+    if (table->model->reverse_sort && !future_after_blank)
+    {
+        if (blank_trans == find_trans)
+            new_trans_row = vcell_loc.virt_row;
+
+        if (blank_split == find_trans_split)
+            new_trans_split_row = vcell_loc.virt_row;
+
+        /* go to blank on first pass */
+        if (info->first_pass)
+        {
+            save_loc.vcell_loc = vcell_loc;
+            save_loc.phys_row_offset = 0;
+            save_loc.phys_col_offset = 0;
+        }
+
+        // used in the setting the rows insensitive
+        table->model->blank_trans_row = vcell_loc.virt_row;
+
+        gnc_split_register_add_transaction (reg,
+                                            blank_trans, blank_split,
+                                            lead_cursor, split_cursor,
+                                            multi_line, start_primary_color,
+                                            info->blank_split_edited,
+                                            find_trans, find_split,
+                                            find_class, &new_split_row,
+                                            &vcell_loc);
+
+        if (!multi_line)
+            start_primary_color = !start_primary_color;
+
+        added_blank_trans = TRUE;
+    }
+
     /* populate the table */
     for (node = slist; node; node = node->next)
     {
@@ -593,7 +628,6 @@ gnc_split_register_load (SplitRegister* reg, GList* slist,
                  xaccSplitGetAccount (split) == NULL)
             continue;
 
-
         /* Do not load splits from the blank transaction. */
         if (trans == blank_trans)
             continue;
@@ -627,7 +661,28 @@ gnc_split_register_load (SplitRegister* reg, GList* slist,
             ((table->model->reverse_sort && xaccTransGetDate (trans) < present) ||
              (!table->model->reverse_sort && xaccTransGetDate (trans) > present)))
         {
-            table->model->dividing_row = vcell_loc.virt_row;
+            gint count_blank_splits = 1;
+            gint virt_row_offset = 2;
+            gboolean show_lower_divider = FALSE;
+
+            if (table->model->reverse_sort)
+            {
+                count_blank_splits = xaccTransCountSplits (blank_trans);
+
+                if (count_blank_splits > 1)
+                   count_blank_splits ++;
+
+                if (table->model->reverse_sort && future_after_blank)
+                   virt_row_offset = 0;
+            }
+
+            if ((table->model->reverse_sort && vcell_loc.virt_row != count_blank_splits + virt_row_offset) ||
+                !table->model->reverse_sort)
+            {
+                table->model->dividing_row = vcell_loc.virt_row; // blue top
+                show_lower_divider = TRUE;
+            }
+
             found_divider = TRUE;
 
             if (future_after_blank)
@@ -658,7 +713,10 @@ gnc_split_register_load (SplitRegister* reg, GList* slist,
                                                     find_class, &new_split_row,
                                                     &vcell_loc);
 
-                table->model->dividing_row_lower = vcell_loc.virt_row;
+
+                if (show_lower_divider)
+                    table->model->dividing_row_lower = vcell_loc.virt_row; // blue bottom
+
                 if (!multi_line)
                     start_primary_color = !start_primary_color;
 
@@ -720,7 +778,8 @@ gnc_split_register_load (SplitRegister* reg, GList* slist,
         pending_trans = NULL;
     }
 
-    if (!added_blank_trans) {
+    if (!added_blank_trans)
+    {
         if (blank_trans == find_trans)
             new_trans_row = vcell_loc.virt_row;
 
@@ -815,7 +874,15 @@ gnc_split_register_load (SplitRegister* reg, GList* slist,
 
     gnc_table_refresh_gui (table, TRUE);
 
-    gnc_split_register_show_trans (reg, table->current_cursor_loc.vcell_loc);
+    // if in reverse order, always show the first transaction
+    if (table->model->reverse_sort)
+    {
+        VirtualCellLocation vc_loc;
+        vc_loc.virt_row = 0;
+        gnc_split_register_show_trans (reg, vc_loc);
+    }
+    else
+        gnc_split_register_show_trans (reg, table->current_cursor_loc.vcell_loc);
 
     /* enable callback for cursor user-driven moves */
     gnc_table_control_allow_move (table->control, TRUE);



Summary of changes:
 gnucash/gtkbuilder/dialog-preferences.glade        |  6 +-
 gnucash/register/ledger-core/split-register-load.c | 77 ++++++++++++++++++++--
 gnucash/ui/gnc-plugin-page-register.ui             | 12 ++--
 3 files changed, 81 insertions(+), 14 deletions(-)



More information about the gnucash-changes mailing list