[geany/geany] ad5a68: Make Open Project dialog cancellable without closing existing session

Nick Treleaven git-noreply at xxxxx
Sun Sep 29 16:26:43 UTC 2019


Branch:      refs/heads/master
Author:      Nick Treleaven <n at trelsoft.com>
Committer:   Nick Treleaven <n at trelsoft.com>
Date:        Sun, 29 Sep 2019 16:26:43 UTC
Commit:      ad5a684c32e2474d00846e4a3edf0c5b8e2a1d47
             https://github.com/geany/geany/commit/ad5a684c32e2474d00846e4a3edf0c5b8e2a1d47

Log Message:
-----------
Make Open Project dialog cancellable without closing existing session


Modified Paths:
--------------
    src/project.c

Modified: src/project.c
8 lines changed, 4 insertions(+), 4 deletions(-)
===================================================================
@@ -286,8 +286,9 @@ static void run_open_dialog(GtkDialog *dialog)
 	{
 		gchar *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
 
+		if (app->project && !project_close(FALSE)) {}
 		/* try to load the config */
-		if (! project_load_file_with_session(filename))
+		else if (! project_load_file_with_session(filename))
 		{
 			gchar *utf8_filename = utils_get_utf8_from_locale(filename);
 
@@ -307,16 +308,15 @@ void project_open(void)
 {
 	const gchar *dir = local_prefs.project_file_path;
 
-	if (! project_ask_close()) return;
-
 #ifdef G_OS_WIN32
 	if (interface_prefs.use_native_windows_dialogs)
 	{
 		gchar *file = win32_show_project_open_dialog(main_widgets.window, _("Open Project"), dir, FALSE, TRUE);
 		if (file != NULL)
 		{
+			if (app->project && !project_close(FALSE)) {}
 			/* try to load the config */
-			if (! project_load_file_with_session(file))
+			else if (! project_load_file_with_session(file))
 			{
 				SHOW_ERR1(_("Project file \"%s\" could not be loaded."), file);
 			}



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list