Skip to content

Commit

Permalink
Bug 309943 - Change previous fix commit
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Bob-IT committed Dec 8, 2020
1 parent 0f76265 commit de63a79
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions gnucash/gnome-utils/gnc-file.c
Expand Up @@ -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)
Expand Down Expand Up @@ -848,20 +849,32 @@ gnc_post_file_open (GtkWindow *parent, const char * filename, gboolean is_readon

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)
{
Expand All @@ -879,11 +892,19 @@ gnc_post_file_open (GtkWindow *parent, const char * filename, gboolean is_readon
/* 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;
}
}
Expand Down

0 comments on commit de63a79

Please sign in to comment.