gnucash maint: Bug 309943 - Change previous fix commit

Robert Fewell bobit at code.gnucash.org
Tue Dec 8 09:13:36 EST 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/de63a795 (commit)
	from  https://github.com/Gnucash/gnucash/commit/0f76265c (commit)



commit de63a79527822df3e126118e160d9d4070d8b074
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Dec 8 11:11:47 2020 +0000

    Bug 309943 - Change previous fix commit
    
    Instead of replacing the 'New' button with 'Open' the Gnucash main
    window add another button that 'Opens' a file browser so another file
    can be chosen.

diff --git a/gnucash/gnome-utils/gnc-file.c b/gnucash/gnome-utils/gnc-file.c
index 10245195e..d8ff86b83 100644
--- a/gnucash/gnome-utils/gnc-file.c
+++ b/gnucash/gnome-utils/gnc-file.c
@@ -695,10 +695,11 @@ gnc_file_query_save (GtkWindow *parent, gboolean can_cancel)
 
 /* private utilities for file open; done in two stages */
 
-#define RESPONSE_NO_FILE 1
+#define RESPONSE_NEW 1
 #define RESPONSE_OPEN 2
 #define RESPONSE_QUIT 3
 #define RESPONSE_READONLY 4
+#define RESPONSE_FILE 5
 
 static gboolean
 gnc_post_file_open (GtkWindow *parent, const char * filename, gboolean is_readonly)
@@ -848,20 +849,32 @@ RESTART:
 
         gnc_gtk_dialog_add_button(dialog, _("Open _Read-Only"),
                                   "emblem-readonly", RESPONSE_READONLY);
-        gnc_gtk_dialog_add_button(dialog, _("Open with _No File"),
-                                  "document-new-symbolic", RESPONSE_NO_FILE);
+
+        gnc_gtk_dialog_add_button(dialog, _("Create _New File"),
+                                  "document-new-symbolic", RESPONSE_NEW);
+
         gnc_gtk_dialog_add_button(dialog, _("Open _Anyway"),
                                   "document-open-symbolic", RESPONSE_OPEN);
+
+        gnc_gtk_dialog_add_button(dialog, _("Open _Folder"),
+                                  "folder-open-symbolic", RESPONSE_FILE);
+
         if (shutdown_cb)
+        {
             gtk_dialog_add_button(GTK_DIALOG(dialog),
                                   _("_Quit"), RESPONSE_QUIT);
+            gtk_dialog_set_default_response (GTK_DIALOG(dialog), RESPONSE_QUIT);
+        }
+        else
+            gtk_dialog_set_default_response (GTK_DIALOG(dialog), RESPONSE_FILE);
+
         rc = gtk_dialog_run(GTK_DIALOG(dialog));
         gtk_widget_destroy(dialog);
         g_free (displayname);
 
         if (rc == GTK_RESPONSE_DELETE_EVENT)
         {
-            rc = shutdown_cb ? RESPONSE_QUIT : RESPONSE_NO_FILE;
+            rc = shutdown_cb ? RESPONSE_QUIT : RESPONSE_FILE;
         }
         switch (rc)
         {
@@ -879,11 +892,19 @@ RESTART:
             /* user told us to ignore locks. So ignore them. */
             qof_session_begin (new_session, newfile, SESSION_BREAK_LOCK);
             break;
-        default:
+        case RESPONSE_NEW:
             /* Can't use the given file, so just create a new
-             * Gnucash window so they can choose File->New, File->Open
-             * or just "Exit".
+             * database so that the user will get a window that
+             * they can click "Exit" on.
+             */
+            gnc_file_new (parent);
+            break;
+        default:
+            /* Can't use the given file, so open a file browser dialog
+             * so they can choose a different file and get a window that
+             * they can click "Exit" on.
              */
+            gnc_file_open (parent);
             break;
         }
     }



Summary of changes:
 gnucash/gnome-utils/gnc-file.c | 35 ++++++++++++++++++++++++++++-------
 1 file changed, 28 insertions(+), 7 deletions(-)



More information about the gnucash-changes mailing list