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
This commit is contained in:
Enrico Tröger 2010-05-16 17:43:24 +00:00
parent 798fc82a2b
commit 48064120f8
4 changed files with 21 additions and 8 deletions

View File

@ -4,7 +4,10 @@
win32.h can be included unconditionally. win32.h can be included unconditionally.
* src/sidebar.c: * src/sidebar.c:
Fix project base_path detection if the path has a trailing slash. 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 <enrico(dot)troeger(at)uvena(dot)de> 2010-05-15 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>

View File

@ -640,10 +640,13 @@ gboolean document_remove_page(guint page_num)
doc->is_valid = FALSE; doc->is_valid = FALSE;
notebook_remove_page(page_num); if (! main_status.quitting)
sidebar_remove_document(doc); {
navqueue_remove_file(doc->file_name); notebook_remove_page(page_num);
msgwin_status_add(_("File %s closed."), DOC_FILENAME(doc)); 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->encoding);
g_free(doc->priv->saved_encoding.encoding); g_free(doc->priv->saved_encoding.encoding);
g_free(doc->file_name); g_free(doc->file_name);
@ -2830,7 +2833,7 @@ gboolean document_account_for_unsaved(void)
for (p = 0; p < page_count; p++) for (p = 0; p < page_count; p++)
{ {
doc = document_get_from_page(p); doc = document_get_from_page(p);
if (doc->changed) if (DOC_VALID(doc) && doc->changed)
{ {
if (! dialogs_show_unsaved_file(doc)) if (! dialogs_show_unsaved_file(doc))
return FALSE; return FALSE;
@ -2863,9 +2866,9 @@ static void force_close_all(void)
} }
main_status.closing_all = TRUE; 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; main_status.closing_all = FALSE;

View File

@ -65,6 +65,7 @@
#include "keybindings.h" #include "keybindings.h"
#include "project.h" #include "project.h"
#include "projectprivate.h" #include "projectprivate.h"
#include "main.h"
/* Note: use sciwrappers.h instead where possible. /* Note: use sciwrappers.h instead where possible.
@ -4972,6 +4973,9 @@ void editor_apply_update_prefs(GeanyEditor *editor)
g_return_if_fail(editor != NULL); g_return_if_fail(editor != NULL);
if (main_status.quitting)
return;
sci = editor->sci; sci = editor->sci;
sci_set_mark_long_lines(sci, editor_get_long_line_type(), sci_set_mark_long_lines(sci, editor_get_long_line_type(),

View File

@ -309,6 +309,9 @@ void project_open(void)
/* Called when creating, opening, closing and updating projects. */ /* Called when creating, opening, closing and updating projects. */
static void update_ui(void) static void update_ui(void)
{ {
if (main_status.quitting)
return;
ui_set_window_title(NULL); ui_set_window_title(NULL);
build_menu_update(NULL); build_menu_update(NULL);
sidebar_openfiles_update_all(); sidebar_openfiles_update_all();