SF.net SVN: geany: [2437] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Wed Apr 2 13:48:40 UTC 2008


Revision: 2437
          http://geany.svn.sourceforge.net/geany/?rev=2437&view=rev
Author:   eht16
Date:     2008-04-02 06:48:39 -0700 (Wed, 02 Apr 2008)

Log Message:
-----------
Ignore notebook_switch_page signal handler when closing projects to speed it up a little bit with many session files.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/callbacks.c
    trunk/src/main.h
    trunk/src/project.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-04-02 13:26:38 UTC (rev 2436)
+++ trunk/ChangeLog	2008-04-02 13:48:39 UTC (rev 2437)
@@ -3,6 +3,9 @@
  * src/dialogs.c:
    Fix GTK warnings in open file dialog by using a positive response ID
    for the View button.
+ * src/callbacks.c, src/main.h, src/project.c:
+   Ignore notebook_switch_page signal handler when closing projects
+   to speed it up a little bit with many session files.
 
 
 2008-04-01  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2008-04-02 13:26:38 UTC (rev 2436)
+++ trunk/src/callbacks.c	2008-04-02 13:48:39 UTC (rev 2437)
@@ -75,9 +75,6 @@
 #endif
 
 
-/* represents the state while closing all tabs(used to prevent notebook switch page signals) */
-static gboolean closing_all = FALSE;
-
 /* flag to indicate the explicit change of a toggle button of the toolbar menu and so the
  * toggled callback should ignore the change since it is not triggered by the user */
 static gboolean ignore_toolbar_toggle = FALSE;
@@ -263,7 +260,7 @@
 	gboolean ret = TRUE;
 	gint i, max = gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook));
 
-	closing_all = TRUE;
+	main_status.closing_all = TRUE;
 	for(i = 0; i < max; i++)
 	{
 		if (! document_remove(0))
@@ -272,7 +269,7 @@
 			break;
 		}
 	}
-	closing_all = FALSE;
+	main_status.closing_all = FALSE;
 	tm_workspace_update(TM_WORK_OBJECT(app->tm_workspace), TRUE, TRUE, FALSE);
 	/* if cancel is clicked, cancel the complete exit process */
 	return ret;
@@ -782,7 +779,8 @@
 {
 	gint idx;
 
-	if (closing_all) return;
+	if (main_status.opening_session_files || main_status.closing_all)
+		return;
 
 	/* guint == -1 seems useless, but it isn't! */
 	if (page_num == (guint) -1 && page != NULL)
@@ -790,7 +788,7 @@
 	else
 		idx = document_get_n_idx(page_num);
 
-	if (idx >= 0 && main_status.opening_session_files == FALSE)
+	if (idx >= 0)
 	{
 		treeviews_select_openfiles_item(idx);
 		document_set_text_changed(idx);	/* also sets window title and status bar */

Modified: trunk/src/main.h
===================================================================
--- trunk/src/main.h	2008-04-02 13:26:38 UTC (rev 2436)
+++ trunk/src/main.h	2008-04-02 13:48:39 UTC (rev 2437)
@@ -39,6 +39,8 @@
 typedef struct GeanyStatus
 {
 	gboolean	opening_session_files;	/* state at startup while opening session files */
+	gboolean	closing_all; /* the state while closing all tabs
+							  * (used to prevent notebook switch page signals) */
 	gboolean	quitting;	/* state when Geany is quitting completely */
 	gboolean	main_window_realized;
 }

Modified: trunk/src/project.c
===================================================================
--- trunk/src/project.c	2008-04-02 13:26:38 UTC (rev 2436)
+++ trunk/src/project.c	2008-04-02 13:48:39 UTC (rev 2437)
@@ -329,11 +329,13 @@
 	if (project_prefs.project_session)
 	{
 		/* close all existing tabs first */
+		main_status.closing_all = TRUE;
 		for (i = 0; i < max; i++)
 		{
 			if (! document_remove(0))
 				break;
 		}
+		main_status.closing_all = FALSE;
 
 		/* after closing all tabs let's open the tabs found in the default config */
 		if (open_default == TRUE && cl_options.load_session)


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