gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sat Jul 18 18:06:31 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/82da49ef (commit)
	 via  https://github.com/Gnucash/gnucash/commit/e4e6ef41 (commit)
	from  https://github.com/Gnucash/gnucash/commit/0b4cd692 (commit)



commit 82da49efc2b1f5d65a7c00b1f8a5a1cb1511566d
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Jul 18 15:03:34 2020 -0700

    Bug 797858 - Transaction date is one day too early from...
    
    SWIFT MT940 import.
    
    GWEN_Date_ToLocalTime doesn't handle Daylight Savings Time correctly
    so extract the day, month, and year from the GWEN_DATE and use our
    own coversion function.

diff --git a/gnucash/import-export/aqb/gnc-ab-utils.c b/gnucash/import-export/aqb/gnc-ab-utils.c
index de422da3a..a049b3efe 100644
--- a/gnucash/import-export/aqb/gnc-ab-utils.c
+++ b/gnucash/import-export/aqb/gnc-ab-utils.c
@@ -89,6 +89,14 @@ struct _GncABImExContextImport
     GData *tmp_job_list;
 };
 
+static inline time64
+gnc_gwen_date_to_time64 (const GWEN_DATE* date)
+{
+    return gnc_dmy2time64_neutral(GWEN_Date_GetDay(date),
+                                  GWEN_Date_GetMonth(date),
+                                  GWEN_Date_GetYear(date));
+}
+
 void
 gnc_GWEN_Init(void)
 {
@@ -571,11 +579,7 @@ gnc_ab_trans_to_gnc(const AB_TRANSACTION *ab_trans, Account *gnc_acc)
     }
     if (valuta_date)
     {
-#ifdef AQBANKING6
-        time64 secs = GWEN_Date_toLocalTime(valuta_date);
-#else
-        time64 secs = GWEN_Time_toTime_t(valuta_date);
-#endif
+        time64 secs = gnc_gwen_date_to_time64(valuta_date);
         xaccTransSetDatePostedSecsNormalized(gnc_trans, secs);
     }
     else
@@ -1057,12 +1061,7 @@ bal_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data)
 #endif
         if (ti)
         {
-#ifdef AQBANKING6
-            time64 secs = GWEN_Date_toLocalTime(ti);
-#else
-            time64 secs = GWEN_Time_toTime_t(ti);
-#endif
-            booked_tt = gnc_time64_get_day_neutral(secs);
+            booked_tt = gnc_gwen_date_to_time64(ti);
         }
         else
         {

commit e4e6ef41638e01acdec8b26c2a064349c198cfc0
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Jul 18 13:50:54 2020 -0700

    Bug 797834 - Ctrl+A in account register fields chimes after any...
    
    element newly focussed.
    
    Restore finding the cursor location in the string and setting the entry
    position to that value.

diff --git a/gnucash/register/register-gnome/gnucash-sheet.c b/gnucash/register/register-gnome/gnucash-sheet.c
index b2d73713d..30aeb718c 100644
--- a/gnucash/register/register-gnome/gnucash-sheet.c
+++ b/gnucash/register/register-gnome/gnucash-sheet.c
@@ -413,7 +413,38 @@ gnucash_sheet_activate_cursor_cell (GnucashSheet *sheet,
         }
         else
         {
-            gnucash_sheet_set_selection_from_entry (sheet);
+            GncItemEdit *item_edit = GNC_ITEM_EDIT(sheet->item_editor);
+            Table *table = sheet->table;
+            const char *text = gnc_table_get_entry (table, virt_loc);
+            PangoLayout *layout;
+            PangoRectangle logical_rect;
+            GdkRectangle rect;
+            gint x, y, width, height;
+            gint index = 0, trailing = 0;
+            gboolean result;
+            gint x_offset = 0;
+
+            if (text && *text)
+            {
+                // Get the item_edit position
+                gnc_item_edit_get_pixel_coords (item_edit, &x, &y,
+                                                &width, &height);
+                layout = gtk_widget_create_pango_layout (GTK_WIDGET (sheet),
+                                                         text);
+                // We don't need word wrap or line wrap
+                pango_layout_set_width (layout, -1);
+                pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
+                gnucash_sheet_set_text_bounds (sheet, &rect, x, y,
+                                               width, height);
+                x_offset = gnucash_sheet_get_text_offset (sheet, virt_loc,
+                                                          rect.width,
+                                                          logical_rect.width);
+                pango_layout_xy_to_index (layout,
+                                          PANGO_SCALE * (sheet->button_x - rect.x - x_offset),
+                                          PANGO_SCALE * (height/2), &index, &trailing);
+                g_object_unref (layout);
+            }
+            gnucash_sheet_set_position (sheet, index + trailing);
         }
         sheet->direct_update_cell =
             gnucash_sheet_check_direct_update_cell (sheet, virt_loc);



Summary of changes:
 gnucash/import-export/aqb/gnc-ab-utils.c        | 21 ++++++++--------
 gnucash/register/register-gnome/gnucash-sheet.c | 33 ++++++++++++++++++++++++-
 2 files changed, 42 insertions(+), 12 deletions(-)



More information about the gnucash-changes mailing list