gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sun Sep 16 15:37:46 EDT 2018


Updated	 via  https://github.com/Gnucash/gnucash/commit/162605f5 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/06d836e6 (commit)
	from  https://github.com/Gnucash/gnucash/commit/5057703d (commit)



commit 162605f505a255af7c4d50505d12d8b326b34bca
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Sep 16 12:36:04 2018 -0700

    Fix Windows binreloc executable finding.
    
    Taking into account the behavior of
    g_win32_get_package_installation_directory_of_module when the last
    directory element either is or isn't "bin".

diff --git a/libgnucash/core-utils/binreloc.c b/libgnucash/core-utils/binreloc.c
index 8eacaf1..c637a06 100644
--- a/libgnucash/core-utils/binreloc.c
+++ b/libgnucash/core-utils/binreloc.c
@@ -70,23 +70,32 @@ _br_find_exe (Gnc_GbrInitError *error)
     if (error)
         *error = GNC_GBR_INIT_ERROR_DISABLED;
     return NULL;
-#else
-#ifdef G_OS_WIN32
-    /* I *thought* this program code already included the
-       relocation code for windows. Unfortunately this is not
-       the case and we have to add this manually. This is only
-       one possibility; other ways of looking up the full path
-       of gnucash.exe probably exist.*/
-    gchar *prefix;
-    gchar *result;
-
-    /* From the glib docs: When passed NULL, this function looks
-       up installation the directory of the main executable of
-       the current process */
-    prefix = g_win32_get_package_installation_directory_of_module (NULL);
-    result = g_build_filename (prefix,
-                               BINDIR, "gnucash.exe",
-                               (char*)NULL);
+#elif defined G_OS_WIN32
+    /* N.B. g_win32_get_package_installation_directory_of_module returns the
+     * parent if the last element of the directory is "bin" or "lib", but
+     * otherwise the directory itself. We assume that gnucash.exe isn't in lib.
+     */
+    gchar *prefix = g_win32_get_package_installation_directory_of_module (NULL);
+    gchar *result = g_build_filename (prefix, "bin", "gnucash.exe", NULL);
+    if (prefix = NULL)
+    {
+        if (error)
+            *error = GNC_GBR_INIT_WIN32_NO_EXE;
+        return NULL;
+    }
+    if (!g_file_test (result, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_EXECUTABLE))
+    {
+        g_free (result);
+        result = g_build_filename (prefix, "gnucash.exe");
+        if (!g_file_test (result,
+                           G_FILE_TEST_EXISTS | G_FILE_TEST_IS_EXECUTABLE))
+        {
+            g_free (result);
+            result = NULL;
+            if (error)
+                *error = GNC_GBR_INIT_WIN32_NO_EXE;
+        }
+    }
     g_free (prefix);
     return result;
 #elif defined MAC_INTEGRATION
@@ -228,7 +237,6 @@ _br_find_exe (Gnc_GbrInitError *error)
     g_free (line);
     fclose (f);
     return path;
-#endif /* G_OS_WINDOWS */
 #endif /* ENABLE_BINRELOC */
 }
 
@@ -309,6 +317,15 @@ set_gerror (GError **error, Gnc_GbrInitError errcode)
     case GNC_GBR_INIT_ERROR_DISABLED:
         error_message = "Binary relocation support is disabled.";
         break;
+    case GNC_GBR_INIT_ERROR_MAC_NOT_BUNDLE:
+        error_message = "BinReloc determined that gnucash is not running from a bundle";
+        break;
+    case GNC_GBR_INIT_ERROR_MAC_NOT_APP_BUNDLE:
+        error_message = "Binreloc determined that the bundle is not an app bundle";
+        break;
+    case GNC_GBR_INIT_WIN32_NO_EXE_DIR:
+        error_message = "Binreloc was unable to determine the location of gnucash.exe.";
+        break;
     default:
         error_message = "Unknown error.";
         break;
diff --git a/libgnucash/core-utils/binreloc.h b/libgnucash/core-utils/binreloc.h
index ecec309..3449694 100644
--- a/libgnucash/core-utils/binreloc.h
+++ b/libgnucash/core-utils/binreloc.h
@@ -54,7 +54,9 @@ typedef enum
     /** Binreloc determined that the bundle is not an app bundle */
     GNC_GBR_INIT_ERROR_MAC_NOT_APP_BUNDLE,
     /** BinReloc is disabled (the ENABLE_BINRELOC macro is not defined). */
-    GNC_GBR_INIT_ERROR_DISABLED
+    GNC_GBR_INIT_ERROR_DISABLED,
+    /** Binreloc was unable to determine the location of gnucash.exe. */
+    GNC_GBR_INIT_WIN32_NO_EXE_DIR
 } Gnc_GbrInitError;
 
 

commit 06d836e66b149f70a37d8ec062c237b7d4f06d26
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Sep 16 11:19:26 2018 -0700

    Fix cursor handling in the register.
    
    Broken by over-aggressively capturing the selection.

diff --git a/gnucash/register/register-gnome/gnucash-sheet.c b/gnucash/register/register-gnome/gnucash-sheet.c
index e94a9bc..7b9dc01 100644
--- a/gnucash/register/register-gnome/gnucash-sheet.c
+++ b/gnucash/register/register-gnome/gnucash-sheet.c
@@ -399,8 +399,6 @@ gnucash_sheet_activate_cursor_cell (GnucashSheet *sheet,
         {
             gtk_editable_set_position (editable, cursor_pos);
             gtk_editable_select_region (editable, start_sel, end_sel);
-            sheet->start_sel = start_sel;
-            sheet->end_sel = end_sel;
         }
         else
             gtk_editable_set_position (editable,



Summary of changes:
 gnucash/register/register-gnome/gnucash-sheet.c |  2 -
 libgnucash/core-utils/binreloc.c                | 53 ++++++++++++++++---------
 libgnucash/core-utils/binreloc.h                |  4 +-
 3 files changed, 38 insertions(+), 21 deletions(-)



More information about the gnucash-changes mailing list