Reverting the change to close window when all documents are closed, it breaks too much

This commit is contained in:
Yevgen Muntyan 2012-08-11 01:15:32 -07:00
parent 3a8e52381c
commit 73309f22d1

View File

@ -1643,7 +1643,7 @@ moo_editor_close_docs (MooEditor *editor,
MooEditArray *docs) MooEditArray *docs)
{ {
guint i; guint i;
MooEditWindowArray *windows; MooEditWindow *window;
g_return_val_if_fail (MOO_IS_EDITOR (editor), FALSE); g_return_val_if_fail (MOO_IS_EDITOR (editor), FALSE);
@ -1663,31 +1663,13 @@ moo_editor_close_docs (MooEditor *editor,
} }
} }
windows = moo_edit_window_array_new (); window = moo_edit_get_window (docs->elms[0]);
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);
}
if (!close_docs_real (editor, docs)) if (close_docs_real (editor, docs))
{ {
moo_edit_window_array_free (windows); if (window &&
return FALSE; !moo_edit_window_get_n_tabs (window) &&
} !test_flag (editor, ALLOW_EMPTY_WINDOW))
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), MooEdit *doc = MOO_EDIT (g_object_new (get_doc_type (editor),
"editor", editor, "editor", editor,
@ -1696,11 +1678,13 @@ moo_editor_close_docs (MooEditor *editor,
moo_editor_add_doc (editor, window, doc); moo_editor_add_doc (editor, window, doc);
g_object_unref (doc); g_object_unref (doc);
} }
}
}
moo_edit_window_array_free (windows);
return TRUE; return TRUE;
}
else
{
return FALSE;
}
} }