From 6db80a247f6969ffc14272189da449d566a745c0 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Tue, 8 Sep 2015 16:23:57 +0200 Subject: [PATCH] Don't open more than one document for non-existing paths from the CLI When creating a new document for a non-existing file from the command line, check if we don't already have opened it and simply show the existing one if we do. This avoids creating new documents that will be saved to the same location again and again. Closes https://bugs.launchpad.net/linuxmint/+bug/1482558 --- src/libmain.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libmain.c b/src/libmain.c index cbe2cf1bd9..41286a85f1 100644 --- a/src/libmain.c +++ b/src/libmain.c @@ -804,7 +804,11 @@ gboolean main_handle_filename(const gchar *locale_filename) { /* create new file with the given filename */ gchar *utf8_filename = utils_get_utf8_from_locale(filename); - doc = document_new_file(utf8_filename, NULL, NULL); + doc = document_find_by_filename(utf8_filename); + if (doc) + document_show_tab(doc); + else + doc = document_new_file(utf8_filename, NULL, NULL); if (doc != NULL) ui_add_recent_document(doc); g_free(utf8_filename);