Close window when last document is closed, if there are other open windows
This commit is contained in:
parent
0c38d806ad
commit
c2453675f6
@ -1643,7 +1643,7 @@ moo_editor_close_docs (MooEditor *editor,
|
|||||||
MooEditArray *docs)
|
MooEditArray *docs)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
MooEditWindow *window;
|
MooEditWindowArray *windows;
|
||||||
|
|
||||||
g_return_val_if_fail (MOO_IS_EDITOR (editor), FALSE);
|
g_return_val_if_fail (MOO_IS_EDITOR (editor), FALSE);
|
||||||
|
|
||||||
@ -1663,13 +1663,31 @@ moo_editor_close_docs (MooEditor *editor,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window = moo_edit_get_window (docs->elms[0]);
|
windows = moo_edit_window_array_new ();
|
||||||
|
for (i = 0; i < docs->n_elms; ++i)
|
||||||
if (close_docs_real (editor, docs))
|
|
||||||
{
|
{
|
||||||
if (window &&
|
MooEdit *doc = docs->elms[i];
|
||||||
!moo_edit_window_get_n_tabs (window) &&
|
MooEditWindow *window = moo_edit_get_window (doc);
|
||||||
!test_flag (editor, ALLOW_EMPTY_WINDOW))
|
if (moo_edit_window_array_find (windows, window) < 0)
|
||||||
|
moo_edit_window_array_append (windows, window);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!close_docs_real (editor, docs))
|
||||||
|
{
|
||||||
|
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),
|
MooEdit *doc = MOO_EDIT (g_object_new (get_doc_type (editor),
|
||||||
"editor", editor,
|
"editor", editor,
|
||||||
@ -1678,14 +1696,12 @@ 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Loading…
x
Reference in New Issue
Block a user