From 48064120f82ad805f2503ec2f8f1e65e5544b98a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Sun, 16 May 2010 17:43:24 +0000 Subject: [PATCH] Small improvements to speed up quit process with many open documents. Avoid calling gtk_notebook_remove_page() on exit as it takes a lot of time. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4921 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 5 ++++- src/document.c | 17 ++++++++++------- src/editor.c | 4 ++++ src/project.c | 3 +++ 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index fe068a31..7b0012ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,7 +4,10 @@ win32.h can be included unconditionally. * src/sidebar.c: Fix project base_path detection if the path has a trailing slash. - + * src/document.c, src/editor.c, src/project.c: + Small improvements to speed up quit process with many open documents. + Avoid calling gtk_notebook_remove_page() on exit as it takes + a lot of time. 2010-05-15 Enrico Tröger diff --git a/src/document.c b/src/document.c index 13881174..0b20dcfe 100644 --- a/src/document.c +++ b/src/document.c @@ -640,10 +640,13 @@ gboolean document_remove_page(guint page_num) doc->is_valid = FALSE; - notebook_remove_page(page_num); - sidebar_remove_document(doc); - navqueue_remove_file(doc->file_name); - msgwin_status_add(_("File %s closed."), DOC_FILENAME(doc)); + if (! main_status.quitting) + { + notebook_remove_page(page_num); + sidebar_remove_document(doc); + navqueue_remove_file(doc->file_name); + msgwin_status_add(_("File %s closed."), DOC_FILENAME(doc)); + } g_free(doc->encoding); g_free(doc->priv->saved_encoding.encoding); g_free(doc->file_name); @@ -2830,7 +2833,7 @@ gboolean document_account_for_unsaved(void) for (p = 0; p < page_count; p++) { doc = document_get_from_page(p); - if (doc->changed) + if (DOC_VALID(doc) && doc->changed) { if (! dialogs_show_unsaved_file(doc)) return FALSE; @@ -2863,9 +2866,9 @@ static void force_close_all(void) } main_status.closing_all = TRUE; - while (gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)) > 0) + foreach_document(i) { - document_remove_page(0); + document_close(documents[i]); } main_status.closing_all = FALSE; diff --git a/src/editor.c b/src/editor.c index 886fddaf..d51623a3 100644 --- a/src/editor.c +++ b/src/editor.c @@ -65,6 +65,7 @@ #include "keybindings.h" #include "project.h" #include "projectprivate.h" +#include "main.h" /* Note: use sciwrappers.h instead where possible. @@ -4972,6 +4973,9 @@ void editor_apply_update_prefs(GeanyEditor *editor) g_return_if_fail(editor != NULL); + if (main_status.quitting) + return; + sci = editor->sci; sci_set_mark_long_lines(sci, editor_get_long_line_type(), diff --git a/src/project.c b/src/project.c index bcd201cb..d119868e 100644 --- a/src/project.c +++ b/src/project.c @@ -309,6 +309,9 @@ void project_open(void) /* Called when creating, opening, closing and updating projects. */ static void update_ui(void) { + if (main_status.quitting) + return; + ui_set_window_title(NULL); build_menu_update(NULL); sidebar_openfiles_update_all();