SF.net SVN: geany:[4921] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sun May 16 17:43:24 UTC 2010


Revision: 4921
          http://geany.svn.sourceforge.net/geany/?rev=4921&view=rev
Author:   eht16
Date:     2010-05-16 17:43:24 +0000 (Sun, 16 May 2010)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/document.c
    trunk/src/editor.c
    trunk/src/project.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-05-16 17:43:10 UTC (rev 4920)
+++ trunk/ChangeLog	2010-05-16 17:43:24 UTC (rev 4921)
@@ -4,8 +4,11 @@
    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  <enrico(dot)troeger(at)uvena(dot)de>
 
  * src/win32.c:

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2010-05-16 17:43:10 UTC (rev 4920)
+++ trunk/src/document.c	2010-05-16 17:43:24 UTC (rev 4921)
@@ -640,10 +640,13 @@
 
 	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 @@
 	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 @@
 	}
 	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;

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2010-05-16 17:43:10 UTC (rev 4920)
+++ trunk/src/editor.c	2010-05-16 17:43:24 UTC (rev 4921)
@@ -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 @@
 
 	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(),

Modified: trunk/src/project.c
===================================================================
--- trunk/src/project.c	2010-05-16 17:43:10 UTC (rev 4920)
+++ trunk/src/project.c	2010-05-16 17:43:24 UTC (rev 4921)
@@ -309,6 +309,9 @@
 /* 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();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list