From 73309f22d19989e67a5bf289ee9eaee65b0480a3 Mon Sep 17 00:00:00 2001 From: Yevgen Muntyan <17531749+muntyan@users.noreply.github.com> Date: Sat, 11 Aug 2012 01:15:32 -0700 Subject: [PATCH] Reverting the change to close window when all documents are closed, it breaks too much --- moo/mooedit/mooeditor.c | 54 +++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/moo/mooedit/mooeditor.c b/moo/mooedit/mooeditor.c index a5c669ed..37adefd3 100644 --- a/moo/mooedit/mooeditor.c +++ b/moo/mooedit/mooeditor.c @@ -1643,7 +1643,7 @@ moo_editor_close_docs (MooEditor *editor, MooEditArray *docs) { guint i; - MooEditWindowArray *windows; + MooEditWindow *window; g_return_val_if_fail (MOO_IS_EDITOR (editor), FALSE); @@ -1663,44 +1663,28 @@ moo_editor_close_docs (MooEditor *editor, } } - windows = moo_edit_window_array_new (); - for (i = 0; i < docs->n_elms; ++i) - { - MooEdit *doc = docs->elms[i]; - MooEditWindow *window = moo_edit_get_window (doc); - if (moo_edit_window_array_find (windows, window) < 0) - moo_edit_window_array_append (windows, window); - } + window = moo_edit_get_window (docs->elms[0]); - if (!close_docs_real (editor, docs)) + if (close_docs_real (editor, docs)) + { + if (window && + !moo_edit_window_get_n_tabs (window) && + !test_flag (editor, ALLOW_EMPTY_WINDOW)) + { + MooEdit *doc = MOO_EDIT (g_object_new (get_doc_type (editor), + "editor", editor, + (const char*) NULL)); + _moo_edit_window_insert_doc (window, doc, NULL); + moo_editor_add_doc (editor, window, doc); + g_object_unref (doc); + } + + return TRUE; + } + else { - moo_edit_window_array_free (windows); return FALSE; } - - for (i = 0; i < windows->n_elms; ++i) - { - MooEditWindow *window = windows->elms[i]; - if (!moo_edit_window_get_n_tabs (window)) - { - if (editor->priv->windows->n_elms > 1) - { - moo_editor_close_window (editor, window); - } - else if (!test_flag (editor, ALLOW_EMPTY_WINDOW)) - { - MooEdit *doc = MOO_EDIT (g_object_new (get_doc_type (editor), - "editor", editor, - (const char*) NULL)); - _moo_edit_window_insert_doc (window, doc, NULL); - moo_editor_add_doc (editor, window, doc); - g_object_unref (doc); - } - } - } - - moo_edit_window_array_free (windows); - return TRUE; }